bundlesocial 2.11.0 → 2.12.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 +33 -3
- package/dist/index.d.ts +33 -3
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -8530,10 +8530,40 @@ declare class ApiError extends Error {
|
|
|
8530
8530
|
constructor(request: ApiRequestOptions, response: ApiResult, message: string);
|
|
8531
8531
|
}
|
|
8532
8532
|
|
|
8533
|
-
|
|
8533
|
+
declare enum WebhookEventEnum {
|
|
8534
|
+
POST_PUBLISHED = "post.published",
|
|
8535
|
+
COMMENT_PUBLISHED = "comment.published",
|
|
8536
|
+
TEAM_CREATED = "team.created",
|
|
8537
|
+
TEAM_UPDATED = "team.updated",
|
|
8538
|
+
TEAM_DELETED = "team.deleted",
|
|
8539
|
+
SOCIAL_ACCOUNT_CREATED = "social-account.created",
|
|
8540
|
+
SOCIAL_ACCOUNT_UPDATED = "social-account.updated",
|
|
8541
|
+
SOCIAL_ACCOUNT_DELETED = "social-account.deleted"
|
|
8542
|
+
}
|
|
8534
8543
|
type WebhookEvent = {
|
|
8535
|
-
type:
|
|
8544
|
+
type: WebhookEventEnum.POST_PUBLISHED;
|
|
8536
8545
|
data: PostGetResponse;
|
|
8546
|
+
} | {
|
|
8547
|
+
type: WebhookEventEnum.COMMENT_PUBLISHED;
|
|
8548
|
+
data: CommentGetResponse;
|
|
8549
|
+
} | {
|
|
8550
|
+
type: WebhookEventEnum.TEAM_CREATED;
|
|
8551
|
+
data: TeamGetTeamResponse;
|
|
8552
|
+
} | {
|
|
8553
|
+
type: WebhookEventEnum.TEAM_UPDATED;
|
|
8554
|
+
data: TeamGetTeamResponse;
|
|
8555
|
+
} | {
|
|
8556
|
+
type: WebhookEventEnum.TEAM_DELETED;
|
|
8557
|
+
data: TeamGetTeamResponse;
|
|
8558
|
+
} | {
|
|
8559
|
+
type: WebhookEventEnum.SOCIAL_ACCOUNT_CREATED;
|
|
8560
|
+
data: TeamGetTeamResponse['socialAccounts'][number];
|
|
8561
|
+
} | {
|
|
8562
|
+
type: WebhookEventEnum.SOCIAL_ACCOUNT_UPDATED;
|
|
8563
|
+
data: TeamGetTeamResponse['socialAccounts'][number];
|
|
8564
|
+
} | {
|
|
8565
|
+
type: WebhookEventEnum.SOCIAL_ACCOUNT_DELETED;
|
|
8566
|
+
data: TeamGetTeamResponse['socialAccounts'][number];
|
|
8537
8567
|
};
|
|
8538
8568
|
declare class Webhooks {
|
|
8539
8569
|
constructor();
|
|
@@ -8559,4 +8589,4 @@ declare class Bundlesocial extends Client {
|
|
|
8559
8589
|
constructor(apiKey: string, options?: OpenAPIConfig);
|
|
8560
8590
|
}
|
|
8561
8591
|
|
|
8562
|
-
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,
|
|
8592
|
+
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, WebhookEventEnum };
|
package/dist/index.d.ts
CHANGED
|
@@ -8530,10 +8530,40 @@ declare class ApiError extends Error {
|
|
|
8530
8530
|
constructor(request: ApiRequestOptions, response: ApiResult, message: string);
|
|
8531
8531
|
}
|
|
8532
8532
|
|
|
8533
|
-
|
|
8533
|
+
declare enum WebhookEventEnum {
|
|
8534
|
+
POST_PUBLISHED = "post.published",
|
|
8535
|
+
COMMENT_PUBLISHED = "comment.published",
|
|
8536
|
+
TEAM_CREATED = "team.created",
|
|
8537
|
+
TEAM_UPDATED = "team.updated",
|
|
8538
|
+
TEAM_DELETED = "team.deleted",
|
|
8539
|
+
SOCIAL_ACCOUNT_CREATED = "social-account.created",
|
|
8540
|
+
SOCIAL_ACCOUNT_UPDATED = "social-account.updated",
|
|
8541
|
+
SOCIAL_ACCOUNT_DELETED = "social-account.deleted"
|
|
8542
|
+
}
|
|
8534
8543
|
type WebhookEvent = {
|
|
8535
|
-
type:
|
|
8544
|
+
type: WebhookEventEnum.POST_PUBLISHED;
|
|
8536
8545
|
data: PostGetResponse;
|
|
8546
|
+
} | {
|
|
8547
|
+
type: WebhookEventEnum.COMMENT_PUBLISHED;
|
|
8548
|
+
data: CommentGetResponse;
|
|
8549
|
+
} | {
|
|
8550
|
+
type: WebhookEventEnum.TEAM_CREATED;
|
|
8551
|
+
data: TeamGetTeamResponse;
|
|
8552
|
+
} | {
|
|
8553
|
+
type: WebhookEventEnum.TEAM_UPDATED;
|
|
8554
|
+
data: TeamGetTeamResponse;
|
|
8555
|
+
} | {
|
|
8556
|
+
type: WebhookEventEnum.TEAM_DELETED;
|
|
8557
|
+
data: TeamGetTeamResponse;
|
|
8558
|
+
} | {
|
|
8559
|
+
type: WebhookEventEnum.SOCIAL_ACCOUNT_CREATED;
|
|
8560
|
+
data: TeamGetTeamResponse['socialAccounts'][number];
|
|
8561
|
+
} | {
|
|
8562
|
+
type: WebhookEventEnum.SOCIAL_ACCOUNT_UPDATED;
|
|
8563
|
+
data: TeamGetTeamResponse['socialAccounts'][number];
|
|
8564
|
+
} | {
|
|
8565
|
+
type: WebhookEventEnum.SOCIAL_ACCOUNT_DELETED;
|
|
8566
|
+
data: TeamGetTeamResponse['socialAccounts'][number];
|
|
8537
8567
|
};
|
|
8538
8568
|
declare class Webhooks {
|
|
8539
8569
|
constructor();
|
|
@@ -8559,4 +8589,4 @@ declare class Bundlesocial extends Client {
|
|
|
8559
8589
|
constructor(apiKey: string, options?: OpenAPIConfig);
|
|
8560
8590
|
}
|
|
8561
8591
|
|
|
8562
|
-
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,
|
|
8592
|
+
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, WebhookEventEnum };
|
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:()=>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});
|
|
1
|
+
"use strict";var J=Object.create;var T=Object.defineProperty,K=Object.defineProperties,Q=Object.getOwnPropertyDescriptor,X=Object.getOwnPropertyDescriptors,Y=Object.getOwnPropertyNames,N=Object.getOwnPropertySymbols,Z=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty,ee=Object.prototype.propertyIsEnumerable;var j=(t,e,s)=>e in t?T(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)&&j(t,s,e[s]);if(N)for(var s of N(e))ee.call(e,s)&&j(t,s,e[s]);return t},C=(t,e)=>K(t,X(e));var te=(t,e)=>{for(var s in e)T(t,s,{get:e[s],enumerable:!0})},M=(t,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Y(e))!k.call(t,o)&&o!==s&&T(t,o,{get:()=>e[o],enumerable:!(r=Q(e,o))||r.enumerable});return t};var se=(t,e,s)=>(s=t!=null?J(Z(t)):{},M(e||!t||!t.__esModule?T(s,"default",{value:t,enumerable:!0}):s,t)),re=t=>M(T({},"__esModule",{value:!0}),t);var h=(t,e,s)=>new Promise((r,o)=>{var a=p=>{try{n(s.next(p))}catch(l){o(l)}},i=p=>{try{n(s.throw(p))}catch(l){o(l)}},n=p=>p.done?r(p.value):Promise.resolve(p.value).then(a,i);n((s=s.apply(t,e)).next())});var Re={};te(Re,{ApiError:()=>c,BaseHttpRequest:()=>m,Bundlesocial:()=>H,CancelError:()=>y,CancelablePromise:()=>R,OpenAPI:()=>q,WebhookEventEnum:()=>$});module.exports=re(Re);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]}},q={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 b=t=>typeof t=="string",L=t=>b(t)&&t!=="",x=t=>t instanceof Blob,z=t=>t instanceof FormData,oe=t=>{try{return btoa(t)}catch(e){return Buffer.from(t).toString("base64")}},ae=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("&")}`:""},ne=(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+ae(e.query):o},ie=t=>{if(t.formData){let e=new FormData,s=(r,o)=>{b(o)||x(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}},f=(t,e)=>h(void 0,null,function*(){return typeof e=="function"?e(t):e}),pe=(t,e)=>h(void 0,null,function*(){let[s,r,o,a]=yield Promise.all([f(e,t.TOKEN),f(e,t.USERNAME),f(e,t.PASSWORD),f(e,t.HEADERS)]),i=Object.entries(u(u({Accept:"application/json"},a),e.headers)).filter(([,n])=>n!=null).reduce((n,[p,l])=>C(u({},n),{[p]:String(l)}),{});if(L(s)&&(i.Authorization=`Bearer ${s}`),L(r)&&L(o)){let n=oe(`${r}:${o}`);i.Authorization=`Basic ${n}`}return e.body!==void 0&&(e.mediaType?i["Content-Type"]=e.mediaType:x(e.body)?i["Content-Type"]=e.body.type||"application/octet-stream":b(e.body)?i["Content-Type"]="text/plain":z(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):b(t.body)||x(t.body)||z(t.body)?t.body:JSON.stringify(t.body)},ue=(t,e,s,r,o,a,i)=>h(void 0,null,function*(){let n=new AbortController,p={headers:a,body:r!=null?r:o,method:e.method,signal:n.signal};t.WITH_CREDENTIALS&&(p.credentials=t.CREDENTIALS);for(let l of t.interceptors.request._fns)p=yield l(p);return i(()=>n.abort()),yield fetch(s,p)}),ce=(t,e)=>{if(e){let s=t.headers.get(e);if(b(s))return s}},de=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)}}),me=(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",p=(()=>{try{return JSON.stringify(e.body,null,2)}catch(l){return}})();throw new c(t,e,`Generic Error: status: ${i}; status text: ${n}; body: ${p}`)}},F=(t,e)=>new R((s,r,o)=>h(void 0,null,function*(){try{let a=ne(t,e),i=ie(e),n=le(e),p=yield pe(t,e);if(!o.isCancelled){let l=yield ue(t,e,a,n,i,p,o);for(let V of t.interceptors.response._fns)l=yield V(l);let P=yield de(l),g=ce(l,e.responseHeader),B={url:a,ok:l.ok,status:l.status,statusText:l.statusText,body:g!=null?g:P};me(e,B),s(B.body)}}catch(a){r(a)}}));var D=class extends m{constructor(e){super(e)}request(e){return F(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"}})}},I=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"}})}},U=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"}})}},_=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 A=class{constructor(e,s=D){var r,o,a,i,n,p,l,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:(p=(n=e==null?void 0:e.interceptors)==null?void 0:n.request)!=null?p:new d,response:(P=(l=e==null?void 0:e.interceptors)==null?void 0:l.response)!=null?P:new d}}),this.analytics=new G(this.request),this.app=new E(this.request),this.comment=new _(this.request),this.organization=new S(this.request),this.post=new U(this.request),this.socialAccount=new v(this.request),this.team=new O(this.request),this.upload=new I(this.request)}};var W=se(require("crypto"));var $=(p=>(p.POST_PUBLISHED="post.published",p.COMMENT_PUBLISHED="comment.published",p.TEAM_CREATED="team.created",p.TEAM_UPDATED="team.updated",p.TEAM_DELETED="team.deleted",p.SOCIAL_ACCOUNT_CREATED="social-account.created",p.SOCIAL_ACCOUNT_UPDATED="social-account.updated",p.SOCIAL_ACCOUNT_DELETED="social-account.deleted",p))($||{}),w=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)}},H=class extends A{constructor(s,r){super(C(u({},r),{HEADERS:C(u(u({},q.HEADERS),r==null?void 0:r.HEADERS),{"x-api-key":s})}));this.webhooks=new w}};0&&(module.exports={ApiError,BaseHttpRequest,Bundlesocial,CancelError,CancelablePromise,OpenAPI,WebhookEventEnum});
|
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}},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};
|
|
1
|
+
var z=Object.defineProperty,F=Object.defineProperties;var W=Object.getOwnPropertyDescriptors;var H=Object.getOwnPropertySymbols;var $=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable;var B=(t,e,s)=>e in t?z(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)&&B(t,s,e[s]);if(H)for(var s of H(e))V.call(e,s)&&B(t,s,e[s]);return t},y=(t,e)=>F(t,W(e));var m=(t,e,s)=>new Promise((r,o)=>{var a=p=>{try{n(s.next(p))}catch(l){o(l)}},i=p=>{try{n(s.throw(p))}catch(l){o(l)}},n=p=>p.done?r(p.value):Promise.resolve(p.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]}},_={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 T=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 T("Request aborted"))}}get isCancelled(){return this._isCancelled}};var C=t=>typeof t=="string",g=t=>C(t)&&t!=="",L=t=>t instanceof Blob,N=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)=>{C(o)||L(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,[p,l])=>y(u({},n),{[p]:String(l)}),{});if(g(s)&&(i.Authorization=`Bearer ${s}`),g(r)&&g(o)){let n=J(`${r}:${o}`);i.Authorization=`Basic ${n}`}return e.body!==void 0&&(e.mediaType?i["Content-Type"]=e.mediaType:L(e.body)?i["Content-Type"]=e.body.type||"application/octet-stream":C(e.body)?i["Content-Type"]="text/plain":N(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):C(t.body)||L(t.body)||N(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,p={headers:a,body:r!=null?r:o,method:e.method,signal:n.signal};t.WITH_CREDENTIALS&&(p.credentials=t.CREDENTIALS);for(let l of t.interceptors.request._fns)p=yield l(p);return i(()=>n.abort()),yield fetch(s,p)}),te=(t,e)=>{if(e){let s=t.headers.get(e);if(C(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",p=(()=>{try{return JSON.stringify(e.body,null,2)}catch(l){return}})();throw new d(t,e,`Generic Error: status: ${i}; status text: ${n}; body: ${p}`)}},j=(t,e)=>new h((s,r,o)=>m(void 0,null,function*(){try{let a=Q(t,e),i=X(e),n=Z(e),p=yield Y(t,e);if(!o.isCancelled){let l=yield ee(t,e,a,n,i,p,o);for(let M of t.interceptors.response._fns)l=yield M(l);let A=yield se(l),G=te(l,e.responseHeader),w={url:a,ok:l.ok,status:l.status,statusText:l.statusText,body:G!=null?G:A};re(e,w),s(w.body)}}catch(a){r(a)}}));var q=class extends R{constructor(e){super(e)}request(e){return j(this.config,e)}};var f=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"}})}},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"}})}},U=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 b=class{constructor(e,s=q){var r,o,a,i,n,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:(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:(p=(n=e==null?void 0:e.interceptors)==null?void 0:n.request)!=null?p:new c,response:(A=(l=e==null?void 0:e.interceptors)==null?void 0:l.response)!=null?A:new c}}),this.analytics=new I(this.request),this.app=new f(this.request),this.comment=new U(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 ae=(p=>(p.POST_PUBLISHED="post.published",p.COMMENT_PUBLISHED="comment.published",p.TEAM_CREATED="team.created",p.TEAM_UPDATED="team.updated",p.TEAM_DELETED="team.deleted",p.SOCIAL_ACCOUNT_CREATED="social-account.created",p.SOCIAL_ACCOUNT_UPDATED="social-account.updated",p.SOCIAL_ACCOUNT_DELETED="social-account.deleted",p))(ae||{}),x=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 b{constructor(s,r){super(y(u({},r),{HEADERS:y(u(u({},_.HEADERS),r==null?void 0:r.HEADERS),{"x-api-key":s})}));this.webhooks=new x}};export{d as ApiError,R as BaseHttpRequest,k as Bundlesocial,T as CancelError,h as CancelablePromise,_ as OpenAPI,ae as WebhookEventEnum};
|