Skip to content

Commit 35e92a6

Browse files
Fix admin methods
1 parent 8d4e219 commit 35e92a6

5 files changed

Lines changed: 4 additions & 81 deletions

File tree

examples/admin-subscription.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ async function adminSubscriptionExample(): Promise<void> {
1010

1111
await getSubscriptionStatus(admin);
1212
await getSeats(admin);
13-
await getPricing(admin);
14-
1513
} catch (error) {
1614
if (error instanceof LinkedApiError) {
1715
console.error('🚨 Linked API Error:', error.message);
@@ -42,18 +40,6 @@ async function getSeats(admin: LinkedApiAdmin): Promise<void> {
4240
}
4341
}
4442

45-
async function getPricing(admin: LinkedApiAdmin): Promise<void> {
46-
console.log('\n💰 Getting pricing information...');
47-
48-
const { products } = await admin.subscription.getPricing();
49-
console.log('✅ Pricing retrieved');
50-
for (const product of products) {
51-
const price = (product.unitPrice / 100).toFixed(2);
52-
const currencySymbol = product.currency === 'eur' ? '€' : '$';
53-
console.log(` ${product.seatType} ${product.billingPeriod}: ${currencySymbol}${price}/seat`);
54-
}
55-
}
56-
5743
async function setSeats(admin: LinkedApiAdmin): Promise<void> {
5844
console.log('\n🔧 Setting subscription seats...');
5945

@@ -71,14 +57,6 @@ async function setSeats(admin: LinkedApiAdmin): Promise<void> {
7157
}
7258
}
7359

74-
async function getBillingLink(admin: LinkedApiAdmin): Promise<void> {
75-
console.log('\n🔗 Getting billing portal link...');
76-
77-
const { stripeLink } = await admin.subscription.getBillingLink();
78-
console.log('✅ Billing link retrieved');
79-
console.log(` ${stripeLink}`);
80-
}
81-
8260
if (require.main === module) {
8361
adminSubscriptionExample();
8462
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@linkedapi/node",
3-
"version": "2.0.4",
3+
"version": "2.0.5",
44
"description": "Control your LinkedIn accounts and retrieve real-time data, all through this Node.js SDK.",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/admin/admin-subscription.ts

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
import {
22
HttpClient,
33
LinkedApiError,
4-
TBillingLinkResult,
5-
TCancelResult,
64
TLinkedApiErrorType,
75
TSetSeatsParams,
86
TSetSeatsResult,
9-
TSubscriptionProduct,
107
TSubscriptionSeat,
118
TSubscriptionStatus,
129
} from '../types';
@@ -40,19 +37,6 @@ export class AdminSubscription {
4037
);
4138
}
4239

43-
public async getPricing(): Promise<{ products: Array<TSubscriptionProduct> }> {
44-
const response = await this.httpClient.post<{ products: Array<TSubscriptionProduct> }>(
45-
'/admin/subscription.getPricing',
46-
);
47-
if (response.success && response.result) {
48-
return response.result;
49-
}
50-
throw new LinkedApiError(
51-
(response.error?.type ?? 'httpError') as TLinkedApiErrorType,
52-
response.error?.message ?? 'Failed to get pricing',
53-
);
54-
}
55-
5640
public async setSeats(params: TSetSeatsParams): Promise<TSetSeatsResult> {
5741
const response = await this.httpClient.post<TSetSeatsResult>(
5842
'/admin/subscription.setSeats',
@@ -66,28 +50,4 @@ export class AdminSubscription {
6650
response.error?.message ?? 'Failed to set seats',
6751
);
6852
}
69-
70-
public async getBillingLink(): Promise<TBillingLinkResult> {
71-
const response = await this.httpClient.post<TBillingLinkResult>(
72-
'/admin/subscription.getBillingLink',
73-
);
74-
if (response.success && response.result) {
75-
return response.result;
76-
}
77-
throw new LinkedApiError(
78-
(response.error?.type ?? 'httpError') as TLinkedApiErrorType,
79-
response.error?.message ?? 'Failed to get billing link',
80-
);
81-
}
82-
83-
public async cancel(): Promise<TCancelResult> {
84-
const response = await this.httpClient.post<TCancelResult>('/admin/subscription.cancel');
85-
if (response.success && response.result) {
86-
return response.result;
87-
}
88-
throw new LinkedApiError(
89-
(response.error?.type ?? 'httpError') as TLinkedApiErrorType,
90-
response.error?.message ?? 'Failed to cancel subscription',
91-
);
92-
}
9353
}

src/types/admin/subscription.type.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,6 @@ export interface TSubscriptionSeat {
1010
billingPeriod: 'month' | 'year';
1111
}
1212

13-
export interface TSubscriptionProduct {
14-
id: string;
15-
seatType: 'core' | 'plus';
16-
billingPeriod: 'month' | 'year';
17-
unitPrice: number;
18-
currency: 'usd' | 'eur';
19-
}
20-
2113
export interface TSetSeatsParams {
2214
quantity: number;
2315
seatType: 'core' | 'plus';
@@ -28,11 +20,3 @@ export interface TSetSeatsResult {
2820
status: 'complete' | 'processing';
2921
paymentLink?: string;
3022
}
31-
32-
export interface TBillingLinkResult {
33-
stripeLink: string;
34-
}
35-
36-
export interface TCancelResult {
37-
cancelAtDate: string;
38-
}

src/types/workflows.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ export interface TWorkflowStatusResponse {
4444
message?: string;
4545
}
4646

47-
export interface TWorkflowResponse<TResult extends TWorkflowData = TWorkflowData>
48-
extends TWorkflowStatusResponse {
47+
export interface TWorkflowResponse<
48+
TResult extends TWorkflowData = TWorkflowData,
49+
> extends TWorkflowStatusResponse {
4950
completion?: TWorkflowCompletion<TResult>;
5051
failure?: TWorkflowFailure;
5152
}

0 commit comments

Comments
 (0)