bundlesocial 2.12.0 → 2.13.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 +254 -65
- package/dist/index.d.ts +254 -65
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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});
|
|
1
|
+
"use strict";var K=Object.create;var T=Object.defineProperty,V=Object.defineProperties,J=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?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)&&N(t,s,e[s]);if(B)for(var s of B(e))Z.call(e,s)&&N(t,s,e[s]);return t},b=(t,e)=>V(t,Q(e));var ee=(t,e)=>{for(var s in e)T(t,s,{get:e[s],enumerable:!0})},M=(t,e,s,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of X(e))!k.call(t,r)&&r!==s&&T(t,r,{get:()=>e[r],enumerable:!(o=J(e,r))||o.enumerable});return t};var te=(t,e,s)=>(s=t!=null?K(Y(t)):{},M(e||!t||!t.__esModule?T(s,"default",{value:t,enumerable:!0}):s,t)),se=t=>M(T({},"__esModule",{value:!0}),t);var h=(t,e,s)=>new Promise((o,r)=>{var a=p=>{try{n(s.next(p))}catch(l){r(l)}},i=p=>{try{n(s.throw(p))}catch(l){r(l)}},n=p=>p.done?o(p.value):Promise.resolve(p.value).then(a,i);n((s=s.apply(t,e)).next())});var Re={};ee(Re,{ApiError:()=>c,BaseHttpRequest:()=>m,Bundlesocial:()=>_,CancelError:()=>y,CancelablePromise:()=>R,OpenAPI:()=>P,webhookEventTypes:()=>me});module.exports=se(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]}},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,o,r){super(r);this.name="ApiError",this.url=o.url,this.status=o.status,this.statusText=o.statusText,this.body=o.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,o)=>{this._resolve=s,this._reject=o;let r=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(r,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,z=t=>t instanceof FormData,oe=t=>{try{return btoa(t)}catch(e){return Buffer.from(t).toString("base64")}},re=t=>{let e=[],s=(r,a)=>{e.push(`${encodeURIComponent(r)}=${encodeURIComponent(String(a))}`)},o=(r,a)=>{a!=null&&(a instanceof Date?s(r,a.toISOString()):Array.isArray(a)?a.forEach(i=>o(r,i)):typeof a=="object"?Object.entries(a).forEach(([i,n])=>o(`${r}[${i}]`,n)):s(r,a))};return Object.entries(t).forEach(([r,a])=>o(r,a)),e.length?`?${e.join("&")}`:""},ae=(t,e)=>{let s=t.ENCODE_PATH||encodeURI,o=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}),r=t.BASE+o;return e.query?r+re(e.query):r},ne=t=>{if(t.formData){let e=new FormData,s=(o,r)=>{C(r)||H(r)?e.append(o,r):e.append(o,JSON.stringify(r))};return Object.entries(t.formData).filter(([,o])=>o!=null).forEach(([o,r])=>{Array.isArray(r)?r.forEach(a=>s(o,a)):s(o,r)}),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,o,r,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,[p,l])=>b(u({},n),{[p]:String(l)}),{});if(w(s)&&(i.Authorization=`Bearer ${s}`),w(o)&&w(r)){let n=oe(`${o}:${r}`);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":z(e.body)||(i["Content-Type"]="application/json")),new Headers(i)}),pe=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)||z(t.body)?t.body:JSON.stringify(t.body)},le=(t,e,s,o,r,a,i)=>h(void 0,null,function*(){let n=new AbortController,p={headers:a,body:o!=null?o:r,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)}),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(o=>e.includes(o)))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 r,a;let o=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(o)throw new c(t,e,o);if(!e.ok){let i=(r=e.status)!=null?r:"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,o,r)=>h(void 0,null,function*(){try{let a=ae(t,e),i=ne(e),n=pe(e),p=yield ie(t,e);if(!r.isCancelled){let l=yield le(t,e,a,n,i,p,r);for(let $ of t.interceptors.response._fns)l=yield $(l);let q=yield ce(l),U=ue(l,e.responseHeader),j={url:a,ok:l.ok,status:l.status,statusText:l.statusText,body:U!=null?U:q};de(e,j),s(j.body)}}catch(a){o(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"}})}},G=class{constructor(e){this.httpRequest=e}uploadGetList(e={}){return this.httpRequest.request({method:"GET",url:"/api/v1/upload/",query:{teamId:e.teamId,type:e.type},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 f=class{constructor(e,s=D){var o,r,a,i,n,p,l,q;this.request=new s({BASE:(o=e==null?void 0:e.BASE)!=null?o:"https://api.bundle.social",VERSION:(r=e==null?void 0:e.VERSION)!=null?r:"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:(q=(l=e==null?void 0:e.interceptors)==null?void 0:l.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 me=["post.published","comment.published","team.created","team.updated","team.deleted","social-account.created","social-account.updated","social-account.deleted"],L=class{constructor(){}verifySignature(e,s,o){return W.default.createHmac("sha256",o).update(e).digest("hex")===s}constructEvent(e,s,o){let r=typeof e=="string"?e:JSON.stringify(e);if(!this.verifySignature(r,s,o))throw new Error("Invalid signature");return JSON.parse(r)}},_=class extends f{constructor(s,o){super(b(u({},o),{HEADERS:b(u(u({},P.HEADERS),o==null?void 0:o.HEADERS),{"x-api-key":s})}));this.webhooks=new L}};0&&(module.exports={ApiError,BaseHttpRequest,Bundlesocial,CancelError,CancelablePromise,OpenAPI,webhookEventTypes});
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
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};
|
|
1
|
+
var z=Object.defineProperty,F=Object.defineProperties;var W=Object.getOwnPropertyDescriptors;var _=Object.getOwnPropertySymbols;var $=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable;var j=(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)&&j(t,s,e[s]);if(_)for(var s of _(e))K.call(e,s)&&j(t,s,e[s]);return t},y=(t,e)=>F(t,W(e));var m=(t,e,s)=>new Promise((o,r)=>{var a=p=>{try{n(s.next(p))}catch(l){r(l)}},i=p=>{try{n(s.throw(p))}catch(l){r(l)}},n=p=>p.done?o(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]}},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,o,r){super(r);this.name="ApiError",this.url=o.url,this.status=o.status,this.statusText=o.statusText,this.body=o.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,o)=>{this._resolve=s,this._reject=o;let r=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(r,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 b=t=>typeof t=="string",U=t=>b(t)&&t!=="",w=t=>t instanceof Blob,B=t=>t instanceof FormData,V=t=>{try{return btoa(t)}catch(e){return Buffer.from(t).toString("base64")}},J=t=>{let e=[],s=(r,a)=>{e.push(`${encodeURIComponent(r)}=${encodeURIComponent(String(a))}`)},o=(r,a)=>{a!=null&&(a instanceof Date?s(r,a.toISOString()):Array.isArray(a)?a.forEach(i=>o(r,i)):typeof a=="object"?Object.entries(a).forEach(([i,n])=>o(`${r}[${i}]`,n)):s(r,a))};return Object.entries(t).forEach(([r,a])=>o(r,a)),e.length?`?${e.join("&")}`:""},Q=(t,e)=>{let s=t.ENCODE_PATH||encodeURI,o=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}),r=t.BASE+o;return e.query?r+J(e.query):r},X=t=>{if(t.formData){let e=new FormData,s=(o,r)=>{b(r)||w(r)?e.append(o,r):e.append(o,JSON.stringify(r))};return Object.entries(t.formData).filter(([,o])=>o!=null).forEach(([o,r])=>{Array.isArray(r)?r.forEach(a=>s(o,a)):s(o,r)}),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,o,r,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,[p,l])=>y(u({},n),{[p]:String(l)}),{});if(U(s)&&(i.Authorization=`Bearer ${s}`),U(o)&&U(r)){let n=V(`${o}:${r}`);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":b(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):b(t.body)||w(t.body)||B(t.body)?t.body:JSON.stringify(t.body)},ee=(t,e,s,o,r,a,i)=>m(void 0,null,function*(){let n=new AbortController,p={headers:a,body:o!=null?o:r,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(b(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(o=>e.includes(o)))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)}}),oe=(t,e)=>{var r,a;let o=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(o)throw new d(t,e,o);if(!e.ok){let i=(r=e.status)!=null?r:"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}`)}},N=(t,e)=>new h((s,o,r)=>m(void 0,null,function*(){try{let a=Q(t,e),i=X(e),n=Z(e),p=yield Y(t,e);if(!r.isCancelled){let l=yield ee(t,e,a,n,i,p,r);for(let M of t.interceptors.response._fns)l=yield M(l);let f=yield se(l),I=te(l,e.responseHeader),L={url:a,ok:l.ok,status:l.status,statusText:l.statusText,body:I!=null?I:f};oe(e,L),s(L.body)}}catch(a){o(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"}})}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,type:e.type},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=P){var o,r,a,i,n,p,l,f;this.request=new s({BASE:(o=e==null?void 0:e.BASE)!=null?o:"https://api.bundle.social",VERSION:(r=e==null?void 0:e.VERSION)!=null?r:"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:(f=(l=e==null?void 0:e.interceptors)==null?void 0:l.response)!=null?f: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 re from"crypto";var Me=["post.published","comment.published","team.created","team.updated","team.deleted","social-account.created","social-account.updated","social-account.deleted"],H=class{constructor(){}verifySignature(e,s,o){return re.createHmac("sha256",o).update(e).digest("hex")===s}constructEvent(e,s,o){let r=typeof e=="string"?e:JSON.stringify(e);if(!this.verifySignature(r,s,o))throw new Error("Invalid signature");return JSON.parse(r)}},k=class extends C{constructor(s,o){super(y(u({},o),{HEADERS:y(u(u({},x.HEADERS),o==null?void 0:o.HEADERS),{"x-api-key":s})}));this.webhooks=new H}};export{d as ApiError,R as BaseHttpRequest,k as Bundlesocial,T as CancelError,h as CancelablePromise,x as OpenAPI,Me as webhookEventTypes};
|