@great-detail/support-sdk 0.19.0 → 0.19.1

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.
@@ -553,6 +553,28 @@ type ListAccountNotificationEventsResponse = {
553
553
  }[];
554
554
  };
555
555
 
556
+ /**
557
+ * Great Detail Support System.
558
+ *
559
+ * @copyright 2025 Great Detail Ltd
560
+ * @author Great Detail Ltd <info@greatdetail.com>
561
+ * @author Dom Webber <dom.webber@greatdetail.com>
562
+ * @see https://greatdetail.com
563
+ */
564
+
565
+ type UpdateAccountNotificationEventPayload = {
566
+ readAt?: boolean | Date;
567
+ };
568
+ interface UpdateAccountNotificationEventOptions {
569
+ body: UpdateAccountNotificationEventPayload;
570
+ request?: SendOptions;
571
+ }
572
+ type UpdateAccountNotificationEventResponse = {
573
+ data: {
574
+ accountNotificationEvent: AccountNotificationEvent;
575
+ };
576
+ };
577
+
556
578
  declare class AccountNotificationEventAPI {
557
579
  protected _transport: FetchTransport;
558
580
  constructor(_transport: FetchTransport);
@@ -564,6 +586,10 @@ declare class AccountNotificationEventAPI {
564
586
  response: () => Promise<ky.KyResponse<ListAccountNotificationEventsResponse>>;
565
587
  json: () => Promise<ListAccountNotificationEventsResponse>;
566
588
  };
589
+ update(id: AccountNotificationEventID, { body, request }: UpdateAccountNotificationEventOptions): {
590
+ response: () => Promise<ky.KyResponse<UpdateAccountNotificationEventResponse>>;
591
+ json: () => Promise<UpdateAccountNotificationEventResponse>;
592
+ };
567
593
  }
568
594
 
569
595
  /**
@@ -553,6 +553,28 @@ type ListAccountNotificationEventsResponse = {
553
553
  }[];
554
554
  };
555
555
 
556
+ /**
557
+ * Great Detail Support System.
558
+ *
559
+ * @copyright 2025 Great Detail Ltd
560
+ * @author Great Detail Ltd <info@greatdetail.com>
561
+ * @author Dom Webber <dom.webber@greatdetail.com>
562
+ * @see https://greatdetail.com
563
+ */
564
+
565
+ type UpdateAccountNotificationEventPayload = {
566
+ readAt?: boolean | Date;
567
+ };
568
+ interface UpdateAccountNotificationEventOptions {
569
+ body: UpdateAccountNotificationEventPayload;
570
+ request?: SendOptions;
571
+ }
572
+ type UpdateAccountNotificationEventResponse = {
573
+ data: {
574
+ accountNotificationEvent: AccountNotificationEvent;
575
+ };
576
+ };
577
+
556
578
  declare class AccountNotificationEventAPI {
557
579
  protected _transport: FetchTransport;
558
580
  constructor(_transport: FetchTransport);
@@ -564,6 +586,10 @@ declare class AccountNotificationEventAPI {
564
586
  response: () => Promise<ky.KyResponse<ListAccountNotificationEventsResponse>>;
565
587
  json: () => Promise<ListAccountNotificationEventsResponse>;
566
588
  };
589
+ update(id: AccountNotificationEventID, { body, request }: UpdateAccountNotificationEventOptions): {
590
+ response: () => Promise<ky.KyResponse<UpdateAccountNotificationEventResponse>>;
591
+ json: () => Promise<UpdateAccountNotificationEventResponse>;
592
+ };
567
593
  }
568
594
 
