@great-detail/support-sdk 0.17.1 → 0.17.2
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/{Client-BobTSG8s.d.cts → Client-B1Z3ldbE.d.cts} +1 -1
- package/dist/{Client-BobTSG8s.d.ts → Client-B1Z3ldbE.d.ts} +1 -1
- package/dist/{chunk-O4VU5LNU.js → chunk-5YOY53RX.js} +1 -1
- package/dist/{chunk-BMWOMVWD.js → chunk-BF7QHNJE.js} +1 -1
- package/dist/cli/index.cjs +1 -1
- package/dist/cli/index.d.cts +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -2988,7 +2988,7 @@ declare class WebhookSubscriptionAPI {
|
|
|
2988
2988
|
response: () => Promise<ky.KyResponse<ListWebhookSubscriptionsResponse>>;
|
|
2989
2989
|
json: () => Promise<ListWebhookSubscriptionsResponse>;
|
|
2990
2990
|
};
|
|
2991
|
-
test(id: WebhookSubscriptionID, { request }
|
|
2991
|
+
test(id: WebhookSubscriptionID, { request }?: TestWebhookSubscriptionOptions): {
|
|
2992
2992
|
response: () => Promise<ky.KyResponse<TestWebhookSubscriptionResponse>>;
|
|
2993
2993
|
json: () => Promise<TestWebhookSubscriptionResponse>;
|
|
2994
2994
|
};
|
|
@@ -2988,7 +2988,7 @@ declare class WebhookSubscriptionAPI {
|
|
|
2988
2988
|
response: () => Promise<ky.KyResponse<ListWebhookSubscriptionsResponse>>;
|
|
2989
2989
|
json: () => Promise<ListWebhookSubscriptionsResponse>;
|
|
2990
2990
|
};
|
|
2991
|
-
test(id: WebhookSubscriptionID, { request }
|
|
2991
|
+
test(id: WebhookSubscriptionID, { request }?: TestWebhookSubscriptionOptions): {
|
|
2992
2992
|
response: () => Promise<ky.KyResponse<TestWebhookSubscriptionResponse>>;
|
|
2993
2993
|
json: () => Promise<TestWebhookSubscriptionResponse>;
|
|
2994
2994
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var J=Object.defineProperty;var et=(n,t)=>{for(var e in t)J(n,e,{get:t[e],enumerable:!0})};var d=class{getHeaders(){return{}}};var j="SUPPORT_ACCESS_TOKEN",q="SUPPORT_KEY_NAME",H="SUPPORT_KEY_PASSWORD",W="SUPPORT_SIGNING_KEY",V="SUPPORT_BASE_URL";var u=class{name;#t;constructor({name:t=process.env[q],password:e=process.env[H]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var h=class{#t;constructor({token:t=process.env[j]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var K="https://api.support.greatdetail.com",Y={"X-Powered-By":"GDSupport/JavaScript"};import{z as a}from"zod";var z=a.object({data:a.object({event:a.object({id:a.string(),type:a.string(),payload:a.record(a.string()),createdAt:a.string().datetime()})})});var C=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}getCurrent({request:t={}}){return this._transport.send("v1/accounts/current",{...t,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/accounts",{...e,method:"POST",json:t})}};var f=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}delete(t,e,{body:o,request:s={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...s,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var R=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var b=class{constructor(t){this._transport=t}list({limit:t,sort:e,request:o={}}={}){return this._transport.send("v1/actions",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var O=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var g=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByCategory=this.listByBoilerplateCategory;listByBoilerplateCategory(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t)+"/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var v=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}metaWhatsappGetBusinessProfile(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/meta-whatsapp/business-profile",{...e,method:"GET"})}twilioSendgridChannelSync(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/twilio-sendgrid/sync",{...o,method:"POST",json:e})}};var _=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var L=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}getRelativeVCFURL(t,{vcf:e={}}={}){let o=e.variant??"vcard",s=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(s)}getVCFURL(t,e={}){return this._transport.getURL(this.getRelativeVCFURL(t,e))}getVCF(t,e={}){return this._transport.send(this.getVCFURL(t,e),{method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var I=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}list({limit:t,filter:e,include:o,request:s={}}={}){return this._transport.send("v1/conversations",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var T=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,include:o,request:s={}}={}){return this._transport.send("v1/labels",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByConversation(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var S=class{constructor(t){this._transport=t}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}listByConversation(t,{limit:e,include:o,request:s={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:s={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o)]})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var A=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}createResponse(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,json:e})}createCorrection(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",json:e})}};var y=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}listByContact(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}createForConversation(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var U=class{constructor(t){this._transport=t}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",json:e})}};var G=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Y;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var D=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}list({featured:t,category:e,request:o={}}={}){let s=[];if(e){let r=Array.isArray(e)?e:[e];for(let m of r)s.push(["category",m])}return t!==void 0&&s.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:s})}};var E=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};import X from"is-network-error";import Z,{HTTPError as tt}from"ky";var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends i{};var w=class extends c{static unauthenticated(){return new this("An unauthenticated request occurred")}};var P=class extends c{static forbidden(){return new this("A forbidden request occurred")}};var p=class extends i{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var k=class extends i{};var l=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var B=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Z.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let s of this.options.requestFilterables){let r=s.getHeaders();for(let[m,$]of Object.entries(r))o.headers.has(m)||o.headers.set(m,$)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,s]of Object.entries(t))s!==void 0&&e.push(["sort",s+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let o=this.client(t,e).catch(s=>{if(X(s))throw new k("A network error occurred",{cause:s});if(s instanceof tt){let r=s.response.status;switch(console.error(JSON.stringify(s.response)),r){case 400:throw l.badRequest();case 401:throw w.unauthenticated();case 403:throw P.forbidden();case 404:throw p.notFound(t);case 405:throw p.forbiddenMethod(t,e.method??"GET");case 415:throw l.unsupportedMediaType();case 418:throw p.teapot();case 429:throw p.rateLimited()}if(r>=500&&r<600)throw i.serverError(r)}throw s});return{response:()=>o,json:async()=>(await o).json()}}};var F=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}create({account:t,files:e,request:o={}}){let s=new FormData;for(let r of e)s.append("file",r);return this._transport.send("v1/uploads",{...o,method:"POST",body:s,searchParams:{account:t}})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var x=class{constructor(t){this._transport=t}async event({key:t=process.env[W],maxSignatures:e=3,request:o}){let s=o.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+W);if(!s)throw new Error("Missing signature header");if(!this._verifySignature(t,o.body,Array.isArray(s)?s.slice(0,e):[s]))throw new Error("Untrusted signature")}let{data:r}=z.parse(o.body);return{event:r.event}}async _verifySignature(t,e,o){let s=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let r of o)if(await crypto.subtle.verify("HMAC",s,new TextEncoder().encode(atob(r)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var M=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/webhooks/subscriptions",{...t,method:"GET"})}test(t,{request:e={}}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t)+"/test",{...e,method:"POST"})}create({body:t,request:e={}}){return this._transport.send("v1/webhooks/subscriptions",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var N=class{constructor(t){this._transport=t}getNotifications({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var Q=class n{static DEFAULT_BASE_URL=K;static PublicAuthentication=d;static BasicAuthentication=u;static BearerAuthentication=h;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;compositionSection;contact;conversation;label;message;model;note;notificationSubscription;source;statistics;upload;webhook;webhookSubscription;wellKnown;constructor(t,{baseURL:e,...o}={}){this._transport=new B({requestFilterables:[new G,t],...o,baseURL:e?.toString()??n.getBaseURL()}),this.account=new C(this._transport),this.accountAccessToken=new f(this._transport),this.accountConversationSettings=new R(this._transport),this.action=new b(this._transport),this.boilerplateCategory=new O(this._transport),this.boilerplateContent=new g(this._transport),this.channel=new v(this._transport),this.compositionSection=new _(this._transport),this.contact=new L(this._transport),this.conversation=new I(this._transport),this.label=new T(this._transport),this.message=new S(this._transport),this.model=new A(this._transport),this.note=new y(this._transport),this.notificationSubscription=new U(this._transport),this.source=new D(this._transport),this.statistics=new E(this._transport),this.upload=new F(this._transport),this.webhook=new x(this._transport),this.webhookSubscription=new M(this._transport),this.wellKnown=new N(this._transport)}static getBaseURL(){return process.env[V]??this.DEFAULT_BASE_URL}};export{et as a,d as b,K as c,i as d,c as e,w as f,P as g,p as h,k as i,l as j,z as k,Q as l};
|
|
1
|
+
var J=Object.defineProperty;var et=(n,t)=>{for(var e in t)J(n,e,{get:t[e],enumerable:!0})};var d=class{getHeaders(){return{}}};var j="SUPPORT_ACCESS_TOKEN",q="SUPPORT_KEY_NAME",H="SUPPORT_KEY_PASSWORD",W="SUPPORT_SIGNING_KEY",V="SUPPORT_BASE_URL";var u=class{name;#t;constructor({name:t=process.env[q],password:e=process.env[H]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var h=class{#t;constructor({token:t=process.env[j]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var K="https://api.support.greatdetail.com",Y={"X-Powered-By":"GDSupport/JavaScript"};import{z as a}from"zod";var z=a.object({data:a.object({event:a.object({id:a.string(),type:a.string(),payload:a.record(a.string()),createdAt:a.string().datetime()})})});var C=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}getCurrent({request:t={}}){return this._transport.send("v1/accounts/current",{...t,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/accounts",{...e,method:"POST",json:t})}};var f=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}delete(t,e,{body:o,request:s={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...s,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var R=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var b=class{constructor(t){this._transport=t}list({limit:t,sort:e,request:o={}}={}){return this._transport.send("v1/actions",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var O=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var g=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByCategory=this.listByBoilerplateCategory;listByBoilerplateCategory(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t)+"/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var v=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}metaWhatsappGetBusinessProfile(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/meta-whatsapp/business-profile",{...e,method:"GET"})}twilioSendgridChannelSync(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/twilio-sendgrid/sync",{...o,method:"POST",json:e})}};var _=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var L=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}getRelativeVCFURL(t,{vcf:e={}}={}){let o=e.variant??"vcard",s=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(s)}getVCFURL(t,e={}){return this._transport.getURL(this.getRelativeVCFURL(t,e))}getVCF(t,e={}){return this._transport.send(this.getVCFURL(t,e),{method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var I=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}list({limit:t,filter:e,include:o,request:s={}}={}){return this._transport.send("v1/conversations",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var T=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,include:o,request:s={}}={}){return this._transport.send("v1/labels",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByConversation(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var S=class{constructor(t){this._transport=t}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}listByConversation(t,{limit:e,include:o,request:s={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:s={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o)]})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var A=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}createResponse(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,json:e})}createCorrection(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",json:e})}};var y=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}listByContact(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}createForConversation(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var U=class{constructor(t){this._transport=t}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",json:e})}};var G=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Y;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var D=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}list({featured:t,category:e,request:o={}}={}){let s=[];if(e){let r=Array.isArray(e)?e:[e];for(let m of r)s.push(["category",m])}return t!==void 0&&s.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:s})}};var E=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};import X from"is-network-error";import Z,{HTTPError as tt}from"ky";var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends i{};var w=class extends c{static unauthenticated(){return new this("An unauthenticated request occurred")}};var P=class extends c{static forbidden(){return new this("A forbidden request occurred")}};var p=class extends i{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var k=class extends i{};var l=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var B=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Z.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let s of this.options.requestFilterables){let r=s.getHeaders();for(let[m,$]of Object.entries(r))o.headers.has(m)||o.headers.set(m,$)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,s]of Object.entries(t))s!==void 0&&e.push(["sort",s+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let o=this.client(t,e).catch(s=>{if(X(s))throw new k("A network error occurred",{cause:s});if(s instanceof tt){let r=s.response.status;switch(console.error(JSON.stringify(s.response)),r){case 400:throw l.badRequest();case 401:throw w.unauthenticated();case 403:throw P.forbidden();case 404:throw p.notFound(t);case 405:throw p.forbiddenMethod(t,e.method??"GET");case 415:throw l.unsupportedMediaType();case 418:throw p.teapot();case 429:throw p.rateLimited()}if(r>=500&&r<600)throw i.serverError(r)}throw s});return{response:()=>o,json:async()=>(await o).json()}}};var F=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}create({account:t,files:e,request:o={}}){let s=new FormData;for(let r of e)s.append("file",r);return this._transport.send("v1/uploads",{...o,method:"POST",body:s,searchParams:{account:t}})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var x=class{constructor(t){this._transport=t}async event({key:t=process.env[W],maxSignatures:e=3,request:o}){let s=o.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+W);if(!s)throw new Error("Missing signature header");if(!this._verifySignature(t,o.body,Array.isArray(s)?s.slice(0,e):[s]))throw new Error("Untrusted signature")}let{data:r}=z.parse(o.body);return{event:r.event}}async _verifySignature(t,e,o){let s=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let r of o)if(await crypto.subtle.verify("HMAC",s,new TextEncoder().encode(atob(r)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var M=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/webhooks/subscriptions",{...t,method:"GET"})}test(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t)+"/test",{...e,method:"POST"})}create({body:t,request:e={}}){return this._transport.send("v1/webhooks/subscriptions",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var N=class{constructor(t){this._transport=t}getNotifications({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var Q=class n{static DEFAULT_BASE_URL=K;static PublicAuthentication=d;static BasicAuthentication=u;static BearerAuthentication=h;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;compositionSection;contact;conversation;label;message;model;note;notificationSubscription;source;statistics;upload;webhook;webhookSubscription;wellKnown;constructor(t,{baseURL:e,...o}={}){this._transport=new B({requestFilterables:[new G,t],...o,baseURL:e?.toString()??n.getBaseURL()}),this.account=new C(this._transport),this.accountAccessToken=new f(this._transport),this.accountConversationSettings=new R(this._transport),this.action=new b(this._transport),this.boilerplateCategory=new O(this._transport),this.boilerplateContent=new g(this._transport),this.channel=new v(this._transport),this.compositionSection=new _(this._transport),this.contact=new L(this._transport),this.conversation=new I(this._transport),this.label=new T(this._transport),this.message=new S(this._transport),this.model=new A(this._transport),this.note=new y(this._transport),this.notificationSubscription=new U(this._transport),this.source=new D(this._transport),this.statistics=new E(this._transport),this.upload=new F(this._transport),this.webhook=new x(this._transport),this.webhookSubscription=new M(this._transport),this.wellKnown=new N(this._transport)}static getBaseURL(){return process.env[V]??this.DEFAULT_BASE_URL}};export{et as a,d as b,K as c,i as d,c as e,w as f,P as g,p as h,k as i,l as j,z as k,Q as l};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as v,l as b}from"./chunk-
|
|
1
|
+
import{b as v,l as b}from"./chunk-5YOY53RX.js";import{Command as G}from"commander";import{Command as L}from"commander";import{oraPromise as S}from"ora";function r({client:t,ora:s}){let o=new L("actions").description("Actions");return o.addCommand(new L("list").description("List actions").action(async()=>{let n=await S(()=>t.action.list().json(),{...s,text:"Finding actions"});console.log(n)})),o}import{Command as D}from"commander";import{oraPromise as M}from"ora";function d({client:t,ora:s}){let o=new D("channels").description("Channels");return o.addCommand(new D("list").description("List channels").action(async()=>{let n=await M(()=>t.channel.list().json(),{...s,text:"Finding channels"});console.log(n)})),o}import{Command as a}from"commander";import{oraPromise as c}from"ora";function p({client:t,ora:s}){let o=new a("contacts").description("Contacts");return o.addCommand(new a("get").description("Find contact").argument("<contact>","Contact ID").action(async n=>{let i=await c(()=>t.contact.get(n).json(),{...s,text:"Finding contact"});console.log(i)})),o.addCommand(new a("list").description("List contacts").action(async()=>{let n=await c(()=>t.contact.list().json(),{...s,text:"Finding contacts"});console.log(n)})),o.addCommand(new a("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async n=>{let i=await c(()=>t.contact.getVCF(n).response(),{...s,text:"Exporting contact"});console.log(i)})),o}import{Command as l}from"commander";import{oraPromise as I}from"ora";function f({client:t,ora:s}){let o=new l("conversations").description("Conversations");return o.addCommand(new l("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let i=await I(()=>t.conversation.get(n).json(),{...s,text:"Finding conversation"});console.log(i)})),o.addCommand(new l("list").description("List conversations").action(async()=>{let n=await I(()=>t.conversation.list().json(),{...s,text:"Finding conversations"});console.log(n)})),o}import{Command as m}from"commander";import{oraPromise as u}from"ora";function C({client:t,ora:s}){let o=new m("labels").description("Labels");return o.addCommand(new m("get").description("Find label").argument("<label>","Label ID").action(async n=>{let i=await u(()=>t.label.get(n).json(),{...s,text:"Finding label"});console.log(i)})),o.addCommand(new m("list").description("List labels").action(async()=>{let n=await u(()=>t.label.list().json(),{...s,text:"Finding labels"});console.log(n)})),o.addCommand(new m("conversations").description("Find label conversations").argument("<label>","Label ID").action(async n=>{let i=await u(()=>t.conversation.listByLabel(n).json(),{...s,text:"Finding conversations"});console.log(i)})),o}import{Command as P}from"commander";import{oraPromise as W}from"ora";function g({client:t,ora:s}){let o=new P("messages").description("Messages");return o.addCommand(new P("list").description("List messages").action(async()=>{let n=await W(()=>t.message.list().json(),{...s,text:"Finding messages"});console.log(n)})),o}import{Command as w}from"commander";import{oraPromise as K}from"ora";function O({client:t,ora:s}){let o=new w("models").description("Models");return o.addCommand(new w("get").description("Find model").argument("<model>","Model ID").action(async n=>{let i=await K(()=>t.model.get(n).json(),{...s,text:"Finding model"});console.log(i)})),o.addCommand(new w("list").description("List models").action(async()=>{let n=await K(()=>t.model.list().json(),{...s,text:"Finding models"});console.log(n)})),o}import{Command as x}from"commander";import{oraPromise as h}from"ora";function y({client:t,ora:s}){let o=new x("sources").description("Sources");return o.addCommand(new x("get").description("Find source").argument("<source>","Source ID").action(async n=>{let i=await h(()=>t.source.get(n).json(),{...s,text:"Finding source"});console.log(i)})),o.addCommand(new x("list").description("List sources").action(async()=>{let n=await h(()=>t.source.list().json(),{...s,text:"Finding sources"});console.log(n)})),o}import{Command as E}from"commander";import{Command as N}from"commander";import{oraPromise as A}from"ora";function j({client:t,ora:s}){let o=new N("notifications").description("Well-Known Notifications Details");return o.addCommand(new N("get").description("Get Notifications Server Well-Known Info").action(async()=>{let n=await A(()=>t.wellKnown.getNotifications().json(),{...s,text:"Finding Notifications Well-Known Info"});console.log(n)})),o}function F({client:t,ora:s}){let o=new E("well-known").description("Well-Known Metadata & Info");return o.addCommand(j({client:t,ora:s})),o}var e={ora:{spinner:"simpleDotsScrolling"},client:new b(new v)},V=new G("gds").description("Great Detail Support System").addCommand(r(e)).addCommand(d(e)).addCommand(p(e)).addCommand(f(e)).addCommand(C(e)).addCommand(g(e)).addCommand(O(e)).addCommand(y(e)).addCommand(F(e)),Po=V;export{Po as a};
|
package/dist/cli/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Et=Object.create;var K=Object.defineProperty;var xt=Object.getOwnPropertyDescriptor;var Pt=Object.getOwnPropertyNames;var Ft=Object.getPrototypeOf,kt=Object.prototype.hasOwnProperty;var Bt=(n,t)=>{for(var e in t)K(n,e,{get:t[e],enumerable:!0})},ft=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Pt(t))!kt.call(n,s)&&s!==e&&K(n,s,{get:()=>t[s],enumerable:!(o=xt(t,s))||o.enumerable});return n};var Ot=(n,t,e)=>(e=n!=null?Et(Ft(n)):{},ft(t||!n||!n.__esModule?K(e,"default",{value:n,enumerable:!0}):e,n)),Mt=n=>ft(K({},"__esModule",{value:!0}),n);var Wt={};Bt(Wt,{default:()=>jt});module.exports=Mt(Wt);var Dt=require("commander");var m=class{getHeaders(){return{}}};var C=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}getCurrent({request:t={}}){return this._transport.send("v1/accounts/current",{...t,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/accounts",{...e,method:"POST",json:t})}};var h=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}delete(t,e,{body:o,request:s={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...s,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var f=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var O=class{constructor(t){this._transport=t}list({limit:t,sort:e,request:o={}}={}){return this._transport.send("v1/actions",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var gt="SUPPORT_ACCESS_TOKEN",Rt="SUPPORT_KEY_NAME",bt="SUPPORT_KEY_PASSWORD",X="SUPPORT_SIGNING_KEY",vt="SUPPORT_BASE_URL";var g=class{name;#t;constructor({name:t=process.env[Rt],password:e=process.env[bt]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var R=class{#t;constructor({token:t=process.env[gt]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var b=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var v=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByCategory=this.listByBoilerplateCategory;listByBoilerplateCategory(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t)+"/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var _=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}metaWhatsappGetBusinessProfile(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/meta-whatsapp/business-profile",{...e,method:"GET"})}twilioSendgridChannelSync(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/twilio-sendgrid/sync",{...o,method:"POST",json:e})}};var L=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var _t="https://api.support.greatdetail.com",Lt={"X-Powered-By":"GDSupport/JavaScript"};var I=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}getRelativeVCFURL(t,{vcf:e={}}={}){let o=e.variant??"vcard",s=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(s)}getVCFURL(t,e={}){return this._transport.getURL(this.getRelativeVCFURL(t,e))}getVCF(t,e={}){return this._transport.send(this.getVCFURL(t,e),{method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var y=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}list({limit:t,filter:e,include:o,request:s={}}={}){return this._transport.send("v1/conversations",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var T=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,include:o,request:s={}}={}){return this._transport.send("v1/labels",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByConversation(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var S=class{constructor(t){this._transport=t}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}listByConversation(t,{limit:e,include:o,request:s={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:s={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o)]})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var A=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}createResponse(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,json:e})}createCorrection(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",json:e})}};var w=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}listByContact(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}createForConversation(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var U=class{constructor(t){this._transport=t}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",json:e})}};var D=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Lt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var G=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}list({featured:t,category:e,request:o={}}={}){let s=[];if(e){let r=Array.isArray(e)?e:[e];for(let l of r)s.push(["category",l])}return t!==void 0&&s.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:s})}};var E=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};var It=Ot(require("is-network-error"),1),V=Ot(require("ky"),1);var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var d=class extends i{};var x=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var P=class extends d{static forbidden(){return new this("A forbidden request occurred")}};var c=class extends i{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var F=class extends i{};var u=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var k=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=V.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let s of this.options.requestFilterables){let r=s.getHeaders();for(let[l,Gt]of Object.entries(r))o.headers.has(l)||o.headers.set(l,Gt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,s]of Object.entries(t))s!==void 0&&e.push(["sort",s+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let o=this.client(t,e).catch(s=>{if((0,It.default)(s))throw new F("A network error occurred",{cause:s});if(s instanceof V.HTTPError){let r=s.response.status;switch(console.error(JSON.stringify(s.response)),r){case 400:throw u.badRequest();case 401:throw x.unauthenticated();case 403:throw P.forbidden();case 404:throw c.notFound(t);case 405:throw c.forbiddenMethod(t,e.method??"GET");case 415:throw u.unsupportedMediaType();case 418:throw c.teapot();case 429:throw c.rateLimited()}if(r>=500&&r<600)throw i.serverError(r)}throw s});return{response:()=>o,json:async()=>(await o).json()}}};var B=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}create({account:t,files:e,request:o={}}){let s=new FormData;for(let r of e)s.append("file",r);return this._transport.send("v1/uploads",{...o,method:"POST",body:s,searchParams:{account:t}})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var a=require("zod"),yt=a.z.object({data:a.z.object({event:a.z.object({id:a.z.string(),type:a.z.string(),payload:a.z.record(a.z.string()),createdAt:a.z.string().datetime()})})});var M=class{constructor(t){this._transport=t}async event({key:t=process.env[X],maxSignatures:e=3,request:o}){let s=o.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+X);if(!s)throw new Error("Missing signature header");if(!this._verifySignature(t,o.body,Array.isArray(s)?s.slice(0,e):[s]))throw new Error("Untrusted signature")}let{data:r}=yt.parse(o.body);return{event:r.event}}async _verifySignature(t,e,o){let s=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let r of o)if(await crypto.subtle.verify("HMAC",s,new TextEncoder().encode(atob(r)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var N=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/webhooks/subscriptions",{...t,method:"GET"})}test(t,{request:e={}}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t)+"/test",{...e,method:"POST"})}create({body:t,request:e={}}){return this._transport.send("v1/webhooks/subscriptions",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var j=class{constructor(t){this._transport=t}getNotifications({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var W=class n{static DEFAULT_BASE_URL=_t;static PublicAuthentication=m;static BasicAuthentication=g;static BearerAuthentication=R;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;compositionSection;contact;conversation;label;message;model;note;notificationSubscription;source;statistics;upload;webhook;webhookSubscription;wellKnown;constructor(t,{baseURL:e,...o}={}){this._transport=new k({requestFilterables:[new D,t],...o,baseURL:e?.toString()??n.getBaseURL()}),this.account=new C(this._transport),this.accountAccessToken=new h(this._transport),this.accountConversationSettings=new f(this._transport),this.action=new O(this._transport),this.boilerplateCategory=new b(this._transport),this.boilerplateContent=new v(this._transport),this.channel=new _(this._transport),this.compositionSection=new L(this._transport),this.contact=new I(this._transport),this.conversation=new y(this._transport),this.label=new T(this._transport),this.message=new S(this._transport),this.model=new A(this._transport),this.note=new w(this._transport),this.notificationSubscription=new U(this._transport),this.source=new G(this._transport),this.statistics=new E(this._transport),this.upload=new B(this._transport),this.webhook=new M(this._transport),this.webhookSubscription=new N(this._transport),this.wellKnown=new j(this._transport)}static getBaseURL(){return process.env[vt]??this.DEFAULT_BASE_URL}};var Z=require("commander"),Tt=require("ora");function tt({client:n,ora:t}){let e=new Z.Command("actions").description("Actions");return e.addCommand(new Z.Command("list").description("List actions").action(async()=>{let o=await(0,Tt.oraPromise)(()=>n.action.list().json(),{...t,text:"Finding actions"});console.log(o)})),e}var et=require("commander"),St=require("ora");function ot({client:n,ora:t}){let e=new et.Command("channels").description("Channels");return e.addCommand(new et.Command("list").description("List channels").action(async()=>{let o=await(0,St.oraPromise)(()=>n.channel.list().json(),{...t,text:"Finding channels"});console.log(o)})),e}var Q=require("commander"),H=require("ora");function nt({client:n,ora:t}){let e=new Q.Command("contacts").description("Contacts");return e.addCommand(new Q.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async o=>{let s=await(0,H.oraPromise)(()=>n.contact.get(o).json(),{...t,text:"Finding contact"});console.log(s)})),e.addCommand(new Q.Command("list").description("List contacts").action(async()=>{let o=await(0,H.oraPromise)(()=>n.contact.list().json(),{...t,text:"Finding contacts"});console.log(o)})),e.addCommand(new Q.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async o=>{let s=await(0,H.oraPromise)(()=>n.contact.getVCF(o).response(),{...t,text:"Exporting contact"});console.log(s)})),e}var Y=require("commander"),st=require("ora");function rt({client:n,ora:t}){let e=new Y.Command("conversations").description("Conversations");return e.addCommand(new Y.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async o=>{let s=await(0,st.oraPromise)(()=>n.conversation.get(o).json(),{...t,text:"Finding conversation"});console.log(s)})),e.addCommand(new Y.Command("list").description("List conversations").action(async()=>{let o=await(0,st.oraPromise)(()=>n.conversation.list().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var q=require("commander"),z=require("ora");function it({client:n,ora:t}){let e=new q.Command("labels").description("Labels");return e.addCommand(new q.Command("get").description("Find label").argument("<label>","Label ID").action(async o=>{let s=await(0,z.oraPromise)(()=>n.label.get(o).json(),{...t,text:"Finding label"});console.log(s)})),e.addCommand(new q.Command("list").description("List labels").action(async()=>{let o=await(0,z.oraPromise)(()=>n.label.list().json(),{...t,text:"Finding labels"});console.log(o)})),e.addCommand(new q.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async o=>{let s=await(0,z.oraPromise)(()=>n.conversation.listByLabel(o).json(),{...t,text:"Finding conversations"});console.log(s)})),e}var at=require("commander"),At=require("ora");function pt({client:n,ora:t}){let e=new at.Command("messages").description("Messages");return e.addCommand(new at.Command("list").description("List messages").action(async()=>{let o=await(0,At.oraPromise)(()=>n.message.list().json(),{...t,text:"Finding messages"});console.log(o)})),e}var $=require("commander"),ct=require("ora");function mt({client:n,ora:t}){let e=new $.Command("models").description("Models");return e.addCommand(new $.Command("get").description("Find model").argument("<model>","Model ID").action(async o=>{let s=await(0,ct.oraPromise)(()=>n.model.get(o).json(),{...t,text:"Finding model"});console.log(s)})),e.addCommand(new $.Command("list").description("List models").action(async()=>{let o=await(0,ct.oraPromise)(()=>n.model.list().json(),{...t,text:"Finding models"});console.log(o)})),e}var J=require("commander"),dt=require("ora");function lt({client:n,ora:t}){let e=new J.Command("sources").description("Sources");return e.addCommand(new J.Command("get").description("Find source").argument("<source>","Source ID").action(async o=>{let s=await(0,dt.oraPromise)(()=>n.source.get(o).json(),{...t,text:"Finding source"});console.log(s)})),e.addCommand(new J.Command("list").description("List sources").action(async()=>{let o=await(0,dt.oraPromise)(()=>n.source.list().json(),{...t,text:"Finding sources"});console.log(o)})),e}var Ut=require("commander");var ut=require("commander"),wt=require("ora");function Ct({client:n,ora:t}){let e=new ut.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new ut.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let o=await(0,wt.oraPromise)(()=>n.wellKnown.getNotifications().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(o)})),e}function ht({client:n,ora:t}){let e=new Ut.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(Ct({client:n,ora:t})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new W(new m)},Nt=new Dt.Command("gds").description("Great Detail Support System").addCommand(tt(p)).addCommand(ot(p)).addCommand(nt(p)).addCommand(rt(p)).addCommand(it(p)).addCommand(pt(p)).addCommand(mt(p)).addCommand(lt(p)).addCommand(ht(p)),jt=Nt;
|
|
1
|
+
"use strict";var Et=Object.create;var K=Object.defineProperty;var xt=Object.getOwnPropertyDescriptor;var Pt=Object.getOwnPropertyNames;var Ft=Object.getPrototypeOf,kt=Object.prototype.hasOwnProperty;var Bt=(n,t)=>{for(var e in t)K(n,e,{get:t[e],enumerable:!0})},ft=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Pt(t))!kt.call(n,s)&&s!==e&&K(n,s,{get:()=>t[s],enumerable:!(o=xt(t,s))||o.enumerable});return n};var Ot=(n,t,e)=>(e=n!=null?Et(Ft(n)):{},ft(t||!n||!n.__esModule?K(e,"default",{value:n,enumerable:!0}):e,n)),Mt=n=>ft(K({},"__esModule",{value:!0}),n);var Wt={};Bt(Wt,{default:()=>jt});module.exports=Mt(Wt);var Dt=require("commander");var m=class{getHeaders(){return{}}};var C=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}getCurrent({request:t={}}){return this._transport.send("v1/accounts/current",{...t,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/accounts",{...e,method:"POST",json:t})}};var h=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}delete(t,e,{body:o,request:s={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...s,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var f=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var O=class{constructor(t){this._transport=t}list({limit:t,sort:e,request:o={}}={}){return this._transport.send("v1/actions",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var gt="SUPPORT_ACCESS_TOKEN",Rt="SUPPORT_KEY_NAME",bt="SUPPORT_KEY_PASSWORD",X="SUPPORT_SIGNING_KEY",vt="SUPPORT_BASE_URL";var g=class{name;#t;constructor({name:t=process.env[Rt],password:e=process.env[bt]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var R=class{#t;constructor({token:t=process.env[gt]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var b=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var v=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByCategory=this.listByBoilerplateCategory;listByBoilerplateCategory(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t)+"/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var _=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}metaWhatsappGetBusinessProfile(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/meta-whatsapp/business-profile",{...e,method:"GET"})}twilioSendgridChannelSync(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/twilio-sendgrid/sync",{...o,method:"POST",json:e})}};var L=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var _t="https://api.support.greatdetail.com",Lt={"X-Powered-By":"GDSupport/JavaScript"};var I=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}getRelativeVCFURL(t,{vcf:e={}}={}){let o=e.variant??"vcard",s=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(s)}getVCFURL(t,e={}){return this._transport.getURL(this.getRelativeVCFURL(t,e))}getVCF(t,e={}){return this._transport.send(this.getVCFURL(t,e),{method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var y=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}list({limit:t,filter:e,include:o,request:s={}}={}){return this._transport.send("v1/conversations",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var T=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,include:o,request:s={}}={}){return this._transport.send("v1/labels",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByConversation(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var S=class{constructor(t){this._transport=t}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}listByConversation(t,{limit:e,include:o,request:s={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:s={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o)]})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var A=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}createResponse(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,json:e})}createCorrection(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",json:e})}};var w=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}listByContact(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}createForConversation(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var U=class{constructor(t){this._transport=t}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",json:e})}};var D=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Lt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var G=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}list({featured:t,category:e,request:o={}}={}){let s=[];if(e){let r=Array.isArray(e)?e:[e];for(let l of r)s.push(["category",l])}return t!==void 0&&s.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:s})}};var E=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};var It=Ot(require("is-network-error"),1),V=Ot(require("ky"),1);var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var d=class extends i{};var x=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var P=class extends d{static forbidden(){return new this("A forbidden request occurred")}};var c=class extends i{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var F=class extends i{};var u=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var k=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=V.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let s of this.options.requestFilterables){let r=s.getHeaders();for(let[l,Gt]of Object.entries(r))o.headers.has(l)||o.headers.set(l,Gt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,s]of Object.entries(t))s!==void 0&&e.push(["sort",s+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let o=this.client(t,e).catch(s=>{if((0,It.default)(s))throw new F("A network error occurred",{cause:s});if(s instanceof V.HTTPError){let r=s.response.status;switch(console.error(JSON.stringify(s.response)),r){case 400:throw u.badRequest();case 401:throw x.unauthenticated();case 403:throw P.forbidden();case 404:throw c.notFound(t);case 405:throw c.forbiddenMethod(t,e.method??"GET");case 415:throw u.unsupportedMediaType();case 418:throw c.teapot();case 429:throw c.rateLimited()}if(r>=500&&r<600)throw i.serverError(r)}throw s});return{response:()=>o,json:async()=>(await o).json()}}};var B=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}create({account:t,files:e,request:o={}}){let s=new FormData;for(let r of e)s.append("file",r);return this._transport.send("v1/uploads",{...o,method:"POST",body:s,searchParams:{account:t}})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var a=require("zod"),yt=a.z.object({data:a.z.object({event:a.z.object({id:a.z.string(),type:a.z.string(),payload:a.z.record(a.z.string()),createdAt:a.z.string().datetime()})})});var M=class{constructor(t){this._transport=t}async event({key:t=process.env[X],maxSignatures:e=3,request:o}){let s=o.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+X);if(!s)throw new Error("Missing signature header");if(!this._verifySignature(t,o.body,Array.isArray(s)?s.slice(0,e):[s]))throw new Error("Untrusted signature")}let{data:r}=yt.parse(o.body);return{event:r.event}}async _verifySignature(t,e,o){let s=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let r of o)if(await crypto.subtle.verify("HMAC",s,new TextEncoder().encode(atob(r)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var N=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/webhooks/subscriptions",{...t,method:"GET"})}test(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t)+"/test",{...e,method:"POST"})}create({body:t,request:e={}}){return this._transport.send("v1/webhooks/subscriptions",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var j=class{constructor(t){this._transport=t}getNotifications({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var W=class n{static DEFAULT_BASE_URL=_t;static PublicAuthentication=m;static BasicAuthentication=g;static BearerAuthentication=R;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;compositionSection;contact;conversation;label;message;model;note;notificationSubscription;source;statistics;upload;webhook;webhookSubscription;wellKnown;constructor(t,{baseURL:e,...o}={}){this._transport=new k({requestFilterables:[new D,t],...o,baseURL:e?.toString()??n.getBaseURL()}),this.account=new C(this._transport),this.accountAccessToken=new h(this._transport),this.accountConversationSettings=new f(this._transport),this.action=new O(this._transport),this.boilerplateCategory=new b(this._transport),this.boilerplateContent=new v(this._transport),this.channel=new _(this._transport),this.compositionSection=new L(this._transport),this.contact=new I(this._transport),this.conversation=new y(this._transport),this.label=new T(this._transport),this.message=new S(this._transport),this.model=new A(this._transport),this.note=new w(this._transport),this.notificationSubscription=new U(this._transport),this.source=new G(this._transport),this.statistics=new E(this._transport),this.upload=new B(this._transport),this.webhook=new M(this._transport),this.webhookSubscription=new N(this._transport),this.wellKnown=new j(this._transport)}static getBaseURL(){return process.env[vt]??this.DEFAULT_BASE_URL}};var Z=require("commander"),Tt=require("ora");function tt({client:n,ora:t}){let e=new Z.Command("actions").description("Actions");return e.addCommand(new Z.Command("list").description("List actions").action(async()=>{let o=await(0,Tt.oraPromise)(()=>n.action.list().json(),{...t,text:"Finding actions"});console.log(o)})),e}var et=require("commander"),St=require("ora");function ot({client:n,ora:t}){let e=new et.Command("channels").description("Channels");return e.addCommand(new et.Command("list").description("List channels").action(async()=>{let o=await(0,St.oraPromise)(()=>n.channel.list().json(),{...t,text:"Finding channels"});console.log(o)})),e}var Q=require("commander"),H=require("ora");function nt({client:n,ora:t}){let e=new Q.Command("contacts").description("Contacts");return e.addCommand(new Q.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async o=>{let s=await(0,H.oraPromise)(()=>n.contact.get(o).json(),{...t,text:"Finding contact"});console.log(s)})),e.addCommand(new Q.Command("list").description("List contacts").action(async()=>{let o=await(0,H.oraPromise)(()=>n.contact.list().json(),{...t,text:"Finding contacts"});console.log(o)})),e.addCommand(new Q.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async o=>{let s=await(0,H.oraPromise)(()=>n.contact.getVCF(o).response(),{...t,text:"Exporting contact"});console.log(s)})),e}var Y=require("commander"),st=require("ora");function rt({client:n,ora:t}){let e=new Y.Command("conversations").description("Conversations");return e.addCommand(new Y.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async o=>{let s=await(0,st.oraPromise)(()=>n.conversation.get(o).json(),{...t,text:"Finding conversation"});console.log(s)})),e.addCommand(new Y.Command("list").description("List conversations").action(async()=>{let o=await(0,st.oraPromise)(()=>n.conversation.list().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var q=require("commander"),z=require("ora");function it({client:n,ora:t}){let e=new q.Command("labels").description("Labels");return e.addCommand(new q.Command("get").description("Find label").argument("<label>","Label ID").action(async o=>{let s=await(0,z.oraPromise)(()=>n.label.get(o).json(),{...t,text:"Finding label"});console.log(s)})),e.addCommand(new q.Command("list").description("List labels").action(async()=>{let o=await(0,z.oraPromise)(()=>n.label.list().json(),{...t,text:"Finding labels"});console.log(o)})),e.addCommand(new q.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async o=>{let s=await(0,z.oraPromise)(()=>n.conversation.listByLabel(o).json(),{...t,text:"Finding conversations"});console.log(s)})),e}var at=require("commander"),At=require("ora");function pt({client:n,ora:t}){let e=new at.Command("messages").description("Messages");return e.addCommand(new at.Command("list").description("List messages").action(async()=>{let o=await(0,At.oraPromise)(()=>n.message.list().json(),{...t,text:"Finding messages"});console.log(o)})),e}var $=require("commander"),ct=require("ora");function mt({client:n,ora:t}){let e=new $.Command("models").description("Models");return e.addCommand(new $.Command("get").description("Find model").argument("<model>","Model ID").action(async o=>{let s=await(0,ct.oraPromise)(()=>n.model.get(o).json(),{...t,text:"Finding model"});console.log(s)})),e.addCommand(new $.Command("list").description("List models").action(async()=>{let o=await(0,ct.oraPromise)(()=>n.model.list().json(),{...t,text:"Finding models"});console.log(o)})),e}var J=require("commander"),dt=require("ora");function lt({client:n,ora:t}){let e=new J.Command("sources").description("Sources");return e.addCommand(new J.Command("get").description("Find source").argument("<source>","Source ID").action(async o=>{let s=await(0,dt.oraPromise)(()=>n.source.get(o).json(),{...t,text:"Finding source"});console.log(s)})),e.addCommand(new J.Command("list").description("List sources").action(async()=>{let o=await(0,dt.oraPromise)(()=>n.source.list().json(),{...t,text:"Finding sources"});console.log(o)})),e}var Ut=require("commander");var ut=require("commander"),wt=require("ora");function Ct({client:n,ora:t}){let e=new ut.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new ut.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let o=await(0,wt.oraPromise)(()=>n.wellKnown.getNotifications().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(o)})),e}function ht({client:n,ora:t}){let e=new Ut.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(Ct({client:n,ora:t})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new W(new m)},Nt=new Dt.Command("gds").description("Great Detail Support System").addCommand(tt(p)).addCommand(ot(p)).addCommand(nt(p)).addCommand(rt(p)).addCommand(it(p)).addCommand(pt(p)).addCommand(mt(p)).addCommand(lt(p)).addCommand(ht(p)),jt=Nt;
|
package/dist/cli/index.d.cts
CHANGED
package/dist/cli/index.d.ts
CHANGED
package/dist/cli/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-BF7QHNJE.js";import"../chunk-5YOY53RX.js";export{a as default};
|
package/dist/cli.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var Et=Object.create;var ht=Object.defineProperty;var xt=Object.getOwnPropertyDescriptor;var Pt=Object.getOwnPropertyNames;var Ft=Object.getPrototypeOf,kt=Object.prototype.hasOwnProperty;var Bt=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Pt(t))!kt.call(n,s)&&s!==e&&ht(n,s,{get:()=>t[s],enumerable:!(o=xt(t,s))||o.enumerable});return n};var ft=(n,t,e)=>(e=n!=null?Et(Ft(n)):{},Bt(t||!n||!n.__esModule?ht(e,"default",{value:n,enumerable:!0}):e,n));var Ut=require("commander");var m=class{getHeaders(){return{}}};var C=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}getCurrent({request:t={}}){return this._transport.send("v1/accounts/current",{...t,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/accounts",{...e,method:"POST",json:t})}};var h=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}delete(t,e,{body:o,request:s={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...s,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var f=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var O=class{constructor(t){this._transport=t}list({limit:t,sort:e,request:o={}}={}){return this._transport.send("v1/actions",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var Ot="SUPPORT_ACCESS_TOKEN",gt="SUPPORT_KEY_NAME",Rt="SUPPORT_KEY_PASSWORD",J="SUPPORT_SIGNING_KEY",bt="SUPPORT_BASE_URL";var g=class{name;#t;constructor({name:t=process.env[gt],password:e=process.env[Rt]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var R=class{#t;constructor({token:t=process.env[Ot]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var b=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var v=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByCategory=this.listByBoilerplateCategory;listByBoilerplateCategory(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t)+"/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var _=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}metaWhatsappGetBusinessProfile(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/meta-whatsapp/business-profile",{...e,method:"GET"})}twilioSendgridChannelSync(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/twilio-sendgrid/sync",{...o,method:"POST",json:e})}};var L=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var vt="https://api.support.greatdetail.com",_t={"X-Powered-By":"GDSupport/JavaScript"};var I=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}getRelativeVCFURL(t,{vcf:e={}}={}){let o=e.variant??"vcard",s=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(s)}getVCFURL(t,e={}){return this._transport.getURL(this.getRelativeVCFURL(t,e))}getVCF(t,e={}){return this._transport.send(this.getVCFURL(t,e),{method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var y=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}list({limit:t,filter:e,include:o,request:s={}}={}){return this._transport.send("v1/conversations",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var T=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,include:o,request:s={}}={}){return this._transport.send("v1/labels",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByConversation(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var S=class{constructor(t){this._transport=t}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}listByConversation(t,{limit:e,include:o,request:s={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:s={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o)]})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var A=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}createResponse(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,json:e})}createCorrection(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",json:e})}};var w=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}listByContact(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}createForConversation(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var U=class{constructor(t){this._transport=t}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",json:e})}};var D=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=_t;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var G=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}list({featured:t,category:e,request:o={}}={}){let s=[];if(e){let r=Array.isArray(e)?e:[e];for(let l of r)s.push(["category",l])}return t!==void 0&&s.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:s})}};var E=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};var Lt=ft(require("is-network-error"),1),K=ft(require("ky"),1);var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var d=class extends i{};var x=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var P=class extends d{static forbidden(){return new this("A forbidden request occurred")}};var c=class extends i{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var F=class extends i{};var u=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var k=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=K.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let s of this.options.requestFilterables){let r=s.getHeaders();for(let[l,Gt]of Object.entries(r))o.headers.has(l)||o.headers.set(l,Gt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,s]of Object.entries(t))s!==void 0&&e.push(["sort",s+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let o=this.client(t,e).catch(s=>{if((0,Lt.default)(s))throw new F("A network error occurred",{cause:s});if(s instanceof K.HTTPError){let r=s.response.status;switch(console.error(JSON.stringify(s.response)),r){case 400:throw u.badRequest();case 401:throw x.unauthenticated();case 403:throw P.forbidden();case 404:throw c.notFound(t);case 405:throw c.forbiddenMethod(t,e.method??"GET");case 415:throw u.unsupportedMediaType();case 418:throw c.teapot();case 429:throw c.rateLimited()}if(r>=500&&r<600)throw i.serverError(r)}throw s});return{response:()=>o,json:async()=>(await o).json()}}};var B=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}create({account:t,files:e,request:o={}}){let s=new FormData;for(let r of e)s.append("file",r);return this._transport.send("v1/uploads",{...o,method:"POST",body:s,searchParams:{account:t}})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var a=require("zod"),It=a.z.object({data:a.z.object({event:a.z.object({id:a.z.string(),type:a.z.string(),payload:a.z.record(a.z.string()),createdAt:a.z.string().datetime()})})});var M=class{constructor(t){this._transport=t}async event({key:t=process.env[J],maxSignatures:e=3,request:o}){let s=o.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+J);if(!s)throw new Error("Missing signature header");if(!this._verifySignature(t,o.body,Array.isArray(s)?s.slice(0,e):[s]))throw new Error("Untrusted signature")}let{data:r}=It.parse(o.body);return{event:r.event}}async _verifySignature(t,e,o){let s=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let r of o)if(await crypto.subtle.verify("HMAC",s,new TextEncoder().encode(atob(r)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var N=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/webhooks/subscriptions",{...t,method:"GET"})}test(t,{request:e={}}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t)+"/test",{...e,method:"POST"})}create({body:t,request:e={}}){return this._transport.send("v1/webhooks/subscriptions",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var j=class{constructor(t){this._transport=t}getNotifications({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var W=class n{static DEFAULT_BASE_URL=vt;static PublicAuthentication=m;static BasicAuthentication=g;static BearerAuthentication=R;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;compositionSection;contact;conversation;label;message;model;note;notificationSubscription;source;statistics;upload;webhook;webhookSubscription;wellKnown;constructor(t,{baseURL:e,...o}={}){this._transport=new k({requestFilterables:[new D,t],...o,baseURL:e?.toString()??n.getBaseURL()}),this.account=new C(this._transport),this.accountAccessToken=new h(this._transport),this.accountConversationSettings=new f(this._transport),this.action=new O(this._transport),this.boilerplateCategory=new b(this._transport),this.boilerplateContent=new v(this._transport),this.channel=new _(this._transport),this.compositionSection=new L(this._transport),this.contact=new I(this._transport),this.conversation=new y(this._transport),this.label=new T(this._transport),this.message=new S(this._transport),this.model=new A(this._transport),this.note=new w(this._transport),this.notificationSubscription=new U(this._transport),this.source=new G(this._transport),this.statistics=new E(this._transport),this.upload=new B(this._transport),this.webhook=new M(this._transport),this.webhookSubscription=new N(this._transport),this.wellKnown=new j(this._transport)}static getBaseURL(){return process.env[bt]??this.DEFAULT_BASE_URL}};var X=require("commander"),yt=require("ora");function Z({client:n,ora:t}){let e=new X.Command("actions").description("Actions");return e.addCommand(new X.Command("list").description("List actions").action(async()=>{let o=await(0,yt.oraPromise)(()=>n.action.list().json(),{...t,text:"Finding actions"});console.log(o)})),e}var tt=require("commander"),Tt=require("ora");function et({client:n,ora:t}){let e=new tt.Command("channels").description("Channels");return e.addCommand(new tt.Command("list").description("List channels").action(async()=>{let o=await(0,Tt.oraPromise)(()=>n.channel.list().json(),{...t,text:"Finding channels"});console.log(o)})),e}var Q=require("commander"),V=require("ora");function ot({client:n,ora:t}){let e=new Q.Command("contacts").description("Contacts");return e.addCommand(new Q.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async o=>{let s=await(0,V.oraPromise)(()=>n.contact.get(o).json(),{...t,text:"Finding contact"});console.log(s)})),e.addCommand(new Q.Command("list").description("List contacts").action(async()=>{let o=await(0,V.oraPromise)(()=>n.contact.list().json(),{...t,text:"Finding contacts"});console.log(o)})),e.addCommand(new Q.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async o=>{let s=await(0,V.oraPromise)(()=>n.contact.getVCF(o).response(),{...t,text:"Exporting contact"});console.log(s)})),e}var H=require("commander"),nt=require("ora");function st({client:n,ora:t}){let e=new H.Command("conversations").description("Conversations");return e.addCommand(new H.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async o=>{let s=await(0,nt.oraPromise)(()=>n.conversation.get(o).json(),{...t,text:"Finding conversation"});console.log(s)})),e.addCommand(new H.Command("list").description("List conversations").action(async()=>{let o=await(0,nt.oraPromise)(()=>n.conversation.list().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var q=require("commander"),Y=require("ora");function rt({client:n,ora:t}){let e=new q.Command("labels").description("Labels");return e.addCommand(new q.Command("get").description("Find label").argument("<label>","Label ID").action(async o=>{let s=await(0,Y.oraPromise)(()=>n.label.get(o).json(),{...t,text:"Finding label"});console.log(s)})),e.addCommand(new q.Command("list").description("List labels").action(async()=>{let o=await(0,Y.oraPromise)(()=>n.label.list().json(),{...t,text:"Finding labels"});console.log(o)})),e.addCommand(new q.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async o=>{let s=await(0,Y.oraPromise)(()=>n.conversation.listByLabel(o).json(),{...t,text:"Finding conversations"});console.log(s)})),e}var it=require("commander"),St=require("ora");function at({client:n,ora:t}){let e=new it.Command("messages").description("Messages");return e.addCommand(new it.Command("list").description("List messages").action(async()=>{let o=await(0,St.oraPromise)(()=>n.message.list().json(),{...t,text:"Finding messages"});console.log(o)})),e}var z=require("commander"),pt=require("ora");function ct({client:n,ora:t}){let e=new z.Command("models").description("Models");return e.addCommand(new z.Command("get").description("Find model").argument("<model>","Model ID").action(async o=>{let s=await(0,pt.oraPromise)(()=>n.model.get(o).json(),{...t,text:"Finding model"});console.log(s)})),e.addCommand(new z.Command("list").description("List models").action(async()=>{let o=await(0,pt.oraPromise)(()=>n.model.list().json(),{...t,text:"Finding models"});console.log(o)})),e}var $=require("commander"),mt=require("ora");function dt({client:n,ora:t}){let e=new $.Command("sources").description("Sources");return e.addCommand(new $.Command("get").description("Find source").argument("<source>","Source ID").action(async o=>{let s=await(0,mt.oraPromise)(()=>n.source.get(o).json(),{...t,text:"Finding source"});console.log(s)})),e.addCommand(new $.Command("list").description("List sources").action(async()=>{let o=await(0,mt.oraPromise)(()=>n.source.list().json(),{...t,text:"Finding sources"});console.log(o)})),e}var wt=require("commander");var lt=require("commander"),At=require("ora");function ut({client:n,ora:t}){let e=new lt.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new lt.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let o=await(0,At.oraPromise)(()=>n.wellKnown.getNotifications().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(o)})),e}function Ct({client:n,ora:t}){let e=new wt.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(ut({client:n,ora:t})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new W(new m)},Mt=new Ut.Command("gds").description("Great Detail Support System").addCommand(Z(p)).addCommand(et(p)).addCommand(ot(p)).addCommand(st(p)).addCommand(rt(p)).addCommand(at(p)).addCommand(ct(p)).addCommand(dt(p)).addCommand(Ct(p)),Dt=Mt;Dt.parseAsync(process.argv);
|
|
2
|
+
"use strict";var Et=Object.create;var ht=Object.defineProperty;var xt=Object.getOwnPropertyDescriptor;var Pt=Object.getOwnPropertyNames;var Ft=Object.getPrototypeOf,kt=Object.prototype.hasOwnProperty;var Bt=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Pt(t))!kt.call(n,s)&&s!==e&&ht(n,s,{get:()=>t[s],enumerable:!(o=xt(t,s))||o.enumerable});return n};var ft=(n,t,e)=>(e=n!=null?Et(Ft(n)):{},Bt(t||!n||!n.__esModule?ht(e,"default",{value:n,enumerable:!0}):e,n));var Ut=require("commander");var m=class{getHeaders(){return{}}};var C=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}getCurrent({request:t={}}){return this._transport.send("v1/accounts/current",{...t,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/accounts",{...e,method:"POST",json:t})}};var h=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}delete(t,e,{body:o,request:s={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...s,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var f=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var O=class{constructor(t){this._transport=t}list({limit:t,sort:e,request:o={}}={}){return this._transport.send("v1/actions",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var Ot="SUPPORT_ACCESS_TOKEN",gt="SUPPORT_KEY_NAME",Rt="SUPPORT_KEY_PASSWORD",J="SUPPORT_SIGNING_KEY",bt="SUPPORT_BASE_URL";var g=class{name;#t;constructor({name:t=process.env[gt],password:e=process.env[Rt]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var R=class{#t;constructor({token:t=process.env[Ot]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var b=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var v=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByCategory=this.listByBoilerplateCategory;listByBoilerplateCategory(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t)+"/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var _=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}metaWhatsappGetBusinessProfile(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/meta-whatsapp/business-profile",{...e,method:"GET"})}twilioSendgridChannelSync(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/twilio-sendgrid/sync",{...o,method:"POST",json:e})}};var L=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var vt="https://api.support.greatdetail.com",_t={"X-Powered-By":"GDSupport/JavaScript"};var I=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}getRelativeVCFURL(t,{vcf:e={}}={}){let o=e.variant??"vcard",s=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(s)}getVCFURL(t,e={}){return this._transport.getURL(this.getRelativeVCFURL(t,e))}getVCF(t,e={}){return this._transport.send(this.getVCFURL(t,e),{method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var y=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}list({limit:t,filter:e,include:o,request:s={}}={}){return this._transport.send("v1/conversations",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var T=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,include:o,request:s={}}={}){return this._transport.send("v1/labels",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByConversation(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var S=class{constructor(t){this._transport=t}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}listByConversation(t,{limit:e,include:o,request:s={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:s={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o)]})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var A=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}createResponse(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,json:e})}createCorrection(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",json:e})}};var w=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}listByContact(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}createForConversation(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var U=class{constructor(t){this._transport=t}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",json:e})}};var D=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=_t;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var G=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}list({featured:t,category:e,request:o={}}={}){let s=[];if(e){let r=Array.isArray(e)?e:[e];for(let l of r)s.push(["category",l])}return t!==void 0&&s.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:s})}};var E=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};var Lt=ft(require("is-network-error"),1),K=ft(require("ky"),1);var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var d=class extends i{};var x=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var P=class extends d{static forbidden(){return new this("A forbidden request occurred")}};var c=class extends i{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var F=class extends i{};var u=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var k=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=K.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let s of this.options.requestFilterables){let r=s.getHeaders();for(let[l,Gt]of Object.entries(r))o.headers.has(l)||o.headers.set(l,Gt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,s]of Object.entries(t))s!==void 0&&e.push(["sort",s+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let o=this.client(t,e).catch(s=>{if((0,Lt.default)(s))throw new F("A network error occurred",{cause:s});if(s instanceof K.HTTPError){let r=s.response.status;switch(console.error(JSON.stringify(s.response)),r){case 400:throw u.badRequest();case 401:throw x.unauthenticated();case 403:throw P.forbidden();case 404:throw c.notFound(t);case 405:throw c.forbiddenMethod(t,e.method??"GET");case 415:throw u.unsupportedMediaType();case 418:throw c.teapot();case 429:throw c.rateLimited()}if(r>=500&&r<600)throw i.serverError(r)}throw s});return{response:()=>o,json:async()=>(await o).json()}}};var B=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}create({account:t,files:e,request:o={}}){let s=new FormData;for(let r of e)s.append("file",r);return this._transport.send("v1/uploads",{...o,method:"POST",body:s,searchParams:{account:t}})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var a=require("zod"),It=a.z.object({data:a.z.object({event:a.z.object({id:a.z.string(),type:a.z.string(),payload:a.z.record(a.z.string()),createdAt:a.z.string().datetime()})})});var M=class{constructor(t){this._transport=t}async event({key:t=process.env[J],maxSignatures:e=3,request:o}){let s=o.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+J);if(!s)throw new Error("Missing signature header");if(!this._verifySignature(t,o.body,Array.isArray(s)?s.slice(0,e):[s]))throw new Error("Untrusted signature")}let{data:r}=It.parse(o.body);return{event:r.event}}async _verifySignature(t,e,o){let s=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let r of o)if(await crypto.subtle.verify("HMAC",s,new TextEncoder().encode(atob(r)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var N=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/webhooks/subscriptions",{...t,method:"GET"})}test(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t)+"/test",{...e,method:"POST"})}create({body:t,request:e={}}){return this._transport.send("v1/webhooks/subscriptions",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var j=class{constructor(t){this._transport=t}getNotifications({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var W=class n{static DEFAULT_BASE_URL=vt;static PublicAuthentication=m;static BasicAuthentication=g;static BearerAuthentication=R;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;compositionSection;contact;conversation;label;message;model;note;notificationSubscription;source;statistics;upload;webhook;webhookSubscription;wellKnown;constructor(t,{baseURL:e,...o}={}){this._transport=new k({requestFilterables:[new D,t],...o,baseURL:e?.toString()??n.getBaseURL()}),this.account=new C(this._transport),this.accountAccessToken=new h(this._transport),this.accountConversationSettings=new f(this._transport),this.action=new O(this._transport),this.boilerplateCategory=new b(this._transport),this.boilerplateContent=new v(this._transport),this.channel=new _(this._transport),this.compositionSection=new L(this._transport),this.contact=new I(this._transport),this.conversation=new y(this._transport),this.label=new T(this._transport),this.message=new S(this._transport),this.model=new A(this._transport),this.note=new w(this._transport),this.notificationSubscription=new U(this._transport),this.source=new G(this._transport),this.statistics=new E(this._transport),this.upload=new B(this._transport),this.webhook=new M(this._transport),this.webhookSubscription=new N(this._transport),this.wellKnown=new j(this._transport)}static getBaseURL(){return process.env[bt]??this.DEFAULT_BASE_URL}};var X=require("commander"),yt=require("ora");function Z({client:n,ora:t}){let e=new X.Command("actions").description("Actions");return e.addCommand(new X.Command("list").description("List actions").action(async()=>{let o=await(0,yt.oraPromise)(()=>n.action.list().json(),{...t,text:"Finding actions"});console.log(o)})),e}var tt=require("commander"),Tt=require("ora");function et({client:n,ora:t}){let e=new tt.Command("channels").description("Channels");return e.addCommand(new tt.Command("list").description("List channels").action(async()=>{let o=await(0,Tt.oraPromise)(()=>n.channel.list().json(),{...t,text:"Finding channels"});console.log(o)})),e}var Q=require("commander"),V=require("ora");function ot({client:n,ora:t}){let e=new Q.Command("contacts").description("Contacts");return e.addCommand(new Q.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async o=>{let s=await(0,V.oraPromise)(()=>n.contact.get(o).json(),{...t,text:"Finding contact"});console.log(s)})),e.addCommand(new Q.Command("list").description("List contacts").action(async()=>{let o=await(0,V.oraPromise)(()=>n.contact.list().json(),{...t,text:"Finding contacts"});console.log(o)})),e.addCommand(new Q.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async o=>{let s=await(0,V.oraPromise)(()=>n.contact.getVCF(o).response(),{...t,text:"Exporting contact"});console.log(s)})),e}var H=require("commander"),nt=require("ora");function st({client:n,ora:t}){let e=new H.Command("conversations").description("Conversations");return e.addCommand(new H.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async o=>{let s=await(0,nt.oraPromise)(()=>n.conversation.get(o).json(),{...t,text:"Finding conversation"});console.log(s)})),e.addCommand(new H.Command("list").description("List conversations").action(async()=>{let o=await(0,nt.oraPromise)(()=>n.conversation.list().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var q=require("commander"),Y=require("ora");function rt({client:n,ora:t}){let e=new q.Command("labels").description("Labels");return e.addCommand(new q.Command("get").description("Find label").argument("<label>","Label ID").action(async o=>{let s=await(0,Y.oraPromise)(()=>n.label.get(o).json(),{...t,text:"Finding label"});console.log(s)})),e.addCommand(new q.Command("list").description("List labels").action(async()=>{let o=await(0,Y.oraPromise)(()=>n.label.list().json(),{...t,text:"Finding labels"});console.log(o)})),e.addCommand(new q.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async o=>{let s=await(0,Y.oraPromise)(()=>n.conversation.listByLabel(o).json(),{...t,text:"Finding conversations"});console.log(s)})),e}var it=require("commander"),St=require("ora");function at({client:n,ora:t}){let e=new it.Command("messages").description("Messages");return e.addCommand(new it.Command("list").description("List messages").action(async()=>{let o=await(0,St.oraPromise)(()=>n.message.list().json(),{...t,text:"Finding messages"});console.log(o)})),e}var z=require("commander"),pt=require("ora");function ct({client:n,ora:t}){let e=new z.Command("models").description("Models");return e.addCommand(new z.Command("get").description("Find model").argument("<model>","Model ID").action(async o=>{let s=await(0,pt.oraPromise)(()=>n.model.get(o).json(),{...t,text:"Finding model"});console.log(s)})),e.addCommand(new z.Command("list").description("List models").action(async()=>{let o=await(0,pt.oraPromise)(()=>n.model.list().json(),{...t,text:"Finding models"});console.log(o)})),e}var $=require("commander"),mt=require("ora");function dt({client:n,ora:t}){let e=new $.Command("sources").description("Sources");return e.addCommand(new $.Command("get").description("Find source").argument("<source>","Source ID").action(async o=>{let s=await(0,mt.oraPromise)(()=>n.source.get(o).json(),{...t,text:"Finding source"});console.log(s)})),e.addCommand(new $.Command("list").description("List sources").action(async()=>{let o=await(0,mt.oraPromise)(()=>n.source.list().json(),{...t,text:"Finding sources"});console.log(o)})),e}var wt=require("commander");var lt=require("commander"),At=require("ora");function ut({client:n,ora:t}){let e=new lt.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new lt.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let o=await(0,At.oraPromise)(()=>n.wellKnown.getNotifications().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(o)})),e}function Ct({client:n,ora:t}){let e=new wt.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(ut({client:n,ora:t})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new W(new m)},Mt=new Ut.Command("gds").description("Great Detail Support System").addCommand(Z(p)).addCommand(et(p)).addCommand(ot(p)).addCommand(st(p)).addCommand(rt(p)).addCommand(at(p)).addCommand(ct(p)).addCommand(dt(p)).addCommand(Ct(p)),Dt=Mt;Dt.parseAsync(process.argv);
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as r}from"./chunk-
|
|
2
|
+
import{a as r}from"./chunk-BF7QHNJE.js";import"./chunk-5YOY53RX.js";r.parseAsync(process.argv);
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var rt=Object.create;var Q=Object.defineProperty;var nt=Object.getOwnPropertyDescriptor;var it=Object.getOwnPropertyNames;var pt=Object.getPrototypeOf,at=Object.prototype.hasOwnProperty;var Y=(s,t)=>{for(var e in t)Q(s,e,{get:t[e],enumerable:!0})},z=(s,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of it(t))!at.call(s,r)&&r!==e&&Q(s,r,{get:()=>t[r],enumerable:!(o=nt(t,r))||o.enumerable});return s};var $=(s,t,e)=>(e=s!=null?rt(pt(s)):{},z(t||!s||!s.__esModule?Q(e,"default",{value:s,enumerable:!0}):e,s)),ct=s=>z(Q({},"__esModule",{value:!0}),s);var mt={};Y(mt,{Client:()=>h,DEFAULT_SUPPORT_BASE_URL:()=>j,Error:()=>K,default:()=>h,eventWebhookSchema:()=>H});module.exports=ct(mt);var j="https://api.support.greatdetail.com",J={"X-Powered-By":"GDSupport/JavaScript"};var C=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}getCurrent({request:t={}}){return this._transport.send("v1/accounts/current",{...t,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/accounts",{...e,method:"POST",json:t})}};var R=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}delete(t,e,{body:o,request:r={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...r,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var b=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var O=class{constructor(t){this._transport=t}list({limit:t,sort:e,request:o={}}={}){return this._transport.send("v1/actions",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var X="SUPPORT_ACCESS_TOKEN",Z="SUPPORT_KEY_NAME",tt="SUPPORT_KEY_PASSWORD",V="SUPPORT_SIGNING_KEY",et="SUPPORT_BASE_URL";var x=class{name;#t;constructor({name:t=process.env[Z],password:e=process.env[tt]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var g=class{#t;constructor({token:t=process.env[X]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var v=class{getHeaders(){return{}}};var _=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var L=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByCategory=this.listByBoilerplateCategory;listByBoilerplateCategory(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t)+"/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var T=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}metaWhatsappGetBusinessProfile(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/meta-whatsapp/business-profile",{...e,method:"GET"})}twilioSendgridChannelSync(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/twilio-sendgrid/sync",{...o,method:"POST",json:e})}};var I=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var A=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}getRelativeVCFURL(t,{vcf:e={}}={}){let o=e.variant??"vcard",r=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(r)}getVCFURL(t,e={}){return this._transport.getURL(this.getRelativeVCFURL(t,e))}getVCF(t,e={}){return this._transport.send(this.getVCFURL(t,e),{method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var S=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}list({limit:t,filter:e,include:o,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var y=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,include:o,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByConversation(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var U=class{constructor(t){this._transport=t}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}listByConversation(t,{limit:e,include:o,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o)]})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var E=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}createResponse(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,json:e})}createCorrection(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",json:e})}};var G=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}listByContact(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}createForConversation(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var D=class{constructor(t){this._transport=t}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",json:e})}};var w=class s{constructor(t=s.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=J;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var P=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}list({featured:t,category:e,request:o={}}={}){let r=[];if(e){let i=Array.isArray(e)?e:[e];for(let f of i)r.push(["category",f])}return t!==void 0&&r.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:r})}};var k=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};var ot=$(require("is-network-error"),1),q=$(require("ky"),1);var n=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var a=class extends n{};var l=class extends a{static unauthenticated(){return new this("An unauthenticated request occurred")}};var d=class extends a{static forbidden(){return new this("A forbidden request occurred")}};var p=class extends n{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var u=class extends n{};var m=class extends n{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var B=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=q.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let r of this.options.requestFilterables){let i=r.getHeaders();for(let[f,st]of Object.entries(i))o.headers.has(f)||o.headers.set(f,st)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,r]of Object.entries(t))r!==void 0&&e.push(["sort",r+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let o=this.client(t,e).catch(r=>{if((0,ot.default)(r))throw new u("A network error occurred",{cause:r});if(r instanceof q.HTTPError){let i=r.response.status;switch(console.error(JSON.stringify(r.response)),i){case 400:throw m.badRequest();case 401:throw l.unauthenticated();case 403:throw d.forbidden();case 404:throw p.notFound(t);case 405:throw p.forbiddenMethod(t,e.method??"GET");case 415:throw m.unsupportedMediaType();case 418:throw p.teapot();case 429:throw p.rateLimited()}if(i>=500&&i<600)throw n.serverError(i)}throw r});return{response:()=>o,json:async()=>(await o).json()}}};var F=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}create({account:t,files:e,request:o={}}){let r=new FormData;for(let i of e)r.append("file",i);return this._transport.send("v1/uploads",{...o,method:"POST",body:r,searchParams:{account:t}})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var c=require("zod"),H=c.z.object({data:c.z.object({event:c.z.object({id:c.z.string(),type:c.z.string(),payload:c.z.record(c.z.string()),createdAt:c.z.string().datetime()})})});var M=class{constructor(t){this._transport=t}async event({key:t=process.env[V],maxSignatures:e=3,request:o}){let r=o.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+V);if(!r)throw new Error("Missing signature header");if(!this._verifySignature(t,o.body,Array.isArray(r)?r.slice(0,e):[r]))throw new Error("Untrusted signature")}let{data:i}=H.parse(o.body);return{event:i.event}}async _verifySignature(t,e,o){let r=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let i of o)if(await crypto.subtle.verify("HMAC",r,new TextEncoder().encode(atob(i)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var N=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/webhooks/subscriptions",{...t,method:"GET"})}test(t,{request:e={}}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t)+"/test",{...e,method:"POST"})}create({body:t,request:e={}}){return this._transport.send("v1/webhooks/subscriptions",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var W=class{constructor(t){this._transport=t}getNotifications({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var h=class s{static DEFAULT_BASE_URL=j;static PublicAuthentication=v;static BasicAuthentication=x;static BearerAuthentication=g;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;compositionSection;contact;conversation;label;message;model;note;notificationSubscription;source;statistics;upload;webhook;webhookSubscription;wellKnown;constructor(t,{baseURL:e,...o}={}){this._transport=new B({requestFilterables:[new w,t],...o,baseURL:e?.toString()??s.getBaseURL()}),this.account=new C(this._transport),this.accountAccessToken=new R(this._transport),this.accountConversationSettings=new b(this._transport),this.action=new O(this._transport),this.boilerplateCategory=new _(this._transport),this.boilerplateContent=new L(this._transport),this.channel=new T(this._transport),this.compositionSection=new I(this._transport),this.contact=new A(this._transport),this.conversation=new S(this._transport),this.label=new y(this._transport),this.message=new U(this._transport),this.model=new E(this._transport),this.note=new G(this._transport),this.notificationSubscription=new D(this._transport),this.source=new P(this._transport),this.statistics=new k(this._transport),this.upload=new F(this._transport),this.webhook=new M(this._transport),this.webhookSubscription=new N(this._transport),this.wellKnown=new W(this._transport)}static getBaseURL(){return process.env[et]??this.DEFAULT_BASE_URL}};var K={};Y(K,{AuthError:()=>a,AuthenticationError:()=>l,AuthorizationError:()=>d,LogicError:()=>p,NetworkError:()=>u,SupportError:()=>n,ValidationError:()=>m});0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,Error,eventWebhookSchema});
|
|
1
|
+
"use strict";var rt=Object.create;var Q=Object.defineProperty;var nt=Object.getOwnPropertyDescriptor;var it=Object.getOwnPropertyNames;var pt=Object.getPrototypeOf,at=Object.prototype.hasOwnProperty;var Y=(s,t)=>{for(var e in t)Q(s,e,{get:t[e],enumerable:!0})},z=(s,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of it(t))!at.call(s,r)&&r!==e&&Q(s,r,{get:()=>t[r],enumerable:!(o=nt(t,r))||o.enumerable});return s};var $=(s,t,e)=>(e=s!=null?rt(pt(s)):{},z(t||!s||!s.__esModule?Q(e,"default",{value:s,enumerable:!0}):e,s)),ct=s=>z(Q({},"__esModule",{value:!0}),s);var mt={};Y(mt,{Client:()=>h,DEFAULT_SUPPORT_BASE_URL:()=>j,Error:()=>K,default:()=>h,eventWebhookSchema:()=>H});module.exports=ct(mt);var j="https://api.support.greatdetail.com",J={"X-Powered-By":"GDSupport/JavaScript"};var C=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}getCurrent({request:t={}}){return this._transport.send("v1/accounts/current",{...t,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/accounts",{...e,method:"POST",json:t})}};var R=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}delete(t,e,{body:o,request:r={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...r,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var b=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var O=class{constructor(t){this._transport=t}list({limit:t,sort:e,request:o={}}={}){return this._transport.send("v1/actions",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var X="SUPPORT_ACCESS_TOKEN",Z="SUPPORT_KEY_NAME",tt="SUPPORT_KEY_PASSWORD",V="SUPPORT_SIGNING_KEY",et="SUPPORT_BASE_URL";var x=class{name;#t;constructor({name:t=process.env[Z],password:e=process.env[tt]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var g=class{#t;constructor({token:t=process.env[X]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var v=class{getHeaders(){return{}}};var _=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var L=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByCategory=this.listByBoilerplateCategory;listByBoilerplateCategory(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t)+"/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var T=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}metaWhatsappGetBusinessProfile(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/meta-whatsapp/business-profile",{...e,method:"GET"})}twilioSendgridChannelSync(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/twilio-sendgrid/sync",{...o,method:"POST",json:e})}};var I=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var A=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}getRelativeVCFURL(t,{vcf:e={}}={}){let o=e.variant??"vcard",r=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(r)}getVCFURL(t,e={}){return this._transport.getURL(this.getRelativeVCFURL(t,e))}getVCF(t,e={}){return this._transport.send(this.getVCFURL(t,e),{method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var S=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}list({limit:t,filter:e,include:o,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var y=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,include:o,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByConversation(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var U=class{constructor(t){this._transport=t}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}listByConversation(t,{limit:e,include:o,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o)]})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var E=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}createResponse(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,json:e})}createCorrection(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",json:e})}};var G=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}listByContact(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}createForConversation(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var D=class{constructor(t){this._transport=t}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",json:e})}};var w=class s{constructor(t=s.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=J;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var P=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}list({featured:t,category:e,request:o={}}={}){let r=[];if(e){let i=Array.isArray(e)?e:[e];for(let f of i)r.push(["category",f])}return t!==void 0&&r.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:r})}};var k=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};var ot=$(require("is-network-error"),1),q=$(require("ky"),1);var n=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var a=class extends n{};var l=class extends a{static unauthenticated(){return new this("An unauthenticated request occurred")}};var d=class extends a{static forbidden(){return new this("A forbidden request occurred")}};var p=class extends n{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var u=class extends n{};var m=class extends n{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var B=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=q.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let r of this.options.requestFilterables){let i=r.getHeaders();for(let[f,st]of Object.entries(i))o.headers.has(f)||o.headers.set(f,st)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,r]of Object.entries(t))r!==void 0&&e.push(["sort",r+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let o=this.client(t,e).catch(r=>{if((0,ot.default)(r))throw new u("A network error occurred",{cause:r});if(r instanceof q.HTTPError){let i=r.response.status;switch(console.error(JSON.stringify(r.response)),i){case 400:throw m.badRequest();case 401:throw l.unauthenticated();case 403:throw d.forbidden();case 404:throw p.notFound(t);case 405:throw p.forbiddenMethod(t,e.method??"GET");case 415:throw m.unsupportedMediaType();case 418:throw p.teapot();case 429:throw p.rateLimited()}if(i>=500&&i<600)throw n.serverError(i)}throw r});return{response:()=>o,json:async()=>(await o).json()}}};var F=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}create({account:t,files:e,request:o={}}){let r=new FormData;for(let i of e)r.append("file",i);return this._transport.send("v1/uploads",{...o,method:"POST",body:r,searchParams:{account:t}})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var c=require("zod"),H=c.z.object({data:c.z.object({event:c.z.object({id:c.z.string(),type:c.z.string(),payload:c.z.record(c.z.string()),createdAt:c.z.string().datetime()})})});var M=class{constructor(t){this._transport=t}async event({key:t=process.env[V],maxSignatures:e=3,request:o}){let r=o.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+V);if(!r)throw new Error("Missing signature header");if(!this._verifySignature(t,o.body,Array.isArray(r)?r.slice(0,e):[r]))throw new Error("Untrusted signature")}let{data:i}=H.parse(o.body);return{event:i.event}}async _verifySignature(t,e,o){let r=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let i of o)if(await crypto.subtle.verify("HMAC",r,new TextEncoder().encode(atob(i)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var N=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/webhooks/subscriptions",{...t,method:"GET"})}test(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t)+"/test",{...e,method:"POST"})}create({body:t,request:e={}}){return this._transport.send("v1/webhooks/subscriptions",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var W=class{constructor(t){this._transport=t}getNotifications({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var h=class s{static DEFAULT_BASE_URL=j;static PublicAuthentication=v;static BasicAuthentication=x;static BearerAuthentication=g;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;compositionSection;contact;conversation;label;message;model;note;notificationSubscription;source;statistics;upload;webhook;webhookSubscription;wellKnown;constructor(t,{baseURL:e,...o}={}){this._transport=new B({requestFilterables:[new w,t],...o,baseURL:e?.toString()??s.getBaseURL()}),this.account=new C(this._transport),this.accountAccessToken=new R(this._transport),this.accountConversationSettings=new b(this._transport),this.action=new O(this._transport),this.boilerplateCategory=new _(this._transport),this.boilerplateContent=new L(this._transport),this.channel=new T(this._transport),this.compositionSection=new I(this._transport),this.contact=new A(this._transport),this.conversation=new S(this._transport),this.label=new y(this._transport),this.message=new U(this._transport),this.model=new E(this._transport),this.note=new G(this._transport),this.notificationSubscription=new D(this._transport),this.source=new P(this._transport),this.statistics=new k(this._transport),this.upload=new F(this._transport),this.webhook=new M(this._transport),this.webhookSubscription=new N(this._transport),this.wellKnown=new W(this._transport)}static getBaseURL(){return process.env[et]??this.DEFAULT_BASE_URL}};var K={};Y(K,{AuthError:()=>a,AuthenticationError:()=>l,AuthorizationError:()=>d,LogicError:()=>p,NetworkError:()=>u,SupportError:()=>n,ValidationError:()=>m});0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,Error,eventWebhookSchema});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Account, k as AccountAccessToken, l as AccountAccessTokenID, u as AccountConversationSettings, b as AccountID, B as Action, E as ActionID, b0 as ActiveConversationStatus, $ as BoilerplateCategory, a0 as BoilerplateCategoryID, I as BoilerplateContent, J as BoilerplateContentID, ac as Channel, ad as ChannelID, C as Client, at as CompositionSection, au as CompositionSectionID, b1 as ConcludedConversationStatus, aH as Contact, aI as ContactID, a_ as Conversation, a$ as ConversationID, b2 as ConversationStatus, n as CreateAccountAccessTokenOptions, m as CreateAccountAccessTokenPayload, o as CreateAccountAccessTokenResponse, d as CreateAccountOptions, c as CreateAccountPayload, e as CreateAccountResponse, a2 as CreateBoilerplateCategoryOptions, a1 as CreateBoilerplateCategoryPayload, a3 as CreateBoilerplateCategoryResponse, M as CreateBoilerplateContentOptions, K as CreateBoilerplateContentPayload, N as CreateBoilerplateContentResponse, af as CreateChannelOptions, ae as CreateChannelPayload, ag as CreateChannelResponse, aw as CreateCompositionSectionOptions, av as CreateCompositionSectionPayload, ax as CreateCompositionSectionResponse, cb as CreateContactNoteOptions, ca as CreateContactNotePayload, cc as CreateContactNoteResponse, cy as CreateContactNotificationSubscriptionOptions, cx as CreateContactNotificationSubscriptionPayload, cz as CreateContactNotificationSubscriptionResponse, aL as CreateContactOptions, aK as CreateContactPayload, aM as CreateContactResponse, ce as CreateConversationNoteOptions, cd as CreateConversationNotePayload, cf as CreateConversationNoteResponse, b4 as CreateConversationOptions, b3 as CreateConversationPayload, b5 as CreateConversationResponse, b$ as CreateCorrectionModelOptions, b_ as CreateCorrectionModelPayload, c0 as CreateCorrectionResponse, bq as CreateLabelOptions, bp as CreateLabelPayload, br as CreateLabelResponse, bJ as CreateMessageOptions, bI as CreateMessagePayload, bK as CreateMessageResponse, c2 as CreateResponseModelOptions, c1 as CreateResponseModelPayload, c3 as CreateResponseResponse, cC as CreateUploadOptions, cD as CreateUploadResponse, cP as CreateWebhookSubscriptionOptions, cO as CreateWebhookSubscriptionPayload, cQ as CreateWebhookSubscriptionResponse, aJ as CustomMetadata, p as DeleteAccountAccessTokenOptions, D as DeleteAccountAccessTokenPayload, q as DeleteAccountAccessTokenResponse, aN as DeleteContactOptions, aO as DeleteContactResponse, b6 as DeleteConversationOptions, b7 as DeleteConversationResponse, bs as DeleteLabelOptions, bt as DeleteLabelResponse, bL as DeleteMessageOptions, bM as DeleteMessageResponse, cE as DeleteUploadOptions, cF as DeleteUploadResponse, cR as DeleteWebhookSubscriptionOptions, cS as DeleteWebhookSubscriptionResponse, cJ as EventWebhookOptions, bg as FilterOptions, r as GetAccountAccessTokenOptions, s as GetAccountAccessTokenResponse, v as GetAccountConversationSettingsOptions, w as GetAccountConversationSettingsResponse, G as GetAccountOptions, f as GetAccountResponse, a4 as GetBoilerplateCategoryOptions, a5 as GetBoilerplateCategoryResponse, P as GetBoilerplateContentOptions, Q as GetBoilerplateContentResponse, ah as GetChannelOptions, ai as GetChannelResponse, ay as GetCompositionSectionOptions, az as GetCompositionSectionResponse, aP as GetContactIncludeOptions, aQ as GetContactOptions, aR as GetContactResponse, aS as GetContactVCFOptions, b8 as GetConversationIncludeOptions, b9 as GetConversationOptions, ba as GetConversationResponse, g as GetCurrentAccountOptions, h as GetCurrentAccountResponse, bu as GetLabelOptions, bv as GetLabelResponse, c4 as GetModelOptions, c5 as GetModelResponse, cg as GetNoteOptions, ch as GetNoteResponse, c_ as GetNotificationWellKnownResponse, cr as GetSourceOptions, cs as GetSourceResponse, cG as GetUploadOptions, cH as GetUploadResponse, cT as GetWebhookSubscriptionOptions, cU as GetWebhookSubscriptionResponse, bo as Label, bw as LabelID, L as ListAccountAccessTokensOptions, t as ListAccountAccessTokensResponse, F as ListActionsOptions, H as ListActionsResponse, a6 as ListBoilerplateCategoriesIncludeOptions, a7 as ListBoilerplateCategoriesOptions, a8 as ListBoilerplateCategoriesResponse, T as ListBoilerplateCategoryBoilerplateContentsOptions, V as ListBoilerplateCategoryBoilerplateContentsResponse, W as ListBoilerplateContentsOptions, X as ListBoilerplateContentsResponse, aA as ListChannelCompositionSectionsOptions, aB as ListChannelCompositionSectionsResponse, bb as ListChannelConversationsOptions, bc as ListChannelConversationsResponse, bN as ListChannelMessagesIncludeOptions, bO as ListChannelMessagesOptions, bP as ListChannelMessagesResponse, aj as ListChannelsOptions, ak as ListChannelsResponse, aC as ListCompositionSectionsOptions, aD as ListCompositionSectionsResponse, bd as ListContactConversationsOptions, be as ListContactConversationsResponse, bx as ListContactLabelsOptions, by as ListContactLabelsResponse, ci as ListContactNotesOptions, cj as ListContactNotesResponse, aT as ListContactsOptions, aU as ListContactsResponse, bz as ListConversationLabelsOptions, bA as ListConversationLabelsResponse, bQ as ListConversationMessagesIncludeOptions, bR as ListConversationMessagesOptions, bS as ListConversationMessagesResponse, ck as ListConversationNotesOptions, cl as ListConversationNotesResponse, bh as ListConversationOptions, bf as ListConversationsIncludeOptions, bi as ListConversationsResponse, aV as ListLabelContactsOptions, aW as ListLabelContactsResponse, bj as ListLabelConversationsOptions, bk as ListLabelConversationsResponse, bB as ListLabelsIncludeOptions, bC as ListLabelsOptions, bD as ListLabelsResponse, bT as ListMessagesIncludeOptions, bU as ListMessagesOptions, bV as ListMessagesResponse, c6 as ListModelsOptions, c7 as ListModelsResponse, ct as ListSourcesOptions, cu as ListSourcesResponse, cV as ListWebhookSubscriptionsOptions, cW as ListWebhookSubscriptionsResponse, bH as Message, bW as MessageID, bX as MessageRole, bY as MessageStatus, al as MetaWhatsappChannelGetBusinessProfileOptions, am as MetaWhatsappChannelGetBusinessProfileResponse, bZ as Model, c8 as ModelID, c9 as Note, cm as NoteID, cw as NotificationSubscription, cA as NotificationSubscriptionID, O as Options, R as RequestFilterable, S as SortOptions, cq as Source, cv as SourceID, cX as TestWebhookSubscriptionOptions, cY as TestWebhookSubscriptionResponse, a as TransportOptions, an as TwilioSendChannelSyncPayload, ao as TwilioSendgridChannelSyncOptions, ap as TwilioSendgridChannelSyncResponse, y as UpdateAccountConversationSettingsOptions, x as UpdateAccountConversationSettingsPayload, z as UpdateAccountConversationSettingsResponse, i as UpdateAccountOptions, U as UpdateAccountPayload, j as UpdateAccountResponse, aa as UpdateBoilerplateCategoryOptions, a9 as UpdateBoilerplateCategoryPayload, ab as UpdateBoilerplateCategoryResponse, Z as UpdateBoilerplateContentOptions, Y as UpdateBoilerplateContentPayload, _ as UpdateBoilerplateContentResponse, ar as UpdateChannelOptions, aq as UpdateChannelPayload, as as UpdateChannelResponse, aF as UpdateCompositionSectionOptions, aE as UpdateCompositionSectionPayload, aG as UpdateCompositionSectionResponse, aY as UpdateContactOptions, aX as UpdateContactPayload, aZ as UpdateContactResponse, bm as UpdateConversationOptions, bl as UpdateConversationPayload, bn as UpdateConversationResponse, bF as UpdateLabelOptions, bE as UpdateLabelPayload, bG as UpdateLabelResponse, co as UpdateNoteOptions, cn as UpdateNotePayload, cp as UpdateNoteResponse, cB as Upload, cI as UploadID, cL as WebhookEventPayload, cM as WebhookResponse, cN as WebhookSubscription, cZ as WebhookSubscriptionID, C as default, cK as eventWebhookSchema } from './Client-
|
|
1
|
+
export { A as Account, k as AccountAccessToken, l as AccountAccessTokenID, u as AccountConversationSettings, b as AccountID, B as Action, E as ActionID, b0 as ActiveConversationStatus, $ as BoilerplateCategory, a0 as BoilerplateCategoryID, I as BoilerplateContent, J as BoilerplateContentID, ac as Channel, ad as ChannelID, C as Client, at as CompositionSection, au as CompositionSectionID, b1 as ConcludedConversationStatus, aH as Contact, aI as ContactID, a_ as Conversation, a$ as ConversationID, b2 as ConversationStatus, n as CreateAccountAccessTokenOptions, m as CreateAccountAccessTokenPayload, o as CreateAccountAccessTokenResponse, d as CreateAccountOptions, c as CreateAccountPayload, e as CreateAccountResponse, a2 as CreateBoilerplateCategoryOptions, a1 as CreateBoilerplateCategoryPayload, a3 as CreateBoilerplateCategoryResponse, M as CreateBoilerplateContentOptions, K as CreateBoilerplateContentPayload, N as CreateBoilerplateContentResponse, af as CreateChannelOptions, ae as CreateChannelPayload, ag as CreateChannelResponse, aw as CreateCompositionSectionOptions, av as CreateCompositionSectionPayload, ax as CreateCompositionSectionResponse, cb as CreateContactNoteOptions, ca as CreateContactNotePayload, cc as CreateContactNoteResponse, cy as CreateContactNotificationSubscriptionOptions, cx as CreateContactNotificationSubscriptionPayload, cz as CreateContactNotificationSubscriptionResponse, aL as CreateContactOptions, aK as CreateContactPayload, aM as CreateContactResponse, ce as CreateConversationNoteOptions, cd as CreateConversationNotePayload, cf as CreateConversationNoteResponse, b4 as CreateConversationOptions, b3 as CreateConversationPayload, b5 as CreateConversationResponse, b$ as CreateCorrectionModelOptions, b_ as CreateCorrectionModelPayload, c0 as CreateCorrectionResponse, bq as CreateLabelOptions, bp as CreateLabelPayload, br as CreateLabelResponse, bJ as CreateMessageOptions, bI as CreateMessagePayload, bK as CreateMessageResponse, c2 as CreateResponseModelOptions, c1 as CreateResponseModelPayload, c3 as CreateResponseResponse, cC as CreateUploadOptions, cD as CreateUploadResponse, cP as CreateWebhookSubscriptionOptions, cO as CreateWebhookSubscriptionPayload, cQ as CreateWebhookSubscriptionResponse, aJ as CustomMetadata, p as DeleteAccountAccessTokenOptions, D as DeleteAccountAccessTokenPayload, q as DeleteAccountAccessTokenResponse, aN as DeleteContactOptions, aO as DeleteContactResponse, b6 as DeleteConversationOptions, b7 as DeleteConversationResponse, bs as DeleteLabelOptions, bt as DeleteLabelResponse, bL as DeleteMessageOptions, bM as DeleteMessageResponse, cE as DeleteUploadOptions, cF as DeleteUploadResponse, cR as DeleteWebhookSubscriptionOptions, cS as DeleteWebhookSubscriptionResponse, cJ as EventWebhookOptions, bg as FilterOptions, r as GetAccountAccessTokenOptions, s as GetAccountAccessTokenResponse, v as GetAccountConversationSettingsOptions, w as GetAccountConversationSettingsResponse, G as GetAccountOptions, f as GetAccountResponse, a4 as GetBoilerplateCategoryOptions, a5 as GetBoilerplateCategoryResponse, P as GetBoilerplateContentOptions, Q as GetBoilerplateContentResponse, ah as GetChannelOptions, ai as GetChannelResponse, ay as GetCompositionSectionOptions, az as GetCompositionSectionResponse, aP as GetContactIncludeOptions, aQ as GetContactOptions, aR as GetContactResponse, aS as GetContactVCFOptions, b8 as GetConversationIncludeOptions, b9 as GetConversationOptions, ba as GetConversationResponse, g as GetCurrentAccountOptions, h as GetCurrentAccountResponse, bu as GetLabelOptions, bv as GetLabelResponse, c4 as GetModelOptions, c5 as GetModelResponse, cg as GetNoteOptions, ch as GetNoteResponse, c_ as GetNotificationWellKnownResponse, cr as GetSourceOptions, cs as GetSourceResponse, cG as GetUploadOptions, cH as GetUploadResponse, cT as GetWebhookSubscriptionOptions, cU as GetWebhookSubscriptionResponse, bo as Label, bw as LabelID, L as ListAccountAccessTokensOptions, t as ListAccountAccessTokensResponse, F as ListActionsOptions, H as ListActionsResponse, a6 as ListBoilerplateCategoriesIncludeOptions, a7 as ListBoilerplateCategoriesOptions, a8 as ListBoilerplateCategoriesResponse, T as ListBoilerplateCategoryBoilerplateContentsOptions, V as ListBoilerplateCategoryBoilerplateContentsResponse, W as ListBoilerplateContentsOptions, X as ListBoilerplateContentsResponse, aA as ListChannelCompositionSectionsOptions, aB as ListChannelCompositionSectionsResponse, bb as ListChannelConversationsOptions, bc as ListChannelConversationsResponse, bN as ListChannelMessagesIncludeOptions, bO as ListChannelMessagesOptions, bP as ListChannelMessagesResponse, aj as ListChannelsOptions, ak as ListChannelsResponse, aC as ListCompositionSectionsOptions, aD as ListCompositionSectionsResponse, bd as ListContactConversationsOptions, be as ListContactConversationsResponse, bx as ListContactLabelsOptions, by as ListContactLabelsResponse, ci as ListContactNotesOptions, cj as ListContactNotesResponse, aT as ListContactsOptions, aU as ListContactsResponse, bz as ListConversationLabelsOptions, bA as ListConversationLabelsResponse, bQ as ListConversationMessagesIncludeOptions, bR as ListConversationMessagesOptions, bS as ListConversationMessagesResponse, ck as ListConversationNotesOptions, cl as ListConversationNotesResponse, bh as ListConversationOptions, bf as ListConversationsIncludeOptions, bi as ListConversationsResponse, aV as ListLabelContactsOptions, aW as ListLabelContactsResponse, bj as ListLabelConversationsOptions, bk as ListLabelConversationsResponse, bB as ListLabelsIncludeOptions, bC as ListLabelsOptions, bD as ListLabelsResponse, bT as ListMessagesIncludeOptions, bU as ListMessagesOptions, bV as ListMessagesResponse, c6 as ListModelsOptions, c7 as ListModelsResponse, ct as ListSourcesOptions, cu as ListSourcesResponse, cV as ListWebhookSubscriptionsOptions, cW as ListWebhookSubscriptionsResponse, bH as Message, bW as MessageID, bX as MessageRole, bY as MessageStatus, al as MetaWhatsappChannelGetBusinessProfileOptions, am as MetaWhatsappChannelGetBusinessProfileResponse, bZ as Model, c8 as ModelID, c9 as Note, cm as NoteID, cw as NotificationSubscription, cA as NotificationSubscriptionID, O as Options, R as RequestFilterable, S as SortOptions, cq as Source, cv as SourceID, cX as TestWebhookSubscriptionOptions, cY as TestWebhookSubscriptionResponse, a as TransportOptions, an as TwilioSendChannelSyncPayload, ao as TwilioSendgridChannelSyncOptions, ap as TwilioSendgridChannelSyncResponse, y as UpdateAccountConversationSettingsOptions, x as UpdateAccountConversationSettingsPayload, z as UpdateAccountConversationSettingsResponse, i as UpdateAccountOptions, U as UpdateAccountPayload, j as UpdateAccountResponse, aa as UpdateBoilerplateCategoryOptions, a9 as UpdateBoilerplateCategoryPayload, ab as UpdateBoilerplateCategoryResponse, Z as UpdateBoilerplateContentOptions, Y as UpdateBoilerplateContentPayload, _ as UpdateBoilerplateContentResponse, ar as UpdateChannelOptions, aq as UpdateChannelPayload, as as UpdateChannelResponse, aF as UpdateCompositionSectionOptions, aE as UpdateCompositionSectionPayload, aG as UpdateCompositionSectionResponse, aY as UpdateContactOptions, aX as UpdateContactPayload, aZ as UpdateContactResponse, bm as UpdateConversationOptions, bl as UpdateConversationPayload, bn as UpdateConversationResponse, bF as UpdateLabelOptions, bE as UpdateLabelPayload, bG as UpdateLabelResponse, co as UpdateNoteOptions, cn as UpdateNotePayload, cp as UpdateNoteResponse, cB as Upload, cI as UploadID, cL as WebhookEventPayload, cM as WebhookResponse, cN as WebhookSubscription, cZ as WebhookSubscriptionID, C as default, cK as eventWebhookSchema } from './Client-B1Z3ldbE.cjs';
|
|
2
2
|
import 'ky';
|
|
3
3
|
import 'zod';
|
|
4
4
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Account, k as AccountAccessToken, l as AccountAccessTokenID, u as AccountConversationSettings, b as AccountID, B as Action, E as ActionID, b0 as ActiveConversationStatus, $ as BoilerplateCategory, a0 as BoilerplateCategoryID, I as BoilerplateContent, J as BoilerplateContentID, ac as Channel, ad as ChannelID, C as Client, at as CompositionSection, au as CompositionSectionID, b1 as ConcludedConversationStatus, aH as Contact, aI as ContactID, a_ as Conversation, a$ as ConversationID, b2 as ConversationStatus, n as CreateAccountAccessTokenOptions, m as CreateAccountAccessTokenPayload, o as CreateAccountAccessTokenResponse, d as CreateAccountOptions, c as CreateAccountPayload, e as CreateAccountResponse, a2 as CreateBoilerplateCategoryOptions, a1 as CreateBoilerplateCategoryPayload, a3 as CreateBoilerplateCategoryResponse, M as CreateBoilerplateContentOptions, K as CreateBoilerplateContentPayload, N as CreateBoilerplateContentResponse, af as CreateChannelOptions, ae as CreateChannelPayload, ag as CreateChannelResponse, aw as CreateCompositionSectionOptions, av as CreateCompositionSectionPayload, ax as CreateCompositionSectionResponse, cb as CreateContactNoteOptions, ca as CreateContactNotePayload, cc as CreateContactNoteResponse, cy as CreateContactNotificationSubscriptionOptions, cx as CreateContactNotificationSubscriptionPayload, cz as CreateContactNotificationSubscriptionResponse, aL as CreateContactOptions, aK as CreateContactPayload, aM as CreateContactResponse, ce as CreateConversationNoteOptions, cd as CreateConversationNotePayload, cf as CreateConversationNoteResponse, b4 as CreateConversationOptions, b3 as CreateConversationPayload, b5 as CreateConversationResponse, b$ as CreateCorrectionModelOptions, b_ as CreateCorrectionModelPayload, c0 as CreateCorrectionResponse, bq as CreateLabelOptions, bp as CreateLabelPayload, br as CreateLabelResponse, bJ as CreateMessageOptions, bI as CreateMessagePayload, bK as CreateMessageResponse, c2 as CreateResponseModelOptions, c1 as CreateResponseModelPayload, c3 as CreateResponseResponse, cC as CreateUploadOptions, cD as CreateUploadResponse, cP as CreateWebhookSubscriptionOptions, cO as CreateWebhookSubscriptionPayload, cQ as CreateWebhookSubscriptionResponse, aJ as CustomMetadata, p as DeleteAccountAccessTokenOptions, D as DeleteAccountAccessTokenPayload, q as DeleteAccountAccessTokenResponse, aN as DeleteContactOptions, aO as DeleteContactResponse, b6 as DeleteConversationOptions, b7 as DeleteConversationResponse, bs as DeleteLabelOptions, bt as DeleteLabelResponse, bL as DeleteMessageOptions, bM as DeleteMessageResponse, cE as DeleteUploadOptions, cF as DeleteUploadResponse, cR as DeleteWebhookSubscriptionOptions, cS as DeleteWebhookSubscriptionResponse, cJ as EventWebhookOptions, bg as FilterOptions, r as GetAccountAccessTokenOptions, s as GetAccountAccessTokenResponse, v as GetAccountConversationSettingsOptions, w as GetAccountConversationSettingsResponse, G as GetAccountOptions, f as GetAccountResponse, a4 as GetBoilerplateCategoryOptions, a5 as GetBoilerplateCategoryResponse, P as GetBoilerplateContentOptions, Q as GetBoilerplateContentResponse, ah as GetChannelOptions, ai as GetChannelResponse, ay as GetCompositionSectionOptions, az as GetCompositionSectionResponse, aP as GetContactIncludeOptions, aQ as GetContactOptions, aR as GetContactResponse, aS as GetContactVCFOptions, b8 as GetConversationIncludeOptions, b9 as GetConversationOptions, ba as GetConversationResponse, g as GetCurrentAccountOptions, h as GetCurrentAccountResponse, bu as GetLabelOptions, bv as GetLabelResponse, c4 as GetModelOptions, c5 as GetModelResponse, cg as GetNoteOptions, ch as GetNoteResponse, c_ as GetNotificationWellKnownResponse, cr as GetSourceOptions, cs as GetSourceResponse, cG as GetUploadOptions, cH as GetUploadResponse, cT as GetWebhookSubscriptionOptions, cU as GetWebhookSubscriptionResponse, bo as Label, bw as LabelID, L as ListAccountAccessTokensOptions, t as ListAccountAccessTokensResponse, F as ListActionsOptions, H as ListActionsResponse, a6 as ListBoilerplateCategoriesIncludeOptions, a7 as ListBoilerplateCategoriesOptions, a8 as ListBoilerplateCategoriesResponse, T as ListBoilerplateCategoryBoilerplateContentsOptions, V as ListBoilerplateCategoryBoilerplateContentsResponse, W as ListBoilerplateContentsOptions, X as ListBoilerplateContentsResponse, aA as ListChannelCompositionSectionsOptions, aB as ListChannelCompositionSectionsResponse, bb as ListChannelConversationsOptions, bc as ListChannelConversationsResponse, bN as ListChannelMessagesIncludeOptions, bO as ListChannelMessagesOptions, bP as ListChannelMessagesResponse, aj as ListChannelsOptions, ak as ListChannelsResponse, aC as ListCompositionSectionsOptions, aD as ListCompositionSectionsResponse, bd as ListContactConversationsOptions, be as ListContactConversationsResponse, bx as ListContactLabelsOptions, by as ListContactLabelsResponse, ci as ListContactNotesOptions, cj as ListContactNotesResponse, aT as ListContactsOptions, aU as ListContactsResponse, bz as ListConversationLabelsOptions, bA as ListConversationLabelsResponse, bQ as ListConversationMessagesIncludeOptions, bR as ListConversationMessagesOptions, bS as ListConversationMessagesResponse, ck as ListConversationNotesOptions, cl as ListConversationNotesResponse, bh as ListConversationOptions, bf as ListConversationsIncludeOptions, bi as ListConversationsResponse, aV as ListLabelContactsOptions, aW as ListLabelContactsResponse, bj as ListLabelConversationsOptions, bk as ListLabelConversationsResponse, bB as ListLabelsIncludeOptions, bC as ListLabelsOptions, bD as ListLabelsResponse, bT as ListMessagesIncludeOptions, bU as ListMessagesOptions, bV as ListMessagesResponse, c6 as ListModelsOptions, c7 as ListModelsResponse, ct as ListSourcesOptions, cu as ListSourcesResponse, cV as ListWebhookSubscriptionsOptions, cW as ListWebhookSubscriptionsResponse, bH as Message, bW as MessageID, bX as MessageRole, bY as MessageStatus, al as MetaWhatsappChannelGetBusinessProfileOptions, am as MetaWhatsappChannelGetBusinessProfileResponse, bZ as Model, c8 as ModelID, c9 as Note, cm as NoteID, cw as NotificationSubscription, cA as NotificationSubscriptionID, O as Options, R as RequestFilterable, S as SortOptions, cq as Source, cv as SourceID, cX as TestWebhookSubscriptionOptions, cY as TestWebhookSubscriptionResponse, a as TransportOptions, an as TwilioSendChannelSyncPayload, ao as TwilioSendgridChannelSyncOptions, ap as TwilioSendgridChannelSyncResponse, y as UpdateAccountConversationSettingsOptions, x as UpdateAccountConversationSettingsPayload, z as UpdateAccountConversationSettingsResponse, i as UpdateAccountOptions, U as UpdateAccountPayload, j as UpdateAccountResponse, aa as UpdateBoilerplateCategoryOptions, a9 as UpdateBoilerplateCategoryPayload, ab as UpdateBoilerplateCategoryResponse, Z as UpdateBoilerplateContentOptions, Y as UpdateBoilerplateContentPayload, _ as UpdateBoilerplateContentResponse, ar as UpdateChannelOptions, aq as UpdateChannelPayload, as as UpdateChannelResponse, aF as UpdateCompositionSectionOptions, aE as UpdateCompositionSectionPayload, aG as UpdateCompositionSectionResponse, aY as UpdateContactOptions, aX as UpdateContactPayload, aZ as UpdateContactResponse, bm as UpdateConversationOptions, bl as UpdateConversationPayload, bn as UpdateConversationResponse, bF as UpdateLabelOptions, bE as UpdateLabelPayload, bG as UpdateLabelResponse, co as UpdateNoteOptions, cn as UpdateNotePayload, cp as UpdateNoteResponse, cB as Upload, cI as UploadID, cL as WebhookEventPayload, cM as WebhookResponse, cN as WebhookSubscription, cZ as WebhookSubscriptionID, C as default, cK as eventWebhookSchema } from './Client-
|
|
1
|
+
export { A as Account, k as AccountAccessToken, l as AccountAccessTokenID, u as AccountConversationSettings, b as AccountID, B as Action, E as ActionID, b0 as ActiveConversationStatus, $ as BoilerplateCategory, a0 as BoilerplateCategoryID, I as BoilerplateContent, J as BoilerplateContentID, ac as Channel, ad as ChannelID, C as Client, at as CompositionSection, au as CompositionSectionID, b1 as ConcludedConversationStatus, aH as Contact, aI as ContactID, a_ as Conversation, a$ as ConversationID, b2 as ConversationStatus, n as CreateAccountAccessTokenOptions, m as CreateAccountAccessTokenPayload, o as CreateAccountAccessTokenResponse, d as CreateAccountOptions, c as CreateAccountPayload, e as CreateAccountResponse, a2 as CreateBoilerplateCategoryOptions, a1 as CreateBoilerplateCategoryPayload, a3 as CreateBoilerplateCategoryResponse, M as CreateBoilerplateContentOptions, K as CreateBoilerplateContentPayload, N as CreateBoilerplateContentResponse, af as CreateChannelOptions, ae as CreateChannelPayload, ag as CreateChannelResponse, aw as CreateCompositionSectionOptions, av as CreateCompositionSectionPayload, ax as CreateCompositionSectionResponse, cb as CreateContactNoteOptions, ca as CreateContactNotePayload, cc as CreateContactNoteResponse, cy as CreateContactNotificationSubscriptionOptions, cx as CreateContactNotificationSubscriptionPayload, cz as CreateContactNotificationSubscriptionResponse, aL as CreateContactOptions, aK as CreateContactPayload, aM as CreateContactResponse, ce as CreateConversationNoteOptions, cd as CreateConversationNotePayload, cf as CreateConversationNoteResponse, b4 as CreateConversationOptions, b3 as CreateConversationPayload, b5 as CreateConversationResponse, b$ as CreateCorrectionModelOptions, b_ as CreateCorrectionModelPayload, c0 as CreateCorrectionResponse, bq as CreateLabelOptions, bp as CreateLabelPayload, br as CreateLabelResponse, bJ as CreateMessageOptions, bI as CreateMessagePayload, bK as CreateMessageResponse, c2 as CreateResponseModelOptions, c1 as CreateResponseModelPayload, c3 as CreateResponseResponse, cC as CreateUploadOptions, cD as CreateUploadResponse, cP as CreateWebhookSubscriptionOptions, cO as CreateWebhookSubscriptionPayload, cQ as CreateWebhookSubscriptionResponse, aJ as CustomMetadata, p as DeleteAccountAccessTokenOptions, D as DeleteAccountAccessTokenPayload, q as DeleteAccountAccessTokenResponse, aN as DeleteContactOptions, aO as DeleteContactResponse, b6 as DeleteConversationOptions, b7 as DeleteConversationResponse, bs as DeleteLabelOptions, bt as DeleteLabelResponse, bL as DeleteMessageOptions, bM as DeleteMessageResponse, cE as DeleteUploadOptions, cF as DeleteUploadResponse, cR as DeleteWebhookSubscriptionOptions, cS as DeleteWebhookSubscriptionResponse, cJ as EventWebhookOptions, bg as FilterOptions, r as GetAccountAccessTokenOptions, s as GetAccountAccessTokenResponse, v as GetAccountConversationSettingsOptions, w as GetAccountConversationSettingsResponse, G as GetAccountOptions, f as GetAccountResponse, a4 as GetBoilerplateCategoryOptions, a5 as GetBoilerplateCategoryResponse, P as GetBoilerplateContentOptions, Q as GetBoilerplateContentResponse, ah as GetChannelOptions, ai as GetChannelResponse, ay as GetCompositionSectionOptions, az as GetCompositionSectionResponse, aP as GetContactIncludeOptions, aQ as GetContactOptions, aR as GetContactResponse, aS as GetContactVCFOptions, b8 as GetConversationIncludeOptions, b9 as GetConversationOptions, ba as GetConversationResponse, g as GetCurrentAccountOptions, h as GetCurrentAccountResponse, bu as GetLabelOptions, bv as GetLabelResponse, c4 as GetModelOptions, c5 as GetModelResponse, cg as GetNoteOptions, ch as GetNoteResponse, c_ as GetNotificationWellKnownResponse, cr as GetSourceOptions, cs as GetSourceResponse, cG as GetUploadOptions, cH as GetUploadResponse, cT as GetWebhookSubscriptionOptions, cU as GetWebhookSubscriptionResponse, bo as Label, bw as LabelID, L as ListAccountAccessTokensOptions, t as ListAccountAccessTokensResponse, F as ListActionsOptions, H as ListActionsResponse, a6 as ListBoilerplateCategoriesIncludeOptions, a7 as ListBoilerplateCategoriesOptions, a8 as ListBoilerplateCategoriesResponse, T as ListBoilerplateCategoryBoilerplateContentsOptions, V as ListBoilerplateCategoryBoilerplateContentsResponse, W as ListBoilerplateContentsOptions, X as ListBoilerplateContentsResponse, aA as ListChannelCompositionSectionsOptions, aB as ListChannelCompositionSectionsResponse, bb as ListChannelConversationsOptions, bc as ListChannelConversationsResponse, bN as ListChannelMessagesIncludeOptions, bO as ListChannelMessagesOptions, bP as ListChannelMessagesResponse, aj as ListChannelsOptions, ak as ListChannelsResponse, aC as ListCompositionSectionsOptions, aD as ListCompositionSectionsResponse, bd as ListContactConversationsOptions, be as ListContactConversationsResponse, bx as ListContactLabelsOptions, by as ListContactLabelsResponse, ci as ListContactNotesOptions, cj as ListContactNotesResponse, aT as ListContactsOptions, aU as ListContactsResponse, bz as ListConversationLabelsOptions, bA as ListConversationLabelsResponse, bQ as ListConversationMessagesIncludeOptions, bR as ListConversationMessagesOptions, bS as ListConversationMessagesResponse, ck as ListConversationNotesOptions, cl as ListConversationNotesResponse, bh as ListConversationOptions, bf as ListConversationsIncludeOptions, bi as ListConversationsResponse, aV as ListLabelContactsOptions, aW as ListLabelContactsResponse, bj as ListLabelConversationsOptions, bk as ListLabelConversationsResponse, bB as ListLabelsIncludeOptions, bC as ListLabelsOptions, bD as ListLabelsResponse, bT as ListMessagesIncludeOptions, bU as ListMessagesOptions, bV as ListMessagesResponse, c6 as ListModelsOptions, c7 as ListModelsResponse, ct as ListSourcesOptions, cu as ListSourcesResponse, cV as ListWebhookSubscriptionsOptions, cW as ListWebhookSubscriptionsResponse, bH as Message, bW as MessageID, bX as MessageRole, bY as MessageStatus, al as MetaWhatsappChannelGetBusinessProfileOptions, am as MetaWhatsappChannelGetBusinessProfileResponse, bZ as Model, c8 as ModelID, c9 as Note, cm as NoteID, cw as NotificationSubscription, cA as NotificationSubscriptionID, O as Options, R as RequestFilterable, S as SortOptions, cq as Source, cv as SourceID, cX as TestWebhookSubscriptionOptions, cY as TestWebhookSubscriptionResponse, a as TransportOptions, an as TwilioSendChannelSyncPayload, ao as TwilioSendgridChannelSyncOptions, ap as TwilioSendgridChannelSyncResponse, y as UpdateAccountConversationSettingsOptions, x as UpdateAccountConversationSettingsPayload, z as UpdateAccountConversationSettingsResponse, i as UpdateAccountOptions, U as UpdateAccountPayload, j as UpdateAccountResponse, aa as UpdateBoilerplateCategoryOptions, a9 as UpdateBoilerplateCategoryPayload, ab as UpdateBoilerplateCategoryResponse, Z as UpdateBoilerplateContentOptions, Y as UpdateBoilerplateContentPayload, _ as UpdateBoilerplateContentResponse, ar as UpdateChannelOptions, aq as UpdateChannelPayload, as as UpdateChannelResponse, aF as UpdateCompositionSectionOptions, aE as UpdateCompositionSectionPayload, aG as UpdateCompositionSectionResponse, aY as UpdateContactOptions, aX as UpdateContactPayload, aZ as UpdateContactResponse, bm as UpdateConversationOptions, bl as UpdateConversationPayload, bn as UpdateConversationResponse, bF as UpdateLabelOptions, bE as UpdateLabelPayload, bG as UpdateLabelResponse, co as UpdateNoteOptions, cn as UpdateNotePayload, cp as UpdateNoteResponse, cB as Upload, cI as UploadID, cL as WebhookEventPayload, cM as WebhookResponse, cN as WebhookSubscription, cZ as WebhookSubscriptionID, C as default, cK as eventWebhookSchema } from './Client-B1Z3ldbE.js';
|
|
2
2
|
import 'ky';
|
|
3
3
|
import 'zod';
|
|
4
4
|
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s,c as l,d as o,e as r,f as t,g as e,h as p,i as f,j as m,k as u,l as x}from"./chunk-
|
|
1
|
+
import{a as s,c as l,d as o,e as r,f as t,g as e,h as p,i as f,j as m,k as u,l as x}from"./chunk-5YOY53RX.js";var a={};s(a,{AuthError:()=>r,AuthenticationError:()=>t,AuthorizationError:()=>e,LogicError:()=>p,NetworkError:()=>f,SupportError:()=>o,ValidationError:()=>m});export{x as Client,l as DEFAULT_SUPPORT_BASE_URL,a as Error,x as default,u as eventWebhookSchema};
|