bundlesocial 2.9.0 → 2.10.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
@@ -392,6 +392,7 @@ type TeamCreateTeamData = {
392
392
  requestBody?: {
393
393
  name: string;
394
394
  avatarUrl?: string | null;
395
+ copyTeamId?: string | null;
395
396
  };
396
397
  };
397
398
  type TeamCreateTeamResponse = {
@@ -498,7 +499,7 @@ type SocialAccountRefreshChannelsData = {
498
499
  * Body
499
500
  */
500
501
  requestBody?: {
501
- type: 'DISCORD' | 'SLACK' | 'REDDIT' | 'PINTEREST';
502
+ type: 'DISCORD' | 'SLACK' | 'REDDIT' | 'PINTEREST' | 'FACEBOOK' | 'INSTAGRAM' | 'LINKEDIN' | 'YOUTUBE';
502
503
  teamId: string;
503
504
  };
504
505
  };
@@ -543,6 +544,45 @@ type SocialAccountCreatePortalLinkData = {
543
544
  type SocialAccountCreatePortalLinkResponse = {
544
545
  url: string;
545
546
  };
547
+ type SocialAccountCopyData = {
548
+ /**
549
+ * Body
550
+ */
551
+ requestBody?: {
552
+ fromTeamId: string;
553
+ toTeamId: string;
554
+ /**
555
+ * If you set that to true, selected page will not be transferred automatically. The user will have to select the page themselves again. This only applies to Facebook, Instagram, Linkedin and Youtube.
556
+ */
557
+ resetChannel?: boolean;
558
+ socialAccountTypes: Array<('TIKTOK' | 'YOUTUBE' | 'INSTAGRAM' | 'FACEBOOK' | 'TWITTER' | 'THREADS' | 'LINKEDIN' | 'PINTEREST' | 'REDDIT' | 'MASTODON' | 'DISCORD' | 'SLACK')>;
559
+ };
560
+ };
561
+ type SocialAccountCopyResponse = Array<{
562
+ id: string;
563
+ type: 'TIKTOK' | 'YOUTUBE' | 'INSTAGRAM' | 'FACEBOOK' | 'TWITTER' | 'THREADS' | 'LINKEDIN' | 'PINTEREST' | 'REDDIT' | 'MASTODON' | 'DISCORD' | 'SLACK';
564
+ teamId: string;
565
+ username?: string | null;
566
+ displayName?: string | null;
567
+ externalId?: string | null;
568
+ userUsername?: string | null;
569
+ userDisplayName?: string | null;
570
+ userId?: string | null;
571
+ channels?: Array<{
572
+ id: string;
573
+ name?: string | null;
574
+ username?: string | null;
575
+ webhook?: {
576
+ id?: string | null;
577
+ name?: string | null;
578
+ avatar?: string | null;
579
+ url?: string | null;
580
+ } | null;
581
+ }> | null;
582
+ createdAt: string | null;
583
+ updatedAt: string | null;
584
+ deletedAt?: string | null;
585
+ }>;
546
586
  type UploadGetListData = {
547
587
  teamId?: string | null;
548
588
  };
@@ -4566,6 +4606,81 @@ type $OpenApiTs = {
4566
4606
  };
4567
4607
  };
4568
4608
  };
