bundlesocial 2.3.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -81,8 +81,6 @@ type OrganizationGetOrganizationResponse = {
81
81
  promotionCodeId?: string | null;
82
82
  name?: string | null;
83
83
  avatarUrl?: string | null;
84
- defaultPaymentMethodFilled?: boolean;
85
- billingAddressFilled?: boolean;
86
84
  apiAccess?: boolean;
87
85
  ref?: string | null;
88
86
  createdAt: string | null;
@@ -124,6 +122,8 @@ type OrganizationGetOrganizationResponse = {
124
122
  }> | null;
125
123
  status: 'trialing' | 'active' | 'canceled' | 'incomplete' | 'incomplete_expired' | 'past_due' | 'unpaid' | 'paused';
126
124
  metadata?: unknown;
125
+ stripePriceId: string;
126
+ tier: 'PRO' | 'BUSINESS';
127
127
  cancelAtPeriodEnd: boolean;
128
128
  created: string | null;
129
129
  currentPeriodStart: string | null;
@@ -133,23 +133,11 @@ type OrganizationGetOrganizationResponse = {
133
133
  canceledAt?: string | null;
134
134
  trialStart?: string | null;
135
135
  trialEnd?: string | null;
136
- defaultMaxMonthlyPosts: number;
137
- defaultMaxDailyPosts: number;
136
+ maxMonthlyPosts: number;
138
137
  discountStart?: string | null;
139
138
  discountEnd?: string | null;
140
139
  createdAt: string | null;
141
140
  updatedAt: string | null;
142
- teamPlans: Array<{
143
- id: string;
144
- subscriptionId: string;
145
- teamId: string;
146
- stripePriceId: string;
147
- tier: 'PRO';
148
- maxMonthlyPosts: number;
149
- maxDailyPosts: number;
150
- createdAt: string | null;
151
- updatedAt: string | null;
152
- }>;
153
141
  coupon?: {
154
142
  id: string;
155
143
  name?: string | null;
@@ -223,6 +211,9 @@ type OrganizationGetOrganizationResponse = {
223
211
  updatedAt: string | null;
224
212
  };
225
213
  } | null;
214
+ usage: {
215
+ monthlyPosts: number;
216
+ };
226
217
  };
227
218
  type TeamGetTeamData = {
228
219
  id: string;
@@ -242,8 +233,6 @@ type TeamGetTeamResponse = {
242
233
  promotionCodeId?: string | null;
243
234
  name?: string | null;
244
235
  avatarUrl?: string | null;
245
- defaultPaymentMethodFilled?: boolean;
246
- billingAddressFilled?: boolean;
247
236
  apiAccess?: boolean;
248
237
  ref?: string | null;
249
238
  createdAt: string | null;
@@ -297,9 +286,6 @@ type TeamGetTeamResponse = {
297
286
  updatedAt: string | null;
298
287
  deletedAt?: string | null;
299
288
  }>;
300
- usage: {
301
- monthlyPosts: number;
302
- };
303
289
  bio?: {
304
290
  id: string;
305
291
  username: string;
@@ -337,46 +323,6 @@ type TeamGetTeamResponse = {
337
323
  }>;
338
324
  }>;
339
325
  } | null;
340
- teamPlan?: {
341
- id: string;
342
- subscriptionId: string;
343
- teamId: string;
344
- stripePriceId: string;
345
- tier: 'PRO';
346
- maxMonthlyPosts: number;
347
- maxDailyPosts: number;
348
- createdAt: string | null;
349
- updatedAt: string | null;
350
- subscription?: {
351
- id: string;
352
- organizationId: string;
353
- couponId?: string | null;
354
- promotionCodeId?: string | null;
355
- stripeSubscriptionId: string;
356
- stripeSubscriptionItems?: Array<{
357
- id: string;
358
- price: string;
359
- quantity: number;
360
- }> | null;
361
- status: 'trialing' | 'active' | 'canceled' | 'incomplete' | 'incomplete_expired' | 'past_due' | 'unpaid' | 'paused';
362
- metadata?: unknown;
363
- cancelAtPeriodEnd: boolean;
364
- created: string | null;
365
- currentPeriodStart: string | null;
366
- currentPeriodEnd: string | null;
367
- endedAt?: string | null;
368
- cancelAt?: string | null;
369
- canceledAt?: string | null;
370
- trialStart?: string | null;
371
- trialEnd?: string | null;
372
- defaultMaxMonthlyPosts: number;
373
- defaultMaxDailyPosts: number;
374
- discountStart?: string | null;
375
- discountEnd?: string | null;
376
- createdAt: string | null;
377
- updatedAt: string | null;
378
- } | null;
379
- } | null;
380
326
  };
381
327
  type TeamUpdateTeamData = {
382
328
  id: string;
@@ -417,7 +363,6 @@ type TeamCreateTeamData = {
417
363
  */
418
364
  requestBody?: {
419
365
  name: string;
420
- tier: 'FREE' | 'PRO';
421
366
  avatarUrl?: string | null;
422
367
  };
423
368
  };
@@ -554,6 +499,19 @@ type SocialAccountRefreshChannelsResponse = {
554
499
  updatedAt: string | null;
555
500
  deletedAt?: string | null;
556
501
  };
502
+ type SocialAccountCreatePortalLinkData = {
503
+ /**
504
+ * Body
505
+ */
506
+ requestBody?: {
507
+ teamId: string;
508
+ redirectUrl: string;
509
+ socialAccountTypes: Array<('TIKTOK' | 'YOUTUBE' | 'INSTAGRAM' | 'FACEBOOK' | 'TWITTER' | 'THREADS' | 'LINKEDIN' | 'PINTEREST' | 'REDDIT' | 'DISCORD' | 'SLACK' | 'MASTODON')>;
510
+ };
511
+ };
512
+ type SocialAccountCreatePortalLinkResponse = {
513
+ url: string;
514
+ };
557
515
  type UploadGetListData = {
558
516
  teamId: string;
559
517
  };
@@ -2299,8 +2257,6 @@ type $OpenApiTs = {
2299
2257
  promotionCodeId?: string | null;
2300
2258
  name?: string | null;
2301
2259
  avatarUrl?: string | null;
2302
- defaultPaymentMethodFilled?: boolean;
2303
- billingAddressFilled?: boolean;
2304
2260
  apiAccess?: boolean;
2305
2261
  ref?: string | null;
2306
2262
  createdAt: string | null;
@@ -2342,6 +2298,8 @@ type $OpenApiTs = {
2342
2298
  }> | null;
2343
2299
  status: 'trialing' | 'active' | 'canceled' | 'incomplete' | 'incomplete_expired' | 'past_due' | 'unpaid' | 'paused';
2344
2300
  metadata?: unknown;
2301
+ stripePriceId: string;
2302
+ tier: 'PRO' | 'BUSINESS';
2345
2303
  cancelAtPeriodEnd: boolean;
2346
2304
  created: string | null;
2347
2305
  currentPeriodStart: string | null;
@@ -2351,23 +2309,11 @@ type $OpenApiTs = {
2351
2309
  canceledAt?: string | null;
2352
2310
  trialStart?: string | null;
2353
2311
  trialEnd?: string | null;
2354
- defaultMaxMonthlyPosts: number;
2355
- defaultMaxDailyPosts: number;
2312
+ maxMonthlyPosts: number;
2356
2313
  discountStart?: string | null;
2357
2314
  discountEnd?: string | null;
2358
2315
  createdAt: string | null;
2359
2316
  updatedAt: string | null;
2360
- teamPlans: Array<{
2361
- id: string;
2362
- subscriptionId: string;
2363
- teamId: string;
2364
- stripePriceId: string;
2365
- tier: 'PRO';
2366
- maxMonthlyPosts: number;
2367
- maxDailyPosts: number;
2368
- createdAt: string | null;
2369
- updatedAt: string | null;
2370
- }>;
2371
2317
  coupon?: {
2372
2318
  id: string;
2373
2319
  name?: string | null;
@@ -2441,6 +2387,9 @@ type $OpenApiTs = {
2441
2387
  updatedAt: string | null;
2442
2388
  };
2443
2389
  } | null;
2390
+ usage: {
2391
+ monthlyPosts: number;
2392
+ };
2444
2393
  };
2445
2394
  /**
2446
2395
  * 400
@@ -2507,8 +2456,6 @@ type $OpenApiTs = {
2507
2456
  promotionCodeId?: string | null;
2508
2457
  name?: string | null;
2509
2458
  avatarUrl?: string | null;
2510
- defaultPaymentMethodFilled?: boolean;
2511
- billingAddressFilled?: boolean;
2512
2459
  apiAccess?: boolean;
2513
2460
  ref?: string | null;
2514
2461
  createdAt: string | null;
@@ -2562,9 +2509,6 @@ type $OpenApiTs = {
2562
2509
  updatedAt: string | null;
2563
2510
  deletedAt?: string | null;
2564
2511
  }>;
2565
- usage: {
2566
- monthlyPosts: number;
2567
- };
2568
2512
  bio?: {
2569
2513
  id: string;
2570
2514
  username: string;
@@ -2602,46 +2546,6 @@ type $OpenApiTs = {
2602
2546
  }>;
2603
2547
  }>;
2604
2548
  } | null;
2605
- teamPlan?: {
2606
- id: string;
2607
- subscriptionId: string;
2608
- teamId: string;
2609
- stripePriceId: string;
2610
- tier: 'PRO';
2611
- maxMonthlyPosts: number;
2612
- maxDailyPosts: number;
2613
- createdAt: string | null;
2614
- updatedAt: string | null;
2615
- subscription?: {
2616
- id: string;
2617
- organizationId: string;
2618
- couponId?: string | null;
2619
- promotionCodeId?: string | null;
2620
- stripeSubscriptionId: string;
2621
- stripeSubscriptionItems?: Array<{
2622
- id: string;
2623
- price: string;
2624
- quantity: number;
2625
- }> | null;
2626
- status: 'trialing' | 'active' | 'canceled' | 'incomplete' | 'incomplete_expired' | 'past_due' | 'unpaid' | 'paused';
2627
- metadata?: unknown;
2628
- cancelAtPeriodEnd: boolean;
2629
- created: string | null;
2630
- currentPeriodStart: string | null;
2631
- currentPeriodEnd: string | null;
2632
- endedAt?: string | null;
2633
- cancelAt?: string | null;
2634
- canceledAt?: string | null;
2635
- trialStart?: string | null;
2636
- trialEnd?: string | null;
2637
- defaultMaxMonthlyPosts: number;
2638
- defaultMaxDailyPosts: number;
2639
- discountStart?: string | null;
2640
- discountEnd?: string | null;
2641
- createdAt: string | null;
2642
- updatedAt: string | null;
2643
- } | null;
2644
- } | null;
2645
2549
  };
2646
2550
  /**
2647
2551
  * 400
@@ -3143,6 +3047,59 @@ type $OpenApiTs = {
3143
3047
  };
3144
3048
  };
3145
3049
  };
3050
+ '/api/v1/social-account/create-portal-link': {
3051
+ post: {
3052
+ req: SocialAccountCreatePortalLinkData;
3053
+ res: {
3054
+ /**
3055
+ * 200
3056
+ */
3057
+ 200: {
3058
+ url: string;
3059
+ };
3060
+ /**
3061
+ * 400
3062
+ */
3063
+ 400: {
3064
+ message: string;
3065
+ issues?: Array<{
3066
+ message: string;
3067
+ path?: Array<(string | number)> | null;
3068
+ }> | null;
3069
+ };
3070
+ /**
3071
+ * 401
3072
+ */
3073
+ 401: {
3074
+ message: string;
3075
+ };
3076
+ /**
3077
+ * 403
3078
+ */
3079
+ 403: {
3080
+ message: string;
3081
+ };
3082
+ /**
3083
+ * 404
3084
+ */
3085
+ 404: {
3086
+ message: string;
3087
+ };
3088
+ /**
3089
+ * 429
3090
+ */
3091
+ 429: {
3092
+ message: string;
3093
+ };
3094
+ /**
3095
+ * 500
3096
+ */
3097
+ 500: {
3098
+ message: string;
3099
+ };
3100
+ };
3101
+ };
3102
+ };
3146
3103
  '/api/v1/upload/': {
3147
3104
  get: {
3148
3105
  req: UploadGetListData;
@@ -5058,6 +5015,15 @@ declare class SocialAccountService {
5058
5015
  * @throws ApiError
5059
5016
  */
5060
5017
  socialAccountRefreshChannels(data?: SocialAccountRefreshChannelsData): CancelablePromise<SocialAccountRefreshChannelsResponse>;
5018
+ /**
5019
+ * Create portal link
5020
+ * Create a portal link which can be used to manage connected social accounts
5021
+ * @param data The data for the request.
5022
+ * @param data.requestBody Body
5023
+ * @returns unknown 200
5024
+ * @throws ApiError
5025
+ */
5026
+ socialAccountCreatePortalLink(data?: SocialAccountCreatePortalLinkData): CancelablePromise<SocialAccountCreatePortalLinkResponse>;
5061
5027
  }
5062
5028
  declare class UploadService {
5063
5029
  readonly httpRequest: BaseHttpRequest;
@@ -5215,4 +5181,4 @@ declare class Bundlesocial extends Client {
5215
5181
  constructor(apiKey: string, options?: OpenAPIConfig);
5216
5182
  }
5217
5183
 
5218
- export { $OpenApiTs, ApiError, AppGetHealthResponse, BaseHttpRequest, Bundlesocial, CancelError, CancelablePromise, OpenAPI, OpenAPIConfig, OrganizationGetOrganizationResponse, PostCreateData, PostCreateResponse, PostDeleteData, PostDeleteResponse, PostGetData, PostGetListData, PostGetListResponse, PostGetResponse, PostUpdateData, PostUpdateResponse, SocialAccountConnectData, SocialAccountConnectResponse, SocialAccountDisconnectData, SocialAccountDisconnectResponse, SocialAccountRefreshChannelsData, SocialAccountRefreshChannelsResponse, SocialAccountSetChannelData, SocialAccountSetChannelResponse, TeamCreateTeamData, TeamCreateTeamResponse, TeamDeleteTeamData, TeamDeleteTeamResponse, TeamGetTeamData, TeamGetTeamResponse, TeamUpdateTeamData, TeamUpdateTeamResponse, UploadCreateData, UploadCreateResponse, UploadDeleteData, UploadDeleteManyData, UploadDeleteManyResponse, UploadDeleteResponse, UploadGetData, UploadGetListData, UploadGetListResponse, UploadGetResponse, WebhookEvent, WebhookEventType };
5184
+ export { $OpenApiTs, ApiError, AppGetHealthResponse, BaseHttpRequest, Bundlesocial, CancelError, CancelablePromise, OpenAPI, OpenAPIConfig, OrganizationGetOrganizationResponse, PostCreateData, PostCreateResponse, PostDeleteData, PostDeleteResponse, PostGetData, PostGetListData, PostGetListResponse, PostGetResponse, PostUpdateData, PostUpdateResponse, SocialAccountConnectData, SocialAccountConnectResponse, SocialAccountCreatePortalLinkData, SocialAccountCreatePortalLinkResponse, SocialAccountDisconnectData, SocialAccountDisconnectResponse, SocialAccountRefreshChannelsData, SocialAccountRefreshChannelsResponse, SocialAccountSetChannelData, SocialAccountSetChannelResponse, TeamCreateTeamData, TeamCreateTeamResponse, TeamDeleteTeamData, TeamDeleteTeamResponse, TeamGetTeamData, TeamGetTeamResponse, TeamUpdateTeamData, TeamUpdateTeamResponse, UploadCreateData, UploadCreateResponse, UploadDeleteData, UploadDeleteManyData, UploadDeleteManyResponse, UploadDeleteResponse, UploadGetData, UploadGetListData, UploadGetListResponse, UploadGetResponse, WebhookEvent, WebhookEventType };
package/dist/index.d.ts CHANGED
@@ -81,8 +81,6 @@ type OrganizationGetOrganizationResponse = {
81
81
  promotionCodeId?: string | null;
82
82
  name?: string | null;
83
83
  avatarUrl?: string | null;
84
- defaultPaymentMethodFilled?: boolean;
85
- billingAddressFilled?: boolean;
86
84
  apiAccess?: boolean;
87
85
  ref?: string | null;
88
86
  createdAt: string | null;
@@ -124,6 +122,8 @@ type OrganizationGetOrganizationResponse = {
124
122
  }> | null;
125
123
  status: 'trialing' | 'active' | 'canceled' | 'incomplete' | 'incomplete_expired' | 'past_due' | 'unpaid' | 'paused';
126
124
  metadata?: unknown;
125
+ stripePriceId: string;
126
+ tier: 'PRO' | 'BUSINESS';
127
127
  cancelAtPeriodEnd: boolean;
128
128
  created: string | null;
129
129
  currentPeriodStart: string | null;
@@ -133,23 +133,11 @@ type OrganizationGetOrganizationResponse = {
133
133
  canceledAt?: string | null;
134
134
  trialStart?: string | null;
135
135
  trialEnd?: string | null;
136
- defaultMaxMonthlyPosts: number;
137
- defaultMaxDailyPosts: number;
136
+ maxMonthlyPosts: number;
138
137
  discountStart?: string | null;
139
138
  discountEnd?: string | null;
140
139
  createdAt: string | null;
141
140
  updatedAt: string | null;
142
- teamPlans: Array<{
143
- id: string;
144
- subscriptionId: string;
145
- teamId: string;
146
- stripePriceId: string;
147
- tier: 'PRO';
148
- maxMonthlyPosts: number;
149
- maxDailyPosts: number;
150
- createdAt: string | null;
151
- updatedAt: string | null;
152
- }>;
153
141
  coupon?: {
154
142
  id: string;
155
143
  name?: string | null;
@@ -223,6 +211,9 @@ type OrganizationGetOrganizationResponse = {
223
211
  updatedAt: string | null;
224
212
  };
225
213
  } | null;
214
+ usage: {
215
+ monthlyPosts: number;
216
+ };
226
217
  };
227
218
  type TeamGetTeamData = {
228
219
  id: string;
@@ -242,8 +233,6 @@ type TeamGetTeamResponse = {
242
233
  promotionCodeId?: string | null;
243
234
  name?: string | null;
244
235
  avatarUrl?: string | null;
245
- defaultPaymentMethodFilled?: boolean;
246
- billingAddressFilled?: boolean;
247
236
  apiAccess?: boolean;
248
237
  ref?: string | null;
249
238
  createdAt: string | null;
@@ -297,9 +286,6 @@ type TeamGetTeamResponse = {
297
286
  updatedAt: string | null;
298
287
  deletedAt?: string | null;
299
288
  }>;
300
- usage: {
301
- monthlyPosts: number;
302
- };
303
289
  bio?: {
304
290
  id: string;
305
291
  username: string;
@@ -337,46 +323,6 @@ type TeamGetTeamResponse = {
337
323
  }>;
338
324
  }>;
339
325
  } | null;
340
- teamPlan?: {
341
- id: string;
342
- subscriptionId: string;
343
- teamId: string;
344
- stripePriceId: string;
345
- tier: 'PRO';
346
- maxMonthlyPosts: number;
347
- maxDailyPosts: number;
348
- createdAt: string | null;
349
- updatedAt: string | null;
350
- subscription?: {
351
- id: string;
352
- organizationId: string;
353
- couponId?: string | null;
354
- promotionCodeId?: string | null;
355
- stripeSubscriptionId: string;
356
- stripeSubscriptionItems?: Array<{
357
- id: string;
358
- price: string;
359
- quantity: number;
360
- }> | null;
361
- status: 'trialing' | 'active' | 'canceled' | 'incomplete' | 'incomplete_expired' | 'past_due' | 'unpaid' | 'paused';
362
- metadata?: unknown;
363
- cancelAtPeriodEnd: boolean;
364
- created: string | null;
365
- currentPeriodStart: string | null;
366
- currentPeriodEnd: string | null;
367
- endedAt?: string | null;
368
- cancelAt?: string | null;
369
- canceledAt?: string | null;
370
- trialStart?: string | null;
371
- trialEnd?: string | null;
372
- defaultMaxMonthlyPosts: number;
373
- defaultMaxDailyPosts: number;
374
- discountStart?: string | null;
375
- discountEnd?: string | null;
376
- createdAt: string | null;
377
- updatedAt: string | null;
378
- } | null;
379
- } | null;
380
326
  };
381
327
  type TeamUpdateTeamData = {
382
328
  id: string;
@@ -417,7 +363,6 @@ type TeamCreateTeamData = {
417
363
  */
418
364
  requestBody?: {
419
365
  name: string;
420
- tier: 'FREE' | 'PRO';
421
366
  avatarUrl?: string | null;
422
367
  };
423
368
  };
@@ -554,6 +499,19 @@ type SocialAccountRefreshChannelsResponse = {
554
499
  updatedAt: string | null;
555
500
  deletedAt?: string | null;
556
501
  };
502
+ type SocialAccountCreatePortalLinkData = {
503
+ /**
504
+ * Body
505
+ */
506
+ requestBody?: {
507
+ teamId: string;
508
+ redirectUrl: string;
509
+ socialAccountTypes: Array<('TIKTOK' | 'YOUTUBE' | 'INSTAGRAM' | 'FACEBOOK' | 'TWITTER' | 'THREADS' | 'LINKEDIN' | 'PINTEREST' | 'REDDIT' | 'DISCORD' | 'SLACK' | 'MASTODON')>;
510
+ };
511
+ };
512
+ type SocialAccountCreatePortalLinkResponse = {
513
+ url: string;
514
+ };
557
515
  type UploadGetListData = {
558
516
  teamId: string;
559
517
  };
@@ -2299,8 +2257,6 @@ type $OpenApiTs = {
2299
2257
  promotionCodeId?: string | null;
2300
2258
  name?: string | null;
2301
2259
  avatarUrl?: string | null;
2302
- defaultPaymentMethodFilled?: boolean;
2303
- billingAddressFilled?: boolean;
2304
2260
  apiAccess?: boolean;
2305
2261
  ref?: string | null;
2306
2262
  createdAt: string | null;
@@ -2342,6 +2298,8 @@ type $OpenApiTs = {
2342
2298
  }> | null;
2343
2299
  status: 'trialing' | 'active' | 'canceled' | 'incomplete' | 'incomplete_expired' | 'past_due' | 'unpaid' | 'paused';
2344
2300
  metadata?: unknown;
2301
+ stripePriceId: string;
2302
+ tier: 'PRO' | 'BUSINESS';
2345
2303
  cancelAtPeriodEnd: boolean;
2346
2304
  created: string | null;
2347
2305
  currentPeriodStart: string | null;
@@ -2351,23 +2309,11 @@ type $OpenApiTs = {
2351
2309
  canceledAt?: string | null;
2352
2310
  trialStart?: string | null;
2353
2311
  trialEnd?: string | null;
2354
- defaultMaxMonthlyPosts: number;
2355
- defaultMaxDailyPosts: number;
2312
+ maxMonthlyPosts: number;
2356
2313
  discountStart?: string | null;
2357
2314
  discountEnd?: string | null;
2358
2315
  createdAt: string | null;
2359
2316
  updatedAt: string | null;
2360
- teamPlans: Array<{
2361
- id: string;
2362
- subscriptionId: string;
2363
- teamId: string;
2364
- stripePriceId: string;
2365
- tier: 'PRO';
2366
- maxMonthlyPosts: number;
2367
- maxDailyPosts: number;
2368
- createdAt: string | null;
2369
- updatedAt: string | null;
2370
- }>;
2371
2317
  coupon?: {
2372
2318
  id: string;
2373
2319
  name?: string | null;
@@ -2441,6 +2387,9 @@ type $OpenApiTs = {
2441
2387
  updatedAt: string | null;
2442
2388
  };
2443
2389
  } | null;
2390
+ usage: {
2391
+ monthlyPosts: number;
2392
+ };
2444
2393
  };
2445
2394
  /**
2446
2395
  * 400
@@ -2507,8 +2456,6 @@ type $OpenApiTs = {
2507
2456
  promotionCodeId?: string | null;
2508
2457
  name?: string | null;
2509
2458
  avatarUrl?: string | null;
2510
- defaultPaymentMethodFilled?: boolean;
2511
- billingAddressFilled?: boolean;
2512
2459
  apiAccess?: boolean;
2513
2460
  ref?: string | null;
2514
2461
  createdAt: string | null;
@@ -2562,9 +2509,6 @@ type $OpenApiTs = {
2562
2509
  updatedAt: string | null;
2563
2510
  deletedAt?: string | null;
2564
2511
  }>;
2565
- usage: {
2566
- monthlyPosts: number;
2567
- };
2568
2512
  bio?: {
2569
2513
  id: string;
2570
2514
  username: string;
@@ -2602,46 +2546,6 @@ type $OpenApiTs = {
2602
2546
  }>;
2603
2547
  }>;
2604
2548
  } | null;
2605
- teamPlan?: {
2606
- id: string;
2607
- subscriptionId: string;
2608
- teamId: string;
2609
- stripePriceId: string;
2610
- tier: 'PRO';
2611
- maxMonthlyPosts: number;
2612
- maxDailyPosts: number;
2613
- createdAt: string | null;
2614
- updatedAt: string | null;
2615
- subscription?: {
2616
- id: string;
2617
- organizationId: string;
2618
- couponId?: string | null;
2619
- promotionCodeId?: string | null;
2620
- stripeSubscriptionId: string;
2621
- stripeSubscriptionItems?: Array<{
2622
- id: string;
2623
- price: string;
2624
- quantity: number;
2625
- }> | null;
2626
- status: 'trialing' | 'active' | 'canceled' | 'incomplete' | 'incomplete_expired' | 'past_due' | 'unpaid' | 'paused';
2627
- metadata?: unknown;
2628
- cancelAtPeriodEnd: boolean;
2629
- created: string | null;
2630
- currentPeriodStart: string | null;
2631
- currentPeriodEnd: string | null;
2632
- endedAt?: string | null;
2633
- cancelAt?: string | null;
2634
- canceledAt?: string | null;
2635
- trialStart?: string | null;
2636
- trialEnd?: string | null;
2637
- defaultMaxMonthlyPosts: number;
2638
- defaultMaxDailyPosts: number;
2639
- discountStart?: string | null;
2640
- discountEnd?: string | null;
2641
- createdAt: string | null;
2642
- updatedAt: string | null;
2643
- } | null;
2644
- } | null;
2645
2549
  };
2646
2550
  /**
2647
2551
  * 400
@@ -3143,6 +3047,59 @@ type $OpenApiTs = {
3143
3047
  };
3144
3048
  };
3145
3049
  };
3050
+ '/api/v1/social-account/create-portal-link': {
3051
+ post: {
3052
+ req: SocialAccountCreatePortalLinkData;
3053
+ res: {
3054
+ /**
3055
+ * 200
3056
+ */
3057
+ 200: {
3058
+ url: string;
3059
+ };
3060
+ /**
3061
+ * 400
3062
+ */
3063
+ 400: {
3064
+ message: string;
3065
+ issues?: Array<{
3066
+ message: string;
3067
+ path?: Array<(string | number)> | null;
3068
+ }> | null;
3069
+ };
3070
+ /**
3071
+ * 401
3072
+ */
3073
+ 401: {
3074
+ message: string;
3075
+ };
3076
+ /**
3077
+ * 403
3078
+ */
3079
+ 403: {
3080
+ message: string;
3081
+ };
3082
+ /**
3083
+ * 404
3084
+ */
3085
+ 404: {
3086
+ message: string;
3087
+ };
3088
+ /**
3089
+ * 429
3090
+ */
3091
+ 429: {
3092
+ message: string;
3093
+ };
3094
+ /**
3095
+ * 500
3096
+ */
3097
+ 500: {
3098
+ message: string;
3099
+ };
3100
+ };
3101
+ };
3102
+ };
3146
3103
  '/api/v1/upload/': {
3147
3104
  get: {
3148
3105
  req: UploadGetListData;
@@ -5058,6 +5015,15 @@ declare class SocialAccountService {
5058
5015
  * @throws ApiError
5059
5016
  */
5060
5017
  socialAccountRefreshChannels(data?: SocialAccountRefreshChannelsData): CancelablePromise<SocialAccountRefreshChannelsResponse>;
5018
+ /**
5019
+ * Create portal link
5020
+ * Create a portal link which can be used to manage connected social accounts
5021
+ * @param data The data for the request.
5022
+ * @param data.requestBody Body
5023
+ * @returns unknown 200
5024
+ * @throws ApiError
5025
+ */
5026
+ socialAccountCreatePortalLink(data?: SocialAccountCreatePortalLinkData): CancelablePromise<SocialAccountCreatePortalLinkResponse>;
5061
5027
  }
5062
5028
  declare class UploadService {
5063
5029
  readonly httpRequest: BaseHttpRequest;
@@ -5215,4 +5181,4 @@ declare class Bundlesocial extends Client {
5215
5181
  constructor(apiKey: string, options?: OpenAPIConfig);
5216
5182
  }
5217
5183
 
5218
- export { $OpenApiTs, ApiError, AppGetHealthResponse, BaseHttpRequest, Bundlesocial, CancelError, CancelablePromise, OpenAPI, OpenAPIConfig, OrganizationGetOrganizationResponse, PostCreateData, PostCreateResponse, PostDeleteData, PostDeleteResponse, PostGetData, PostGetListData, PostGetListResponse, PostGetResponse, PostUpdateData, PostUpdateResponse, SocialAccountConnectData, SocialAccountConnectResponse, SocialAccountDisconnectData, SocialAccountDisconnectResponse, SocialAccountRefreshChannelsData, SocialAccountRefreshChannelsResponse, SocialAccountSetChannelData, SocialAccountSetChannelResponse, TeamCreateTeamData, TeamCreateTeamResponse, TeamDeleteTeamData, TeamDeleteTeamResponse, TeamGetTeamData, TeamGetTeamResponse, TeamUpdateTeamData, TeamUpdateTeamResponse, UploadCreateData, UploadCreateResponse, UploadDeleteData, UploadDeleteManyData, UploadDeleteManyResponse, UploadDeleteResponse, UploadGetData, UploadGetListData, UploadGetListResponse, UploadGetResponse, WebhookEvent, WebhookEventType };
5184
+ export { $OpenApiTs, ApiError, AppGetHealthResponse, BaseHttpRequest, Bundlesocial, CancelError, CancelablePromise, OpenAPI, OpenAPIConfig, OrganizationGetOrganizationResponse, PostCreateData, PostCreateResponse, PostDeleteData, PostDeleteResponse, PostGetData, PostGetListData, PostGetListResponse, PostGetResponse, PostUpdateData, PostUpdateResponse, SocialAccountConnectData, SocialAccountConnectResponse, SocialAccountCreatePortalLinkData, SocialAccountCreatePortalLinkResponse, SocialAccountDisconnectData, SocialAccountDisconnectResponse, SocialAccountRefreshChannelsData, SocialAccountRefreshChannelsResponse, SocialAccountSetChannelData, SocialAccountSetChannelResponse, TeamCreateTeamData, TeamCreateTeamResponse, TeamDeleteTeamData, TeamDeleteTeamResponse, TeamGetTeamData, TeamGetTeamResponse, TeamUpdateTeamData, TeamUpdateTeamResponse, UploadCreateData, UploadCreateResponse, UploadDeleteData, UploadDeleteManyData, UploadDeleteManyResponse, UploadDeleteResponse, UploadGetData, UploadGetListData, UploadGetListResponse, UploadGetResponse, WebhookEvent, WebhookEventType };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var W=Object.create;var y=Object.defineProperty,$=Object.defineProperties,V=Object.getOwnPropertyDescriptor,J=Object.getOwnPropertyDescriptors,K=Object.getOwnPropertyNames,j=Object.getOwnPropertySymbols,Q=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable;var G=(t,e,s)=>e in t?y(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,u=(t,e)=>{for(var s in e||(e={}))B.call(e,s)&&G(t,s,e[s]);if(j)for(var s of j(e))X.call(e,s)&&G(t,s,e[s]);return t},b=(t,e)=>$(t,J(e));var Y=(t,e)=>{for(var s in e)y(t,s,{get:e[s],enumerable:!0})},L=(t,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of K(e))!B.call(t,o)&&o!==s&&y(t,o,{get:()=>e[o],enumerable:!(r=V(e,o))||r.enumerable});return t};var Z=(t,e,s)=>(s=t!=null?W(Q(t)):{},L(e||!t||!t.__esModule?y(s,"default",{value:t,enumerable:!0}):s,t)),ee=t=>L(y({},"__esModule",{value:!0}),t);var h=(t,e,s)=>new Promise((r,o)=>{var n=p=>{try{a(s.next(p))}catch(l){o(l)}},i=p=>{try{a(s.throw(p))}catch(l){o(l)}},a=p=>p.done?r(p.value):Promise.resolve(p.value).then(n,i);a((s=s.apply(t,e)).next())});var ce={};Y(ce,{ApiError:()=>c,BaseHttpRequest:()=>m,Bundlesocial:()=>U,CancelError:()=>T,CancelablePromise:()=>R,OpenAPI:()=>C});module.exports=ee(ce);var d=class{constructor(){this._fns=[]}eject(e){let s=this._fns.indexOf(e);s!==-1&&(this._fns=[...this._fns.slice(0,s),...this._fns.slice(s+1)])}use(e){this._fns=[...this._fns,e]}},C={BASE:"https://api.bundle.social",CREDENTIALS:"include",ENCODE_PATH:void 0,HEADERS:void 0,PASSWORD:void 0,TOKEN:void 0,USERNAME:void 0,VERSION:"1.0.0",WITH_CREDENTIALS:!1,interceptors:{request:new d,response:new d}};var m=class{constructor(e){this.config=e}};var c=class extends Error{constructor(s,r,o){super(o);this.name="ApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.body=r.body,this.request=s}};var T=class extends Error{constructor(e){super(e),this.name="CancelError"}get isCancelled(){return!0}},R=class{constructor(e){this._isResolved=!1,this._isRejected=!1,this._isCancelled=!1,this.cancelHandlers=[],this.promise=new Promise((s,r)=>{this._resolve=s,this._reject=r;let o=a=>{this._isResolved||this._isRejected||this._isCancelled||(this._isResolved=!0,this._resolve&&this._resolve(a))},n=a=>{this._isResolved||this._isRejected||this._isCancelled||(this._isRejected=!0,this._reject&&this._reject(a))},i=a=>{this._isResolved||this._isRejected||this._isCancelled||this.cancelHandlers.push(a)};return Object.defineProperty(i,"isResolved",{get:()=>this._isResolved}),Object.defineProperty(i,"isRejected",{get:()=>this._isRejected}),Object.defineProperty(i,"isCancelled",{get:()=>this._isCancelled}),e(o,n,i)})}get[Symbol.toStringTag](){return"Cancellable Promise"}then(e,s){return this.promise.then(e,s)}catch(e){return this.promise.catch(e)}finally(e){return this.promise.finally(e)}cancel(){if(!(this._isResolved||this._isRejected||this._isCancelled)){if(this._isCancelled=!0,this.cancelHandlers.length)try{for(let e of this.cancelHandlers)e()}catch(e){console.warn("Cancellation threw an error",e);return}this.cancelHandlers.length=0,this._reject&&this._reject(new T("Request aborted"))}}get isCancelled(){return this._isCancelled}};var f=t=>typeof t=="string",I=t=>f(t)&&t!=="",H=t=>t instanceof Blob,k=t=>t instanceof FormData,te=t=>{try{return btoa(t)}catch(e){return Buffer.from(t).toString("base64")}},se=t=>{let e=[],s=(o,n)=>{e.push(`${encodeURIComponent(o)}=${encodeURIComponent(String(n))}`)},r=(o,n)=>{n!=null&&(n instanceof Date?s(o,n.toISOString()):Array.isArray(n)?n.forEach(i=>r(o,i)):typeof n=="object"?Object.entries(n).forEach(([i,a])=>r(`${o}[${i}]`,a)):s(o,n))};return Object.entries(t).forEach(([o,n])=>r(o,n)),e.length?`?${e.join("&")}`:""},re=(t,e)=>{let s=t.ENCODE_PATH||encodeURI,r=e.url.replace("{api-version}",t.VERSION).replace(/{(.*?)}/g,(n,i)=>{var a;return(a=e.path)!=null&&a.hasOwnProperty(i)?s(String(e.path[i])):n}),o=t.BASE+r;return e.query?o+se(e.query):o},oe=t=>{if(t.formData){let e=new FormData,s=(r,o)=>{f(o)||H(o)?e.append(r,o):e.append(r,JSON.stringify(o))};return Object.entries(t.formData).filter(([,r])=>r!=null).forEach(([r,o])=>{Array.isArray(o)?o.forEach(n=>s(r,n)):s(r,o)}),e}},P=(t,e)=>h(void 0,null,function*(){return typeof e=="function"?e(t):e}),ne=(t,e)=>h(void 0,null,function*(){let[s,r,o,n]=yield Promise.all([P(e,t.TOKEN),P(e,t.USERNAME),P(e,t.PASSWORD),P(e,t.HEADERS)]),i=Object.entries(u(u({Accept:"application/json"},n),e.headers)).filter(([,a])=>a!=null).reduce((a,[p,l])=>b(u({},a),{[p]:String(l)}),{});if(I(s)&&(i.Authorization=`Bearer ${s}`),I(r)&&I(o)){let a=te(`${r}:${o}`);i.Authorization=`Basic ${a}`}return e.body!==void 0&&(e.mediaType?i["Content-Type"]=e.mediaType:H(e.body)?i["Content-Type"]=e.body.type||"application/octet-stream":f(e.body)?i["Content-Type"]="text/plain":k(e.body)||(i["Content-Type"]="application/json")),new Headers(i)}),ae=t=>{var e,s;if(t.body!==void 0)return(e=t.mediaType)!=null&&e.includes("application/json")||(s=t.mediaType)!=null&&s.includes("+json")?JSON.stringify(t.body):f(t.body)||H(t.body)||k(t.body)?t.body:JSON.stringify(t.body)},ie=(t,e,s,r,o,n,i)=>h(void 0,null,function*(){let a=new AbortController,p={headers:n,body:r!=null?r:o,method:e.method,signal:a.signal};t.WITH_CREDENTIALS&&(p.credentials=t.CREDENTIALS);for(let l of t.interceptors.request._fns)p=yield l(p);return i(()=>a.abort()),yield fetch(s,p)}),pe=(t,e)=>{if(e){let s=t.headers.get(e);if(f(s))return s}},le=t=>h(void 0,null,function*(){if(t.status!==204)try{let e=t.headers.get("Content-Type");if(e){let s=["application/octet-stream","application/pdf","application/zip","audio/","image/","video/"];if(e.includes("application/json")||e.includes("+json"))return yield t.json();if(s.some(r=>e.includes(r)))return yield t.blob();if(e.includes("multipart/form-data"))return yield t.formData();if(e.includes("text/"))return yield t.text()}}catch(e){console.error(e)}}),ue=(t,e)=>{var o,n;let r=u({400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"Im a teapot",421:"Misdirected Request",422:"Unprocessable Content",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",510:"Not Extended",511:"Network Authentication Required"},t.errors)[e.status];if(r)throw new c(t,e,r);if(!e.ok){let i=(o=e.status)!=null?o:"unknown",a=(n=e.statusText)!=null?n:"unknown",p=(()=>{try{return JSON.stringify(e.body,null,2)}catch(l){return}})();throw new c(t,e,`Generic Error: status: ${i}; status text: ${a}; body: ${p}`)}},M=(t,e)=>new R((s,r,o)=>h(void 0,null,function*(){try{let n=re(t,e),i=oe(e),a=ae(e),p=yield ne(t,e);if(!o.isCancelled){let l=yield ie(t,e,n,a,i,p,o);for(let F of t.interceptors.response._fns)l=yield F(l);let A=yield le(l),g=pe(l,e.responseHeader),N={url:n,ok:l.ok,status:l.status,statusText:l.statusText,body:g!=null?g:A};ue(e,N),s(N.body)}}catch(n){r(n)}}));var E=class extends m{constructor(e){super(e)}request(e){return M(this.config,e)}};var D=class{constructor(e){this.httpRequest=e}appGetHealth(){return this.httpRequest.request({method:"GET",url:"/api/v1/",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}},S=class{constructor(e){this.httpRequest=e}organizationGetOrganization(){return this.httpRequest.request({method:"GET",url:"/api/v1/organization/",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}},O=class{constructor(e){this.httpRequest=e}teamGetTeam(e){return this.httpRequest.request({method:"GET",url:"/api/v1/team/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}teamUpdateTeam(e){return this.httpRequest.request({method:"PATCH",url:"/api/v1/team/{id}",path:{id:e.id},body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}teamDeleteTeam(e){return this.httpRequest.request({method:"DELETE",url:"/api/v1/team/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}teamCreateTeam(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/team/",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}},v=class{constructor(e){this.httpRequest=e}socialAccountConnect(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/social-account/connect",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}socialAccountDisconnect(e={}){return this.httpRequest.request({method:"DELETE",url:"/api/v1/social-account/disconnect",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}socialAccountSetChannel(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/social-account/set-channel",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}socialAccountRefreshChannels(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/social-account/refresh-channels",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}},x=class{constructor(e){this.httpRequest=e}uploadGetList(e){return this.httpRequest.request({method:"GET",url:"/api/v1/upload/",query:{teamId:e.teamId},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}uploadCreate(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/upload/",formData:e.formData,mediaType:"multipart/form-data",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}uploadDeleteMany(e={}){return this.httpRequest.request({method:"DELETE",url:"/api/v1/upload/",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}uploadGet(e){return this.httpRequest.request({method:"GET",url:"/api/v1/upload/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}uploadDelete(e){return this.httpRequest.request({method:"DELETE",url:"/api/v1/upload/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}},w=class{constructor(e){this.httpRequest=e}postGet(e){return this.httpRequest.request({method:"GET",url:"/api/v1/post/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}postUpdate(e){return this.httpRequest.request({method:"PATCH",url:"/api/v1/post/{id}",path:{id:e.id},body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}postDelete(e){return this.httpRequest.request({method:"DELETE",url:"/api/v1/post/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}postGetList(e){return this.httpRequest.request({method:"GET",url:"/api/v1/post/",query:{teamId:e.teamId,status:e.status,orderBy:e.orderBy,order:e.order,q:e.q,platforms:e.platforms,offset:e.offset,limit:e.limit},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}postCreate(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/post/",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}};var q=class{constructor(e,s=E){var r,o,n,i,a,p,l,A;this.request=new s({BASE:(r=e==null?void 0:e.BASE)!=null?r:"https://api.bundle.social",VERSION:(o=e==null?void 0:e.VERSION)!=null?o:"1.0.0",WITH_CREDENTIALS:(n=e==null?void 0:e.WITH_CREDENTIALS)!=null?n:!1,CREDENTIALS:(i=e==null?void 0:e.CREDENTIALS)!=null?i:"include",TOKEN:e==null?void 0:e.TOKEN,USERNAME:e==null?void 0:e.USERNAME,PASSWORD:e==null?void 0:e.PASSWORD,HEADERS:e==null?void 0:e.HEADERS,ENCODE_PATH:e==null?void 0:e.ENCODE_PATH,interceptors:{request:(p=(a=e==null?void 0:e.interceptors)==null?void 0:a.request)!=null?p:new d,response:(A=(l=e==null?void 0:e.interceptors)==null?void 0:l.response)!=null?A:new d}}),this.app=new D(this.request),this.organization=new S(this.request),this.post=new w(this.request),this.socialAccount=new v(this.request),this.team=new O(this.request),this.upload=new x(this.request)}};var z=Z(require("crypto"));var _=class{constructor(){}verifySignature(e,s,r){return z.default.createHmac("sha256",r).update(e).digest("hex")===s}constructEvent(e,s,r){let o=typeof e=="string"?e:JSON.stringify(e);if(!this.verifySignature(o,s,r))throw new Error("Invalid signature");return JSON.parse(o)}},U=class extends q{constructor(s,r){super(b(u({},r),{HEADERS:b(u(u({},C.HEADERS),r==null?void 0:r.HEADERS),{"x-api-key":s})}));this.webhooks=new _}};0&&(module.exports={ApiError,BaseHttpRequest,Bundlesocial,CancelError,CancelablePromise,OpenAPI});
1
+ "use strict";var W=Object.create;var y=Object.defineProperty,$=Object.defineProperties,V=Object.getOwnPropertyDescriptor,J=Object.getOwnPropertyDescriptors,K=Object.getOwnPropertyNames,N=Object.getOwnPropertySymbols,Q=Object.getPrototypeOf,L=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable;var G=(t,e,s)=>e in t?y(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,u=(t,e)=>{for(var s in e||(e={}))L.call(e,s)&&G(t,s,e[s]);if(N)for(var s of N(e))X.call(e,s)&&G(t,s,e[s]);return t},b=(t,e)=>$(t,J(e));var Y=(t,e)=>{for(var s in e)y(t,s,{get:e[s],enumerable:!0})},B=(t,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of K(e))!L.call(t,o)&&o!==s&&y(t,o,{get:()=>e[o],enumerable:!(r=V(e,o))||r.enumerable});return t};var Z=(t,e,s)=>(s=t!=null?W(Q(t)):{},B(e||!t||!t.__esModule?y(s,"default",{value:t,enumerable:!0}):s,t)),ee=t=>B(y({},"__esModule",{value:!0}),t);var h=(t,e,s)=>new Promise((r,o)=>{var n=p=>{try{a(s.next(p))}catch(l){o(l)}},i=p=>{try{a(s.throw(p))}catch(l){o(l)}},a=p=>p.done?r(p.value):Promise.resolve(p.value).then(n,i);a((s=s.apply(t,e)).next())});var ce={};Y(ce,{ApiError:()=>c,BaseHttpRequest:()=>m,Bundlesocial:()=>U,CancelError:()=>T,CancelablePromise:()=>R,OpenAPI:()=>C});module.exports=ee(ce);var d=class{constructor(){this._fns=[]}eject(e){let s=this._fns.indexOf(e);s!==-1&&(this._fns=[...this._fns.slice(0,s),...this._fns.slice(s+1)])}use(e){this._fns=[...this._fns,e]}},C={BASE:"https://api.bundle.social",CREDENTIALS:"include",ENCODE_PATH:void 0,HEADERS:void 0,PASSWORD:void 0,TOKEN:void 0,USERNAME:void 0,VERSION:"1.0.0",WITH_CREDENTIALS:!1,interceptors:{request:new d,response:new d}};var m=class{constructor(e){this.config=e}};var c=class extends Error{constructor(s,r,o){super(o);this.name="ApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.body=r.body,this.request=s}};var T=class extends Error{constructor(e){super(e),this.name="CancelError"}get isCancelled(){return!0}},R=class{constructor(e){this._isResolved=!1,this._isRejected=!1,this._isCancelled=!1,this.cancelHandlers=[],this.promise=new Promise((s,r)=>{this._resolve=s,this._reject=r;let o=a=>{this._isResolved||this._isRejected||this._isCancelled||(this._isResolved=!0,this._resolve&&this._resolve(a))},n=a=>{this._isResolved||this._isRejected||this._isCancelled||(this._isRejected=!0,this._reject&&this._reject(a))},i=a=>{this._isResolved||this._isRejected||this._isCancelled||this.cancelHandlers.push(a)};return Object.defineProperty(i,"isResolved",{get:()=>this._isResolved}),Object.defineProperty(i,"isRejected",{get:()=>this._isRejected}),Object.defineProperty(i,"isCancelled",{get:()=>this._isCancelled}),e(o,n,i)})}get[Symbol.toStringTag](){return"Cancellable Promise"}then(e,s){return this.promise.then(e,s)}catch(e){return this.promise.catch(e)}finally(e){return this.promise.finally(e)}cancel(){if(!(this._isResolved||this._isRejected||this._isCancelled)){if(this._isCancelled=!0,this.cancelHandlers.length)try{for(let e of this.cancelHandlers)e()}catch(e){console.warn("Cancellation threw an error",e);return}this.cancelHandlers.length=0,this._reject&&this._reject(new T("Request aborted"))}}get isCancelled(){return this._isCancelled}};var f=t=>typeof t=="string",I=t=>f(t)&&t!=="",H=t=>t instanceof Blob,k=t=>t instanceof FormData,te=t=>{try{return btoa(t)}catch(e){return Buffer.from(t).toString("base64")}},se=t=>{let e=[],s=(o,n)=>{e.push(`${encodeURIComponent(o)}=${encodeURIComponent(String(n))}`)},r=(o,n)=>{n!=null&&(n instanceof Date?s(o,n.toISOString()):Array.isArray(n)?n.forEach(i=>r(o,i)):typeof n=="object"?Object.entries(n).forEach(([i,a])=>r(`${o}[${i}]`,a)):s(o,n))};return Object.entries(t).forEach(([o,n])=>r(o,n)),e.length?`?${e.join("&")}`:""},re=(t,e)=>{let s=t.ENCODE_PATH||encodeURI,r=e.url.replace("{api-version}",t.VERSION).replace(/{(.*?)}/g,(n,i)=>{var a;return(a=e.path)!=null&&a.hasOwnProperty(i)?s(String(e.path[i])):n}),o=t.BASE+r;return e.query?o+se(e.query):o},oe=t=>{if(t.formData){let e=new FormData,s=(r,o)=>{f(o)||H(o)?e.append(r,o):e.append(r,JSON.stringify(o))};return Object.entries(t.formData).filter(([,r])=>r!=null).forEach(([r,o])=>{Array.isArray(o)?o.forEach(n=>s(r,n)):s(r,o)}),e}},P=(t,e)=>h(void 0,null,function*(){return typeof e=="function"?e(t):e}),ne=(t,e)=>h(void 0,null,function*(){let[s,r,o,n]=yield Promise.all([P(e,t.TOKEN),P(e,t.USERNAME),P(e,t.PASSWORD),P(e,t.HEADERS)]),i=Object.entries(u(u({Accept:"application/json"},n),e.headers)).filter(([,a])=>a!=null).reduce((a,[p,l])=>b(u({},a),{[p]:String(l)}),{});if(I(s)&&(i.Authorization=`Bearer ${s}`),I(r)&&I(o)){let a=te(`${r}:${o}`);i.Authorization=`Basic ${a}`}return e.body!==void 0&&(e.mediaType?i["Content-Type"]=e.mediaType:H(e.body)?i["Content-Type"]=e.body.type||"application/octet-stream":f(e.body)?i["Content-Type"]="text/plain":k(e.body)||(i["Content-Type"]="application/json")),new Headers(i)}),ae=t=>{var e,s;if(t.body!==void 0)return(e=t.mediaType)!=null&&e.includes("application/json")||(s=t.mediaType)!=null&&s.includes("+json")?JSON.stringify(t.body):f(t.body)||H(t.body)||k(t.body)?t.body:JSON.stringify(t.body)},ie=(t,e,s,r,o,n,i)=>h(void 0,null,function*(){let a=new AbortController,p={headers:n,body:r!=null?r:o,method:e.method,signal:a.signal};t.WITH_CREDENTIALS&&(p.credentials=t.CREDENTIALS);for(let l of t.interceptors.request._fns)p=yield l(p);return i(()=>a.abort()),yield fetch(s,p)}),pe=(t,e)=>{if(e){let s=t.headers.get(e);if(f(s))return s}},le=t=>h(void 0,null,function*(){if(t.status!==204)try{let e=t.headers.get("Content-Type");if(e){let s=["application/octet-stream","application/pdf","application/zip","audio/","image/","video/"];if(e.includes("application/json")||e.includes("+json"))return yield t.json();if(s.some(r=>e.includes(r)))return yield t.blob();if(e.includes("multipart/form-data"))return yield t.formData();if(e.includes("text/"))return yield t.text()}}catch(e){console.error(e)}}),ue=(t,e)=>{var o,n;let r=u({400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"Im a teapot",421:"Misdirected Request",422:"Unprocessable Content",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",510:"Not Extended",511:"Network Authentication Required"},t.errors)[e.status];if(r)throw new c(t,e,r);if(!e.ok){let i=(o=e.status)!=null?o:"unknown",a=(n=e.statusText)!=null?n:"unknown",p=(()=>{try{return JSON.stringify(e.body,null,2)}catch(l){return}})();throw new c(t,e,`Generic Error: status: ${i}; status text: ${a}; body: ${p}`)}},M=(t,e)=>new R((s,r,o)=>h(void 0,null,function*(){try{let n=re(t,e),i=oe(e),a=ae(e),p=yield ne(t,e);if(!o.isCancelled){let l=yield ie(t,e,n,a,i,p,o);for(let F of t.interceptors.response._fns)l=yield F(l);let q=yield le(l),g=pe(l,e.responseHeader),j={url:n,ok:l.ok,status:l.status,statusText:l.statusText,body:g!=null?g:q};ue(e,j),s(j.body)}}catch(n){r(n)}}));var E=class extends m{constructor(e){super(e)}request(e){return M(this.config,e)}};var D=class{constructor(e){this.httpRequest=e}appGetHealth(){return this.httpRequest.request({method:"GET",url:"/api/v1/",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}},S=class{constructor(e){this.httpRequest=e}organizationGetOrganization(){return this.httpRequest.request({method:"GET",url:"/api/v1/organization/",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}},O=class{constructor(e){this.httpRequest=e}teamGetTeam(e){return this.httpRequest.request({method:"GET",url:"/api/v1/team/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}teamUpdateTeam(e){return this.httpRequest.request({method:"PATCH",url:"/api/v1/team/{id}",path:{id:e.id},body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}teamDeleteTeam(e){return this.httpRequest.request({method:"DELETE",url:"/api/v1/team/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}teamCreateTeam(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/team/",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}},v=class{constructor(e){this.httpRequest=e}socialAccountConnect(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/social-account/connect",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}socialAccountDisconnect(e={}){return this.httpRequest.request({method:"DELETE",url:"/api/v1/social-account/disconnect",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}socialAccountSetChannel(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/social-account/set-channel",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}socialAccountRefreshChannels(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/social-account/refresh-channels",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}socialAccountCreatePortalLink(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/social-account/create-portal-link",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}},x=class{constructor(e){this.httpRequest=e}uploadGetList(e){return this.httpRequest.request({method:"GET",url:"/api/v1/upload/",query:{teamId:e.teamId},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}uploadCreate(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/upload/",formData:e.formData,mediaType:"multipart/form-data",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}uploadDeleteMany(e={}){return this.httpRequest.request({method:"DELETE",url:"/api/v1/upload/",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}uploadGet(e){return this.httpRequest.request({method:"GET",url:"/api/v1/upload/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}uploadDelete(e){return this.httpRequest.request({method:"DELETE",url:"/api/v1/upload/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}},w=class{constructor(e){this.httpRequest=e}postGet(e){return this.httpRequest.request({method:"GET",url:"/api/v1/post/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}postUpdate(e){return this.httpRequest.request({method:"PATCH",url:"/api/v1/post/{id}",path:{id:e.id},body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}postDelete(e){return this.httpRequest.request({method:"DELETE",url:"/api/v1/post/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}postGetList(e){return this.httpRequest.request({method:"GET",url:"/api/v1/post/",query:{teamId:e.teamId,status:e.status,orderBy:e.orderBy,order:e.order,q:e.q,platforms:e.platforms,offset:e.offset,limit:e.limit},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}postCreate(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/post/",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}};var A=class{constructor(e,s=E){var r,o,n,i,a,p,l,q;this.request=new s({BASE:(r=e==null?void 0:e.BASE)!=null?r:"https://api.bundle.social",VERSION:(o=e==null?void 0:e.VERSION)!=null?o:"1.0.0",WITH_CREDENTIALS:(n=e==null?void 0:e.WITH_CREDENTIALS)!=null?n:!1,CREDENTIALS:(i=e==null?void 0:e.CREDENTIALS)!=null?i:"include",TOKEN:e==null?void 0:e.TOKEN,USERNAME:e==null?void 0:e.USERNAME,PASSWORD:e==null?void 0:e.PASSWORD,HEADERS:e==null?void 0:e.HEADERS,ENCODE_PATH:e==null?void 0:e.ENCODE_PATH,interceptors:{request:(p=(a=e==null?void 0:e.interceptors)==null?void 0:a.request)!=null?p:new d,response:(q=(l=e==null?void 0:e.interceptors)==null?void 0:l.response)!=null?q:new d}}),this.app=new D(this.request),this.organization=new S(this.request),this.post=new w(this.request),this.socialAccount=new v(this.request),this.team=new O(this.request),this.upload=new x(this.request)}};var z=Z(require("crypto"));var _=class{constructor(){}verifySignature(e,s,r){return z.default.createHmac("sha256",r).update(e).digest("hex")===s}constructEvent(e,s,r){let o=typeof e=="string"?e:JSON.stringify(e);if(!this.verifySignature(o,s,r))throw new Error("Invalid signature");return JSON.parse(o)}},U=class extends A{constructor(s,r){super(b(u({},r),{HEADERS:b(u(u({},C.HEADERS),r==null?void 0:r.HEADERS),{"x-api-key":s})}));this.webhooks=new _}};0&&(module.exports={ApiError,BaseHttpRequest,Bundlesocial,CancelError,CancelablePromise,OpenAPI});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- var k=Object.defineProperty,M=Object.defineProperties;var z=Object.getOwnPropertyDescriptors;var U=Object.getOwnPropertySymbols;var F=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable;var N=(t,e,s)=>e in t?k(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,u=(t,e)=>{for(var s in e||(e={}))F.call(e,s)&&N(t,s,e[s]);if(U)for(var s of U(e))W.call(e,s)&&N(t,s,e[s]);return t},T=(t,e)=>M(t,z(e));var m=(t,e,s)=>new Promise((r,o)=>{var n=p=>{try{a(s.next(p))}catch(l){o(l)}},i=p=>{try{a(s.throw(p))}catch(l){o(l)}},a=p=>p.done?r(p.value):Promise.resolve(p.value).then(n,i);a((s=s.apply(t,e)).next())});var c=class{constructor(){this._fns=[]}eject(e){let s=this._fns.indexOf(e);s!==-1&&(this._fns=[...this._fns.slice(0,s),...this._fns.slice(s+1)])}use(e){this._fns=[...this._fns,e]}},w={BASE:"https://api.bundle.social",CREDENTIALS:"include",ENCODE_PATH:void 0,HEADERS:void 0,PASSWORD:void 0,TOKEN:void 0,USERNAME:void 0,VERSION:"1.0.0",WITH_CREDENTIALS:!1,interceptors:{request:new c,response:new c}};var R=class{constructor(e){this.config=e}};var d=class extends Error{constructor(s,r,o){super(o);this.name="ApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.body=r.body,this.request=s}};var y=class extends Error{constructor(e){super(e),this.name="CancelError"}get isCancelled(){return!0}},h=class{constructor(e){this._isResolved=!1,this._isRejected=!1,this._isCancelled=!1,this.cancelHandlers=[],this.promise=new Promise((s,r)=>{this._resolve=s,this._reject=r;let o=a=>{this._isResolved||this._isRejected||this._isCancelled||(this._isResolved=!0,this._resolve&&this._resolve(a))},n=a=>{this._isResolved||this._isRejected||this._isCancelled||(this._isRejected=!0,this._reject&&this._reject(a))},i=a=>{this._isResolved||this._isRejected||this._isCancelled||this.cancelHandlers.push(a)};return Object.defineProperty(i,"isResolved",{get:()=>this._isResolved}),Object.defineProperty(i,"isRejected",{get:()=>this._isRejected}),Object.defineProperty(i,"isCancelled",{get:()=>this._isCancelled}),e(o,n,i)})}get[Symbol.toStringTag](){return"Cancellable Promise"}then(e,s){return this.promise.then(e,s)}catch(e){return this.promise.catch(e)}finally(e){return this.promise.finally(e)}cancel(){if(!(this._isResolved||this._isRejected||this._isCancelled)){if(this._isCancelled=!0,this.cancelHandlers.length)try{for(let e of this.cancelHandlers)e()}catch(e){console.warn("Cancellation threw an error",e);return}this.cancelHandlers.length=0,this._reject&&this._reject(new y("Request aborted"))}}get isCancelled(){return this._isCancelled}};var b=t=>typeof t=="string",g=t=>b(t)&&t!=="",I=t=>t instanceof Blob,j=t=>t instanceof FormData,$=t=>{try{return btoa(t)}catch(e){return Buffer.from(t).toString("base64")}},V=t=>{let e=[],s=(o,n)=>{e.push(`${encodeURIComponent(o)}=${encodeURIComponent(String(n))}`)},r=(o,n)=>{n!=null&&(n instanceof Date?s(o,n.toISOString()):Array.isArray(n)?n.forEach(i=>r(o,i)):typeof n=="object"?Object.entries(n).forEach(([i,a])=>r(`${o}[${i}]`,a)):s(o,n))};return Object.entries(t).forEach(([o,n])=>r(o,n)),e.length?`?${e.join("&")}`:""},J=(t,e)=>{let s=t.ENCODE_PATH||encodeURI,r=e.url.replace("{api-version}",t.VERSION).replace(/{(.*?)}/g,(n,i)=>{var a;return(a=e.path)!=null&&a.hasOwnProperty(i)?s(String(e.path[i])):n}),o=t.BASE+r;return e.query?o+V(e.query):o},K=t=>{if(t.formData){let e=new FormData,s=(r,o)=>{b(o)||I(o)?e.append(r,o):e.append(r,JSON.stringify(o))};return Object.entries(t.formData).filter(([,r])=>r!=null).forEach(([r,o])=>{Array.isArray(o)?o.forEach(n=>s(r,n)):s(r,o)}),e}},A=(t,e)=>m(void 0,null,function*(){return typeof e=="function"?e(t):e}),Q=(t,e)=>m(void 0,null,function*(){let[s,r,o,n]=yield Promise.all([A(e,t.TOKEN),A(e,t.USERNAME),A(e,t.PASSWORD),A(e,t.HEADERS)]),i=Object.entries(u(u({Accept:"application/json"},n),e.headers)).filter(([,a])=>a!=null).reduce((a,[p,l])=>T(u({},a),{[p]:String(l)}),{});if(g(s)&&(i.Authorization=`Bearer ${s}`),g(r)&&g(o)){let a=$(`${r}:${o}`);i.Authorization=`Basic ${a}`}return e.body!==void 0&&(e.mediaType?i["Content-Type"]=e.mediaType:I(e.body)?i["Content-Type"]=e.body.type||"application/octet-stream":b(e.body)?i["Content-Type"]="text/plain":j(e.body)||(i["Content-Type"]="application/json")),new Headers(i)}),X=t=>{var e,s;if(t.body!==void 0)return(e=t.mediaType)!=null&&e.includes("application/json")||(s=t.mediaType)!=null&&s.includes("+json")?JSON.stringify(t.body):b(t.body)||I(t.body)||j(t.body)?t.body:JSON.stringify(t.body)},Y=(t,e,s,r,o,n,i)=>m(void 0,null,function*(){let a=new AbortController,p={headers:n,body:r!=null?r:o,method:e.method,signal:a.signal};t.WITH_CREDENTIALS&&(p.credentials=t.CREDENTIALS);for(let l of t.interceptors.request._fns)p=yield l(p);return i(()=>a.abort()),yield fetch(s,p)}),Z=(t,e)=>{if(e){let s=t.headers.get(e);if(b(s))return s}},ee=t=>m(void 0,null,function*(){if(t.status!==204)try{let e=t.headers.get("Content-Type");if(e){let s=["application/octet-stream","application/pdf","application/zip","audio/","image/","video/"];if(e.includes("application/json")||e.includes("+json"))return yield t.json();if(s.some(r=>e.includes(r)))return yield t.blob();if(e.includes("multipart/form-data"))return yield t.formData();if(e.includes("text/"))return yield t.text()}}catch(e){console.error(e)}}),te=(t,e)=>{var o,n;let r=u({400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"Im a teapot",421:"Misdirected Request",422:"Unprocessable Content",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",510:"Not Extended",511:"Network Authentication Required"},t.errors)[e.status];if(r)throw new d(t,e,r);if(!e.ok){let i=(o=e.status)!=null?o:"unknown",a=(n=e.statusText)!=null?n:"unknown",p=(()=>{try{return JSON.stringify(e.body,null,2)}catch(l){return}})();throw new d(t,e,`Generic Error: status: ${i}; status text: ${a}; body: ${p}`)}},G=(t,e)=>new h((s,r,o)=>m(void 0,null,function*(){try{let n=J(t,e),i=K(e),a=X(e),p=yield Q(t,e);if(!o.isCancelled){let l=yield Y(t,e,n,a,i,p,o);for(let L of t.interceptors.response._fns)l=yield L(l);let q=yield ee(l),x=Z(l,e.responseHeader),_={url:n,ok:l.ok,status:l.status,statusText:l.statusText,body:x!=null?x:q};te(e,_),s(_.body)}}catch(n){r(n)}}));var C=class extends R{constructor(e){super(e)}request(e){return G(this.config,e)}};var P=class{constructor(e){this.httpRequest=e}appGetHealth(){return this.httpRequest.request({method:"GET",url:"/api/v1/",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}},E=class{constructor(e){this.httpRequest=e}organizationGetOrganization(){return this.httpRequest.request({method:"GET",url:"/api/v1/organization/",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}},D=class{constructor(e){this.httpRequest=e}teamGetTeam(e){return this.httpRequest.request({method:"GET",url:"/api/v1/team/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}teamUpdateTeam(e){return this.httpRequest.request({method:"PATCH",url:"/api/v1/team/{id}",path:{id:e.id},body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}teamDeleteTeam(e){return this.httpRequest.request({method:"DELETE",url:"/api/v1/team/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}teamCreateTeam(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/team/",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}},S=class{constructor(e){this.httpRequest=e}socialAccountConnect(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/social-account/connect",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}socialAccountDisconnect(e={}){return this.httpRequest.request({method:"DELETE",url:"/api/v1/social-account/disconnect",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}socialAccountSetChannel(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/social-account/set-channel",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}socialAccountRefreshChannels(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/social-account/refresh-channels",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}},O=class{constructor(e){this.httpRequest=e}uploadGetList(e){return this.httpRequest.request({method:"GET",url:"/api/v1/upload/",query:{teamId:e.teamId},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}uploadCreate(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/upload/",formData:e.formData,mediaType:"multipart/form-data",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}uploadDeleteMany(e={}){return this.httpRequest.request({method:"DELETE",url:"/api/v1/upload/",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}uploadGet(e){return this.httpRequest.request({method:"GET",url:"/api/v1/upload/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}uploadDelete(e){return this.httpRequest.request({method:"DELETE",url:"/api/v1/upload/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}},v=class{constructor(e){this.httpRequest=e}postGet(e){return this.httpRequest.request({method:"GET",url:"/api/v1/post/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}postUpdate(e){return this.httpRequest.request({method:"PATCH",url:"/api/v1/post/{id}",path:{id:e.id},body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}postDelete(e){return this.httpRequest.request({method:"DELETE",url:"/api/v1/post/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}postGetList(e){return this.httpRequest.request({method:"GET",url:"/api/v1/post/",query:{teamId:e.teamId,status:e.status,orderBy:e.orderBy,order:e.order,q:e.q,platforms:e.platforms,offset:e.offset,limit:e.limit},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}postCreate(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/post/",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}};var f=class{constructor(e,s=C){var r,o,n,i,a,p,l,q;this.request=new s({BASE:(r=e==null?void 0:e.BASE)!=null?r:"https://api.bundle.social",VERSION:(o=e==null?void 0:e.VERSION)!=null?o:"1.0.0",WITH_CREDENTIALS:(n=e==null?void 0:e.WITH_CREDENTIALS)!=null?n:!1,CREDENTIALS:(i=e==null?void 0:e.CREDENTIALS)!=null?i:"include",TOKEN:e==null?void 0:e.TOKEN,USERNAME:e==null?void 0:e.USERNAME,PASSWORD:e==null?void 0:e.PASSWORD,HEADERS:e==null?void 0:e.HEADERS,ENCODE_PATH:e==null?void 0:e.ENCODE_PATH,interceptors:{request:(p=(a=e==null?void 0:e.interceptors)==null?void 0:a.request)!=null?p:new c,response:(q=(l=e==null?void 0:e.interceptors)==null?void 0:l.response)!=null?q:new c}}),this.app=new P(this.request),this.organization=new E(this.request),this.post=new v(this.request),this.socialAccount=new S(this.request),this.team=new D(this.request),this.upload=new O(this.request)}};import se from"crypto";var H=class{constructor(){}verifySignature(e,s,r){return se.createHmac("sha256",r).update(e).digest("hex")===s}constructEvent(e,s,r){let o=typeof e=="string"?e:JSON.stringify(e);if(!this.verifySignature(o,s,r))throw new Error("Invalid signature");return JSON.parse(o)}},B=class extends f{constructor(s,r){super(T(u({},r),{HEADERS:T(u(u({},w.HEADERS),r==null?void 0:r.HEADERS),{"x-api-key":s})}));this.webhooks=new H}};export{d as ApiError,R as BaseHttpRequest,B as Bundlesocial,y as CancelError,h as CancelablePromise,w as OpenAPI};
1
+ var k=Object.defineProperty,M=Object.defineProperties;var z=Object.getOwnPropertyDescriptors;var U=Object.getOwnPropertySymbols;var F=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable;var j=(t,e,s)=>e in t?k(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,u=(t,e)=>{for(var s in e||(e={}))F.call(e,s)&&j(t,s,e[s]);if(U)for(var s of U(e))W.call(e,s)&&j(t,s,e[s]);return t},T=(t,e)=>M(t,z(e));var m=(t,e,s)=>new Promise((r,o)=>{var n=p=>{try{a(s.next(p))}catch(l){o(l)}},i=p=>{try{a(s.throw(p))}catch(l){o(l)}},a=p=>p.done?r(p.value):Promise.resolve(p.value).then(n,i);a((s=s.apply(t,e)).next())});var c=class{constructor(){this._fns=[]}eject(e){let s=this._fns.indexOf(e);s!==-1&&(this._fns=[...this._fns.slice(0,s),...this._fns.slice(s+1)])}use(e){this._fns=[...this._fns,e]}},w={BASE:"https://api.bundle.social",CREDENTIALS:"include",ENCODE_PATH:void 0,HEADERS:void 0,PASSWORD:void 0,TOKEN:void 0,USERNAME:void 0,VERSION:"1.0.0",WITH_CREDENTIALS:!1,interceptors:{request:new c,response:new c}};var R=class{constructor(e){this.config=e}};var d=class extends Error{constructor(s,r,o){super(o);this.name="ApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.body=r.body,this.request=s}};var y=class extends Error{constructor(e){super(e),this.name="CancelError"}get isCancelled(){return!0}},h=class{constructor(e){this._isResolved=!1,this._isRejected=!1,this._isCancelled=!1,this.cancelHandlers=[],this.promise=new Promise((s,r)=>{this._resolve=s,this._reject=r;let o=a=>{this._isResolved||this._isRejected||this._isCancelled||(this._isResolved=!0,this._resolve&&this._resolve(a))},n=a=>{this._isResolved||this._isRejected||this._isCancelled||(this._isRejected=!0,this._reject&&this._reject(a))},i=a=>{this._isResolved||this._isRejected||this._isCancelled||this.cancelHandlers.push(a)};return Object.defineProperty(i,"isResolved",{get:()=>this._isResolved}),Object.defineProperty(i,"isRejected",{get:()=>this._isRejected}),Object.defineProperty(i,"isCancelled",{get:()=>this._isCancelled}),e(o,n,i)})}get[Symbol.toStringTag](){return"Cancellable Promise"}then(e,s){return this.promise.then(e,s)}catch(e){return this.promise.catch(e)}finally(e){return this.promise.finally(e)}cancel(){if(!(this._isResolved||this._isRejected||this._isCancelled)){if(this._isCancelled=!0,this.cancelHandlers.length)try{for(let e of this.cancelHandlers)e()}catch(e){console.warn("Cancellation threw an error",e);return}this.cancelHandlers.length=0,this._reject&&this._reject(new y("Request aborted"))}}get isCancelled(){return this._isCancelled}};var b=t=>typeof t=="string",g=t=>b(t)&&t!=="",I=t=>t instanceof Blob,N=t=>t instanceof FormData,$=t=>{try{return btoa(t)}catch(e){return Buffer.from(t).toString("base64")}},V=t=>{let e=[],s=(o,n)=>{e.push(`${encodeURIComponent(o)}=${encodeURIComponent(String(n))}`)},r=(o,n)=>{n!=null&&(n instanceof Date?s(o,n.toISOString()):Array.isArray(n)?n.forEach(i=>r(o,i)):typeof n=="object"?Object.entries(n).forEach(([i,a])=>r(`${o}[${i}]`,a)):s(o,n))};return Object.entries(t).forEach(([o,n])=>r(o,n)),e.length?`?${e.join("&")}`:""},J=(t,e)=>{let s=t.ENCODE_PATH||encodeURI,r=e.url.replace("{api-version}",t.VERSION).replace(/{(.*?)}/g,(n,i)=>{var a;return(a=e.path)!=null&&a.hasOwnProperty(i)?s(String(e.path[i])):n}),o=t.BASE+r;return e.query?o+V(e.query):o},K=t=>{if(t.formData){let e=new FormData,s=(r,o)=>{b(o)||I(o)?e.append(r,o):e.append(r,JSON.stringify(o))};return Object.entries(t.formData).filter(([,r])=>r!=null).forEach(([r,o])=>{Array.isArray(o)?o.forEach(n=>s(r,n)):s(r,o)}),e}},q=(t,e)=>m(void 0,null,function*(){return typeof e=="function"?e(t):e}),Q=(t,e)=>m(void 0,null,function*(){let[s,r,o,n]=yield Promise.all([q(e,t.TOKEN),q(e,t.USERNAME),q(e,t.PASSWORD),q(e,t.HEADERS)]),i=Object.entries(u(u({Accept:"application/json"},n),e.headers)).filter(([,a])=>a!=null).reduce((a,[p,l])=>T(u({},a),{[p]:String(l)}),{});if(g(s)&&(i.Authorization=`Bearer ${s}`),g(r)&&g(o)){let a=$(`${r}:${o}`);i.Authorization=`Basic ${a}`}return e.body!==void 0&&(e.mediaType?i["Content-Type"]=e.mediaType:I(e.body)?i["Content-Type"]=e.body.type||"application/octet-stream":b(e.body)?i["Content-Type"]="text/plain":N(e.body)||(i["Content-Type"]="application/json")),new Headers(i)}),X=t=>{var e,s;if(t.body!==void 0)return(e=t.mediaType)!=null&&e.includes("application/json")||(s=t.mediaType)!=null&&s.includes("+json")?JSON.stringify(t.body):b(t.body)||I(t.body)||N(t.body)?t.body:JSON.stringify(t.body)},Y=(t,e,s,r,o,n,i)=>m(void 0,null,function*(){let a=new AbortController,p={headers:n,body:r!=null?r:o,method:e.method,signal:a.signal};t.WITH_CREDENTIALS&&(p.credentials=t.CREDENTIALS);for(let l of t.interceptors.request._fns)p=yield l(p);return i(()=>a.abort()),yield fetch(s,p)}),Z=(t,e)=>{if(e){let s=t.headers.get(e);if(b(s))return s}},ee=t=>m(void 0,null,function*(){if(t.status!==204)try{let e=t.headers.get("Content-Type");if(e){let s=["application/octet-stream","application/pdf","application/zip","audio/","image/","video/"];if(e.includes("application/json")||e.includes("+json"))return yield t.json();if(s.some(r=>e.includes(r)))return yield t.blob();if(e.includes("multipart/form-data"))return yield t.formData();if(e.includes("text/"))return yield t.text()}}catch(e){console.error(e)}}),te=(t,e)=>{var o,n;let r=u({400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"Im a teapot",421:"Misdirected Request",422:"Unprocessable Content",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",510:"Not Extended",511:"Network Authentication Required"},t.errors)[e.status];if(r)throw new d(t,e,r);if(!e.ok){let i=(o=e.status)!=null?o:"unknown",a=(n=e.statusText)!=null?n:"unknown",p=(()=>{try{return JSON.stringify(e.body,null,2)}catch(l){return}})();throw new d(t,e,`Generic Error: status: ${i}; status text: ${a}; body: ${p}`)}},G=(t,e)=>new h((s,r,o)=>m(void 0,null,function*(){try{let n=J(t,e),i=K(e),a=X(e),p=yield Q(t,e);if(!o.isCancelled){let l=yield Y(t,e,n,a,i,p,o);for(let B of t.interceptors.response._fns)l=yield B(l);let A=yield ee(l),x=Z(l,e.responseHeader),_={url:n,ok:l.ok,status:l.status,statusText:l.statusText,body:x!=null?x:A};te(e,_),s(_.body)}}catch(n){r(n)}}));var C=class extends R{constructor(e){super(e)}request(e){return G(this.config,e)}};var P=class{constructor(e){this.httpRequest=e}appGetHealth(){return this.httpRequest.request({method:"GET",url:"/api/v1/",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}},E=class{constructor(e){this.httpRequest=e}organizationGetOrganization(){return this.httpRequest.request({method:"GET",url:"/api/v1/organization/",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}},D=class{constructor(e){this.httpRequest=e}teamGetTeam(e){return this.httpRequest.request({method:"GET",url:"/api/v1/team/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}teamUpdateTeam(e){return this.httpRequest.request({method:"PATCH",url:"/api/v1/team/{id}",path:{id:e.id},body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}teamDeleteTeam(e){return this.httpRequest.request({method:"DELETE",url:"/api/v1/team/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}teamCreateTeam(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/team/",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}},S=class{constructor(e){this.httpRequest=e}socialAccountConnect(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/social-account/connect",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}socialAccountDisconnect(e={}){return this.httpRequest.request({method:"DELETE",url:"/api/v1/social-account/disconnect",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}socialAccountSetChannel(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/social-account/set-channel",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}socialAccountRefreshChannels(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/social-account/refresh-channels",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}socialAccountCreatePortalLink(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/social-account/create-portal-link",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}},O=class{constructor(e){this.httpRequest=e}uploadGetList(e){return this.httpRequest.request({method:"GET",url:"/api/v1/upload/",query:{teamId:e.teamId},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}uploadCreate(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/upload/",formData:e.formData,mediaType:"multipart/form-data",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}uploadDeleteMany(e={}){return this.httpRequest.request({method:"DELETE",url:"/api/v1/upload/",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}uploadGet(e){return this.httpRequest.request({method:"GET",url:"/api/v1/upload/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}uploadDelete(e){return this.httpRequest.request({method:"DELETE",url:"/api/v1/upload/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}},v=class{constructor(e){this.httpRequest=e}postGet(e){return this.httpRequest.request({method:"GET",url:"/api/v1/post/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}postUpdate(e){return this.httpRequest.request({method:"PATCH",url:"/api/v1/post/{id}",path:{id:e.id},body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}postDelete(e){return this.httpRequest.request({method:"DELETE",url:"/api/v1/post/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}postGetList(e){return this.httpRequest.request({method:"GET",url:"/api/v1/post/",query:{teamId:e.teamId,status:e.status,orderBy:e.orderBy,order:e.order,q:e.q,platforms:e.platforms,offset:e.offset,limit:e.limit},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}postCreate(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/post/",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}};var f=class{constructor(e,s=C){var r,o,n,i,a,p,l,A;this.request=new s({BASE:(r=e==null?void 0:e.BASE)!=null?r:"https://api.bundle.social",VERSION:(o=e==null?void 0:e.VERSION)!=null?o:"1.0.0",WITH_CREDENTIALS:(n=e==null?void 0:e.WITH_CREDENTIALS)!=null?n:!1,CREDENTIALS:(i=e==null?void 0:e.CREDENTIALS)!=null?i:"include",TOKEN:e==null?void 0:e.TOKEN,USERNAME:e==null?void 0:e.USERNAME,PASSWORD:e==null?void 0:e.PASSWORD,HEADERS:e==null?void 0:e.HEADERS,ENCODE_PATH:e==null?void 0:e.ENCODE_PATH,interceptors:{request:(p=(a=e==null?void 0:e.interceptors)==null?void 0:a.request)!=null?p:new c,response:(A=(l=e==null?void 0:e.interceptors)==null?void 0:l.response)!=null?A:new c}}),this.app=new P(this.request),this.organization=new E(this.request),this.post=new v(this.request),this.socialAccount=new S(this.request),this.team=new D(this.request),this.upload=new O(this.request)}};import se from"crypto";var H=class{constructor(){}verifySignature(e,s,r){return se.createHmac("sha256",r).update(e).digest("hex")===s}constructEvent(e,s,r){let o=typeof e=="string"?e:JSON.stringify(e);if(!this.verifySignature(o,s,r))throw new Error("Invalid signature");return JSON.parse(o)}},L=class extends f{constructor(s,r){super(T(u({},r),{HEADERS:T(u(u({},w.HEADERS),r==null?void 0:r.HEADERS),{"x-api-key":s})}));this.webhooks=new H}};export{d as ApiError,R as BaseHttpRequest,L as Bundlesocial,y as CancelError,h as CancelablePromise,w as OpenAPI};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bundlesocial",
3
- "version": "2.3.0",
3
+ "version": "2.5.0",
4
4
  "description": "Node.js library for the bundle.social API",
5
5
  "keywords": [
6
6
  "bundle.social",