569
595
  /**
@@ -0,0 +1 @@
1
+ var Y=Object.defineProperty;var X=(s,t)=>{for(var e in t)Y(s,e,{get:t[e],enumerable:!0})};var p=class{getHeaders(){return{}}};var M="SUPPORT_ACCESS_TOKEN",W="SUPPORT_KEY_NAME",Q="SUPPORT_KEY_PASSWORD",x="SUPPORT_SIGNING_KEY",j="SUPPORT_BASE_URL";var c=class{name;#t;constructor({name:t=process.env[W],password:e=process.env[Q]}={}){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}async getHeaders(){let t=typeof this.name=="function"?await Promise.resolve(this.name()):this.name,e=typeof this.#t=="function"?await Promise.resolve(this.#t()):this.#t;return{Authorization:`Basic ${btoa(t+":"+e)}`}}};var m=class{#t;constructor({token:t=process.env[M]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}async getHeaders(){return{Authorization:`Bearer ${typeof this.#t=="function"?await Promise.resolve(this.#t()):this.#t}`}}};var H="https://api.support.greatdetail.com",V={"X-Powered-By":"GDSupport/JavaScript"};var B=class extends Error{constructor(e,o){super("Support Error",{cause:o});this.response=e}};import{z as a}from"zod";var q=a.object({data:a.object({event:a.object({id:a.string(),type:a.string(),payload:a.record(a.string()),createdAt:a.string().datetime()})})});var l=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,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 d=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:n={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...n,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 u=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 h=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/notifications/events/account/"+encodeURIComponent(t),{...e,method:"GET"})}listByAccount(t,{limit:e,level:o,request:n={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/notifications/events",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.filterQuery("level",o)]})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notifications/events/account/"+encodeURIComponent(t),{...o,method:"PATCH",json:{...e,readAt:e.readAt instanceof Date&&typeof e.readAt.getMonth=="function"?e.readAt.toISOString():e.readAt}})}};var C=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 f=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 R=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/channels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}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 b=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var g=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 O=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",n=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(n)}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,type:o,request:n={}}={}){return this._transport.send("v1/contacts",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.filterQuery("type",o)]})}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 _=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({query:t,limit:e,filter:o,include:n,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.limitQuery(e),...this._transport.filterQuery("filter",o),...this._transport.includeQuery(n??{})]})}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 I=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/feedback/conversation",{...t,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/feedback",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/feedback/conversation",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var y=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/escalations/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/escalations",{...t,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/escalations",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/escalations",{...e,method:"POST",json:t})}};var A=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:n={}}={}){return this._transport.send("v1/labels",{...n,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 T=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,type:o,visibility:n,request:r={}}={}){return this._transport.send("v1/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{}),...this._transport.filterQuery("type",o),...this._transport.filterQuery("visibility",n)]})}listByConversation(t,{limit:e,include:o,type:n,visibility:r,request:i={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...i,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{}),...this._transport.filterQuery("type",n),...this._transport.filterQuery("visibility",r)]})}listByChannel(t,{limit:e,include:o,type:n,visibility:r,request:i={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...i,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o),...this._transport.filterQuery("type",n),...this._transport.filterQuery("visibility",r)]})}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 L=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 E=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"})}create({body:t,request:e={}}){return this._transport.send("v1/notes",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var U=class s{constructor(t=s.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=V;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var S=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 n=[];if(e){let r=Array.isArray(e)?e:[e];for(let i of r)n.push(["category",i])}return t!==void 0&&n.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:n})}};var D=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 z from"is-network-error";import $,{HTTPError as J}from"ky";var G=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=$.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[async o=>{for(let n of this.options.requestFilterables){let r=await Promise.resolve(n.getHeaders());for(let[i,K]of Object.entries(r))o.headers.has(i)||o.headers.set(i,K)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,n]of Object.entries(t))n!==void 0&&e.push(["sort",n+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}filterQuery(t,e){let o=[];return e===void 0||o.push([t,e]),o}send(t,e={}){let o=this.client(t,e).catch(async n=>{throw z(n)?new Error("A network error occurred",{cause:n}):n instanceof J?new B(n.response,n):n});return{response:()=>o,json:async()=>(await o).json()}}};var k=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,include:e,request:o={}}){let n=new FormData;for(let r of t)n.append("file",r);return this._transport.send("v1/uploads",{...o,method:"POST",searchParams:[...this._transport.includeQuery(e??{})],body:n})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var P=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var F=class{constructor(t){this._transport=t}async event({key:t=process.env[x],maxSignatures:e=3,request:o}){let n=o.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+x);if(!n)throw new Error("Missing signature header");if(!this._verifySignature(t,o.body,Array.isArray(n)?n.slice(0,e):[n]))throw new Error("Untrusted signature")}let{data:r}=q.parse(o.body);return{event:r.event}}async _verifySignature(t,e,o){let n=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",n,new TextEncoder().encode(atob(r)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var w=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 s{static DEFAULT_BASE_URL=H;static PublicAuthentication=p;static BasicAuthentication=c;static BearerAuthentication=m;_transport;account;accountAccessToken;accountConversationSettings;accountNotificationEvent;action;boilerplateCategory;boilerplateContent;channel;channelConversationSettings;compositionSection;contact;conversation;conversationFeedback;escalation;label;message;model;note;source;statistics;upload;user;webhook;webhookSubscription;constructor(t,{baseURL:e,...o}={}){this._transport=new G({requestFilterables:[new U,t],...o,baseURL:e?.toString()??s.getBaseURL()}),this.account=new l(this._transport),this.accountAccessToken=new d(this._transport),this.accountConversationSettings=new u(this._transport),this.accountNotificationEvent=new h(this._transport),this.action=new C(this._transport),this.boilerplateCategory=new f(this._transport),this.boilerplateContent=new v(this._transport),this.channel=new R(this._transport),this.channelConversationSettings=new b(this._transport),this.compositionSection=new g(this._transport),this.contact=new O(this._transport),this.conversation=new _(this._transport),this.conversationFeedback=new I(this._transport),this.escalation=new y(this._transport),this.label=new A(this._transport),this.message=new T(this._transport),this.model=new L(this._transport),this.note=new E(this._transport),this.source=new S(this._transport),this.statistics=new D(this._transport),this.upload=new k(this._transport),this.user=new P(this._transport),this.webhook=new F(this._transport),this.webhookSubscription=new w(this._transport)}static getBaseURL(){return process.env[j]??this.DEFAULT_BASE_URL}};export{X as a,p as b,H as c,B as d,q as e,N as f};
@@ -1 +1 @@
1
- import{b as j,f as F}from"./chunk-UPDHBDWN.js";import{Command as A}from"commander";import{Command as b}from"commander";import{oraPromise as I}from"ora";function r({client:t,ora:s}){let o=new b("actions").description("Actions");return o.addCommand(new b("list").description("List actions").action(async()=>{let n=await I(()=>t.action.list().json(),{...s,text:"Finding actions"});console.log(n)})),o}import{Command as v}from"commander";import{oraPromise as S}from"ora";function c({client:t,ora:s}){let o=new v("channels").description("Channels");return o.addCommand(new v("list").description("List channels").action(async()=>{let n=await S(()=>t.channel.list().json(),{...s,text:"Finding channels"});console.log(n)})),o}import{Command as a}from"commander";import{oraPromise as d}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 d(()=>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 d(()=>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 d(()=>t.contact.getVCF(n).response(),{...s,text:"Exporting contact"});console.log(i)})),o}import{Command as l}from"commander";import{oraPromise as L}from"ora";function u({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 L(()=>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 L(()=>t.conversation.list().json(),{...s,text:"Finding conversations"});console.log(n)})),o}import{Command as m}from"commander";import{oraPromise as C}from"ora";function g({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 C(()=>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 C(()=>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 C(()=>t.conversation.listByLabel(n).json(),{...s,text:"Finding conversations"});console.log(i)})),o}import{Command as D}from"commander";import{oraPromise as M}from"ora";function f({client:t,ora:s}){let o=new D("messages").description("Messages");return o.addCommand(new D("list").description("List messages").action(async()=>{let n=await M(()=>t.message.list().json(),{...s,text:"Finding messages"});console.log(n)})),o}import{Command as O}from"commander";import{oraPromise as P}from"ora";function x({client:t,ora:s}){let o=new O("models").description("Models");return o.addCommand(new O("get").description("Find model").argument("<model>","Model ID").action(async n=>{let i=await P(()=>t.model.get(n).json(),{...s,text:"Finding model"});console.log(i)})),o.addCommand(new O("list").description("List models").action(async()=>{let n=await P(()=>t.model.list().json(),{...s,text:"Finding models"});console.log(n)})),o}import{Command as w}from"commander";import{oraPromise as h}from"ora";function y({client:t,ora:s}){let o=new w("sources").description("Sources");return o.addCommand(new w("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 w("list").description("List sources").action(async()=>{let n=await h(()=>t.source.list().json(),{...s,text:"Finding sources"});console.log(n)})),o}var e={ora:{spinner:"simpleDotsScrolling"},client:new F(new j)},E=new A("gds").description("Great Detail Support System").addCommand(r(e)).addCommand(c(e)).addCommand(p(e)).addCommand(u(e)).addCommand(g(e)).addCommand(f(e)).addCommand(x(e)).addCommand(y(e)),fo=E;export{fo as a};
1
+ import{b as j,f as F}from"./chunk-WIRRATXE.js";import{Command as A}from"commander";import{Command as b}from"commander";import{oraPromise as I}from"ora";function r({client:t,ora:s}){let o=new b("actions").description("Actions");return o.addCommand(new b("list").description("List actions").action(async()=>{let n=await I(()=>t.action.list().json(),{...s,text:"Finding actions"});console.log(n)})),o}import{Command as v}from"commander";import{oraPromise as S}from"ora";function c({client:t,ora:s}){let o=new v("channels").description("Channels");return o.addCommand(new v("list").description("List channels").action(async()=>{let n=await S(()=>t.channel.list().json(),{...s,text:"Finding channels"});console.log(n)})),o}import{Command as a}from"commander";import{oraPromise as d}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 d(()=>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 d(()=>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 d(()=>t.contact.getVCF(n).response(),{...s,text:"Exporting contact"});console.log(i)})),o}import{Command as l}from"commander";import{oraPromise as L}from"ora";function u({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 L(()=>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 L(()=>t.conversation.list().json(),{...s,text:"Finding conversations"});console.log(n)})),o}import{Command as m}from"commander";import{oraPromise as C}from"ora";function g({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 C(()=>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 C(()=>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 C(()=>t.conversation.listByLabel(n).json(),{...s,text:"Finding conversations"});console.log(i)})),o}import{Command as D}from"commander";import{oraPromise as M}from"ora";function f({client:t,ora:s}){let o=new D("messages").description("Messages");return o.addCommand(new D("list").description("List messages").action(async()=>{let n=await M(()=>t.message.list().json(),{...s,text:"Finding messages"});console.log(n)})),o}import{Command as O}from"commander";import{oraPromise as P}from"ora";function x({client:t,ora:s}){let o=new O("models").description("Models");return o.addCommand(new O("get").description("Find model").argument("<model>","Model ID").action(async n=>{let i=await P(()=>t.model.get(n).json(),{...s,text:"Finding model"});console.log(i)})),o.addCommand(new O("list").description("List models").action(async()=>{let n=await P(()=>t.model.list().json(),{...s,text:"Finding models"});console.log(n)})),o}import{Command as w}from"commander";import{oraPromise as h}from"ora";function y({client:t,ora:s}){let o=new w("sources").description("Sources");return o.addCommand(new w("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 w("list").description("List sources").action(async()=>{let n=await h(()=>t.source.list().json(),{...s,text:"Finding sources"});console.log(n)})),o}var e={ora:{spinner:"simpleDotsScrolling"},client:new F(new j)},E=new A("gds").description("Great Detail Support System").addCommand(r(e)).addCommand(c(e)).addCommand(p(e)).addCommand(u(e)).addCommand(g(e)).addCommand(f(e)).addCommand(x(e)).addCommand(y(e)),fo=E;export{fo as a};
@@ -1 +1 @@
1
- "use strict";var Tt=Object.create;var W=Object.defineProperty;var Lt=Object.getOwnPropertyDescriptor;var At=Object.getOwnPropertyNames;var Et=Object.getPrototypeOf,Ut=Object.prototype.hasOwnProperty;var St=(n,t)=>{for(var e in t)W(n,e,{get:t[e],enumerable:!0})},mt=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of At(t))!Ut.call(n,s)&&s!==e&&W(n,s,{get:()=>t[s],enumerable:!(o=Lt(t,s))||o.enumerable});return n};var dt=(n,t,e)=>(e=n!=null?Tt(Et(n)):{},mt(t||!n||!n.__esModule?W(e,"default",{value:n,enumerable:!0}):e,n)),Dt=n=>mt(W({},"__esModule",{value:!0}),n);var wt={};St(wt,{default:()=>kt});module.exports=Dt(wt);var It=require("commander");var c=class{getHeaders(){return{}}};var m=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,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 d=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 l=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 u=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/notifications/events/account/"+encodeURIComponent(t),{...e,method:"GET"})}listByAccount(t,{limit:e,level:o,request:s={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/notifications/events",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.filterQuery("level",o)]})}};var h=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 lt="SUPPORT_ACCESS_TOKEN",ut="SUPPORT_KEY_NAME",ht="SUPPORT_KEY_PASSWORD",z="SUPPORT_SIGNING_KEY",Ct="SUPPORT_BASE_URL";var C=class{name;#t;constructor({name:t=process.env[ut],password:e=process.env[ht]}={}){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}async getHeaders(){let t=typeof this.name=="function"?await Promise.resolve(this.name()):this.name,e=typeof this.#t=="function"?await Promise.resolve(this.#t()):this.#t;return{Authorization:`Basic ${btoa(t+":"+e)}`}}};var f=class{#t;constructor({token:t=process.env[lt]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}async getHeaders(){return{Authorization:`Bearer ${typeof this.#t=="function"?await Promise.resolve(this.#t()):this.#t}`}}};var v=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 b=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 g=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/channels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}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 R=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var O=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 ft="https://api.support.greatdetail.com",vt={"X-Powered-By":"GDSupport/JavaScript"};var y=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,type:o,request:s={}}={}){return this._transport.send("v1/contacts",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.filterQuery("type",o)]})}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({query:t,limit:e,filter:o,include:s,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.limitQuery(e),...this._transport.filterQuery("filter",o),...this._transport.includeQuery(s??{})]})}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 _=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/feedback/conversation",{...t,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/feedback",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/feedback/conversation",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var T=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/escalations/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/escalations",{...t,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/escalations",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/escalations",{...e,method:"POST",json:t})}};var L=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 A=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,type:o,visibility:s,request:r={}}={}){return this._transport.send("v1/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{}),...this._transport.filterQuery("type",o),...this._transport.filterQuery("visibility",s)]})}listByConversation(t,{limit:e,include:o,type:s,visibility:r,request:i={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...i,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{}),...this._transport.filterQuery("type",s),...this._transport.filterQuery("visibility",r)]})}listByChannel(t,{limit:e,include:o,type:s,visibility:r,request:i={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...i,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o),...this._transport.filterQuery("type",s),...this._transport.filterQuery("visibility",r)]})}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 U=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"})}create({body:t,request:e={}}){return this._transport.send("v1/notes",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var S=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=vt;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 i of r)s.push(["category",i])}return t!==void 0&&s.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:s})}};var G=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 bt=dt(require("is-network-error"),1),Q=dt(require("ky"),1);var j=class extends Error{constructor(e,o){super("Support Error",{cause:o});this.response=e}};var k=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:[async o=>{for(let s of this.options.requestFilterables){let r=await Promise.resolve(s.getHeaders());for(let[i,_t]of Object.entries(r))o.headers.has(i)||o.headers.set(i,_t)}}]}})}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}filterQuery(t,e){let o=[];return e===void 0||o.push([t,e]),o}send(t,e={}){let o=this.client(t,e).catch(async s=>{throw(0,bt.default)(s)?new Error("A network error occurred",{cause:s}):s instanceof Q.HTTPError?new j(s.response,s):s});return{response:()=>o,json:async()=>(await o).json()}}};var w=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,include:e,request:o={}}){let s=new FormData;for(let r of t)s.append("file",r);return this._transport.send("v1/uploads",{...o,method:"POST",searchParams:[...this._transport.includeQuery(e??{})],body:s})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var F=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var a=require("zod"),gt=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 x=class{constructor(t){this._transport=t}async event({key:t=process.env[z],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."+z);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}=gt.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 P=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 B=class n{static DEFAULT_BASE_URL=ft;static PublicAuthentication=c;static BasicAuthentication=C;static BearerAuthentication=f;_transport;account;accountAccessToken;accountConversationSettings;accountNotificationEvent;action;boilerplateCategory;boilerplateContent;channel;channelConversationSettings;compositionSection;contact;conversation;conversationFeedback;escalation;label;message;model;note;source;statistics;upload;user;webhook;webhookSubscription;constructor(t,{baseURL:e,...o}={}){this._transport=new k({requestFilterables:[new S,t],...o,baseURL:e?.toString()??n.getBaseURL()}),this.account=new m(this._transport),this.accountAccessToken=new d(this._transport),this.accountConversationSettings=new l(this._transport),this.accountNotificationEvent=new u(this._transport),this.action=new h(this._transport),this.boilerplateCategory=new v(this._transport),this.boilerplateContent=new b(this._transport),this.channel=new g(this._transport),this.channelConversationSettings=new R(this._transport),this.compositionSection=new O(this._transport),this.contact=new y(this._transport),this.conversation=new I(this._transport),this.conversationFeedback=new _(this._transport),this.escalation=new T(this._transport),this.label=new L(this._transport),this.message=new A(this._transport),this.model=new E(this._transport),this.note=new U(this._transport),this.source=new D(this._transport),this.statistics=new G(this._transport),this.upload=new w(this._transport),this.user=new F(this._transport),this.webhook=new x(this._transport),this.webhookSubscription=new P(this._transport)}static getBaseURL(){return process.env[Ct]??this.DEFAULT_BASE_URL}};var $=require("commander"),Rt=require("ora");function J({client:n,ora:t}){let e=new $.Command("actions").description("Actions");return e.addCommand(new $.Command("list").description("List actions").action(async()=>{let o=await(0,Rt.oraPromise)(()=>n.action.list().json(),{...t,text:"Finding actions"});console.log(o)})),e}var X=require("commander"),Ot=require("ora");function Z({client:n,ora:t}){let e=new X.Command("channels").description("Channels");return e.addCommand(new X.Command("list").description("List channels").action(async()=>{let o=await(0,Ot.oraPromise)(()=>n.channel.list().json(),{...t,text:"Finding channels"});console.log(o)})),e}var M=require("commander"),H=require("ora");function tt({client:n,ora:t}){let e=new M.Command("contacts").description("Contacts");return e.addCommand(new M.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 M.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 M.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 V=require("commander"),et=require("ora");function ot({client:n,ora:t}){let e=new V.Command("conversations").description("Conversations");return e.addCommand(new V.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async o=>{let s=await(0,et.oraPromise)(()=>n.conversation.get(o).json(),{...t,text:"Finding conversation"});console.log(s)})),e.addCommand(new V.Command("list").description("List conversations").action(async()=>{let o=await(0,et.oraPromise)(()=>n.conversation.list().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var N=require("commander"),q=require("ora");function nt({client:n,ora:t}){let e=new N.Command("labels").description("Labels");return e.addCommand(new N.Command("get").description("Find label").argument("<label>","Label ID").action(async o=>{let s=await(0,q.oraPromise)(()=>n.label.get(o).json(),{...t,text:"Finding label"});console.log(s)})),e.addCommand(new N.Command("list").description("List labels").action(async()=>{let o=await(0,q.oraPromise)(()=>n.label.list().json(),{...t,text:"Finding labels"});console.log(o)})),e.addCommand(new N.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async o=>{let s=await(0,q.oraPromise)(()=>n.conversation.listByLabel(o).json(),{...t,text:"Finding conversations"});console.log(s)})),e}var st=require("commander"),yt=require("ora");function rt({client:n,ora:t}){let e=new st.Command("messages").description("Messages");return e.addCommand(new st.Command("list").description("List messages").action(async()=>{let o=await(0,yt.oraPromise)(()=>n.message.list().json(),{...t,text:"Finding messages"});console.log(o)})),e}var K=require("commander"),it=require("ora");function at({client:n,ora:t}){let e=new K.Command("models").description("Models");return e.addCommand(new K.Command("get").description("Find model").argument("<model>","Model ID").action(async o=>{let s=await(0,it.oraPromise)(()=>n.model.get(o).json(),{...t,text:"Finding model"});console.log(s)})),e.addCommand(new K.Command("list").description("List models").action(async()=>{let o=await(0,it.oraPromise)(()=>n.model.list().json(),{...t,text:"Finding models"});console.log(o)})),e}var Y=require("commander"),pt=require("ora");function ct({client:n,ora:t}){let e=new Y.Command("sources").description("Sources");return e.addCommand(new Y.Command("get").description("Find source").argument("<source>","Source ID").action(async o=>{let s=await(0,pt.oraPromise)(()=>n.source.get(o).json(),{...t,text:"Finding source"});console.log(s)})),e.addCommand(new Y.Command("list").description("List sources").action(async()=>{let o=await(0,pt.oraPromise)(()=>n.source.list().json(),{...t,text:"Finding sources"});console.log(o)})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new B(new c)},Gt=new It.Command("gds").description("Great Detail Support System").addCommand(J(p)).addCommand(Z(p)).addCommand(tt(p)).addCommand(ot(p)).addCommand(nt(p)).addCommand(rt(p)).addCommand(at(p)).addCommand(ct(p)),kt=Gt;
1
+ "use strict";var At=Object.create;var W=Object.defineProperty;var Tt=Object.getOwnPropertyDescriptor;var Lt=Object.getOwnPropertyNames;var Et=Object.getPrototypeOf,Ut=Object.prototype.hasOwnProperty;var St=(n,t)=>{for(var e in t)W(n,e,{get:t[e],enumerable:!0})},mt=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Lt(t))!Ut.call(n,s)&&s!==e&&W(n,s,{get:()=>t[s],enumerable:!(o=Tt(t,s))||o.enumerable});return n};var dt=(n,t,e)=>(e=n!=null?At(Et(n)):{},mt(t||!n||!n.__esModule?W(e,"default",{value:n,enumerable:!0}):e,n)),Dt=n=>mt(W({},"__esModule",{value:!0}),n);var wt={};St(wt,{default:()=>kt});module.exports=Dt(wt);var It=require("commander");var c=class{getHeaders(){return{}}};var m=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,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 d=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 l=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 u=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/notifications/events/account/"+encodeURIComponent(t),{...e,method:"GET"})}listByAccount(t,{limit:e,level:o,request:s={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/notifications/events",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.filterQuery("level",o)]})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notifications/events/account/"+encodeURIComponent(t),{...o,method:"PATCH",json:{...e,readAt:e.readAt instanceof Date&&typeof e.readAt.getMonth=="function"?e.readAt.toISOString():e.readAt}})}};var h=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 lt="SUPPORT_ACCESS_TOKEN",ut="SUPPORT_KEY_NAME",ht="SUPPORT_KEY_PASSWORD",z="SUPPORT_SIGNING_KEY",Ct="SUPPORT_BASE_URL";var C=class{name;#t;constructor({name:t=process.env[ut],password:e=process.env[ht]}={}){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}async getHeaders(){let t=typeof this.name=="function"?await Promise.resolve(this.name()):this.name,e=typeof this.#t=="function"?await Promise.resolve(this.#t()):this.#t;return{Authorization:`Basic ${btoa(t+":"+e)}`}}};var f=class{#t;constructor({token:t=process.env[lt]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}async getHeaders(){return{Authorization:`Bearer ${typeof this.#t=="function"?await Promise.resolve(this.#t()):this.#t}`}}};var v=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 b=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 g=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/channels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}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 R=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var O=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 ft="https://api.support.greatdetail.com",vt={"X-Powered-By":"GDSupport/JavaScript"};var y=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,type:o,request:s={}}={}){return this._transport.send("v1/contacts",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.filterQuery("type",o)]})}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({query:t,limit:e,filter:o,include:s,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.limitQuery(e),...this._transport.filterQuery("filter",o),...this._transport.includeQuery(s??{})]})}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 _=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/feedback/conversation",{...t,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/feedback",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/feedback/conversation",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var A=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/escalations/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/escalations",{...t,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/escalations",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/escalations",{...e,method:"POST",json:t})}};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 L=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,type:o,visibility:s,request:r={}}={}){return this._transport.send("v1/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{}),...this._transport.filterQuery("type",o),...this._transport.filterQuery("visibility",s)]})}listByConversation(t,{limit:e,include:o,type:s,visibility:r,request:i={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...i,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{}),...this._transport.filterQuery("type",s),...this._transport.filterQuery("visibility",r)]})}listByChannel(t,{limit:e,include:o,type:s,visibility:r,request:i={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...i,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o),...this._transport.filterQuery("type",s),...this._transport.filterQuery("visibility",r)]})}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 U=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"})}create({body:t,request:e={}}){return this._transport.send("v1/notes",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var S=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=vt;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 i of r)s.push(["category",i])}return t!==void 0&&s.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:s})}};var G=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 bt=dt(require("is-network-error"),1),Q=dt(require("ky"),1);var j=class extends Error{constructor(e,o){super("Support Error",{cause:o});this.response=e}};var k=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:[async o=>{for(let s of this.options.requestFilterables){let r=await Promise.resolve(s.getHeaders());for(let[i,_t]of Object.entries(r))o.headers.has(i)||o.headers.set(i,_t)}}]}})}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}filterQuery(t,e){let o=[];return e===void 0||o.push([t,e]),o}send(t,e={}){let o=this.client(t,e).catch(async s=>{throw(0,bt.default)(s)?new Error("A network error occurred",{cause:s}):s instanceof Q.HTTPError?new j(s.response,s):s});return{response:()=>o,json:async()=>(await o).json()}}};var w=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,include:e,request:o={}}){let s=new FormData;for(let r of t)s.append("file",r);return this._transport.send("v1/uploads",{...o,method:"POST",searchParams:[...this._transport.includeQuery(e??{})],body:s})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var F=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var a=require("zod"),gt=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 x=class{constructor(t){this._transport=t}async event({key:t=process.env[z],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."+z);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}=gt.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 P=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 B=class n{static DEFAULT_BASE_URL=ft;static PublicAuthentication=c;static BasicAuthentication=C;static BearerAuthentication=f;_transport;account;accountAccessToken;accountConversationSettings;accountNotificationEvent;action;boilerplateCategory;boilerplateContent;channel;channelConversationSettings;compositionSection;contact;conversation;conversationFeedback;escalation;label;message;model;note;source;statistics;upload;user;webhook;webhookSubscription;constructor(t,{baseURL:e,...o}={}){this._transport=new k({requestFilterables:[new S,t],...o,baseURL:e?.toString()??n.getBaseURL()}),this.account=new m(this._transport),this.accountAccessToken=new d(this._transport),this.accountConversationSettings=new l(this._transport),this.accountNotificationEvent=new u(this._transport),this.action=new h(this._transport),this.boilerplateCategory=new v(this._transport),this.boilerplateContent=new b(this._transport),this.channel=new g(this._transport),this.channelConversationSettings=new R(this._transport),this.compositionSection=new O(this._transport),this.contact=new y(this._transport),this.conversation=new I(this._transport),this.conversationFeedback=new _(this._transport),this.escalation=new A(this._transport),this.label=new T(this._transport),this.message=new L(this._transport),this.model=new E(this._transport),this.note=new U(this._transport),this.source=new D(this._transport),this.statistics=new G(this._transport),this.upload=new w(this._transport),this.user=new F(this._transport),this.webhook=new x(this._transport),this.webhookSubscription=new P(this._transport)}static getBaseURL(){return process.env[Ct]??this.DEFAULT_BASE_URL}};var $=require("commander"),Rt=require("ora");function J({client:n,ora:t}){let e=new $.Command("actions").description("Actions");return e.addCommand(new $.Command("list").description("List actions").action(async()=>{let o=await(0,Rt.oraPromise)(()=>n.action.list().json(),{...t,text:"Finding actions"});console.log(o)})),e}var X=require("commander"),Ot=require("ora");function Z({client:n,ora:t}){let e=new X.Command("channels").description("Channels");return e.addCommand(new X.Command("list").description("List channels").action(async()=>{let o=await(0,Ot.oraPromise)(()=>n.channel.list().json(),{...t,text:"Finding channels"});console.log(o)})),e}var M=require("commander"),H=require("ora");function tt({client:n,ora:t}){let e=new M.Command("contacts").description("Contacts");return e.addCommand(new M.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 M.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 M.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 V=require("commander"),et=require("ora");function ot({client:n,ora:t}){let e=new V.Command("conversations").description("Conversations");return e.addCommand(new V.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async o=>{let s=await(0,et.oraPromise)(()=>n.conversation.get(o).json(),{...t,text:"Finding conversation"});console.log(s)})),e.addCommand(new V.Command("list").description("List conversations").action(async()=>{let o=await(0,et.oraPromise)(()=>n.conversation.list().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var N=require("commander"),q=require("ora");function nt({client:n,ora:t}){let e=new N.Command("labels").description("Labels");return e.addCommand(new N.Command("get").description("Find label").argument("<label>","Label ID").action(async o=>{let s=await(0,q.oraPromise)(()=>n.label.get(o).json(),{...t,text:"Finding label"});console.log(s)})),e.addCommand(new N.Command("list").description("List labels").action(async()=>{let o=await(0,q.oraPromise)(()=>n.label.list().json(),{...t,text:"Finding labels"});console.log(o)})),e.addCommand(new N.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async o=>{let s=await(0,q.oraPromise)(()=>n.conversation.listByLabel(o).json(),{...t,text:"Finding conversations"});console.log(s)})),e}var st=require("commander"),yt=require("ora");function rt({client:n,ora:t}){let e=new st.Command("messages").description("Messages");return e.addCommand(new st.Command("list").description("List messages").action(async()=>{let o=await(0,yt.oraPromise)(()=>n.message.list().json(),{...t,text:"Finding messages"});console.log(o)})),e}var K=require("commander"),it=require("ora");function at({client:n,ora:t}){let e=new K.Command("models").description("Models");return e.addCommand(new K.Command("get").description("Find model").argument("<model>","Model ID").action(async o=>{let s=await(0,it.oraPromise)(()=>n.model.get(o).json(),{...t,text:"Finding model"});console.log(s)})),e.addCommand(new K.Command("list").description("List models").action(async()=>{let o=await(0,it.oraPromise)(()=>n.model.list().json(),{...t,text:"Finding models"});console.log(o)})),e}var Y=require("commander"),pt=require("ora");function ct({client:n,ora:t}){let e=new Y.Command("sources").description("Sources");return e.addCommand(new Y.Command("get").description("Find source").argument("<source>","Source ID").action(async o=>{let s=await(0,pt.oraPromise)(()=>n.source.get(o).json(),{...t,text:"Finding source"});console.log(s)})),e.addCommand(new Y.Command("list").description("List sources").action(async()=>{let o=await(0,pt.oraPromise)(()=>n.source.list().json(),{...t,text:"Finding sources"});console.log(o)})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new B(new c)},Gt=new It.Command("gds").description("Great Detail Support System").addCommand(J(p)).addCommand(Z(p)).addCommand(tt(p)).addCommand(ot(p)).addCommand(nt(p)).addCommand(rt(p)).addCommand(at(p)).addCommand(ct(p)),kt=Gt;
@@ -1,5 +1,5 @@
1
1
  import { Command } from 'commander';
2
- import { C as Client } from '../Client-Axl2jdgM.cjs';
2
+ import { C as Client } from '../Client-lX540o8a.cjs';
3
3
  import { Options as Options$1 } from 'ora';
4
4
  import 'ky';
5
5
  import 'zod';
@@ -1,5 +1,5 @@
1
1
  import { Command } from 'commander';
2
- import { C as Client } from '../Client-Axl2jdgM.js';
2
+ import { C as Client } from '../Client-lX540o8a.js';
3
3
  import { Options as Options$1 } from 'ora';
4
4
  import 'ky';
5
5
  import 'zod';
package/dist/cli/index.js CHANGED
@@ -1 +1 @@
1
- import{a}from"../chunk-SFEDZ5W6.js";import"../chunk-UPDHBDWN.js";export{a as default};
1
+ import{a}from"../chunk-YCAYD3TL.js";import"../chunk-WIRRATXE.js";export{a as default};
package/dist/cli.cjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var Tt=Object.create;var ct=Object.defineProperty;var Lt=Object.getOwnPropertyDescriptor;var At=Object.getOwnPropertyNames;var Et=Object.getPrototypeOf,Ut=Object.prototype.hasOwnProperty;var St=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of At(t))!Ut.call(n,s)&&s!==e&&ct(n,s,{get:()=>t[s],enumerable:!(o=Lt(t,s))||o.enumerable});return n};var mt=(n,t,e)=>(e=n!=null?Tt(Et(n)):{},St(t||!n||!n.__esModule?ct(e,"default",{value:n,enumerable:!0}):e,n));var yt=require("commander");var c=class{getHeaders(){return{}}};var m=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,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 d=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 l=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 u=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/notifications/events/account/"+encodeURIComponent(t),{...e,method:"GET"})}listByAccount(t,{limit:e,level:o,request:s={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/notifications/events",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.filterQuery("level",o)]})}};var h=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 dt="SUPPORT_ACCESS_TOKEN",lt="SUPPORT_KEY_NAME",ut="SUPPORT_KEY_PASSWORD",Y="SUPPORT_SIGNING_KEY",ht="SUPPORT_BASE_URL";var C=class{name;#t;constructor({name:t=process.env[lt],password:e=process.env[ut]}={}){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}async getHeaders(){let t=typeof this.name=="function"?await Promise.resolve(this.name()):this.name,e=typeof this.#t=="function"?await Promise.resolve(this.#t()):this.#t;return{Authorization:`Basic ${btoa(t+":"+e)}`}}};var f=class{#t;constructor({token:t=process.env[dt]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}async getHeaders(){return{Authorization:`Bearer ${typeof this.#t=="function"?await Promise.resolve(this.#t()):this.#t}`}}};var v=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 b=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 g=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/channels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}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 R=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var O=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 Ct="https://api.support.greatdetail.com",ft={"X-Powered-By":"GDSupport/JavaScript"};var y=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,type:o,request:s={}}={}){return this._transport.send("v1/contacts",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.filterQuery("type",o)]})}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({query:t,limit:e,filter:o,include:s,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.limitQuery(e),...this._transport.filterQuery("filter",o),...this._transport.includeQuery(s??{})]})}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 _=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/feedback/conversation",{...t,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/feedback",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/feedback/conversation",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var T=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/escalations/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/escalations",{...t,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/escalations",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/escalations",{...e,method:"POST",json:t})}};var L=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 A=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,type:o,visibility:s,request:r={}}={}){return this._transport.send("v1/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{}),...this._transport.filterQuery("type",o),...this._transport.filterQuery("visibility",s)]})}listByConversation(t,{limit:e,include:o,type:s,visibility:r,request:i={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...i,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{}),...this._transport.filterQuery("type",s),...this._transport.filterQuery("visibility",r)]})}listByChannel(t,{limit:e,include:o,type:s,visibility:r,request:i={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...i,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o),...this._transport.filterQuery("type",s),...this._transport.filterQuery("visibility",r)]})}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 U=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"})}create({body:t,request:e={}}){return this._transport.send("v1/notes",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var S=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=ft;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 i of r)s.push(["category",i])}return t!==void 0&&s.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:s})}};var G=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 vt=mt(require("is-network-error"),1),j=mt(require("ky"),1);var W=class extends Error{constructor(e,o){super("Support Error",{cause:o});this.response=e}};var k=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=j.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[async o=>{for(let s of this.options.requestFilterables){let r=await Promise.resolve(s.getHeaders());for(let[i,_t]of Object.entries(r))o.headers.has(i)||o.headers.set(i,_t)}}]}})}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}filterQuery(t,e){let o=[];return e===void 0||o.push([t,e]),o}send(t,e={}){let o=this.client(t,e).catch(async s=>{throw(0,vt.default)(s)?new Error("A network error occurred",{cause:s}):s instanceof j.HTTPError?new W(s.response,s):s});return{response:()=>o,json:async()=>(await o).json()}}};var w=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,include:e,request:o={}}){let s=new FormData;for(let r of t)s.append("file",r);return this._transport.send("v1/uploads",{...o,method:"POST",searchParams:[...this._transport.includeQuery(e??{})],body:s})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var F=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var a=require("zod"),bt=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 x=class{constructor(t){this._transport=t}async event({key:t=process.env[Y],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."+Y);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}=bt.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 P=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 B=class n{static DEFAULT_BASE_URL=Ct;static PublicAuthentication=c;static BasicAuthentication=C;static BearerAuthentication=f;_transport;account;accountAccessToken;accountConversationSettings;accountNotificationEvent;action;boilerplateCategory;boilerplateContent;channel;channelConversationSettings;compositionSection;contact;conversation;conversationFeedback;escalation;label;message;model;note;source;statistics;upload;user;webhook;webhookSubscription;constructor(t,{baseURL:e,...o}={}){this._transport=new k({requestFilterables:[new S,t],...o,baseURL:e?.toString()??n.getBaseURL()}),this.account=new m(this._transport),this.accountAccessToken=new d(this._transport),this.accountConversationSettings=new l(this._transport),this.accountNotificationEvent=new u(this._transport),this.action=new h(this._transport),this.boilerplateCategory=new v(this._transport),this.boilerplateContent=new b(this._transport),this.channel=new g(this._transport),this.channelConversationSettings=new R(this._transport),this.compositionSection=new O(this._transport),this.contact=new y(this._transport),this.conversation=new I(this._transport),this.conversationFeedback=new _(this._transport),this.escalation=new T(this._transport),this.label=new L(this._transport),this.message=new A(this._transport),this.model=new E(this._transport),this.note=new U(this._transport),this.source=new D(this._transport),this.statistics=new G(this._transport),this.upload=new w(this._transport),this.user=new F(this._transport),this.webhook=new x(this._transport),this.webhookSubscription=new P(this._transport)}static getBaseURL(){return process.env[ht]??this.DEFAULT_BASE_URL}};var z=require("commander"),gt=require("ora");function $({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,gt.oraPromise)(()=>n.action.list().json(),{...t,text:"Finding actions"});console.log(o)})),e}var J=require("commander"),Rt=require("ora");function X({client:n,ora:t}){let e=new J.Command("channels").description("Channels");return e.addCommand(new J.Command("list").description("List channels").action(async()=>{let o=await(0,Rt.oraPromise)(()=>n.channel.list().json(),{...t,text:"Finding channels"});console.log(o)})),e}var M=require("commander"),Q=require("ora");function Z({client:n,ora:t}){let e=new M.Command("contacts").description("Contacts");return e.addCommand(new M.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async o=>{let s=await(0,Q.oraPromise)(()=>n.contact.get(o).json(),{...t,text:"Finding contact"});console.log(s)})),e.addCommand(new M.Command("list").description("List contacts").action(async()=>{let o=await(0,Q.oraPromise)(()=>n.contact.list().json(),{...t,text:"Finding contacts"});console.log(o)})),e.addCommand(new M.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async o=>{let s=await(0,Q.oraPromise)(()=>n.contact.getVCF(o).response(),{...t,text:"Exporting contact"});console.log(s)})),e}var H=require("commander"),tt=require("ora");function et({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,tt.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,tt.oraPromise)(()=>n.conversation.list().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var N=require("commander"),V=require("ora");function ot({client:n,ora:t}){let e=new N.Command("labels").description("Labels");return e.addCommand(new N.Command("get").description("Find label").argument("<label>","Label ID").action(async o=>{let s=await(0,V.oraPromise)(()=>n.label.get(o).json(),{...t,text:"Finding label"});console.log(s)})),e.addCommand(new N.Command("list").description("List labels").action(async()=>{let o=await(0,V.oraPromise)(()=>n.label.list().json(),{...t,text:"Finding labels"});console.log(o)})),e.addCommand(new N.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async o=>{let s=await(0,V.oraPromise)(()=>n.conversation.listByLabel(o).json(),{...t,text:"Finding conversations"});console.log(s)})),e}var nt=require("commander"),Ot=require("ora");function st({client:n,ora:t}){let e=new nt.Command("messages").description("Messages");return e.addCommand(new nt.Command("list").description("List messages").action(async()=>{let o=await(0,Ot.oraPromise)(()=>n.message.list().json(),{...t,text:"Finding messages"});console.log(o)})),e}var q=require("commander"),rt=require("ora");function it({client:n,ora:t}){let e=new q.Command("models").description("Models");return e.addCommand(new q.Command("get").description("Find model").argument("<model>","Model ID").action(async o=>{let s=await(0,rt.oraPromise)(()=>n.model.get(o).json(),{...t,text:"Finding model"});console.log(s)})),e.addCommand(new q.Command("list").description("List models").action(async()=>{let o=await(0,rt.oraPromise)(()=>n.model.list().json(),{...t,text:"Finding models"});console.log(o)})),e}var K=require("commander"),at=require("ora");function pt({client:n,ora:t}){let e=new K.Command("sources").description("Sources");return e.addCommand(new K.Command("get").description("Find source").argument("<source>","Source ID").action(async o=>{let s=await(0,at.oraPromise)(()=>n.source.get(o).json(),{...t,text:"Finding source"});console.log(s)})),e.addCommand(new K.Command("list").description("List sources").action(async()=>{let o=await(0,at.oraPromise)(()=>n.source.list().json(),{...t,text:"Finding sources"});console.log(o)})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new B(new c)},Dt=new yt.Command("gds").description("Great Detail Support System").addCommand($(p)).addCommand(X(p)).addCommand(Z(p)).addCommand(et(p)).addCommand(ot(p)).addCommand(st(p)).addCommand(it(p)).addCommand(pt(p)),It=Dt;It.parseAsync(process.argv);
2
+ "use strict";var At=Object.create;var ct=Object.defineProperty;var Tt=Object.getOwnPropertyDescriptor;var Lt=Object.getOwnPropertyNames;var Et=Object.getPrototypeOf,Ut=Object.prototype.hasOwnProperty;var St=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Lt(t))!Ut.call(n,s)&&s!==e&&ct(n,s,{get:()=>t[s],enumerable:!(o=Tt(t,s))||o.enumerable});return n};var mt=(n,t,e)=>(e=n!=null?At(Et(n)):{},St(t||!n||!n.__esModule?ct(e,"default",{value:n,enumerable:!0}):e,n));var yt=require("commander");var c=class{getHeaders(){return{}}};var m=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,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 d=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 l=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 u=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/notifications/events/account/"+encodeURIComponent(t),{...e,method:"GET"})}listByAccount(t,{limit:e,level:o,request:s={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/notifications/events",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.filterQuery("level",o)]})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notifications/events/account/"+encodeURIComponent(t),{...o,method:"PATCH",json:{...e,readAt:e.readAt instanceof Date&&typeof e.readAt.getMonth=="function"?e.readAt.toISOString():e.readAt}})}};var h=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 dt="SUPPORT_ACCESS_TOKEN",lt="SUPPORT_KEY_NAME",ut="SUPPORT_KEY_PASSWORD",Y="SUPPORT_SIGNING_KEY",ht="SUPPORT_BASE_URL";var C=class{name;#t;constructor({name:t=process.env[lt],password:e=process.env[ut]}={}){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}async getHeaders(){let t=typeof this.name=="function"?await Promise.resolve(this.name()):this.name,e=typeof this.#t=="function"?await Promise.resolve(this.#t()):this.#t;return{Authorization:`Basic ${btoa(t+":"+e)}`}}};var f=class{#t;constructor({token:t=process.env[dt]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}async getHeaders(){return{Authorization:`Bearer ${typeof this.#t=="function"?await Promise.resolve(this.#t()):this.#t}`}}};var v=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 b=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 g=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/channels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}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 R=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var O=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 Ct="https://api.support.greatdetail.com",ft={"X-Powered-By":"GDSupport/JavaScript"};var y=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,type:o,request:s={}}={}){return this._transport.send("v1/contacts",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.filterQuery("type",o)]})}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({query:t,limit:e,filter:o,include:s,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.limitQuery(e),...this._transport.filterQuery("filter",o),...this._transport.includeQuery(s??{})]})}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 _=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/feedback/conversation",{...t,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/feedback",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/feedback/conversation",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var A=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/escalations/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/escalations",{...t,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/escalations",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/escalations",{...e,method:"POST",json:t})}};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 L=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,type:o,visibility:s,request:r={}}={}){return this._transport.send("v1/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{}),...this._transport.filterQuery("type",o),...this._transport.filterQuery("visibility",s)]})}listByConversation(t,{limit:e,include:o,type:s,visibility:r,request:i={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...i,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{}),...this._transport.filterQuery("type",s),...this._transport.filterQuery("visibility",r)]})}listByChannel(t,{limit:e,include:o,type:s,visibility:r,request:i={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...i,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o),...this._transport.filterQuery("type",s),...this._transport.filterQuery("visibility",r)]})}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 U=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"})}create({body:t,request:e={}}){return this._transport.send("v1/notes",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var S=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=ft;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 i of r)s.push(["category",i])}return t!==void 0&&s.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:s})}};var G=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 vt=mt(require("is-network-error"),1),j=mt(require("ky"),1);var W=class extends Error{constructor(e,o){super("Support Error",{cause:o});this.response=e}};var k=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=j.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[async o=>{for(let s of this.options.requestFilterables){let r=await Promise.resolve(s.getHeaders());for(let[i,_t]of Object.entries(r))o.headers.has(i)||o.headers.set(i,_t)}}]}})}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}filterQuery(t,e){let o=[];return e===void 0||o.push([t,e]),o}send(t,e={}){let o=this.client(t,e).catch(async s=>{throw(0,vt.default)(s)?new Error("A network error occurred",{cause:s}):s instanceof j.HTTPError?new W(s.response,s):s});return{response:()=>o,json:async()=>(await o).json()}}};var w=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,include:e,request:o={}}){let s=new FormData;for(let r of t)s.append("file",r);return this._transport.send("v1/uploads",{...o,method:"POST",searchParams:[...this._transport.includeQuery(e??{})],body:s})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var F=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var a=require("zod"),bt=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 x=class{constructor(t){this._transport=t}async event({key:t=process.env[Y],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."+Y);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}=bt.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 P=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 B=class n{static DEFAULT_BASE_URL=Ct;static PublicAuthentication=c;static BasicAuthentication=C;static BearerAuthentication=f;_transport;account;accountAccessToken;accountConversationSettings;accountNotificationEvent;action;boilerplateCategory;boilerplateContent;channel;channelConversationSettings;compositionSection;contact;conversation;conversationFeedback;escalation;label;message;model;note;source;statistics;upload;user;webhook;webhookSubscription;constructor(t,{baseURL:e,...o}={}){this._transport=new k({requestFilterables:[new S,t],...o,baseURL:e?.toString()??n.getBaseURL()}),this.account=new m(this._transport),this.accountAccessToken=new d(this._transport),this.accountConversationSettings=new l(this._transport),this.accountNotificationEvent=new u(this._transport),this.action=new h(this._transport),this.boilerplateCategory=new v(this._transport),this.boilerplateContent=new b(this._transport),this.channel=new g(this._transport),this.channelConversationSettings=new R(this._transport),this.compositionSection=new O(this._transport),this.contact=new y(this._transport),this.conversation=new I(this._transport),this.conversationFeedback=new _(this._transport),this.escalation=new A(this._transport),this.label=new T(this._transport),this.message=new L(this._transport),this.model=new E(this._transport),this.note=new U(this._transport),this.source=new D(this._transport),this.statistics=new G(this._transport),this.upload=new w(this._transport),this.user=new F(this._transport),this.webhook=new x(this._transport),this.webhookSubscription=new P(this._transport)}static getBaseURL(){return process.env[ht]??this.DEFAULT_BASE_URL}};var z=require("commander"),gt=require("ora");function $({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,gt.oraPromise)(()=>n.action.list().json(),{...t,text:"Finding actions"});console.log(o)})),e}var J=require("commander"),Rt=require("ora");function X({client:n,ora:t}){let e=new J.Command("channels").description("Channels");return e.addCommand(new J.Command("list").description("List channels").action(async()=>{let o=await(0,Rt.oraPromise)(()=>n.channel.list().json(),{...t,text:"Finding channels"});console.log(o)})),e}var M=require("commander"),Q=require("ora");function Z({client:n,ora:t}){let e=new M.Command("contacts").description("Contacts");return e.addCommand(new M.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async o=>{let s=await(0,Q.oraPromise)(()=>n.contact.get(o).json(),{...t,text:"Finding contact"});console.log(s)})),e.addCommand(new M.Command("list").description("List contacts").action(async()=>{let o=await(0,Q.oraPromise)(()=>n.contact.list().json(),{...t,text:"Finding contacts"});console.log(o)})),e.addCommand(new M.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async o=>{let s=await(0,Q.oraPromise)(()=>n.contact.getVCF(o).response(),{...t,text:"Exporting contact"});console.log(s)})),e}var H=require("commander"),tt=require("ora");function et({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,tt.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,tt.oraPromise)(()=>n.conversation.list().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var N=require("commander"),V=require("ora");function ot({client:n,ora:t}){let e=new N.Command("labels").description("Labels");return e.addCommand(new N.Command("get").description("Find label").argument("<label>","Label ID").action(async o=>{let s=await(0,V.oraPromise)(()=>n.label.get(o).json(),{...t,text:"Finding label"});console.log(s)})),e.addCommand(new N.Command("list").description("List labels").action(async()=>{let o=await(0,V.oraPromise)(()=>n.label.list().json(),{...t,text:"Finding labels"});console.log(o)})),e.addCommand(new N.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async o=>{let s=await(0,V.oraPromise)(()=>n.conversation.listByLabel(o).json(),{...t,text:"Finding conversations"});console.log(s)})),e}var nt=require("commander"),Ot=require("ora");function st({client:n,ora:t}){let e=new nt.Command("messages").description("Messages");return e.addCommand(new nt.Command("list").description("List messages").action(async()=>{let o=await(0,Ot.oraPromise)(()=>n.message.list().json(),{...t,text:"Finding messages"});console.log(o)})),e}var q=require("commander"),rt=require("ora");function it({client:n,ora:t}){let e=new q.Command("models").description("Models");return e.addCommand(new q.Command("get").description("Find model").argument("<model>","Model ID").action(async o=>{let s=await(0,rt.oraPromise)(()=>n.model.get(o).json(),{...t,text:"Finding model"});console.log(s)})),e.addCommand(new q.Command("list").description("List models").action(async()=>{let o=await(0,rt.oraPromise)(()=>n.model.list().json(),{...t,text:"Finding models"});console.log(o)})),e}var K=require("commander"),at=require("ora");function pt({client:n,ora:t}){let e=new K.Command("sources").description("Sources");return e.addCommand(new K.Command("get").description("Find source").argument("<source>","Source ID").action(async o=>{let s=await(0,at.oraPromise)(()=>n.source.get(o).json(),{...t,text:"Finding source"});console.log(s)})),e.addCommand(new K.Command("list").description("List sources").action(async()=>{let o=await(0,at.oraPromise)(()=>n.source.list().json(),{...t,text:"Finding sources"});console.log(o)})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new B(new c)},Dt=new yt.Command("gds").description("Great Detail Support System").addCommand($(p)).addCommand(X(p)).addCommand(Z(p)).addCommand(et(p)).addCommand(ot(p)).addCommand(st(p)).addCommand(it(p)).addCommand(pt(p)),It=Dt;It.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-SFEDZ5W6.js";import"./chunk-UPDHBDWN.js";r.parseAsync(process.argv);
2
+ import{a as r}from"./chunk-YCAYD3TL.js";import"./chunk-WIRRATXE.js";r.parseAsync(process.argv);
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var et=Object.create;var M=Object.defineProperty;var ot=Object.getOwnPropertyDescriptor;var st=Object.getOwnPropertyNames;var nt=Object.getPrototypeOf,rt=Object.prototype.hasOwnProperty;var q=(n,t)=>{for(var e in t)M(n,e,{get:t[e],enumerable:!0})},V=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of st(t))!rt.call(n,s)&&s!==e&&M(n,s,{get:()=>t[s],enumerable:!(o=ot(t,s))||o.enumerable});return n};var K=(n,t,e)=>(e=n!=null?et(nt(n)):{},V(t||!n||!n.__esModule?M(e,"default",{value:n,enumerable:!0}):e,n)),it=n=>V(M({},"__esModule",{value:!0}),n);var pt={};q(pt,{Client:()=>c,DEFAULT_SUPPORT_BASE_URL:()=>N,Error:()=>H,SupportError:()=>a,default:()=>c,eventWebhookSchema:()=>j});module.exports=it(pt);var N="https://api.support.greatdetail.com",Y={"X-Powered-By":"GDSupport/JavaScript"};var m=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,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 l=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 d=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 u=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/notifications/events/account/"+encodeURIComponent(t),{...e,method:"GET"})}listByAccount(t,{limit:e,level:o,request:s={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/notifications/events",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.filterQuery("level",o)]})}};var h=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 z="SUPPORT_ACCESS_TOKEN",$="SUPPORT_KEY_NAME",J="SUPPORT_KEY_PASSWORD",Q="SUPPORT_SIGNING_KEY",X="SUPPORT_BASE_URL";var f=class{name;#t;constructor({name:t=process.env[$],password:e=process.env[J]}={}){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}async getHeaders(){let t=typeof this.name=="function"?await Promise.resolve(this.name()):this.name,e=typeof this.#t=="function"?await Promise.resolve(this.#t()):this.#t;return{Authorization:`Basic ${btoa(t+":"+e)}`}}};var C=class{#t;constructor({token:t=process.env[z]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}async getHeaders(){return{Authorization:`Bearer ${typeof this.#t=="function"?await Promise.resolve(this.#t()):this.#t}`}}};var v=class{getHeaders(){return{}}};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 R=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 g=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/channels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}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 O=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var x=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 y=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,type:o,request:s={}}={}){return this._transport.send("v1/contacts",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.filterQuery("type",o)]})}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 _=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({query:t,limit:e,filter:o,include:s,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.limitQuery(e),...this._transport.filterQuery("filter",o),...this._transport.includeQuery(s??{})]})}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 I=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/feedback/conversation",{...t,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/feedback",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/feedback/conversation",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var T=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/escalations/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/escalations",{...t,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/escalations",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/escalations",{...e,method:"POST",json:t})}};var A=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 L=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,type:o,visibility:s,request:r={}}={}){return this._transport.send("v1/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{}),...this._transport.filterQuery("type",o),...this._transport.filterQuery("visibility",s)]})}listByConversation(t,{limit:e,include:o,type:s,visibility:r,request:i={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...i,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{}),...this._transport.filterQuery("type",s),...this._transport.filterQuery("visibility",r)]})}listByChannel(t,{limit:e,include:o,type:s,visibility:r,request:i={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...i,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o),...this._transport.filterQuery("type",s),...this._transport.filterQuery("visibility",r)]})}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 U=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"})}create({body:t,request:e={}}){return this._transport.send("v1/notes",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var S=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 i of r)s.push(["category",i])}return t!==void 0&&s.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:s})}};var G=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 Z=K(require("is-network-error"),1),W=K(require("ky"),1);var a=class extends Error{constructor(e,o){super("Support Error",{cause:o});this.response=e}};var k=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=W.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[async o=>{for(let s of this.options.requestFilterables){let r=await Promise.resolve(s.getHeaders());for(let[i,tt]of Object.entries(r))o.headers.has(i)||o.headers.set(i,tt)}}]}})}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}filterQuery(t,e){let o=[];return e===void 0||o.push([t,e]),o}send(t,e={}){let o=this.client(t,e).catch(async s=>{throw(0,Z.default)(s)?new Error("A network error occurred",{cause:s}):s instanceof W.HTTPError?new a(s.response,s):s});return{response:()=>o,json:async()=>(await o).json()}}};var P=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,include:e,request:o={}}){let s=new FormData;for(let r of t)s.append("file",r);return this._transport.send("v1/uploads",{...o,method:"POST",searchParams:[...this._transport.includeQuery(e??{})],body:s})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var F=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var p=require("zod"),j=p.z.object({data:p.z.object({event:p.z.object({id:p.z.string(),type:p.z.string(),payload:p.z.record(p.z.string()),createdAt:p.z.string().datetime()})})});var B=class{constructor(t){this._transport=t}async event({key:t=process.env[Q],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."+Q);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}=j.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 w=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 c=class n{static DEFAULT_BASE_URL=N;static PublicAuthentication=v;static BasicAuthentication=f;static BearerAuthentication=C;_transport;account;accountAccessToken;accountConversationSettings;accountNotificationEvent;action;boilerplateCategory;boilerplateContent;channel;channelConversationSettings;compositionSection;contact;conversation;conversationFeedback;escalation;label;message;model;note;source;statistics;upload;user;webhook;webhookSubscription;constructor(t,{baseURL:e,...o}={}){this._transport=new k({requestFilterables:[new S,t],...o,baseURL:e?.toString()??n.getBaseURL()}),this.account=new m(this._transport),this.accountAccessToken=new l(this._transport),this.accountConversationSettings=new d(this._transport),this.accountNotificationEvent=new u(this._transport),this.action=new h(this._transport),this.boilerplateCategory=new b(this._transport),this.boilerplateContent=new R(this._transport),this.channel=new g(this._transport),this.channelConversationSettings=new O(this._transport),this.compositionSection=new x(this._transport),this.contact=new y(this._transport),this.conversation=new _(this._transport),this.conversationFeedback=new I(this._transport),this.escalation=new T(this._transport),this.label=new A(this._transport),this.message=new L(this._transport),this.model=new E(this._transport),this.note=new U(this._transport),this.source=new D(this._transport),this.statistics=new G(this._transport),this.upload=new P(this._transport),this.user=new F(this._transport),this.webhook=new B(this._transport),this.webhookSubscription=new w(this._transport)}static getBaseURL(){return process.env[X]??this.DEFAULT_BASE_URL}};var H={};q(H,{SupportError:()=>a});0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,Error,SupportError,eventWebhookSchema});
1
+ "use strict";var et=Object.create;var N=Object.defineProperty;var ot=Object.getOwnPropertyDescriptor;var st=Object.getOwnPropertyNames;var nt=Object.getPrototypeOf,rt=Object.prototype.hasOwnProperty;var q=(n,t)=>{for(var e in t)N(n,e,{get:t[e],enumerable:!0})},V=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of st(t))!rt.call(n,s)&&s!==e&&N(n,s,{get:()=>t[s],enumerable:!(o=ot(t,s))||o.enumerable});return n};var K=(n,t,e)=>(e=n!=null?et(nt(n)):{},V(t||!n||!n.__esModule?N(e,"default",{value:n,enumerable:!0}):e,n)),it=n=>V(N({},"__esModule",{value:!0}),n);var pt={};q(pt,{Client:()=>c,DEFAULT_SUPPORT_BASE_URL:()=>M,Error:()=>H,SupportError:()=>a,default:()=>c,eventWebhookSchema:()=>j});module.exports=it(pt);var M="https://api.support.greatdetail.com",Y={"X-Powered-By":"GDSupport/JavaScript"};var m=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,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 l=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 d=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 u=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/notifications/events/account/"+encodeURIComponent(t),{...e,method:"GET"})}listByAccount(t,{limit:e,level:o,request:s={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/notifications/events",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.filterQuery("level",o)]})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notifications/events/account/"+encodeURIComponent(t),{...o,method:"PATCH",json:{...e,readAt:e.readAt instanceof Date&&typeof e.readAt.getMonth=="function"?e.readAt.toISOString():e.readAt}})}};var h=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 z="SUPPORT_ACCESS_TOKEN",$="SUPPORT_KEY_NAME",J="SUPPORT_KEY_PASSWORD",Q="SUPPORT_SIGNING_KEY",X="SUPPORT_BASE_URL";var f=class{name;#t;constructor({name:t=process.env[$],password:e=process.env[J]}={}){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}async getHeaders(){let t=typeof this.name=="function"?await Promise.resolve(this.name()):this.name,e=typeof this.#t=="function"?await Promise.resolve(this.#t()):this.#t;return{Authorization:`Basic ${btoa(t+":"+e)}`}}};var C=class{#t;constructor({token:t=process.env[z]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}async getHeaders(){return{Authorization:`Bearer ${typeof this.#t=="function"?await Promise.resolve(this.#t()):this.#t}`}}};var v=class{getHeaders(){return{}}};var R=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 b=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 g=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/channels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}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 O=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var x=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 y=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,type:o,request:s={}}={}){return this._transport.send("v1/contacts",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.filterQuery("type",o)]})}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 _=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({query:t,limit:e,filter:o,include:s,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.limitQuery(e),...this._transport.filterQuery("filter",o),...this._transport.includeQuery(s??{})]})}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 A=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/feedback/conversation",{...t,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/feedback",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/feedback/conversation",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var I=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/escalations/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/escalations",{...t,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/escalations",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/escalations",{...e,method:"POST",json:t})}};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 E=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,type:o,visibility:s,request:r={}}={}){return this._transport.send("v1/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{}),...this._transport.filterQuery("type",o),...this._transport.filterQuery("visibility",s)]})}listByConversation(t,{limit:e,include:o,type:s,visibility:r,request:i={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...i,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{}),...this._transport.filterQuery("type",s),...this._transport.filterQuery("visibility",r)]})}listByChannel(t,{limit:e,include:o,type:s,visibility:r,request:i={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...i,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o),...this._transport.filterQuery("type",s),...this._transport.filterQuery("visibility",r)]})}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 L=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 U=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"})}create({body:t,request:e={}}){return this._transport.send("v1/notes",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var S=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 i of r)s.push(["category",i])}return t!==void 0&&s.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:s})}};var G=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 Z=K(require("is-network-error"),1),W=K(require("ky"),1);var a=class extends Error{constructor(e,o){super("Support Error",{cause:o});this.response=e}};var k=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=W.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[async o=>{for(let s of this.options.requestFilterables){let r=await Promise.resolve(s.getHeaders());for(let[i,tt]of Object.entries(r))o.headers.has(i)||o.headers.set(i,tt)}}]}})}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}filterQuery(t,e){let o=[];return e===void 0||o.push([t,e]),o}send(t,e={}){let o=this.client(t,e).catch(async s=>{throw(0,Z.default)(s)?new Error("A network error occurred",{cause:s}):s instanceof W.HTTPError?new a(s.response,s):s});return{response:()=>o,json:async()=>(await o).json()}}};var P=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,include:e,request:o={}}){let s=new FormData;for(let r of t)s.append("file",r);return this._transport.send("v1/uploads",{...o,method:"POST",searchParams:[...this._transport.includeQuery(e??{})],body:s})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var F=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var p=require("zod"),j=p.z.object({data:p.z.object({event:p.z.object({id:p.z.string(),type:p.z.string(),payload:p.z.record(p.z.string()),createdAt:p.z.string().datetime()})})});var B=class{constructor(t){this._transport=t}async event({key:t=process.env[Q],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."+Q);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}=j.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 w=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 c=class n{static DEFAULT_BASE_URL=M;static PublicAuthentication=v;static BasicAuthentication=f;static BearerAuthentication=C;_transport;account;accountAccessToken;accountConversationSettings;accountNotificationEvent;action;boilerplateCategory;boilerplateContent;channel;channelConversationSettings;compositionSection;contact;conversation;conversationFeedback;escalation;label;message;model;note;source;statistics;upload;user;webhook;webhookSubscription;constructor(t,{baseURL:e,...o}={}){this._transport=new k({requestFilterables:[new S,t],...o,baseURL:e?.toString()??n.getBaseURL()}),this.account=new m(this._transport),this.accountAccessToken=new l(this._transport),this.accountConversationSettings=new d(this._transport),this.accountNotificationEvent=new u(this._transport),this.action=new h(this._transport),this.boilerplateCategory=new R(this._transport),this.boilerplateContent=new b(this._transport),this.channel=new g(this._transport),this.channelConversationSettings=new O(this._transport),this.compositionSection=new x(this._transport),this.contact=new y(this._transport),this.conversation=new _(this._transport),this.conversationFeedback=new A(this._transport),this.escalation=new I(this._transport),this.label=new T(this._transport),this.message=new E(this._transport),this.model=new L(this._transport),this.note=new U(this._transport),this.source=new D(this._transport),this.statistics=new G(this._transport),this.upload=new P(this._transport),this.user=new F(this._transport),this.webhook=new B(this._transport),this.webhookSubscription=new w(this._transport)}static getBaseURL(){return process.env[X]??this.DEFAULT_BASE_URL}};var H={};q(H,{SupportError:()=>a});0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,Error,SupportError,eventWebhookSchema});
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as Account, k as AccountAccessToken, l as AccountAccessTokenID, dv as AccountAccessTokenWebhookEventType, u as AccountConversationSettings, d as AccountID, B as AccountNotificationEvent, dw as AccountNotificationEventEventType, c as AccountStatus, du as AccountWebhookWebhookEventType, J as Action, K as ActionID, M as ActionStatus, br as ActiveConversationStatus, a5 as BoilerplateCategory, a6 as BoilerplateCategoryID, Q as BoilerplateContent, T as BoilerplateContentID, ai as Channel, aA as ChannelConversationSettings, aj as ChannelID, ak as ChannelStatus, C as Client, aG as CompositionSection, aH as CompositionSectionID, aI as CompositionSectionLocation, bs as ConcludedConversationStatus, b3 as Contact, b7 as ContactCustomMetadata, b4 as ContactID, b6 as ContactStatus, b5 as ContactType, dx as ContactWebhookEventType, bo as Conversation, bq as ConversationCustomMetadata, bQ as ConversationFeedback, bp as ConversationID, bP as ConversationSettings, bt as ConversationStatus, dy as ConversationWebhookEventType, n as CreateAccountAccessTokenOptions, m as CreateAccountAccessTokenPayload, o as CreateAccountAccessTokenResponse, f as CreateAccountOptions, e as CreateAccountPayload, g as CreateAccountResponse, a8 as CreateBoilerplateCategoryOptions, a7 as CreateBoilerplateCategoryPayload, a9 as CreateBoilerplateCategoryResponse, W as CreateBoilerplateContentOptions, V as CreateBoilerplateContentPayload, X as CreateBoilerplateContentResponse, am as CreateChannelOptions, al as CreateChannelPayload, an as CreateChannelResponse, aK as CreateCompositionSectionOptions, aJ as CreateCompositionSectionPayload, aL as CreateCompositionSectionResponse, b9 as CreateContactOptions, b8 as CreateContactPayload, ba as CreateContactResponse, bS as CreateConversationFeedbackOptions, bR as CreateConversationFeedbackPayload, bT as CreateConversationFeedbackResponse, bv as CreateConversationOptions, bu as CreateConversationPayload, bw as CreateConversationResponse, cI as CreateCorrectionModelOptions, cH as CreateCorrectionModelPayload, cJ as CreateCorrectionResponse, aX as CreateEscalationOptions, aW as CreateEscalationPayload, aY as CreateEscalationResponse, c2 as CreateLabelOptions, c1 as CreateLabelPayload, c3 as CreateLabelResponse, cl as CreateMessageOptions, ck as CreateMessagePayload, cm as CreateMessageResponse, cU as CreateNoteOptions, cT as CreateNotePayload, cV as CreateNoteResponse, cL as CreateResponseModelOptions, cK as CreateResponseModelPayload, cM as CreateResponseResponse, dc as CreateUploadIncludeOptions, dd as CreateUploadOptions, de as CreateUploadResponse, dF as CreateWebhookSubscriptionOptions, dE as CreateWebhookSubscriptionPayload, dG as CreateWebhookSubscriptionResponse, b as CurrentAccountID, p as DeleteAccountAccessTokenOptions, D as DeleteAccountAccessTokenPayload, q as DeleteAccountAccessTokenResponse, bb as DeleteContactOptions, bc as DeleteContactResponse, bU as DeleteConversationFeedbackOptions, bV as DeleteConversationFeedbackResponse, bx as DeleteConversationOptions, by as DeleteConversationResponse, c4 as DeleteLabelOptions, c5 as DeleteLabelResponse, cn as DeleteMessageOptions, co as DeleteMessageResponse, df as DeleteUploadOptions, dg as DeleteUploadResponse, dH as DeleteWebhookSubscriptionOptions, dI as DeleteWebhookSubscriptionResponse, aV as Escalation, dr as EventWebhookOptions, r as GetAccountAccessTokenOptions, s as GetAccountAccessTokenResponse, v as GetAccountConversationSettingsOptions, w as GetAccountConversationSettingsResponse, E as GetAccountNotificationEventOptions, F as GetAccountNotificationEventResponse, G as GetAccountOptions, h as GetAccountResponse, aa as GetBoilerplateCategoryOptions, ab as GetBoilerplateCategoryResponse, Y as GetBoilerplateContentOptions, Z as GetBoilerplateContentResponse, aB as GetChannelConversationSettingsOptions, aC as GetChannelConversationSettingsResponse, ao as GetChannelOptions, ap as GetChannelResponse, aM as GetCompositionSectionOptions, aN as GetCompositionSectionResponse, bd as GetContactIncludeOptions, be as GetContactOptions, bf as GetContactResponse, bg as GetContactVCFOptions, bW as GetConversationFeedbackOptions, bX as GetConversationFeedbackResponse, bz as GetConversationIncludeOptions, bA as GetConversationOptions, bB as GetConversationResponse, aZ as GetEscalationOptions, a_ as GetEscalationResponse, c6 as GetLabelOptions, c7 as GetLabelResponse, cp as GetMessageOptions, cq as GetMessageResponse, cN as GetModelOptions, cO as GetModelResponse, cW as GetNoteOptions, cX as GetNoteResponse, d6 as GetSourceOptions, d7 as GetSourceResponse, dh as GetUploadOptions, di as GetUploadResponse, dn as GetUserOptions, dp as GetUserResponse, dJ as GetWebhookSubscriptionOptions, dK as GetWebhookSubscriptionResponse, c0 as Label, c8 as LabelID, L as ListAccountAccessTokensOptions, t as ListAccountAccessTokensResponse, H as ListAccountNotificationEventsOptions, I as ListAccountNotificationEventsResponse, N as ListActionsOptions, P as ListActionsResponse, ac as ListBoilerplateCategoriesIncludeOptions, ad as ListBoilerplateCategoriesOptions, ae as ListBoilerplateCategoriesResponse, _ as ListBoilerplateCategoryBoilerplateContentsOptions, $ as ListBoilerplateCategoryBoilerplateContentsResponse, a0 as ListBoilerplateContentsOptions, a1 as ListBoilerplateContentsResponse, aO as ListChannelCompositionSectionsOptions, aP as ListChannelCompositionSectionsResponse, bC as ListChannelConversationsOptions, bD as ListChannelConversationsResponse, cr as ListChannelMessagesIncludeOptions, cs as ListChannelMessagesOptions, ct as ListChannelMessagesResponse, aq as ListChannelsOptions, ar as ListChannelsResponse, aQ as ListCompositionSectionsOptions, aR as ListCompositionSectionsResponse, bE as ListContactConversationsOptions, bF as ListContactConversationsResponse, c9 as ListContactLabelsOptions, ca as ListContactLabelsResponse, cY as ListContactNotesOptions, cZ as ListContactNotesResponse, bh as ListContactsOptions, bi as ListContactsResponse, bY as ListConversationConversationFeedbackOptions, bZ as ListConversationConversationFeedbackResponse, a$ as ListConversationEscalationsOptions, b0 as ListConversationEscalationsResponse, b_ as ListConversationFeedbackOptions, b$ as ListConversationFeedbackResponse, cb as ListConversationLabelsOptions, cc as ListConversationLabelsResponse, cu as ListConversationMessagesIncludeOptions, cv as ListConversationMessagesOptions, cw as ListConversationMessagesResponse, c_ as ListConversationNotesOptions, c$ as ListConversationNotesResponse, bI as ListConversationOptions, bH as ListConversationsFilterOptions, bG as ListConversationsIncludeOptions, bJ as ListConversationsResponse, b1 as ListEscalationsOptions, b2 as ListEscalationsResponse, bj as ListLabelContactsOptions, bk as ListLabelContactsResponse, bK as ListLabelConversationsOptions, bL as ListLabelConversationsResponse, cd as ListLabelsIncludeOptions, ce as ListLabelsOptions, cf as ListLabelsResponse, cx as ListMessagesIncludeOptions, cy as ListMessagesOptions, cz as ListMessagesResponse, cP as ListModelsOptions, cQ as ListModelsResponse, d8 as ListSourcesOptions, d9 as ListSourcesResponse, dj as ListUploadsOptions, dk as ListUploadsResponse, dL as ListWebhookSubscriptionsOptions, dM as ListWebhookSubscriptionsResponse, cj as Message, cF as MessageEventType, cA as MessageID, cB as MessageRole, cD as MessageStatus, cC as MessageType, cE as MessageVisibility, dz as MessageWebhookEventType, as as MetaWhatsappChannelGetBusinessProfileOptions, at as MetaWhatsappChannelGetBusinessProfileResponse, cG as Model, cR as ModelID, cS as Note, d0 as NoteID, d4 as NotificationEvent, O as Options, R as RequestFilterable, S as SortOptions, d5 as Source, da as SourceID, dN as TestWebhookSubscriptionOptions, dO as TestWebhookSubscriptionResponse, a as TransportOptions, au as TwilioSendChannelSyncPayload, av as TwilioSendgridChannelSyncOptions, aw as TwilioSendgridChannelSyncResponse, y as UpdateAccountConversationSettingsOptions, x as UpdateAccountConversationSettingsPayload, z as UpdateAccountConversationSettingsResponse, i as UpdateAccountOptions, U as UpdateAccountPayload, j as UpdateAccountResponse, ag as UpdateBoilerplateCategoryOptions, af as UpdateBoilerplateCategoryPayload, ah as UpdateBoilerplateCategoryResponse, a3 as UpdateBoilerplateContentOptions, a2 as UpdateBoilerplateContentPayload, a4 as UpdateBoilerplateContentResponse, aE as UpdateChannelConversationSettingsOptions, aD as UpdateChannelConversationSettingsPayload, aF as UpdateChannelConversationSettingsResponse, ay as UpdateChannelOptions, ax as UpdateChannelPayload, az as UpdateChannelResponse, aT as UpdateCompositionSectionOptions, aS as UpdateCompositionSectionPayload, aU as UpdateCompositionSectionResponse, bm as UpdateContactOptions, bl as UpdateContactPayload, bn as UpdateContactResponse, bN as UpdateConversationOptions, bM as UpdateConversationPayload, bO as UpdateConversationResponse, ch as UpdateLabelOptions, cg as UpdateLabelPayload, ci as UpdateLabelResponse, d2 as UpdateNoteOptions, d1 as UpdateNotePayload, d3 as UpdateNoteResponse, db as Upload, dl as UploadID, dm as User, dq as UserID, dB as WebhookEventPayload, dt as WebhookEventType, dC as WebhookResponse, dD as WebhookSubscription, dP as WebhookSubscriptionID, dA as WebhookSubscriptionWebhookEventType, C as default, ds as eventWebhookSchema } from './Client-Axl2jdgM.cjs';
1
+ export { A as Account, k as AccountAccessToken, l as AccountAccessTokenID, dv as AccountAccessTokenWebhookEventType, u as AccountConversationSettings, d as AccountID, B as AccountNotificationEvent, dw as AccountNotificationEventEventType, c as AccountStatus, du as AccountWebhookWebhookEventType, J as Action, K as ActionID, M as ActionStatus, br as ActiveConversationStatus, a5 as BoilerplateCategory, a6 as BoilerplateCategoryID, Q as BoilerplateContent, T as BoilerplateContentID, ai as Channel, aA as ChannelConversationSettings, aj as ChannelID, ak as ChannelStatus, C as Client, aG as CompositionSection, aH as CompositionSectionID, aI as CompositionSectionLocation, bs as ConcludedConversationStatus, b3 as Contact, b7 as ContactCustomMetadata, b4 as ContactID, b6 as ContactStatus, b5 as ContactType, dx as ContactWebhookEventType, bo as Conversation, bq as ConversationCustomMetadata, bQ as ConversationFeedback, bp as ConversationID, bP as ConversationSettings, bt as ConversationStatus, dy as ConversationWebhookEventType, n as CreateAccountAccessTokenOptions, m as CreateAccountAccessTokenPayload, o as CreateAccountAccessTokenResponse, f as CreateAccountOptions, e as CreateAccountPayload, g as CreateAccountResponse, a8 as CreateBoilerplateCategoryOptions, a7 as CreateBoilerplateCategoryPayload, a9 as CreateBoilerplateCategoryResponse, W as CreateBoilerplateContentOptions, V as CreateBoilerplateContentPayload, X as CreateBoilerplateContentResponse, am as CreateChannelOptions, al as CreateChannelPayload, an as CreateChannelResponse, aK as CreateCompositionSectionOptions, aJ as CreateCompositionSectionPayload, aL as CreateCompositionSectionResponse, b9 as CreateContactOptions, b8 as CreateContactPayload, ba as CreateContactResponse, bS as CreateConversationFeedbackOptions, bR as CreateConversationFeedbackPayload, bT as CreateConversationFeedbackResponse, bv as CreateConversationOptions, bu as CreateConversationPayload, bw as CreateConversationResponse, cI as CreateCorrectionModelOptions, cH as CreateCorrectionModelPayload, cJ as CreateCorrectionResponse, aX as CreateEscalationOptions, aW as CreateEscalationPayload, aY as CreateEscalationResponse, c2 as CreateLabelOptions, c1 as CreateLabelPayload, c3 as CreateLabelResponse, cl as CreateMessageOptions, ck as CreateMessagePayload, cm as CreateMessageResponse, cU as CreateNoteOptions, cT as CreateNotePayload, cV as CreateNoteResponse, cL as CreateResponseModelOptions, cK as CreateResponseModelPayload, cM as CreateResponseResponse, dc as CreateUploadIncludeOptions, dd as CreateUploadOptions, de as CreateUploadResponse, dF as CreateWebhookSubscriptionOptions, dE as CreateWebhookSubscriptionPayload, dG as CreateWebhookSubscriptionResponse, b as CurrentAccountID, p as DeleteAccountAccessTokenOptions, D as DeleteAccountAccessTokenPayload, q as DeleteAccountAccessTokenResponse, bb as DeleteContactOptions, bc as DeleteContactResponse, bU as DeleteConversationFeedbackOptions, bV as DeleteConversationFeedbackResponse, bx as DeleteConversationOptions, by as DeleteConversationResponse, c4 as DeleteLabelOptions, c5 as DeleteLabelResponse, cn as DeleteMessageOptions, co as DeleteMessageResponse, df as DeleteUploadOptions, dg as DeleteUploadResponse, dH as DeleteWebhookSubscriptionOptions, dI as DeleteWebhookSubscriptionResponse, aV as Escalation, dr as EventWebhookOptions, r as GetAccountAccessTokenOptions, s as GetAccountAccessTokenResponse, v as GetAccountConversationSettingsOptions, w as GetAccountConversationSettingsResponse, E as GetAccountNotificationEventOptions, F as GetAccountNotificationEventResponse, G as GetAccountOptions, h as GetAccountResponse, aa as GetBoilerplateCategoryOptions, ab as GetBoilerplateCategoryResponse, Y as GetBoilerplateContentOptions, Z as GetBoilerplateContentResponse, aB as GetChannelConversationSettingsOptions, aC as GetChannelConversationSettingsResponse, ao as GetChannelOptions, ap as GetChannelResponse, aM as GetCompositionSectionOptions, aN as GetCompositionSectionResponse, bd as GetContactIncludeOptions, be as GetContactOptions, bf as GetContactResponse, bg as GetContactVCFOptions, bW as GetConversationFeedbackOptions, bX as GetConversationFeedbackResponse, bz as GetConversationIncludeOptions, bA as GetConversationOptions, bB as GetConversationResponse, aZ as GetEscalationOptions, a_ as GetEscalationResponse, c6 as GetLabelOptions, c7 as GetLabelResponse, cp as GetMessageOptions, cq as GetMessageResponse, cN as GetModelOptions, cO as GetModelResponse, cW as GetNoteOptions, cX as GetNoteResponse, d6 as GetSourceOptions, d7 as GetSourceResponse, dh as GetUploadOptions, di as GetUploadResponse, dn as GetUserOptions, dp as GetUserResponse, dJ as GetWebhookSubscriptionOptions, dK as GetWebhookSubscriptionResponse, c0 as Label, c8 as LabelID, L as ListAccountAccessTokensOptions, t as ListAccountAccessTokensResponse, H as ListAccountNotificationEventsOptions, I as ListAccountNotificationEventsResponse, N as ListActionsOptions, P as ListActionsResponse, ac as ListBoilerplateCategoriesIncludeOptions, ad as ListBoilerplateCategoriesOptions, ae as ListBoilerplateCategoriesResponse, _ as ListBoilerplateCategoryBoilerplateContentsOptions, $ as ListBoilerplateCategoryBoilerplateContentsResponse, a0 as ListBoilerplateContentsOptions, a1 as ListBoilerplateContentsResponse, aO as ListChannelCompositionSectionsOptions, aP as ListChannelCompositionSectionsResponse, bC as ListChannelConversationsOptions, bD as ListChannelConversationsResponse, cr as ListChannelMessagesIncludeOptions, cs as ListChannelMessagesOptions, ct as ListChannelMessagesResponse, aq as ListChannelsOptions, ar as ListChannelsResponse, aQ as ListCompositionSectionsOptions, aR as ListCompositionSectionsResponse, bE as ListContactConversationsOptions, bF as ListContactConversationsResponse, c9 as ListContactLabelsOptions, ca as ListContactLabelsResponse, cY as ListContactNotesOptions, cZ as ListContactNotesResponse, bh as ListContactsOptions, bi as ListContactsResponse, bY as ListConversationConversationFeedbackOptions, bZ as ListConversationConversationFeedbackResponse, a$ as ListConversationEscalationsOptions, b0 as ListConversationEscalationsResponse, b_ as ListConversationFeedbackOptions, b$ as ListConversationFeedbackResponse, cb as ListConversationLabelsOptions, cc as ListConversationLabelsResponse, cu as ListConversationMessagesIncludeOptions, cv as ListConversationMessagesOptions, cw as ListConversationMessagesResponse, c_ as ListConversationNotesOptions, c$ as ListConversationNotesResponse, bI as ListConversationOptions, bH as ListConversationsFilterOptions, bG as ListConversationsIncludeOptions, bJ as ListConversationsResponse, b1 as ListEscalationsOptions, b2 as ListEscalationsResponse, bj as ListLabelContactsOptions, bk as ListLabelContactsResponse, bK as ListLabelConversationsOptions, bL as ListLabelConversationsResponse, cd as ListLabelsIncludeOptions, ce as ListLabelsOptions, cf as ListLabelsResponse, cx as ListMessagesIncludeOptions, cy as ListMessagesOptions, cz as ListMessagesResponse, cP as ListModelsOptions, cQ as ListModelsResponse, d8 as ListSourcesOptions, d9 as ListSourcesResponse, dj as ListUploadsOptions, dk as ListUploadsResponse, dL as ListWebhookSubscriptionsOptions, dM as ListWebhookSubscriptionsResponse, cj as Message, cF as MessageEventType, cA as MessageID, cB as MessageRole, cD as MessageStatus, cC as MessageType, cE as MessageVisibility, dz as MessageWebhookEventType, as as MetaWhatsappChannelGetBusinessProfileOptions, at as MetaWhatsappChannelGetBusinessProfileResponse, cG as Model, cR as ModelID, cS as Note, d0 as NoteID, d4 as NotificationEvent, O as Options, R as RequestFilterable, S as SortOptions, d5 as Source, da as SourceID, dN as TestWebhookSubscriptionOptions, dO as TestWebhookSubscriptionResponse, a as TransportOptions, au as TwilioSendChannelSyncPayload, av as TwilioSendgridChannelSyncOptions, aw as TwilioSendgridChannelSyncResponse, y as UpdateAccountConversationSettingsOptions, x as UpdateAccountConversationSettingsPayload, z as UpdateAccountConversationSettingsResponse, i as UpdateAccountOptions, U as UpdateAccountPayload, j as UpdateAccountResponse, ag as UpdateBoilerplateCategoryOptions, af as UpdateBoilerplateCategoryPayload, ah as UpdateBoilerplateCategoryResponse, a3 as UpdateBoilerplateContentOptions, a2 as UpdateBoilerplateContentPayload, a4 as UpdateBoilerplateContentResponse, aE as UpdateChannelConversationSettingsOptions, aD as UpdateChannelConversationSettingsPayload, aF as UpdateChannelConversationSettingsResponse, ay as UpdateChannelOptions, ax as UpdateChannelPayload, az as UpdateChannelResponse, aT as UpdateCompositionSectionOptions, aS as UpdateCompositionSectionPayload, aU as UpdateCompositionSectionResponse, bm as UpdateContactOptions, bl as UpdateContactPayload, bn as UpdateContactResponse, bN as UpdateConversationOptions, bM as UpdateConversationPayload, bO as UpdateConversationResponse, ch as UpdateLabelOptions, cg as UpdateLabelPayload, ci as UpdateLabelResponse, d2 as UpdateNoteOptions, d1 as UpdateNotePayload, d3 as UpdateNoteResponse, db as Upload, dl as UploadID, dm as User, dq as UserID, dB as WebhookEventPayload, dt as WebhookEventType, dC as WebhookResponse, dD as WebhookSubscription, dP as WebhookSubscriptionID, dA as WebhookSubscriptionWebhookEventType, C as default, ds as eventWebhookSchema } from './Client-lX540o8a.cjs';
2
2
  import { KyResponse } from '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, dv as AccountAccessTokenWebhookEventType, u as AccountConversationSettings, d as AccountID, B as AccountNotificationEvent, dw as AccountNotificationEventEventType, c as AccountStatus, du as AccountWebhookWebhookEventType, J as Action, K as ActionID, M as ActionStatus, br as ActiveConversationStatus, a5 as BoilerplateCategory, a6 as BoilerplateCategoryID, Q as BoilerplateContent, T as BoilerplateContentID, ai as Channel, aA as ChannelConversationSettings, aj as ChannelID, ak as ChannelStatus, C as Client, aG as CompositionSection, aH as CompositionSectionID, aI as CompositionSectionLocation, bs as ConcludedConversationStatus, b3 as Contact, b7 as ContactCustomMetadata, b4 as ContactID, b6 as ContactStatus, b5 as ContactType, dx as ContactWebhookEventType, bo as Conversation, bq as ConversationCustomMetadata, bQ as ConversationFeedback, bp as ConversationID, bP as ConversationSettings, bt as ConversationStatus, dy as ConversationWebhookEventType, n as CreateAccountAccessTokenOptions, m as CreateAccountAccessTokenPayload, o as CreateAccountAccessTokenResponse, f as CreateAccountOptions, e as CreateAccountPayload, g as CreateAccountResponse, a8 as CreateBoilerplateCategoryOptions, a7 as CreateBoilerplateCategoryPayload, a9 as CreateBoilerplateCategoryResponse, W as CreateBoilerplateContentOptions, V as CreateBoilerplateContentPayload, X as CreateBoilerplateContentResponse, am as CreateChannelOptions, al as CreateChannelPayload, an as CreateChannelResponse, aK as CreateCompositionSectionOptions, aJ as CreateCompositionSectionPayload, aL as CreateCompositionSectionResponse, b9 as CreateContactOptions, b8 as CreateContactPayload, ba as CreateContactResponse, bS as CreateConversationFeedbackOptions, bR as CreateConversationFeedbackPayload, bT as CreateConversationFeedbackResponse, bv as CreateConversationOptions, bu as CreateConversationPayload, bw as CreateConversationResponse, cI as CreateCorrectionModelOptions, cH as CreateCorrectionModelPayload, cJ as CreateCorrectionResponse, aX as CreateEscalationOptions, aW as CreateEscalationPayload, aY as CreateEscalationResponse, c2 as CreateLabelOptions, c1 as CreateLabelPayload, c3 as CreateLabelResponse, cl as CreateMessageOptions, ck as CreateMessagePayload, cm as CreateMessageResponse, cU as CreateNoteOptions, cT as CreateNotePayload, cV as CreateNoteResponse, cL as CreateResponseModelOptions, cK as CreateResponseModelPayload, cM as CreateResponseResponse, dc as CreateUploadIncludeOptions, dd as CreateUploadOptions, de as CreateUploadResponse, dF as CreateWebhookSubscriptionOptions, dE as CreateWebhookSubscriptionPayload, dG as CreateWebhookSubscriptionResponse, b as CurrentAccountID, p as DeleteAccountAccessTokenOptions, D as DeleteAccountAccessTokenPayload, q as DeleteAccountAccessTokenResponse, bb as DeleteContactOptions, bc as DeleteContactResponse, bU as DeleteConversationFeedbackOptions, bV as DeleteConversationFeedbackResponse, bx as DeleteConversationOptions, by as DeleteConversationResponse, c4 as DeleteLabelOptions, c5 as DeleteLabelResponse, cn as DeleteMessageOptions, co as DeleteMessageResponse, df as DeleteUploadOptions, dg as DeleteUploadResponse, dH as DeleteWebhookSubscriptionOptions, dI as DeleteWebhookSubscriptionResponse, aV as Escalation, dr as EventWebhookOptions, r as GetAccountAccessTokenOptions, s as GetAccountAccessTokenResponse, v as GetAccountConversationSettingsOptions, w as GetAccountConversationSettingsResponse, E as GetAccountNotificationEventOptions, F as GetAccountNotificationEventResponse, G as GetAccountOptions, h as GetAccountResponse, aa as GetBoilerplateCategoryOptions, ab as GetBoilerplateCategoryResponse, Y as GetBoilerplateContentOptions, Z as GetBoilerplateContentResponse, aB as GetChannelConversationSettingsOptions, aC as GetChannelConversationSettingsResponse, ao as GetChannelOptions, ap as GetChannelResponse, aM as GetCompositionSectionOptions, aN as GetCompositionSectionResponse, bd as GetContactIncludeOptions, be as GetContactOptions, bf as GetContactResponse, bg as GetContactVCFOptions, bW as GetConversationFeedbackOptions, bX as GetConversationFeedbackResponse, bz as GetConversationIncludeOptions, bA as GetConversationOptions, bB as GetConversationResponse, aZ as GetEscalationOptions, a_ as GetEscalationResponse, c6 as GetLabelOptions, c7 as GetLabelResponse, cp as GetMessageOptions, cq as GetMessageResponse, cN as GetModelOptions, cO as GetModelResponse, cW as GetNoteOptions, cX as GetNoteResponse, d6 as GetSourceOptions, d7 as GetSourceResponse, dh as GetUploadOptions, di as GetUploadResponse, dn as GetUserOptions, dp as GetUserResponse, dJ as GetWebhookSubscriptionOptions, dK as GetWebhookSubscriptionResponse, c0 as Label, c8 as LabelID, L as ListAccountAccessTokensOptions, t as ListAccountAccessTokensResponse, H as ListAccountNotificationEventsOptions, I as ListAccountNotificationEventsResponse, N as ListActionsOptions, P as ListActionsResponse, ac as ListBoilerplateCategoriesIncludeOptions, ad as ListBoilerplateCategoriesOptions, ae as ListBoilerplateCategoriesResponse, _ as ListBoilerplateCategoryBoilerplateContentsOptions, $ as ListBoilerplateCategoryBoilerplateContentsResponse, a0 as ListBoilerplateContentsOptions, a1 as ListBoilerplateContentsResponse, aO as ListChannelCompositionSectionsOptions, aP as ListChannelCompositionSectionsResponse, bC as ListChannelConversationsOptions, bD as ListChannelConversationsResponse, cr as ListChannelMessagesIncludeOptions, cs as ListChannelMessagesOptions, ct as ListChannelMessagesResponse, aq as ListChannelsOptions, ar as ListChannelsResponse, aQ as ListCompositionSectionsOptions, aR as ListCompositionSectionsResponse, bE as ListContactConversationsOptions, bF as ListContactConversationsResponse, c9 as ListContactLabelsOptions, ca as ListContactLabelsResponse, cY as ListContactNotesOptions, cZ as ListContactNotesResponse, bh as ListContactsOptions, bi as ListContactsResponse, bY as ListConversationConversationFeedbackOptions, bZ as ListConversationConversationFeedbackResponse, a$ as ListConversationEscalationsOptions, b0 as ListConversationEscalationsResponse, b_ as ListConversationFeedbackOptions, b$ as ListConversationFeedbackResponse, cb as ListConversationLabelsOptions, cc as ListConversationLabelsResponse, cu as ListConversationMessagesIncludeOptions, cv as ListConversationMessagesOptions, cw as ListConversationMessagesResponse, c_ as ListConversationNotesOptions, c$ as ListConversationNotesResponse, bI as ListConversationOptions, bH as ListConversationsFilterOptions, bG as ListConversationsIncludeOptions, bJ as ListConversationsResponse, b1 as ListEscalationsOptions, b2 as ListEscalationsResponse, bj as ListLabelContactsOptions, bk as ListLabelContactsResponse, bK as ListLabelConversationsOptions, bL as ListLabelConversationsResponse, cd as ListLabelsIncludeOptions, ce as ListLabelsOptions, cf as ListLabelsResponse, cx as ListMessagesIncludeOptions, cy as ListMessagesOptions, cz as ListMessagesResponse, cP as ListModelsOptions, cQ as ListModelsResponse, d8 as ListSourcesOptions, d9 as ListSourcesResponse, dj as ListUploadsOptions, dk as ListUploadsResponse, dL as ListWebhookSubscriptionsOptions, dM as ListWebhookSubscriptionsResponse, cj as Message, cF as MessageEventType, cA as MessageID, cB as MessageRole, cD as MessageStatus, cC as MessageType, cE as MessageVisibility, dz as MessageWebhookEventType, as as MetaWhatsappChannelGetBusinessProfileOptions, at as MetaWhatsappChannelGetBusinessProfileResponse, cG as Model, cR as ModelID, cS as Note, d0 as NoteID, d4 as NotificationEvent, O as Options, R as RequestFilterable, S as SortOptions, d5 as Source, da as SourceID, dN as TestWebhookSubscriptionOptions, dO as TestWebhookSubscriptionResponse, a as TransportOptions, au as TwilioSendChannelSyncPayload, av as TwilioSendgridChannelSyncOptions, aw as TwilioSendgridChannelSyncResponse, y as UpdateAccountConversationSettingsOptions, x as UpdateAccountConversationSettingsPayload, z as UpdateAccountConversationSettingsResponse, i as UpdateAccountOptions, U as UpdateAccountPayload, j as UpdateAccountResponse, ag as UpdateBoilerplateCategoryOptions, af as UpdateBoilerplateCategoryPayload, ah as UpdateBoilerplateCategoryResponse, a3 as UpdateBoilerplateContentOptions, a2 as UpdateBoilerplateContentPayload, a4 as UpdateBoilerplateContentResponse, aE as UpdateChannelConversationSettingsOptions, aD as UpdateChannelConversationSettingsPayload, aF as UpdateChannelConversationSettingsResponse, ay as UpdateChannelOptions, ax as UpdateChannelPayload, az as UpdateChannelResponse, aT as UpdateCompositionSectionOptions, aS as UpdateCompositionSectionPayload, aU as UpdateCompositionSectionResponse, bm as UpdateContactOptions, bl as UpdateContactPayload, bn as UpdateContactResponse, bN as UpdateConversationOptions, bM as UpdateConversationPayload, bO as UpdateConversationResponse, ch as UpdateLabelOptions, cg as UpdateLabelPayload, ci as UpdateLabelResponse, d2 as UpdateNoteOptions, d1 as UpdateNotePayload, d3 as UpdateNoteResponse, db as Upload, dl as UploadID, dm as User, dq as UserID, dB as WebhookEventPayload, dt as WebhookEventType, dC as WebhookResponse, dD as WebhookSubscription, dP as WebhookSubscriptionID, dA as WebhookSubscriptionWebhookEventType, C as default, ds as eventWebhookSchema } from './Client-Axl2jdgM.js';
1
+ export { A as Account, k as AccountAccessToken, l as AccountAccessTokenID, dv as AccountAccessTokenWebhookEventType, u as AccountConversationSettings, d as AccountID, B as AccountNotificationEvent, dw as AccountNotificationEventEventType, c as AccountStatus, du as AccountWebhookWebhookEventType, J as Action, K as ActionID, M as ActionStatus, br as ActiveConversationStatus, a5 as BoilerplateCategory, a6 as BoilerplateCategoryID, Q as BoilerplateContent, T as BoilerplateContentID, ai as Channel, aA as ChannelConversationSettings, aj as ChannelID, ak as ChannelStatus, C as Client, aG as CompositionSection, aH as CompositionSectionID, aI as CompositionSectionLocation, bs as ConcludedConversationStatus, b3 as Contact, b7 as ContactCustomMetadata, b4 as ContactID, b6 as ContactStatus, b5 as ContactType, dx as ContactWebhookEventType, bo as Conversation, bq as ConversationCustomMetadata, bQ as ConversationFeedback, bp as ConversationID, bP as ConversationSettings, bt as ConversationStatus, dy as ConversationWebhookEventType, n as CreateAccountAccessTokenOptions, m as CreateAccountAccessTokenPayload, o as CreateAccountAccessTokenResponse, f as CreateAccountOptions, e as CreateAccountPayload, g as CreateAccountResponse, a8 as CreateBoilerplateCategoryOptions, a7 as CreateBoilerplateCategoryPayload, a9 as CreateBoilerplateCategoryResponse, W as CreateBoilerplateContentOptions, V as CreateBoilerplateContentPayload, X as CreateBoilerplateContentResponse, am as CreateChannelOptions, al as CreateChannelPayload, an as CreateChannelResponse, aK as CreateCompositionSectionOptions, aJ as CreateCompositionSectionPayload, aL as CreateCompositionSectionResponse, b9 as CreateContactOptions, b8 as CreateContactPayload, ba as CreateContactResponse, bS as CreateConversationFeedbackOptions, bR as CreateConversationFeedbackPayload, bT as CreateConversationFeedbackResponse, bv as CreateConversationOptions, bu as CreateConversationPayload, bw as CreateConversationResponse, cI as CreateCorrectionModelOptions, cH as CreateCorrectionModelPayload, cJ as CreateCorrectionResponse, aX as CreateEscalationOptions, aW as CreateEscalationPayload, aY as CreateEscalationResponse, c2 as CreateLabelOptions, c1 as CreateLabelPayload, c3 as CreateLabelResponse, cl as CreateMessageOptions, ck as CreateMessagePayload, cm as CreateMessageResponse, cU as CreateNoteOptions, cT as CreateNotePayload, cV as CreateNoteResponse, cL as CreateResponseModelOptions, cK as CreateResponseModelPayload, cM as CreateResponseResponse, dc as CreateUploadIncludeOptions, dd as CreateUploadOptions, de as CreateUploadResponse, dF as CreateWebhookSubscriptionOptions, dE as CreateWebhookSubscriptionPayload, dG as CreateWebhookSubscriptionResponse, b as CurrentAccountID, p as DeleteAccountAccessTokenOptions, D as DeleteAccountAccessTokenPayload, q as DeleteAccountAccessTokenResponse, bb as DeleteContactOptions, bc as DeleteContactResponse, bU as DeleteConversationFeedbackOptions, bV as DeleteConversationFeedbackResponse, bx as DeleteConversationOptions, by as DeleteConversationResponse, c4 as DeleteLabelOptions, c5 as DeleteLabelResponse, cn as DeleteMessageOptions, co as DeleteMessageResponse, df as DeleteUploadOptions, dg as DeleteUploadResponse, dH as DeleteWebhookSubscriptionOptions, dI as DeleteWebhookSubscriptionResponse, aV as Escalation, dr as EventWebhookOptions, r as GetAccountAccessTokenOptions, s as GetAccountAccessTokenResponse, v as GetAccountConversationSettingsOptions, w as GetAccountConversationSettingsResponse, E as GetAccountNotificationEventOptions, F as GetAccountNotificationEventResponse, G as GetAccountOptions, h as GetAccountResponse, aa as GetBoilerplateCategoryOptions, ab as GetBoilerplateCategoryResponse, Y as GetBoilerplateContentOptions, Z as GetBoilerplateContentResponse, aB as GetChannelConversationSettingsOptions, aC as GetChannelConversationSettingsResponse, ao as GetChannelOptions, ap as GetChannelResponse, aM as GetCompositionSectionOptions, aN as GetCompositionSectionResponse, bd as GetContactIncludeOptions, be as GetContactOptions, bf as GetContactResponse, bg as GetContactVCFOptions, bW as GetConversationFeedbackOptions, bX as GetConversationFeedbackResponse, bz as GetConversationIncludeOptions, bA as GetConversationOptions, bB as GetConversationResponse, aZ as GetEscalationOptions, a_ as GetEscalationResponse, c6 as GetLabelOptions, c7 as GetLabelResponse, cp as GetMessageOptions, cq as GetMessageResponse, cN as GetModelOptions, cO as GetModelResponse, cW as GetNoteOptions, cX as GetNoteResponse, d6 as GetSourceOptions, d7 as GetSourceResponse, dh as GetUploadOptions, di as GetUploadResponse, dn as GetUserOptions, dp as GetUserResponse, dJ as GetWebhookSubscriptionOptions, dK as GetWebhookSubscriptionResponse, c0 as Label, c8 as LabelID, L as ListAccountAccessTokensOptions, t as ListAccountAccessTokensResponse, H as ListAccountNotificationEventsOptions, I as ListAccountNotificationEventsResponse, N as ListActionsOptions, P as ListActionsResponse, ac as ListBoilerplateCategoriesIncludeOptions, ad as ListBoilerplateCategoriesOptions, ae as ListBoilerplateCategoriesResponse, _ as ListBoilerplateCategoryBoilerplateContentsOptions, $ as ListBoilerplateCategoryBoilerplateContentsResponse, a0 as ListBoilerplateContentsOptions, a1 as ListBoilerplateContentsResponse, aO as ListChannelCompositionSectionsOptions, aP as ListChannelCompositionSectionsResponse, bC as ListChannelConversationsOptions, bD as ListChannelConversationsResponse, cr as ListChannelMessagesIncludeOptions, cs as ListChannelMessagesOptions, ct as ListChannelMessagesResponse, aq as ListChannelsOptions, ar as ListChannelsResponse, aQ as ListCompositionSectionsOptions, aR as ListCompositionSectionsResponse, bE as ListContactConversationsOptions, bF as ListContactConversationsResponse, c9 as ListContactLabelsOptions, ca as ListContactLabelsResponse, cY as ListContactNotesOptions, cZ as ListContactNotesResponse, bh as ListContactsOptions, bi as ListContactsResponse, bY as ListConversationConversationFeedbackOptions, bZ as ListConversationConversationFeedbackResponse, a$ as ListConversationEscalationsOptions, b0 as ListConversationEscalationsResponse, b_ as ListConversationFeedbackOptions, b$ as ListConversationFeedbackResponse, cb as ListConversationLabelsOptions, cc as ListConversationLabelsResponse, cu as ListConversationMessagesIncludeOptions, cv as ListConversationMessagesOptions, cw as ListConversationMessagesResponse, c_ as ListConversationNotesOptions, c$ as ListConversationNotesResponse, bI as ListConversationOptions, bH as ListConversationsFilterOptions, bG as ListConversationsIncludeOptions, bJ as ListConversationsResponse, b1 as ListEscalationsOptions, b2 as ListEscalationsResponse, bj as ListLabelContactsOptions, bk as ListLabelContactsResponse, bK as ListLabelConversationsOptions, bL as ListLabelConversationsResponse, cd as ListLabelsIncludeOptions, ce as ListLabelsOptions, cf as ListLabelsResponse, cx as ListMessagesIncludeOptions, cy as ListMessagesOptions, cz as ListMessagesResponse, cP as ListModelsOptions, cQ as ListModelsResponse, d8 as ListSourcesOptions, d9 as ListSourcesResponse, dj as ListUploadsOptions, dk as ListUploadsResponse, dL as ListWebhookSubscriptionsOptions, dM as ListWebhookSubscriptionsResponse, cj as Message, cF as MessageEventType, cA as MessageID, cB as MessageRole, cD as MessageStatus, cC as MessageType, cE as MessageVisibility, dz as MessageWebhookEventType, as as MetaWhatsappChannelGetBusinessProfileOptions, at as MetaWhatsappChannelGetBusinessProfileResponse, cG as Model, cR as ModelID, cS as Note, d0 as NoteID, d4 as NotificationEvent, O as Options, R as RequestFilterable, S as SortOptions, d5 as Source, da as SourceID, dN as TestWebhookSubscriptionOptions, dO as TestWebhookSubscriptionResponse, a as TransportOptions, au as TwilioSendChannelSyncPayload, av as TwilioSendgridChannelSyncOptions, aw as TwilioSendgridChannelSyncResponse, y as UpdateAccountConversationSettingsOptions, x as UpdateAccountConversationSettingsPayload, z as UpdateAccountConversationSettingsResponse, i as UpdateAccountOptions, U as UpdateAccountPayload, j as UpdateAccountResponse, ag as UpdateBoilerplateCategoryOptions, af as UpdateBoilerplateCategoryPayload, ah as UpdateBoilerplateCategoryResponse, a3 as UpdateBoilerplateContentOptions, a2 as UpdateBoilerplateContentPayload, a4 as UpdateBoilerplateContentResponse, aE as UpdateChannelConversationSettingsOptions, aD as UpdateChannelConversationSettingsPayload, aF as UpdateChannelConversationSettingsResponse, ay as UpdateChannelOptions, ax as UpdateChannelPayload, az as UpdateChannelResponse, aT as UpdateCompositionSectionOptions, aS as UpdateCompositionSectionPayload, aU as UpdateCompositionSectionResponse, bm as UpdateContactOptions, bl as UpdateContactPayload, bn as UpdateContactResponse, bN as UpdateConversationOptions, bM as UpdateConversationPayload, bO as UpdateConversationResponse, ch as UpdateLabelOptions, cg as UpdateLabelPayload, ci as UpdateLabelResponse, d2 as UpdateNoteOptions, d1 as UpdateNotePayload, d3 as UpdateNoteResponse, db as Upload, dl as UploadID, dm as User, dq as UserID, dB as WebhookEventPayload, dt as WebhookEventType, dC as WebhookResponse, dD as WebhookSubscription, dP as WebhookSubscriptionID, dA as WebhookSubscriptionWebhookEventType, C as default, ds as eventWebhookSchema } from './Client-lX540o8a.js';
2
2
  import { KyResponse } from 'ky';
3
3
  import 'zod';
4
4
 
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{a as t,c as e,d as p,e as f,f as o}from"./chunk-UPDHBDWN.js";var r={};t(r,{SupportError:()=>p});export{o as Client,e as DEFAULT_SUPPORT_BASE_URL,r as Error,p as SupportError,o as default,f as eventWebhookSchema};
1
+ import{a as t,c as e,d as p,e as f,f as o}from"./chunk-WIRRATXE.js";var r={};t(r,{SupportError:()=>p});export{o as Client,e as DEFAULT_SUPPORT_BASE_URL,r as Error,p as SupportError,o as default,f as eventWebhookSchema};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@great-detail/support-sdk",
3
- "version": "0.19.0",
3
+ "version": "0.19.1",
4
4
  "type": "module",
5
5
  "description": "JavaScript SDK for the Great Detail Support System",
6
6
  "author": "Great Detail Ltd <info@greatdetail.com>",
@@ -1 +0,0 @@
1
- var Y=Object.defineProperty;var X=(n,t)=>{for(var e in t)Y(n,e,{get:t[e],enumerable:!0})};var p=class{getHeaders(){return{}}};var N="SUPPORT_ACCESS_TOKEN",W="SUPPORT_KEY_NAME",Q="SUPPORT_KEY_PASSWORD",x="SUPPORT_SIGNING_KEY",j="SUPPORT_BASE_URL";var c=class{name;#t;constructor({name:t=process.env[W],password:e=process.env[Q]}={}){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}async getHeaders(){let t=typeof this.name=="function"?await Promise.resolve(this.name()):this.name,e=typeof this.#t=="function"?await Promise.resolve(this.#t()):this.#t;return{Authorization:`Basic ${btoa(t+":"+e)}`}}};var m=class{#t;constructor({token:t=process.env[N]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}async getHeaders(){return{Authorization:`Bearer ${typeof this.#t=="function"?await Promise.resolve(this.#t()):this.#t}`}}};var H="https://api.support.greatdetail.com",V={"X-Powered-By":"GDSupport/JavaScript"};var B=class extends Error{constructor(e,o){super("Support Error",{cause:o});this.response=e}};import{z as a}from"zod";var q=a.object({data:a.object({event:a.object({id:a.string(),type:a.string(),payload:a.record(a.string()),createdAt:a.string().datetime()})})});var l=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,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 d=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 u=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 h=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/notifications/events/account/"+encodeURIComponent(t),{...e,method:"GET"})}listByAccount(t,{limit:e,level:o,request:s={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/notifications/events",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.filterQuery("level",o)]})}};var C=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 f=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 R=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/channels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}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 b=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var g=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 O=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,type:o,request:s={}}={}){return this._transport.send("v1/contacts",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.filterQuery("type",o)]})}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({query:t,limit:e,filter:o,include:s,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.limitQuery(e),...this._transport.filterQuery("filter",o),...this._transport.includeQuery(s??{})]})}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 _=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/feedback/conversation",{...t,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/feedback",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/feedback/conversation",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var I=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/escalations/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/escalations",{...t,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/escalations",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/escalations",{...e,method:"POST",json:t})}};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 A=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,type:o,visibility:s,request:r={}}={}){return this._transport.send("v1/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{}),...this._transport.filterQuery("type",o),...this._transport.filterQuery("visibility",s)]})}listByConversation(t,{limit:e,include:o,type:s,visibility:r,request:i={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...i,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{}),...this._transport.filterQuery("type",s),...this._transport.filterQuery("visibility",r)]})}listByChannel(t,{limit:e,include:o,type:s,visibility:r,request:i={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...i,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o),...this._transport.filterQuery("type",s),...this._transport.filterQuery("visibility",r)]})}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 L=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 E=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"})}create({body:t,request:e={}}){return this._transport.send("v1/notes",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var U=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=V;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var S=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 i of r)s.push(["category",i])}return t!==void 0&&s.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:s})}};var D=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 z from"is-network-error";import $,{HTTPError as J}from"ky";var G=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=$.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[async o=>{for(let s of this.options.requestFilterables){let r=await Promise.resolve(s.getHeaders());for(let[i,K]of Object.entries(r))o.headers.has(i)||o.headers.set(i,K)}}]}})}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}filterQuery(t,e){let o=[];return e===void 0||o.push([t,e]),o}send(t,e={}){let o=this.client(t,e).catch(async s=>{throw z(s)?new Error("A network error occurred",{cause:s}):s instanceof J?new B(s.response,s):s});return{response:()=>o,json:async()=>(await o).json()}}};var k=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,include:e,request:o={}}){let s=new FormData;for(let r of t)s.append("file",r);return this._transport.send("v1/uploads",{...o,method:"POST",searchParams:[...this._transport.includeQuery(e??{})],body:s})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var P=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var F=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}=q.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 w=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 M=class n{static DEFAULT_BASE_URL=H;static PublicAuthentication=p;static BasicAuthentication=c;static BearerAuthentication=m;_transport;account;accountAccessToken;accountConversationSettings;accountNotificationEvent;action;boilerplateCategory;boilerplateContent;channel;channelConversationSettings;compositionSection;contact;conversation;conversationFeedback;escalation;label;message;model;note;source;statistics;upload;user;webhook;webhookSubscription;constructor(t,{baseURL:e,...o}={}){this._transport=new G({requestFilterables:[new U,t],...o,baseURL:e?.toString()??n.getBaseURL()}),this.account=new l(this._transport),this.accountAccessToken=new d(this._transport),this.accountConversationSettings=new u(this._transport),this.accountNotificationEvent=new h(this._transport),this.action=new C(this._transport),this.boilerplateCategory=new f(this._transport),this.boilerplateContent=new v(this._transport),this.channel=new R(this._transport),this.channelConversationSettings=new b(this._transport),this.compositionSection=new g(this._transport),this.contact=new O(this._transport),this.conversation=new y(this._transport),this.conversationFeedback=new _(this._transport),this.escalation=new I(this._transport),this.label=new T(this._transport),this.message=new A(this._transport),this.model=new L(this._transport),this.note=new E(this._transport),this.source=new S(this._transport),this.statistics=new D(this._transport),this.upload=new k(this._transport),this.user=new P(this._transport),this.webhook=new F(this._transport),this.webhookSubscription=new w(this._transport)}static getBaseURL(){return process.env[j]??this.DEFAULT_BASE_URL}};export{X as a,p as b,H as c,B as d,q as e,M as f};