4609
+ '/api/v1/social-account/copy': {
4610
+ post: {
4611
+ req: SocialAccountCopyData;
4612
+ res: {
4613
+ /**
4614
+ * 200
4615
+ */
4616
+ 200: Array<{
4617
+ id: string;
4618
+ type: 'TIKTOK' | 'YOUTUBE' | 'INSTAGRAM' | 'FACEBOOK' | 'TWITTER' | 'THREADS' | 'LINKEDIN' | 'PINTEREST' | 'REDDIT' | 'MASTODON' | 'DISCORD' | 'SLACK';
4619
+ teamId: string;
4620
+ username?: string | null;
4621
+ displayName?: string | null;
4622
+ externalId?: string | null;
4623
+ userUsername?: string | null;
4624
+ userDisplayName?: string | null;
4625
+ userId?: string | null;
4626
+ channels?: Array<{
4627
+ id: string;
4628
+ name?: string | null;
4629
+ username?: string | null;
4630
+ webhook?: {
4631
+ id?: string | null;
4632
+ name?: string | null;
4633
+ avatar?: string | null;
4634
+ url?: string | null;
4635
+ } | null;
4636
+ }> | null;
4637
+ createdAt: string | null;
4638
+ updatedAt: string | null;
4639
+ deletedAt?: string | null;
4640
+ }>;
4641
+ /**
4642
+ * 400
4643
+ */
4644
+ 400: {
4645
+ message: string;
4646
+ issues?: Array<{
4647
+ message: string;
4648
+ path?: Array<(string | number)> | null;
4649
+ }> | null;
4650
+ };
4651
+ /**
4652
+ * 401
4653
+ */
4654
+ 401: {
4655
+ message: string;
4656
+ };
4657
+ /**
4658
+ * 403
4659
+ */
4660
+ 403: {
4661
+ message: string;
4662
+ };
4663
+ /**
4664
+ * 404
4665
+ */
4666
+ 404: {
4667
+ message: string;
4668
+ };
4669
+ /**
4670
+ * 429
4671
+ */
4672
+ 429: {
4673
+ message: string;
4674
+ };
4675
+ /**
4676
+ * 500
4677
+ */
4678
+ 500: {
4679
+ message: string;
4680
+ };
4681
+ };
4682
+ };
4683
+ };
4569
4684
  '/api/v1/upload/': {
4570
4685
  get: {
4571
4686
  req: UploadGetListData;
@@ -8175,6 +8290,14 @@ declare class SocialAccountService {
8175
8290
  * @throws ApiError
8176
8291
  */
8177
8292
  socialAccountCreatePortalLink(data?: SocialAccountCreatePortalLinkData): CancelablePromise<SocialAccountCreatePortalLinkResponse>;
8293
+ /**
8294
+ * Copy social accounts
8295
+ * @param data The data for the request.
8296
+ * @param data.requestBody Body
8297
+ * @returns unknown 200
8298
+ * @throws ApiError
8299
+ */
8300
+ socialAccountCopy(data?: SocialAccountCopyData): CancelablePromise<SocialAccountCopyResponse>;
8178
8301
  }
8179
8302
  declare class UploadService {
8180
8303
  readonly httpRequest: BaseHttpRequest;
@@ -8434,4 +8557,4 @@ declare class Bundlesocial extends Client {
8434
8557
  constructor(apiKey: string, options?: OpenAPIConfig);
8435
8558
  }
8436
8559
 
8437
- export { $OpenApiTs, AnalyticsGetProfileAnalyticsData, AnalyticsGetProfileAnalyticsResponse, AnalyticsGetProfilePostData, AnalyticsGetProfilePostResponse, AnalyticsGetProfilePostsData, AnalyticsGetProfilePostsResponse, ApiError, AppGetHealthResponse, BaseHttpRequest, Bundlesocial, CancelError, CancelablePromise, CommentCreateData, CommentCreateResponse, CommentDeleteData, CommentDeleteResponse, CommentGetData, CommentGetListData, CommentGetListResponse, CommentGetResponse, CommentUpdateData, CommentUpdateResponse, 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, UploadFinalizeLargeUploadData, UploadFinalizeLargeUploadResponse, UploadGetData, UploadGetListData, UploadGetListResponse, UploadGetResponse, UploadInitLargeUploadData, UploadInitLargeUploadResponse, WebhookEvent, WebhookEventType };
8560
+ export { $OpenApiTs, AnalyticsGetProfileAnalyticsData, AnalyticsGetProfileAnalyticsResponse, AnalyticsGetProfilePostData, AnalyticsGetProfilePostResponse, AnalyticsGetProfilePostsData, AnalyticsGetProfilePostsResponse, ApiError, AppGetHealthResponse, BaseHttpRequest, Bundlesocial, CancelError, CancelablePromise, CommentCreateData, CommentCreateResponse, CommentDeleteData, CommentDeleteResponse, CommentGetData, CommentGetListData, CommentGetListResponse, CommentGetResponse, CommentUpdateData, CommentUpdateResponse, OpenAPI, OpenAPIConfig, OrganizationGetOrganizationResponse, PostCreateData, PostCreateResponse, PostDeleteData, PostDeleteResponse, PostGetData, PostGetListData, PostGetListResponse, PostGetResponse, PostUpdateData, PostUpdateResponse, SocialAccountConnectData, SocialAccountConnectResponse, SocialAccountCopyData, SocialAccountCopyResponse, SocialAccountCreatePortalLinkData, SocialAccountCreatePortalLinkResponse, SocialAccountDisconnectData, SocialAccountDisconnectResponse, SocialAccountRefreshChannelsData, SocialAccountRefreshChannelsResponse, SocialAccountSetChannelData, SocialAccountSetChannelResponse, TeamCreateTeamData, TeamCreateTeamResponse, TeamDeleteTeamData, TeamDeleteTeamResponse, TeamGetTeamData, TeamGetTeamResponse, TeamUpdateTeamData, TeamUpdateTeamResponse, UploadCreateData, UploadCreateResponse, UploadDeleteData, UploadDeleteManyData, UploadDeleteManyResponse, UploadDeleteResponse, UploadFinalizeLargeUploadData, UploadFinalizeLargeUploadResponse, UploadGetData, UploadGetListData, UploadGetListResponse, UploadGetResponse, UploadInitLargeUploadData, UploadInitLargeUploadResponse, WebhookEvent, WebhookEventType };
package/dist/index.d.ts CHANGED
@@ -392,6 +392,7 @@ type TeamCreateTeamData = {
392
392
  requestBody?: {
393
393
  name: string;
394
394
  avatarUrl?: string | null;
395
+ copyTeamId?: string | null;
395
396
  };
396
397
  };
397
398
  type TeamCreateTeamResponse = {
@@ -498,7 +499,7 @@ type SocialAccountRefreshChannelsData = {
498
499
  * Body
499
500
  */
500
501
  requestBody?: {
501
- type: 'DISCORD' | 'SLACK' | 'REDDIT' | 'PINTEREST';
502
+ type: 'DISCORD' | 'SLACK' | 'REDDIT' | 'PINTEREST' | 'FACEBOOK' | 'INSTAGRAM' | 'LINKEDIN' | 'YOUTUBE';
502
503
  teamId: string;
503
504
  };
504
505
  };
@@ -543,6 +544,45 @@ type SocialAccountCreatePortalLinkData = {
543
544
  type SocialAccountCreatePortalLinkResponse = {
544
545
  url: string;
545
546
  };
547
+ type SocialAccountCopyData = {
548
+ /**
549
+ * Body
550
+ */
551
+ requestBody?: {
552
+ fromTeamId: string;
553
+ toTeamId: string;
554
+ /**
555
+ * If you set that to true, selected page will not be transferred automatically. The user will have to select the page themselves again. This only applies to Facebook, Instagram, Linkedin and Youtube.
556
+ */
557
+ resetChannel?: boolean;
558
+ socialAccountTypes: Array<('TIKTOK' | 'YOUTUBE' | 'INSTAGRAM' | 'FACEBOOK' | 'TWITTER' | 'THREADS' | 'LINKEDIN' | 'PINTEREST' | 'REDDIT' | 'MASTODON' | 'DISCORD' | 'SLACK')>;
559
+ };
560
+ };
561
+ type SocialAccountCopyResponse = Array<{
562
+ id: string;
563
+ type: 'TIKTOK' | 'YOUTUBE' | 'INSTAGRAM' | 'FACEBOOK' | 'TWITTER' | 'THREADS' | 'LINKEDIN' | 'PINTEREST' | 'REDDIT' | 'MASTODON' | 'DISCORD' | 'SLACK';
564
+ teamId: string;
565
+ username?: string | null;
566
+ displayName?: string | null;
567
+ externalId?: string | null;
568
+ userUsername?: string | null;
569
+ userDisplayName?: string | null;
570
+ userId?: string | null;
571
+ channels?: Array<{
572
+ id: string;
573
+ name?: string | null;
574
+ username?: string | null;
575
+ webhook?: {
576
+ id?: string | null;
577
+ name?: string | null;
578
+ avatar?: string | null;
579
+ url?: string | null;
580
+ } | null;
581
+ }> | null;
582
+ createdAt: string | null;
583
+ updatedAt: string | null;
584
+ deletedAt?: string | null;
585
+ }>;
546
586
  type UploadGetListData = {
547
587
  teamId?: string | null;
548
588
  };
@@ -4566,6 +4606,81 @@ type $OpenApiTs = {
4566
4606
  };
4567
4607
  };
4568
4608
  };
4609
+ '/api/v1/social-account/copy': {
4610
+ post: {
4611
+ req: SocialAccountCopyData;
4612
+ res: {
4613
+ /**
4614
+ * 200
4615
+ */
4616
+ 200: Array<{
4617
+ id: string;
4618
+ type: 'TIKTOK' | 'YOUTUBE' | 'INSTAGRAM' | 'FACEBOOK' | 'TWITTER' | 'THREADS' | 'LINKEDIN' | 'PINTEREST' | 'REDDIT' | 'MASTODON' | 'DISCORD' | 'SLACK';
4619
+ teamId: string;
4620
+ username?: string | null;
4621
+ displayName?: string | null;
4622
+ externalId?: string | null;
4623
+ userUsername?: string | null;
4624
+ userDisplayName?: string | null;
4625
+ userId?: string | null;
4626
+ channels?: Array<{
4627
+ id: string;
4628
+ name?: string | null;
4629
+ username?: string | null;
4630
+ webhook?: {
4631
+ id?: string | null;
4632
+ name?: string | null;
4633
+ avatar?: string | null;
4634
+ url?: string | null;
4635
+ } | null;
4636
+ }> | null;
4637
+ createdAt: string | null;
4638
+ updatedAt: string | null;
4639
+ deletedAt?: string | null;
4640
+ }>;
4641
+ /**
4642
+ * 400
4643
+ */
4644
+ 400: {
4645
+ message: string;
4646
+ issues?: Array<{
4647
+ message: string;
4648
+ path?: Array<(string | number)> | null;
4649
+ }> | null;
4650
+ };
4651
+ /**
4652
+ * 401
4653
+ */
4654
+ 401: {
4655
+ message: string;
4656
+ };
4657
+ /**
4658
+ * 403
4659
+ */
4660
+ 403: {
4661
+ message: string;
4662
+ };
4663
+ /**
4664
+ * 404
4665
+ */
4666
+ 404: {
4667
+ message: string;
4668
+ };
4669
+ /**
4670
+ * 429
4671
+ */
4672
+ 429: {
4673
+ message: string;
4674
+ };
4675
+ /**
4676
+ * 500
4677
+ */
4678
+ 500: {
4679
+ message: string;
4680
+ };
4681
+ };
4682
+ };
4683
+ };
4569
4684
  '/api/v1/upload/': {
4570
4685
  get: {
4571
4686
  req: UploadGetListData;
@@ -8175,6 +8290,14 @@ declare class SocialAccountService {
8175
8290
  * @throws ApiError
8176
8291
  */
8177
8292
  socialAccountCreatePortalLink(data?: SocialAccountCreatePortalLinkData): CancelablePromise<SocialAccountCreatePortalLinkResponse>;
8293
+ /**
8294
+ * Copy social accounts
8295
+ * @param data The data for the request.
8296
+ * @param data.requestBody Body
8297
+ * @returns unknown 200
8298
+ * @throws ApiError
8299
+ */
8300
+ socialAccountCopy(data?: SocialAccountCopyData): CancelablePromise<SocialAccountCopyResponse>;
8178
8301
  }
8179
8302
  declare class UploadService {
8180
8303
  readonly httpRequest: BaseHttpRequest;
@@ -8434,4 +8557,4 @@ declare class Bundlesocial extends Client {
8434
8557
  constructor(apiKey: string, options?: OpenAPIConfig);
8435
8558
  }
8436
8559
 
8437
- export { $OpenApiTs, AnalyticsGetProfileAnalyticsData, AnalyticsGetProfileAnalyticsResponse, AnalyticsGetProfilePostData, AnalyticsGetProfilePostResponse, AnalyticsGetProfilePostsData, AnalyticsGetProfilePostsResponse, ApiError, AppGetHealthResponse, BaseHttpRequest, Bundlesocial, CancelError, CancelablePromise, CommentCreateData, CommentCreateResponse, CommentDeleteData, CommentDeleteResponse, CommentGetData, CommentGetListData, CommentGetListResponse, CommentGetResponse, CommentUpdateData, CommentUpdateResponse, 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, UploadFinalizeLargeUploadData, UploadFinalizeLargeUploadResponse, UploadGetData, UploadGetListData, UploadGetListResponse, UploadGetResponse, UploadInitLargeUploadData, UploadInitLargeUploadResponse, WebhookEvent, WebhookEventType };
8560
+ export { $OpenApiTs, AnalyticsGetProfileAnalyticsData, AnalyticsGetProfileAnalyticsResponse, AnalyticsGetProfilePostData, AnalyticsGetProfilePostResponse, AnalyticsGetProfilePostsData, AnalyticsGetProfilePostsResponse, ApiError, AppGetHealthResponse, BaseHttpRequest, Bundlesocial, CancelError, CancelablePromise, CommentCreateData, CommentCreateResponse, CommentDeleteData, CommentDeleteResponse, CommentGetData, CommentGetListData, CommentGetListResponse, CommentGetResponse, CommentUpdateData, CommentUpdateResponse, OpenAPI, OpenAPIConfig, OrganizationGetOrganizationResponse, PostCreateData, PostCreateResponse, PostDeleteData, PostDeleteResponse, PostGetData, PostGetListData, PostGetListResponse, PostGetResponse, PostUpdateData, PostUpdateResponse, SocialAccountConnectData, SocialAccountConnectResponse, SocialAccountCopyData, SocialAccountCopyResponse, SocialAccountCreatePortalLinkData, SocialAccountCreatePortalLinkResponse, SocialAccountDisconnectData, SocialAccountDisconnectResponse, SocialAccountRefreshChannelsData, SocialAccountRefreshChannelsResponse, SocialAccountSetChannelData, SocialAccountSetChannelResponse, TeamCreateTeamData, TeamCreateTeamResponse, TeamDeleteTeamData, TeamDeleteTeamResponse, TeamGetTeamData, TeamGetTeamResponse, TeamUpdateTeamData, TeamUpdateTeamResponse, UploadCreateData, UploadCreateResponse, UploadDeleteData, UploadDeleteManyData, UploadDeleteManyResponse, UploadDeleteResponse, UploadFinalizeLargeUploadData, UploadFinalizeLargeUploadResponse, UploadGetData, UploadGetListData, UploadGetListResponse, UploadGetResponse, UploadInitLargeUploadData, UploadInitLargeUploadResponse, WebhookEvent, WebhookEventType };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var V=Object.create;var b=Object.defineProperty,J=Object.defineProperties,K=Object.getOwnPropertyDescriptor,Q=Object.getOwnPropertyDescriptors,X=Object.getOwnPropertyNames,B=Object.getOwnPropertySymbols,Y=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty,Z=Object.prototype.propertyIsEnumerable;var N=(t,e,s)=>e in t?b(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,u=(t,e)=>{for(var s in e||(e={}))k.call(e,s)&&N(t,s,e[s]);if(B)for(var s of B(e))Z.call(e,s)&&N(t,s,e[s]);return t},T=(t,e)=>J(t,Q(e));var ee=(t,e)=>{for(var s in e)b(t,s,{get:e[s],enumerable:!0})},z=(t,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of X(e))!k.call(t,o)&&o!==s&&b(t,o,{get:()=>e[o],enumerable:!(r=K(e,o))||r.enumerable});return t};var te=(t,e,s)=>(s=t!=null?V(Y(t)):{},z(e||!t||!t.__esModule?b(s,"default",{value:t,enumerable:!0}):s,t)),se=t=>z(b({},"__esModule",{value:!0}),t);var h=(t,e,s)=>new Promise((r,o)=>{var a=l=>{try{n(s.next(l))}catch(p){o(p)}},i=l=>{try{n(s.throw(l))}catch(p){o(p)}},n=l=>l.done?r(l.value):Promise.resolve(l.value).then(a,i);n((s=s.apply(t,e)).next())});var me={};ee(me,{ApiError:()=>c,BaseHttpRequest:()=>m,Bundlesocial:()=>_,CancelError:()=>y,CancelablePromise:()=>R,OpenAPI:()=>P});module.exports=se(me);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]}},P={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 y=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=n=>{this._isResolved||this._isRejected||this._isCancelled||(this._isResolved=!0,this._resolve&&this._resolve(n))},a=n=>{this._isResolved||this._isRejected||this._isCancelled||(this._isRejected=!0,this._reject&&this._reject(n))},i=n=>{this._isResolved||this._isRejected||this._isCancelled||this.cancelHandlers.push(n)};return Object.defineProperty(i,"isResolved",{get:()=>this._isResolved}),Object.defineProperty(i,"isRejected",{get:()=>this._isRejected}),Object.defineProperty(i,"isCancelled",{get:()=>this._isCancelled}),e(o,a,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 f=t=>typeof t=="string",w=t=>f(t)&&t!=="",H=t=>t instanceof Blob,F=t=>t instanceof FormData,re=t=>{try{return btoa(t)}catch(e){return Buffer.from(t).toString("base64")}},oe=t=>{let e=[],s=(o,a)=>{e.push(`${encodeURIComponent(o)}=${encodeURIComponent(String(a))}`)},r=(o,a)=>{a!=null&&(a instanceof Date?s(o,a.toISOString()):Array.isArray(a)?a.forEach(i=>r(o,i)):typeof a=="object"?Object.entries(a).forEach(([i,n])=>r(`${o}[${i}]`,n)):s(o,a))};return Object.entries(t).forEach(([o,a])=>r(o,a)),e.length?`?${e.join("&")}`:""},ae=(t,e)=>{let s=t.ENCODE_PATH||encodeURI,r=e.url.replace("{api-version}",t.VERSION).replace(/{(.*?)}/g,(a,i)=>{var n;return(n=e.path)!=null&&n.hasOwnProperty(i)?s(String(e.path[i])):a}),o=t.BASE+r;return e.query?o+oe(e.query):o},ne=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(a=>s(r,a)):s(r,o)}),e}},A=(t,e)=>h(void 0,null,function*(){return typeof e=="function"?e(t):e}),ie=(t,e)=>h(void 0,null,function*(){let[s,r,o,a]=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"},a),e.headers)).filter(([,n])=>n!=null).reduce((n,[l,p])=>T(u({},n),{[l]:String(p)}),{});if(w(s)&&(i.Authorization=`Bearer ${s}`),w(r)&&w(o)){let n=re(`${r}:${o}`);i.Authorization=`Basic ${n}`}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":F(e.body)||(i["Content-Type"]="application/json")),new Headers(i)}),le=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)||F(t.body)?t.body:JSON.stringify(t.body)},pe=(t,e,s,r,o,a,i)=>h(void 0,null,function*(){let n=new AbortController,l={headers:a,body:r!=null?r:o,method:e.method,signal:n.signal};t.WITH_CREDENTIALS&&(l.credentials=t.CREDENTIALS);for(let p of t.interceptors.request._fns)l=yield p(l);return i(()=>n.abort()),yield fetch(s,l)}),ue=(t,e)=>{if(e){let s=t.headers.get(e);if(f(s))return s}},ce=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)}}),de=(t,e)=>{var o,a;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",n=(a=e.statusText)!=null?a:"unknown",l=(()=>{try{return JSON.stringify(e.body,null,2)}catch(p){return}})();throw new c(t,e,`Generic Error: status: ${i}; status text: ${n}; body: ${l}`)}},M=(t,e)=>new R((s,r,o)=>h(void 0,null,function*(){try{let a=ae(t,e),i=ne(e),n=le(e),l=yield ie(t,e);if(!o.isCancelled){let p=yield pe(t,e,a,n,i,l,o);for(let $ of t.interceptors.response._fns)p=yield $(p);let q=yield ce(p),U=ue(p,e.responseHeader),j={url:a,ok:p.ok,status:p.status,statusText:p.statusText,body:U!=null?U:q};de(e,j),s(j.body)}}catch(a){r(a)}}));var D=class extends m{constructor(e){super(e)}request(e){return M(this.config,e)}};var E=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"}})}},g=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"}})}uploadInitLargeUpload(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/upload/init",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}uploadFinalizeLargeUpload(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/upload/finalize",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}},G=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"}})}},I=class{constructor(e){this.httpRequest=e}analyticsGetProfileAnalytics(e){return this.httpRequest.request({method:"GET",url:"/api/v1/analytics/profile",query:{teamId:e.teamId,platformType:e.platformType},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}analyticsGetProfilePosts(e){return this.httpRequest.request({method:"GET",url:"/api/v1/analytics/profile-post",query:{teamId:e.teamId,platformType:e.platformType},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}analyticsGetProfilePost(e){return this.httpRequest.request({method:"GET",url:"/api/v1/analytics/profile-post/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}},x=class{constructor(e){this.httpRequest=e}commentGet(e){return this.httpRequest.request({method:"GET",url:"/api/v1/comment/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}commentUpdate(e){return this.httpRequest.request({method:"PATCH",url:"/api/v1/comment/{id}",path:{id:e.id},body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}commentDelete(e){return this.httpRequest.request({method:"DELETE",url:"/api/v1/comment/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}commentGetList(e){return this.httpRequest.request({method:"GET",url:"/api/v1/comment/",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"}})}commentCreate(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/comment/",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}};var C=class{constructor(e,s=D){var r,o,a,i,n,l,p,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:(a=e==null?void 0:e.WITH_CREDENTIALS)!=null?a:!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:(l=(n=e==null?void 0:e.interceptors)==null?void 0:n.request)!=null?l:new d,response:(q=(p=e==null?void 0:e.interceptors)==null?void 0:p.response)!=null?q:new d}}),this.analytics=new I(this.request),this.app=new E(this.request),this.comment=new x(this.request),this.organization=new S(this.request),this.post=new G(this.request),this.socialAccount=new v(this.request),this.team=new O(this.request),this.upload=new g(this.request)}};var W=te(require("crypto"));var L=class{constructor(){}verifySignature(e,s,r){return W.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)}},_=class extends C{constructor(s,r){super(T(u({},r),{HEADERS:T(u(u({},P.HEADERS),r==null?void 0:r.HEADERS),{"x-api-key":s})}));this.webhooks=new L}};0&&(module.exports={ApiError,BaseHttpRequest,Bundlesocial,CancelError,CancelablePromise,OpenAPI});
1
+ "use strict";var V=Object.create;var b=Object.defineProperty,J=Object.defineProperties,K=Object.getOwnPropertyDescriptor,Q=Object.getOwnPropertyDescriptors,X=Object.getOwnPropertyNames,B=Object.getOwnPropertySymbols,Y=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty,Z=Object.prototype.propertyIsEnumerable;var N=(t,e,s)=>e in t?b(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,u=(t,e)=>{for(var s in e||(e={}))k.call(e,s)&&N(t,s,e[s]);if(B)for(var s of B(e))Z.call(e,s)&&N(t,s,e[s]);return t},T=(t,e)=>J(t,Q(e));var ee=(t,e)=>{for(var s in e)b(t,s,{get:e[s],enumerable:!0})},z=(t,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of X(e))!k.call(t,o)&&o!==s&&b(t,o,{get:()=>e[o],enumerable:!(r=K(e,o))||r.enumerable});return t};var te=(t,e,s)=>(s=t!=null?V(Y(t)):{},z(e||!t||!t.__esModule?b(s,"default",{value:t,enumerable:!0}):s,t)),se=t=>z(b({},"__esModule",{value:!0}),t);var h=(t,e,s)=>new Promise((r,o)=>{var a=l=>{try{n(s.next(l))}catch(p){o(p)}},i=l=>{try{n(s.throw(l))}catch(p){o(p)}},n=l=>l.done?r(l.value):Promise.resolve(l.value).then(a,i);n((s=s.apply(t,e)).next())});var me={};ee(me,{ApiError:()=>c,BaseHttpRequest:()=>m,Bundlesocial:()=>_,CancelError:()=>y,CancelablePromise:()=>R,OpenAPI:()=>f});module.exports=se(me);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]}},f={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 y=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=n=>{this._isResolved||this._isRejected||this._isCancelled||(this._isResolved=!0,this._resolve&&this._resolve(n))},a=n=>{this._isResolved||this._isRejected||this._isCancelled||(this._isRejected=!0,this._reject&&this._reject(n))},i=n=>{this._isResolved||this._isRejected||this._isCancelled||this.cancelHandlers.push(n)};return Object.defineProperty(i,"isResolved",{get:()=>this._isResolved}),Object.defineProperty(i,"isRejected",{get:()=>this._isRejected}),Object.defineProperty(i,"isCancelled",{get:()=>this._isCancelled}),e(o,a,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 C=t=>typeof t=="string",w=t=>C(t)&&t!=="",H=t=>t instanceof Blob,F=t=>t instanceof FormData,re=t=>{try{return btoa(t)}catch(e){return Buffer.from(t).toString("base64")}},oe=t=>{let e=[],s=(o,a)=>{e.push(`${encodeURIComponent(o)}=${encodeURIComponent(String(a))}`)},r=(o,a)=>{a!=null&&(a instanceof Date?s(o,a.toISOString()):Array.isArray(a)?a.forEach(i=>r(o,i)):typeof a=="object"?Object.entries(a).forEach(([i,n])=>r(`${o}[${i}]`,n)):s(o,a))};return Object.entries(t).forEach(([o,a])=>r(o,a)),e.length?`?${e.join("&")}`:""},ae=(t,e)=>{let s=t.ENCODE_PATH||encodeURI,r=e.url.replace("{api-version}",t.VERSION).replace(/{(.*?)}/g,(a,i)=>{var n;return(n=e.path)!=null&&n.hasOwnProperty(i)?s(String(e.path[i])):a}),o=t.BASE+r;return e.query?o+oe(e.query):o},ne=t=>{if(t.formData){let e=new FormData,s=(r,o)=>{C(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(a=>s(r,a)):s(r,o)}),e}},A=(t,e)=>h(void 0,null,function*(){return typeof e=="function"?e(t):e}),ie=(t,e)=>h(void 0,null,function*(){let[s,r,o,a]=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"},a),e.headers)).filter(([,n])=>n!=null).reduce((n,[l,p])=>T(u({},n),{[l]:String(p)}),{});if(w(s)&&(i.Authorization=`Bearer ${s}`),w(r)&&w(o)){let n=re(`${r}:${o}`);i.Authorization=`Basic ${n}`}return e.body!==void 0&&(e.mediaType?i["Content-Type"]=e.mediaType:H(e.body)?i["Content-Type"]=e.body.type||"application/octet-stream":C(e.body)?i["Content-Type"]="text/plain":F(e.body)||(i["Content-Type"]="application/json")),new Headers(i)}),le=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):C(t.body)||H(t.body)||F(t.body)?t.body:JSON.stringify(t.body)},pe=(t,e,s,r,o,a,i)=>h(void 0,null,function*(){let n=new AbortController,l={headers:a,body:r!=null?r:o,method:e.method,signal:n.signal};t.WITH_CREDENTIALS&&(l.credentials=t.CREDENTIALS);for(let p of t.interceptors.request._fns)l=yield p(l);return i(()=>n.abort()),yield fetch(s,l)}),ue=(t,e)=>{if(e){let s=t.headers.get(e);if(C(s))return s}},ce=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)}}),de=(t,e)=>{var o,a;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",n=(a=e.statusText)!=null?a:"unknown",l=(()=>{try{return JSON.stringify(e.body,null,2)}catch(p){return}})();throw new c(t,e,`Generic Error: status: ${i}; status text: ${n}; body: ${l}`)}},M=(t,e)=>new R((s,r,o)=>h(void 0,null,function*(){try{let a=ae(t,e),i=ne(e),n=le(e),l=yield ie(t,e);if(!o.isCancelled){let p=yield pe(t,e,a,n,i,l,o);for(let $ of t.interceptors.response._fns)p=yield $(p);let P=yield ce(p),U=ue(p,e.responseHeader),j={url:a,ok:p.ok,status:p.status,statusText:p.statusText,body:U!=null?U:P};de(e,j),s(j.body)}}catch(a){r(a)}}));var D=class extends m{constructor(e){super(e)}request(e){return M(this.config,e)}};var E=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"}})}socialAccountCopy(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/social-account/copy",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}},g=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"}})}uploadInitLargeUpload(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/upload/init",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}uploadFinalizeLargeUpload(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/upload/finalize",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}},G=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"}})}},I=class{constructor(e){this.httpRequest=e}analyticsGetProfileAnalytics(e){return this.httpRequest.request({method:"GET",url:"/api/v1/analytics/profile",query:{teamId:e.teamId,platformType:e.platformType},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}analyticsGetProfilePosts(e){return this.httpRequest.request({method:"GET",url:"/api/v1/analytics/profile-post",query:{teamId:e.teamId,platformType:e.platformType},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}analyticsGetProfilePost(e){return this.httpRequest.request({method:"GET",url:"/api/v1/analytics/profile-post/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}},x=class{constructor(e){this.httpRequest=e}commentGet(e){return this.httpRequest.request({method:"GET",url:"/api/v1/comment/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}commentUpdate(e){return this.httpRequest.request({method:"PATCH",url:"/api/v1/comment/{id}",path:{id:e.id},body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}commentDelete(e){return this.httpRequest.request({method:"DELETE",url:"/api/v1/comment/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}commentGetList(e){return this.httpRequest.request({method:"GET",url:"/api/v1/comment/",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"}})}commentCreate(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/comment/",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=D){var r,o,a,i,n,l,p,P;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:(a=e==null?void 0:e.WITH_CREDENTIALS)!=null?a:!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:(l=(n=e==null?void 0:e.interceptors)==null?void 0:n.request)!=null?l:new d,response:(P=(p=e==null?void 0:e.interceptors)==null?void 0:p.response)!=null?P:new d}}),this.analytics=new I(this.request),this.app=new E(this.request),this.comment=new x(this.request),this.organization=new S(this.request),this.post=new G(this.request),this.socialAccount=new v(this.request),this.team=new O(this.request),this.upload=new g(this.request)}};var W=te(require("crypto"));var L=class{constructor(){}verifySignature(e,s,r){return W.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)}},_=class extends q{constructor(s,r){super(T(u({},r),{HEADERS:T(u(u({},f.HEADERS),r==null?void 0:r.HEADERS),{"x-api-key":s})}));this.webhooks=new L}};0&&(module.exports={ApiError,BaseHttpRequest,Bundlesocial,CancelError,CancelablePromise,OpenAPI});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- var F=Object.defineProperty,M=Object.defineProperties;var W=Object.getOwnPropertyDescriptors;var _=Object.getOwnPropertySymbols;var $=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable;var j=(t,e,s)=>e in t?F(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,u=(t,e)=>{for(var s in e||(e={}))$.call(e,s)&&j(t,s,e[s]);if(_)for(var s of _(e))V.call(e,s)&&j(t,s,e[s]);return t},y=(t,e)=>M(t,W(e));var m=(t,e,s)=>new Promise((r,o)=>{var a=l=>{try{n(s.next(l))}catch(p){o(p)}},i=l=>{try{n(s.throw(l))}catch(p){o(p)}},n=l=>l.done?r(l.value):Promise.resolve(l.value).then(a,i);n((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]}},x={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 b=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=n=>{this._isResolved||this._isRejected||this._isCancelled||(this._isResolved=!0,this._resolve&&this._resolve(n))},a=n=>{this._isResolved||this._isRejected||this._isCancelled||(this._isRejected=!0,this._reject&&this._reject(n))},i=n=>{this._isResolved||this._isRejected||this._isCancelled||this.cancelHandlers.push(n)};return Object.defineProperty(i,"isResolved",{get:()=>this._isResolved}),Object.defineProperty(i,"isRejected",{get:()=>this._isRejected}),Object.defineProperty(i,"isCancelled",{get:()=>this._isCancelled}),e(o,a,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 b("Request aborted"))}}get isCancelled(){return this._isCancelled}};var T=t=>typeof t=="string",U=t=>T(t)&&t!=="",w=t=>t instanceof Blob,B=t=>t instanceof FormData,J=t=>{try{return btoa(t)}catch(e){return Buffer.from(t).toString("base64")}},K=t=>{let e=[],s=(o,a)=>{e.push(`${encodeURIComponent(o)}=${encodeURIComponent(String(a))}`)},r=(o,a)=>{a!=null&&(a instanceof Date?s(o,a.toISOString()):Array.isArray(a)?a.forEach(i=>r(o,i)):typeof a=="object"?Object.entries(a).forEach(([i,n])=>r(`${o}[${i}]`,n)):s(o,a))};return Object.entries(t).forEach(([o,a])=>r(o,a)),e.length?`?${e.join("&")}`:""},Q=(t,e)=>{let s=t.ENCODE_PATH||encodeURI,r=e.url.replace("{api-version}",t.VERSION).replace(/{(.*?)}/g,(a,i)=>{var n;return(n=e.path)!=null&&n.hasOwnProperty(i)?s(String(e.path[i])):a}),o=t.BASE+r;return e.query?o+K(e.query):o},X=t=>{if(t.formData){let e=new FormData,s=(r,o)=>{T(o)||w(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(a=>s(r,a)):s(r,o)}),e}},q=(t,e)=>m(void 0,null,function*(){return typeof e=="function"?e(t):e}),Y=(t,e)=>m(void 0,null,function*(){let[s,r,o,a]=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"},a),e.headers)).filter(([,n])=>n!=null).reduce((n,[l,p])=>y(u({},n),{[l]:String(p)}),{});if(U(s)&&(i.Authorization=`Bearer ${s}`),U(r)&&U(o)){let n=J(`${r}:${o}`);i.Authorization=`Basic ${n}`}return e.body!==void 0&&(e.mediaType?i["Content-Type"]=e.mediaType:w(e.body)?i["Content-Type"]=e.body.type||"application/octet-stream":T(e.body)?i["Content-Type"]="text/plain":B(e.body)||(i["Content-Type"]="application/json")),new Headers(i)}),Z=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):T(t.body)||w(t.body)||B(t.body)?t.body:JSON.stringify(t.body)},ee=(t,e,s,r,o,a,i)=>m(void 0,null,function*(){let n=new AbortController,l={headers:a,body:r!=null?r:o,method:e.method,signal:n.signal};t.WITH_CREDENTIALS&&(l.credentials=t.CREDENTIALS);for(let p of t.interceptors.request._fns)l=yield p(l);return i(()=>n.abort()),yield fetch(s,l)}),te=(t,e)=>{if(e){let s=t.headers.get(e);if(T(s))return s}},se=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)}}),re=(t,e)=>{var o,a;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",n=(a=e.statusText)!=null?a:"unknown",l=(()=>{try{return JSON.stringify(e.body,null,2)}catch(p){return}})();throw new d(t,e,`Generic Error: status: ${i}; status text: ${n}; body: ${l}`)}},N=(t,e)=>new h((s,r,o)=>m(void 0,null,function*(){try{let a=Q(t,e),i=X(e),n=Z(e),l=yield Y(t,e);if(!o.isCancelled){let p=yield ee(t,e,a,n,i,l,o);for(let z of t.interceptors.response._fns)p=yield z(p);let C=yield se(p),I=te(p,e.responseHeader),L={url:a,ok:p.ok,status:p.status,statusText:p.statusText,body:I!=null?I:C};re(e,L),s(L.body)}}catch(a){r(a)}}));var P=class extends R{constructor(e){super(e)}request(e){return N(this.config,e)}};var A=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"}})}},D=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"}})}},E=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"}})}uploadInitLargeUpload(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/upload/init",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}uploadFinalizeLargeUpload(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/upload/finalize",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}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"}})}},g=class{constructor(e){this.httpRequest=e}analyticsGetProfileAnalytics(e){return this.httpRequest.request({method:"GET",url:"/api/v1/analytics/profile",query:{teamId:e.teamId,platformType:e.platformType},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}analyticsGetProfilePosts(e){return this.httpRequest.request({method:"GET",url:"/api/v1/analytics/profile-post",query:{teamId:e.teamId,platformType:e.platformType},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}analyticsGetProfilePost(e){return this.httpRequest.request({method:"GET",url:"/api/v1/analytics/profile-post/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}},G=class{constructor(e){this.httpRequest=e}commentGet(e){return this.httpRequest.request({method:"GET",url:"/api/v1/comment/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}commentUpdate(e){return this.httpRequest.request({method:"PATCH",url:"/api/v1/comment/{id}",path:{id:e.id},body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}commentDelete(e){return this.httpRequest.request({method:"DELETE",url:"/api/v1/comment/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}commentGetList(e){return this.httpRequest.request({method:"GET",url:"/api/v1/comment/",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"}})}commentCreate(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/comment/",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=P){var r,o,a,i,n,l,p,C;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:(a=e==null?void 0:e.WITH_CREDENTIALS)!=null?a:!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:(l=(n=e==null?void 0:e.interceptors)==null?void 0:n.request)!=null?l:new c,response:(C=(p=e==null?void 0:e.interceptors)==null?void 0:p.response)!=null?C:new c}}),this.analytics=new g(this.request),this.app=new A(this.request),this.comment=new G(this.request),this.organization=new D(this.request),this.post=new v(this.request),this.socialAccount=new S(this.request),this.team=new E(this.request),this.upload=new O(this.request)}};import oe from"crypto";var H=class{constructor(){}verifySignature(e,s,r){return oe.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)}},k=class extends f{constructor(s,r){super(y(u({},r),{HEADERS:y(u(u({},x.HEADERS),r==null?void 0:r.HEADERS),{"x-api-key":s})}));this.webhooks=new H}};export{d as ApiError,R as BaseHttpRequest,k as Bundlesocial,b as CancelError,h as CancelablePromise,x as OpenAPI};
1
+ var F=Object.defineProperty,M=Object.defineProperties;var W=Object.getOwnPropertyDescriptors;var _=Object.getOwnPropertySymbols;var $=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable;var j=(t,e,s)=>e in t?F(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,u=(t,e)=>{for(var s in e||(e={}))$.call(e,s)&&j(t,s,e[s]);if(_)for(var s of _(e))V.call(e,s)&&j(t,s,e[s]);return t},y=(t,e)=>M(t,W(e));var m=(t,e,s)=>new Promise((r,o)=>{var a=l=>{try{n(s.next(l))}catch(p){o(p)}},i=l=>{try{n(s.throw(l))}catch(p){o(p)}},n=l=>l.done?r(l.value):Promise.resolve(l.value).then(a,i);n((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]}},x={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 b=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=n=>{this._isResolved||this._isRejected||this._isCancelled||(this._isResolved=!0,this._resolve&&this._resolve(n))},a=n=>{this._isResolved||this._isRejected||this._isCancelled||(this._isRejected=!0,this._reject&&this._reject(n))},i=n=>{this._isResolved||this._isRejected||this._isCancelled||this.cancelHandlers.push(n)};return Object.defineProperty(i,"isResolved",{get:()=>this._isResolved}),Object.defineProperty(i,"isRejected",{get:()=>this._isRejected}),Object.defineProperty(i,"isCancelled",{get:()=>this._isCancelled}),e(o,a,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 b("Request aborted"))}}get isCancelled(){return this._isCancelled}};var T=t=>typeof t=="string",U=t=>T(t)&&t!=="",w=t=>t instanceof Blob,B=t=>t instanceof FormData,J=t=>{try{return btoa(t)}catch(e){return Buffer.from(t).toString("base64")}},K=t=>{let e=[],s=(o,a)=>{e.push(`${encodeURIComponent(o)}=${encodeURIComponent(String(a))}`)},r=(o,a)=>{a!=null&&(a instanceof Date?s(o,a.toISOString()):Array.isArray(a)?a.forEach(i=>r(o,i)):typeof a=="object"?Object.entries(a).forEach(([i,n])=>r(`${o}[${i}]`,n)):s(o,a))};return Object.entries(t).forEach(([o,a])=>r(o,a)),e.length?`?${e.join("&")}`:""},Q=(t,e)=>{let s=t.ENCODE_PATH||encodeURI,r=e.url.replace("{api-version}",t.VERSION).replace(/{(.*?)}/g,(a,i)=>{var n;return(n=e.path)!=null&&n.hasOwnProperty(i)?s(String(e.path[i])):a}),o=t.BASE+r;return e.query?o+K(e.query):o},X=t=>{if(t.formData){let e=new FormData,s=(r,o)=>{T(o)||w(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(a=>s(r,a)):s(r,o)}),e}},P=(t,e)=>m(void 0,null,function*(){return typeof e=="function"?e(t):e}),Y=(t,e)=>m(void 0,null,function*(){let[s,r,o,a]=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"},a),e.headers)).filter(([,n])=>n!=null).reduce((n,[l,p])=>y(u({},n),{[l]:String(p)}),{});if(U(s)&&(i.Authorization=`Bearer ${s}`),U(r)&&U(o)){let n=J(`${r}:${o}`);i.Authorization=`Basic ${n}`}return e.body!==void 0&&(e.mediaType?i["Content-Type"]=e.mediaType:w(e.body)?i["Content-Type"]=e.body.type||"application/octet-stream":T(e.body)?i["Content-Type"]="text/plain":B(e.body)||(i["Content-Type"]="application/json")),new Headers(i)}),Z=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):T(t.body)||w(t.body)||B(t.body)?t.body:JSON.stringify(t.body)},ee=(t,e,s,r,o,a,i)=>m(void 0,null,function*(){let n=new AbortController,l={headers:a,body:r!=null?r:o,method:e.method,signal:n.signal};t.WITH_CREDENTIALS&&(l.credentials=t.CREDENTIALS);for(let p of t.interceptors.request._fns)l=yield p(l);return i(()=>n.abort()),yield fetch(s,l)}),te=(t,e)=>{if(e){let s=t.headers.get(e);if(T(s))return s}},se=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)}}),re=(t,e)=>{var o,a;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",n=(a=e.statusText)!=null?a:"unknown",l=(()=>{try{return JSON.stringify(e.body,null,2)}catch(p){return}})();throw new d(t,e,`Generic Error: status: ${i}; status text: ${n}; body: ${l}`)}},N=(t,e)=>new h((s,r,o)=>m(void 0,null,function*(){try{let a=Q(t,e),i=X(e),n=Z(e),l=yield Y(t,e);if(!o.isCancelled){let p=yield ee(t,e,a,n,i,l,o);for(let z of t.interceptors.response._fns)p=yield z(p);let q=yield se(p),I=te(p,e.responseHeader),L={url:a,ok:p.ok,status:p.status,statusText:p.statusText,body:I!=null?I:q};re(e,L),s(L.body)}}catch(a){r(a)}}));var f=class extends R{constructor(e){super(e)}request(e){return N(this.config,e)}};var A=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"}})}},D=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"}})}},E=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"}})}socialAccountCopy(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/social-account/copy",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"}})}uploadInitLargeUpload(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/upload/init",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}uploadFinalizeLargeUpload(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/upload/finalize",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}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"}})}},g=class{constructor(e){this.httpRequest=e}analyticsGetProfileAnalytics(e){return this.httpRequest.request({method:"GET",url:"/api/v1/analytics/profile",query:{teamId:e.teamId,platformType:e.platformType},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}analyticsGetProfilePosts(e){return this.httpRequest.request({method:"GET",url:"/api/v1/analytics/profile-post",query:{teamId:e.teamId,platformType:e.platformType},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}analyticsGetProfilePost(e){return this.httpRequest.request({method:"GET",url:"/api/v1/analytics/profile-post/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}},G=class{constructor(e){this.httpRequest=e}commentGet(e){return this.httpRequest.request({method:"GET",url:"/api/v1/comment/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}commentUpdate(e){return this.httpRequest.request({method:"PATCH",url:"/api/v1/comment/{id}",path:{id:e.id},body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}commentDelete(e){return this.httpRequest.request({method:"DELETE",url:"/api/v1/comment/{id}",path:{id:e.id},errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}commentGetList(e){return this.httpRequest.request({method:"GET",url:"/api/v1/comment/",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"}})}commentCreate(e={}){return this.httpRequest.request({method:"POST",url:"/api/v1/comment/",body:e.requestBody,mediaType:"application/json",errors:{400:"400",401:"401",403:"403",404:"404",429:"429",500:"500"}})}};var C=class{constructor(e,s=f){var r,o,a,i,n,l,p,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:(a=e==null?void 0:e.WITH_CREDENTIALS)!=null?a:!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:(l=(n=e==null?void 0:e.interceptors)==null?void 0:n.request)!=null?l:new c,response:(q=(p=e==null?void 0:e.interceptors)==null?void 0:p.response)!=null?q:new c}}),this.analytics=new g(this.request),this.app=new A(this.request),this.comment=new G(this.request),this.organization=new D(this.request),this.post=new v(this.request),this.socialAccount=new S(this.request),this.team=new E(this.request),this.upload=new O(this.request)}};import oe from"crypto";var H=class{constructor(){}verifySignature(e,s,r){return oe.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)}},k=class extends C{constructor(s,r){super(y(u({},r),{HEADERS:y(u(u({},x.HEADERS),r==null?void 0:r.HEADERS),{"x-api-key":s})}));this.webhooks=new H}};export{d as ApiError,R as BaseHttpRequest,k as Bundlesocial,b as CancelError,h as CancelablePromise,x as OpenAPI};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bundlesocial",
3
- "version": "2.9.0",
3
+ "version": "2.10.0",
4
4
  "description": "Node.js library for the bundle.social API",
5
5
  "keywords": [
6
6
  "bundle.social",