@great-detail/support-sdk 0.12.4 → 0.12.5

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.
@@ -0,0 +1 @@
1
+ var ne=Object.defineProperty;var ae=(o,t)=>{for(var e in t)ne(o,e,{get:t[e],enumerable:!0})};var Jt=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var Zt="https://api.support.greatdetail.com",te={"X-Powered-By":"GDSupport/JavaScript"},le="api-key";import{z as n}from"zod";var me="SUPPORT_ACCESS_TOKEN",he="SUPPORT_API_KEY",fe="SUPPORT_KEY_NAME",$t="SUPPORT_SIGNING_KEY",ee="SUPPORT_BASE_URL";var u=class o{constructor(t){this._client=t}static SCHEMA=n.object({data:n.object({event:n.intersection(n.object({id:n.string(),createdAt:n.string().datetime()}),n.union([n.object({type:n.union([n.literal("account.created"),n.literal("account.updated")]),payload:n.object({account:n.string()})}),n.object({type:n.union([n.literal("accountAccessToken.created"),n.literal("accountAccessToken.updated"),n.literal("accountAccessToken.deleted")]),payload:n.object({accountAccessToken:n.string()})}),n.object({type:n.union([n.literal("contact.created"),n.literal("contact.updated")]),payload:n.object({contact:n.string()})}),n.object({type:n.union([n.literal("conversation.created"),n.literal("conversation.updated"),n.literal("conversation.closed"),n.literal("conversation.received"),n.literal("conversation.resolved"),n.literal("conversation.sent")]),payload:n.object({conversation:n.string()})}),n.object({type:n.union([n.literal("message.created"),n.literal("message.updated"),n.literal("message.delivered"),n.literal("message.failed"),n.literal("message.read"),n.literal("message.received"),n.literal("message.sent")]),payload:n.object({message:n.string()})})]))})});async event({key:t=process.env[$t],maxSignatures:e=3,request:r}){let s=r.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+$t);if(!s)throw new Error("Missing signature header");if(!this._verifySignature(t,r.body,Array.isArray(s)?s.slice(0,e):[s]))throw new Error("Untrusted signature")}let{data:i}=o.SCHEMA.parse(r.body);return{event:i.event}}async _verifySignature(t,e,r){let s=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let i of r)if(await crypto.subtle.verify("HMAC",s,new TextEncoder().encode(atob(i)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var m=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=te;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};import se from"is-network-error";import ie,{HTTPError as pe}from"ky";var p=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends p{};var h=class extends c{static unauthenticated(){return new this("An unauthenticated request occurred")}};var f=class extends c{static forbidden(){return new this("A forbidden request occurred")}};var a=class extends p{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var C=class extends p{};var d=class extends p{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var g=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=ie.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[r=>{for(let s of this.options.requestFilterables){let i=s.getHeaders();for(let[zt,re]of Object.entries(i))r.headers.has(zt)||r.headers.set(zt,re)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[r,s]of Object.entries(t))s!==void 0&&e.push(["sort",s+r]);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 r of Object.keys(t))e.push(["include",r]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let r=this.client(t,e).catch(s=>{if(se(s))throw new C("A network error occurred",{cause:s});if(s instanceof pe){let i=s.response.status;switch(console.error(JSON.stringify(s.response)),i){case 400:throw d.badRequest();case 401:throw h.unauthenticated();case 403:throw f.forbidden();case 404:throw a.notFound(t);case 405:throw a.forbiddenMethod(t,e.method??"GET");case 415:throw d.unsupportedMediaType();case 418:throw a.teapot();case 429:throw a.rateLimited()}if(i>=500&&i<600)throw p.serverError(i)}throw s});return{response:()=>r,json:async()=>(await r).json()}}};var b=class{constructor(t){this._transport=t}send(t,{body:e={},request:r={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...r,method:"POST",json:e})}};var _=class{constructor(t){this._transport=t}send(t,e,{body:r,request:s={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...s,method:"DELETE",json:r})}};var O=class{constructor(t){this._transport=t}send(t,e,{request:r={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...r,method:"GET"})}};var y=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}};var x=class{constructor(t){this._transport=t}get api(){return{get:new O(this._transport),list:new y(this._transport),create:new b(this._transport),delete:new _(this._transport)}}};var S=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}};var T=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var R=class{constructor(t){this._transport=t}get api(){return{get:new S(this._transport),update:new T(this._transport)}}};var v=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}};var F=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...r,method:"PATCH",json:e})}};var A=class{constructor(t){this._transport=t}get api(){return{get:new v(this._transport),update:new F(this._transport)}}};var L=class{constructor(t){this._transport=t}send({limit:t,sort:e,request:r={}}={}){return this._transport.send("v1/actions",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var w=class{constructor(t){this._transport=t}get api(){return{list:new L(this._transport)}}};var U=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var E=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",json:t})}};var G=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var P=class{constructor(t){this._transport=t}send({limit:t,include:e,request:r={}}={}){return this._transport.send("v1/boilerplate-categories",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var q=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var I=class{constructor(t){this._transport=t}get api(){return{get:new G(this._transport),list:new P(this._transport),create:new E(this._transport),update:new q(this._transport),boilerplate:{list:new U(this._transport)}}}};var N=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",json:t})}};var B=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var k=class{constructor(t){this._transport=t}send({limit:t,query:e,request:r={}}={}){return this._transport.send("v1/boilerplates",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var M=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var j=class{constructor(t){this._transport=t}get api(){return{get:new B(this._transport),list:new k(this._transport),update:new M(this._transport),create:new N(this._transport)}}};var Q=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}};var D=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};import{z as oe}from"zod";var K=class o{constructor(t){this._transport=t}static SCHEMA=oe.object({overwrite:oe.boolean().optional()});send(t,{body:e,request:r={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...r,method:"POST",json:o.SCHEMA.parse(e)})}};var V=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var W=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Y=class{constructor(t){this._transport=t}send(t,{limit:e,include:r,request:s={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(r)]})}};var z=class{constructor(t){this._transport=t}get api(){return{get:new D(this._transport),list:new H(this._transport),update:new V(this._transport),create:new Q(this._transport),compositionSection:{list:new W(this._transport)},message:{list:new Y(this._transport)},twilioSendgrid:{sync:new K(this._transport)}}}};var J=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}};var $=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var X=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var Z=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var tt=class{constructor(t){this._transport=t}get api(){return{get:new $(this._transport),list:new X(this._transport),create:new J(this._transport),update:new Z(this._transport)}}};var et=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let r=e.variant??"vcard",s=e.format??(r==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(s)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var ot=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}};var rt=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var nt=class{constructor(t){this._transport=t}send({limit:t,query:e,request:r={}}={}){return this._transport.send("v1/contacts",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var st=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var it=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var pt=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var at=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",json:e})}};var ct=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var dt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...r,method:"POST",json:e})}};var lt=class{constructor(t){this._transport=t}get api(){return{get:new rt(this._transport),list:new nt(this._transport),update:new st(this._transport),create:new ot(this._transport),conversation:{list:new it(this._transport)},label:{list:new pt(this._transport)},note:{list:new ct(this._transport),create:new at(this._transport)},notificationSubscription:{create:new dt(this._transport)},vcf:{get:new et(this._transport)}}}};var ut=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var mt=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:r,request:s={}}={}){return this._transport.send("v1/conversations",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(r??{})]})}};var ht=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var ft=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Ct=class{constructor(t){this._transport=t}send(t,{limit:e,include:r,request:s={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(r??{})]})}};var l=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",json:e})}};var gt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var bt=class{constructor(t){this._transport=t}get api(){return{get:new ut(this._transport),list:new mt(this._transport),update:new ht(this._transport),create:new l(this._transport),label:{list:new ft(this._transport)},message:{list:new Ct(this._transport)},note:{list:new gt(this._transport),create:new l(this._transport)}}}};var _t=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Ot=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var yt=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}};var xt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var St=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var Tt=class{constructor(t){this._transport=t}send({limit:t,query:e,include:r,request:s={}}={}){return this._transport.send("v1/labels",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(r??{})]})}};var Rt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var vt=class{constructor(t){this._transport=t}get api(){return{create:new yt(this._transport),get:new St(this._transport),list:new Tt(this._transport),update:new Rt(this._transport),delete:new xt(this._transport),contact:{list:new _t(this._transport)},conversation:{list:new Ot(this._transport)}}}};var Ft=class{constructor(t){this._transport=t}send({limit:t,include:e,request:r={}}={}){return this._transport.send("v1/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var At=class{constructor(t){this._transport=t}get api(){return{list:new Ft(this._transport)}}};var Lt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",json:e})}};var wt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var Ut=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var Et=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",timeout:12e4,json:e})}};var Gt=class{constructor(t){this._transport=t}get api(){return{get:new wt(this._transport),list:new Ut(this._transport),response:{create:new Et(this._transport)},correction:{create:new Lt(this._transport)}}}};var Pt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var qt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var It=class{constructor(t){this._transport=t}get api(){return{get:new Pt(this._transport),update:new qt(this._transport)}}};var Nt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var Bt=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let r=[];if(t){let s=Array.isArray(t)?t:[t];for(let i of s)r.push(["category",i])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:r})}};var kt=class{constructor(t){this._transport=t}get api(){return{get:new Nt(this._transport),list:new Bt(this._transport)}}};var Mt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}};var jt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}};var Qt=class{constructor(t){this._transport=t}get api(){return{messageFrequency:new jt(this._transport),channelMessageFrequency:new Mt(this._transport)}}};var Dt=class{constructor(t){this._transport=t}send({account:t,files:e,request:r={}}){let s=new FormData;for(let i of e)s.append("file",i);return this._transport.send("v1/uploads",{...r,method:"POST",body:s,searchParams:{account:t}})}};var Ht=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Kt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var Vt=class{constructor(t){this._transport=t}get api(){return{get:new Kt(this._transport),create:new Dt(this._transport),delete:new Ht(this._transport)}}};var Wt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var Yt=class{constructor(t){this._transport=t}get api(){return{notification:{get:new Wt(this._transport)}}}};var Xt=class o{static DEFAULT_BASE_URL=Zt;_transport;_account;_accountAccessToken;_accountConversationSettings;_action;_boilerplate;_boilerplateCategory;_channel;_compositionSection;_contact;_conversation;_label;_message;_model;_note;_source;_statistics;_upload;_webhook;_wellKnown;constructor(t,{baseURL:e,...r}={}){this._transport=new g({requestFilterables:[new m,t],...r,baseURL:e?.toString()??o.getBaseURL()}),this._account=new R(this._transport),this._accountAccessToken=new x(this._transport),this._accountConversationSettings=new A(this._transport),this._action=new w(this._transport),this._boilerplate=new j(this._transport),this._boilerplateCategory=new I(this._transport),this._channel=new z(this._transport),this._compositionSection=new tt(this._transport),this._contact=new lt(this._transport),this._conversation=new bt(this._transport),this._label=new vt(this._transport),this._message=new At(this._transport),this._model=new Gt(this._transport),this._note=new It(this._transport),this._source=new kt(this._transport),this._statistics=new Qt(this._transport),this._upload=new Vt(this._transport),this._webhook=new u(this),this._wellKnown=new Yt(this._transport)}static getBaseURL(){return process.env[ee]??this.DEFAULT_BASE_URL}get account(){return this._account.api}get accountAccessToken(){return this._accountAccessToken.api}get accountConversationSettings(){return this._accountConversationSettings.api}get action(){return this._action.api}get boilerplate(){return this._boilerplate.api}get boilerplateCategory(){return this._boilerplateCategory.api}get channel(){return this._channel.api}get compositionSection(){return this._compositionSection.api}get contact(){return this._contact.api}get conversation(){return this._conversation.api}get label(){return this._label.api}get message(){return this._message.api}get model(){return this._model.api}get note(){return this._note.api}get source(){return this._source.api}get statistics(){return this._statistics.api}get upload(){return this._upload.api}get webhook(){return this._webhook}get wellKnown(){return this._wellKnown.api}};export{ae as a,Jt as b,me as c,he as d,fe as e,Zt as f,le as g,p as h,c as i,h as j,f as k,a as l,C as m,d as n,Xt as o};
@@ -1 +1 @@
1
- import{b as v,o as b}from"./chunk-JSOIYG5K.js";import{Command as G}from"commander";import{Command as L}from"commander";import{oraPromise as N}from"ora";function r({client:t,ora:s}){let o=new L("actions").description("Actions");return o.addCommand(new L("list").description("List actions").action(async()=>{let n=await N(()=>t.action.list.send().json(),{...s,text:"Finding actions"});console.log(n)})),o}import{Command as D}from"commander";import{oraPromise as M}from"ora";function d({client:t,ora:s}){let o=new D("channels").description("Channels");return o.addCommand(new D("list").description("List channels").action(async()=>{let n=await M(()=>t.channel.list.send().json(),{...s,text:"Finding channels"});console.log(n)})),o}import{Command as a}from"commander";import{oraPromise as c}from"ora";function p({client:t,ora:s}){let o=new a("contacts").description("Contacts");return o.addCommand(new a("get").description("Find contact").argument("<contact>","Contact ID").action(async n=>{let i=await c(()=>t.contact.get.send(n).json(),{...s,text:"Finding contact"});console.log(i)})),o.addCommand(new a("list").description("List contacts").action(async()=>{let n=await c(()=>t.contact.list.send().json(),{...s,text:"Finding contacts"});console.log(n)})),o.addCommand(new a("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async n=>{let i=await c(()=>t.contact.vcf.get.send({id:n}).response(),{...s,text:"Exporting contact"});console.log(i)})),o}import{Command as l}from"commander";import{oraPromise as I}from"ora";function f({client:t,ora:s}){let o=new l("conversations").description("Conversations");return o.addCommand(new l("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let i=await I(()=>t.conversation.get.send(n).json(),{...s,text:"Finding conversation"});console.log(i)})),o.addCommand(new l("list").description("List conversations").action(async()=>{let n=await I(()=>t.conversation.list.send().json(),{...s,text:"Finding conversations"});console.log(n)})),o}import{Command as m}from"commander";import{oraPromise as u}from"ora";function C({client:t,ora:s}){let o=new m("labels").description("Labels");return o.addCommand(new m("get").description("Find label").argument("<label>","Label ID").action(async n=>{let i=await u(()=>t.label.get.send(n).json(),{...s,text:"Finding label"});console.log(i)})),o.addCommand(new m("list").description("List labels").action(async()=>{let n=await u(()=>t.label.list.send().json(),{...s,text:"Finding labels"});console.log(n)})),o.addCommand(new m("conversations").description("Find label conversations").argument("<label>","Label ID").action(async n=>{let i=await u(()=>t.label.conversation.list.send(n).json(),{...s,text:"Finding conversations"});console.log(i)})),o}import{Command as P}from"commander";import{oraPromise as W}from"ora";function g({client:t,ora:s}){let o=new P("messages").description("Messages");return o.addCommand(new P("list").description("List messages").action(async()=>{let n=await W(()=>t.message.list.send().json(),{...s,text:"Finding messages"});console.log(n)})),o}import{Command as w}from"commander";import{oraPromise as K}from"ora";function O({client:t,ora:s}){let o=new w("models").description("Models");return o.addCommand(new w("get").description("Find model").argument("<model>","Model ID").action(async n=>{let i=await K(()=>t.model.get.send(n).json(),{...s,text:"Finding model"});console.log(i)})),o.addCommand(new w("list").description("List models").action(async()=>{let n=await K(()=>t.model.list.send().json(),{...s,text:"Finding models"});console.log(n)})),o}import{Command as x}from"commander";import{oraPromise as h}from"ora";function y({client:t,ora:s}){let o=new x("sources").description("Sources");return o.addCommand(new x("get").description("Find source").argument("<source>","Source ID").action(async n=>{let i=await h(()=>t.source.get.send(n).json(),{...s,text:"Finding source"});console.log(i)})),o.addCommand(new x("list").description("List sources").action(async()=>{let n=await h(()=>t.source.list.send().json(),{...s,text:"Finding sources"});console.log(n)})),o}import{Command as E}from"commander";import{Command as S}from"commander";import{oraPromise as A}from"ora";function j({client:t,ora:s}){let o=new S("notifications").description("Well-Known Notifications Details");return o.addCommand(new S("get").description("Get Notifications Server Well-Known Info").action(async()=>{let n=await A(()=>t.wellKnown.notification.get.send().json(),{...s,text:"Finding Notifications Well-Known Info"});console.log(n)})),o}function F({client:t,ora:s}){let o=new E("well-known").description("Well-Known Metadata & Info");return o.addCommand(j({client:t,ora:s})),o}var e={ora:{spinner:"simpleDotsScrolling"},client:new b(new v)},k=new G("gds").description("Great Detail Support System").addCommand(r(e)).addCommand(d(e)).addCommand(p(e)).addCommand(f(e)).addCommand(C(e)).addCommand(g(e)).addCommand(O(e)).addCommand(y(e)).addCommand(F(e)),Po=k;export{Po as a};
1
+ import{b as v,o as b}from"./chunk-5TRP4ZAD.js";import{Command as G}from"commander";import{Command as L}from"commander";import{oraPromise as N}from"ora";function r({client:t,ora:s}){let o=new L("actions").description("Actions");return o.addCommand(new L("list").description("List actions").action(async()=>{let n=await N(()=>t.action.list.send().json(),{...s,text:"Finding actions"});console.log(n)})),o}import{Command as D}from"commander";import{oraPromise as M}from"ora";function d({client:t,ora:s}){let o=new D("channels").description("Channels");return o.addCommand(new D("list").description("List channels").action(async()=>{let n=await M(()=>t.channel.list.send().json(),{...s,text:"Finding channels"});console.log(n)})),o}import{Command as a}from"commander";import{oraPromise as c}from"ora";function p({client:t,ora:s}){let o=new a("contacts").description("Contacts");return o.addCommand(new a("get").description("Find contact").argument("<contact>","Contact ID").action(async n=>{let i=await c(()=>t.contact.get.send(n).json(),{...s,text:"Finding contact"});console.log(i)})),o.addCommand(new a("list").description("List contacts").action(async()=>{let n=await c(()=>t.contact.list.send().json(),{...s,text:"Finding contacts"});console.log(n)})),o.addCommand(new a("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async n=>{let i=await c(()=>t.contact.vcf.get.send({id:n}).response(),{...s,text:"Exporting contact"});console.log(i)})),o}import{Command as l}from"commander";import{oraPromise as I}from"ora";function f({client:t,ora:s}){let o=new l("conversations").description("Conversations");return o.addCommand(new l("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let i=await I(()=>t.conversation.get.send(n).json(),{...s,text:"Finding conversation"});console.log(i)})),o.addCommand(new l("list").description("List conversations").action(async()=>{let n=await I(()=>t.conversation.list.send().json(),{...s,text:"Finding conversations"});console.log(n)})),o}import{Command as m}from"commander";import{oraPromise as u}from"ora";function C({client:t,ora:s}){let o=new m("labels").description("Labels");return o.addCommand(new m("get").description("Find label").argument("<label>","Label ID").action(async n=>{let i=await u(()=>t.label.get.send(n).json(),{...s,text:"Finding label"});console.log(i)})),o.addCommand(new m("list").description("List labels").action(async()=>{let n=await u(()=>t.label.list.send().json(),{...s,text:"Finding labels"});console.log(n)})),o.addCommand(new m("conversations").description("Find label conversations").argument("<label>","Label ID").action(async n=>{let i=await u(()=>t.label.conversation.list.send(n).json(),{...s,text:"Finding conversations"});console.log(i)})),o}import{Command as P}from"commander";import{oraPromise as W}from"ora";function g({client:t,ora:s}){let o=new P("messages").description("Messages");return o.addCommand(new P("list").description("List messages").action(async()=>{let n=await W(()=>t.message.list.send().json(),{...s,text:"Finding messages"});console.log(n)})),o}import{Command as w}from"commander";import{oraPromise as K}from"ora";function O({client:t,ora:s}){let o=new w("models").description("Models");return o.addCommand(new w("get").description("Find model").argument("<model>","Model ID").action(async n=>{let i=await K(()=>t.model.get.send(n).json(),{...s,text:"Finding model"});console.log(i)})),o.addCommand(new w("list").description("List models").action(async()=>{let n=await K(()=>t.model.list.send().json(),{...s,text:"Finding models"});console.log(n)})),o}import{Command as x}from"commander";import{oraPromise as h}from"ora";function y({client:t,ora:s}){let o=new x("sources").description("Sources");return o.addCommand(new x("get").description("Find source").argument("<source>","Source ID").action(async n=>{let i=await h(()=>t.source.get.send(n).json(),{...s,text:"Finding source"});console.log(i)})),o.addCommand(new x("list").description("List sources").action(async()=>{let n=await h(()=>t.source.list.send().json(),{...s,text:"Finding sources"});console.log(n)})),o}import{Command as E}from"commander";import{Command as S}from"commander";import{oraPromise as A}from"ora";function j({client:t,ora:s}){let o=new S("notifications").description("Well-Known Notifications Details");return o.addCommand(new S("get").description("Get Notifications Server Well-Known Info").action(async()=>{let n=await A(()=>t.wellKnown.notification.get.send().json(),{...s,text:"Finding Notifications Well-Known Info"});console.log(n)})),o}function F({client:t,ora:s}){let o=new E("well-known").description("Well-Known Metadata & Info");return o.addCommand(j({client:t,ora:s})),o}var e={ora:{spinner:"simpleDotsScrolling"},client:new b(new v)},k=new G("gds").description("Great Detail Support System").addCommand(r(e)).addCommand(d(e)).addCommand(p(e)).addCommand(f(e)).addCommand(C(e)).addCommand(g(e)).addCommand(O(e)).addCommand(y(e)).addCommand(F(e)),Po=k;export{Po as a};
@@ -1 +1 @@
1
- "use strict";var Me=Object.create;var te=Object.defineProperty;var je=Object.getOwnPropertyDescriptor;var ke=Object.getOwnPropertyNames;var De=Object.getPrototypeOf,Qe=Object.prototype.hasOwnProperty;var He=(o,t)=>{for(var e in t)te(o,e,{get:t[e],enumerable:!0})},ve=(o,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ke(t))!Qe.call(o,r)&&r!==e&&te(o,r,{get:()=>t[r],enumerable:!(n=je(t,r))||n.enumerable});return o};var we=(o,t,e)=>(e=o!=null?Me(De(o)):{},ve(t||!o||!o.__esModule?te(e,"default",{value:o,enumerable:!0}):e,o)),Ke=o=>ve(te({},"__esModule",{value:!0}),o);var Ye={};He(Ye,{default:()=>We});module.exports=Ke(Ye);var Ne=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var ae="SUPPORT_SIGNING_KEY",Fe="SUPPORT_BASE_URL";var Le="https://api.support.greatdetail.com",Ue={"X-Powered-By":"GDSupport/JavaScript"};var h=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Ue;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var Ae=we(require("is-network-error"),1),ee=we(require("ky"),1);var a=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var d=class extends a{};var f=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var C=class extends d{static forbidden(){return new this("A forbidden request occurred")}};var c=class extends a{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var g=class extends a{};var l=class extends a{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var O=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=ee.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[n=>{for(let r of this.options.requestFilterables){let i=r.getHeaders();for(let[Zt,Be]of Object.entries(i))n.headers.has(Zt)||n.headers.set(Zt,Be)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[n,r]of Object.entries(t))r!==void 0&&e.push(["sort",r+n]);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 n of Object.keys(t))e.push(["include",n]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let n=this.client(t,e).catch(r=>{if((0,Ae.default)(r))throw new g("A network error occurred",{cause:r});if(r instanceof ee.HTTPError){let i=r.response.status;switch(console.error(JSON.stringify(r.response)),i){case 400:throw l.badRequest();case 401:throw f.unauthenticated();case 403:throw C.forbidden();case 404:throw c.notFound(t);case 405:throw c.forbiddenMethod(t,e.method??"GET");case 415:throw l.unsupportedMediaType();case 418:throw c.teapot();case 429:throw c.rateLimited()}if(i>=500&&i<600)throw a.serverError(i)}throw r});return{response:()=>n,json:async()=>(await n).json()}}};var s=require("zod");var b=class o{constructor(t){this._client=t}static SCHEMA=s.z.object({data:s.z.object({event:s.z.intersection(s.z.object({id:s.z.string(),createdAt:s.z.string().datetime()}),s.z.union([s.z.object({type:s.z.union([s.z.literal("account.created"),s.z.literal("account.updated")]),payload:s.z.object({account:s.z.string()})}),s.z.object({type:s.z.union([s.z.literal("contact.created"),s.z.literal("contact.updated")]),payload:s.z.object({contact:s.z.string()})}),s.z.object({type:s.z.union([s.z.literal("conversation.created"),s.z.literal("conversation.updated"),s.z.literal("conversation.closed"),s.z.literal("conversation.received"),s.z.literal("conversation.resolved"),s.z.literal("conversation.sent")]),payload:s.z.object({conversation:s.z.string()})}),s.z.object({type:s.z.union([s.z.literal("message.created"),s.z.literal("message.updated"),s.z.literal("message.delivered"),s.z.literal("message.failed"),s.z.literal("message.read"),s.z.literal("message.received"),s.z.literal("message.sent")]),payload:s.z.object({message:s.z.string()})})]))})});async event({key:t=process.env[ae],maxSignatures:e=3,request:n}){let r=n.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+ae);if(!r)throw new Error("Missing signature header");if(!this._verifySignature(t,n.body,Array.isArray(r)?r.slice(0,e):[r]))throw new Error("Untrusted signature")}let{data:i}=o.SCHEMA.parse(n.body);return{event:i.event}}async _verifySignature(t,e,n){let r=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let i of n)if(await crypto.subtle.verify("HMAC",r,new TextEncoder().encode(atob(i)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var y=class{constructor(t){this._transport=t}send(t,{body:e={},request:n={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...n,method:"POST",json:e})}};var x=class{constructor(t){this._transport=t}send(t,e,{body:n,request:r={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...r,method:"DELETE",json:n})}};var _=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}};var S=class{constructor(t){this._transport=t}get api(){return{list:new _(this._transport),create:new y(this._transport),delete:new x(this._transport)}}};var T=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}};var R=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var v=class{constructor(t){this._transport=t}get api(){return{get:new T(this._transport),update:new R(this._transport)}}};var w=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}};var F=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...n,method:"PATCH",json:e})}};var L=class{constructor(t){this._transport=t}get api(){return{get:new w(this._transport),update:new F(this._transport)}}};var U=class{constructor(t){this._transport=t}send({limit:t,sort:e,request:n={}}={}){return this._transport.send("v1/actions",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var A=class{constructor(t){this._transport=t}get api(){return{list:new U(this._transport)}}};var E=class{constructor(t){this._transport=t}send(t,{limit:e,request:n={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var P=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",json:t})}};var G=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var I=class{constructor(t){this._transport=t}send({limit:t,include:e,request:n={}}={}){return this._transport.send("v1/boilerplate-categories",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var q=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var N=class{constructor(t){this._transport=t}get api(){return{get:new G(this._transport),list:new I(this._transport),create:new P(this._transport),update:new q(this._transport),boilerplate:{list:new E(this._transport)}}}};var B=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",json:t})}};var M=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var j=class{constructor(t){this._transport=t}send({limit:t,query:e,request:n={}}={}){return this._transport.send("v1/boilerplates",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var k=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var D=class{constructor(t){this._transport=t}get api(){return{get:new M(this._transport),list:new j(this._transport),update:new k(this._transport),create:new B(this._transport)}}};var Q=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}};var H=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var K=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var pe=require("zod"),V=class o{constructor(t){this._transport=t}static SCHEMA=pe.z.object({overwrite:pe.z.boolean().optional()});send(t,{body:e,request:n={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...n,method:"POST",json:o.SCHEMA.parse(e)})}};var W=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var Y=class{constructor(t){this._transport=t}send(t,{limit:e,request:n={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var z=class{constructor(t){this._transport=t}send(t,{limit:e,include:n,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(n)]})}};var J=class{constructor(t){this._transport=t}get api(){return{get:new H(this._transport),list:new K(this._transport),update:new W(this._transport),create:new Q(this._transport),compositionSection:{list:new Y(this._transport)},message:{list:new z(this._transport)},twilioSendgrid:{sync:new V(this._transport)}}}};var $=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}};var X=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var Z=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var tt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var et=class{constructor(t){this._transport=t}get api(){return{get:new X(this._transport),list:new Z(this._transport),create:new $(this._transport),update:new tt(this._transport)}}};var ot=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let n=e.variant??"vcard",r=e.format??(n==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(n)+"&format="+encodeURIComponent(r)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var nt=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}};var rt=class{constructor(t){this._transport=t}send(t,{include:e,request:n={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var st=class{constructor(t){this._transport=t}send({limit:t,query:e,request:n={}}={}){return this._transport.send("v1/contacts",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var it=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var at=class{constructor(t){this._transport=t}send(t,{limit:e,request:n={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var pt=class{constructor(t){this._transport=t}send(t,{limit:e,request:n={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var ct=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...n,method:"POST",json:e})}};var dt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var lt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...n,method:"POST",json:e})}};var mt=class{constructor(t){this._transport=t}get api(){return{get:new rt(this._transport),list:new st(this._transport),update:new it(this._transport),create:new nt(this._transport),conversation:{list:new at(this._transport)},label:{list:new pt(this._transport)},note:{list:new dt(this._transport),create:new ct(this._transport)},notificationSubscription:{create:new lt(this._transport)},vcf:{get:new ot(this._transport)}}}};var ut=class{constructor(t){this._transport=t}send(t,{include:e,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var ht=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:n,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(n??{})]})}};var ft=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var Ct=class{constructor(t){this._transport=t}send(t,{limit:e,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var gt=class{constructor(t){this._transport=t}send(t,{limit:e,include:n,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(n??{})]})}};var m=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...n,method:"POST",json:e})}};var Ot=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var bt=class{constructor(t){this._transport=t}get api(){return{get:new ut(this._transport),list:new ht(this._transport),update:new ft(this._transport),create:new m(this._transport),label:{list:new Ct(this._transport)},message:{list:new gt(this._transport)},note:{list:new Ot(this._transport),create:new m(this._transport)}}}};var yt=class{constructor(t){this._transport=t}send(t,{limit:e,request:n={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var xt=class{constructor(t){this._transport=t}send(t,{limit:e,request:n={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var _t=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}};var St=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Tt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var Rt=class{constructor(t){this._transport=t}send({limit:t,query:e,include:n,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(n??{})]})}};var vt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var wt=class{constructor(t){this._transport=t}get api(){return{create:new _t(this._transport),get:new Tt(this._transport),list:new Rt(this._transport),update:new vt(this._transport),delete:new St(this._transport),contact:{list:new yt(this._transport)},conversation:{list:new xt(this._transport)}}}};var Ft=class{constructor(t){this._transport=t}send({limit:t,include:e,request:n={}}={}){return this._transport.send("v1/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var Lt=class{constructor(t){this._transport=t}get api(){return{list:new Ft(this._transport)}}};var Ut=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...n,method:"POST",json:e})}};var At=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var Et=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var Pt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...n,method:"POST",timeout:12e4,json:e})}};var Gt=class{constructor(t){this._transport=t}get api(){return{get:new At(this._transport),list:new Et(this._transport),response:{create:new Pt(this._transport)},correction:{create:new Ut(this._transport)}}}};var It=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var qt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var Nt=class{constructor(t){this._transport=t}get api(){return{get:new It(this._transport),update:new qt(this._transport)}}};var Bt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var Mt=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let n=[];if(t){let r=Array.isArray(t)?t:[t];for(let i of r)n.push(["category",i])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:n})}};var jt=class{constructor(t){this._transport=t}get api(){return{get:new Bt(this._transport),list:new Mt(this._transport)}}};var kt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}};var Dt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}};var Qt=class{constructor(t){this._transport=t}get api(){return{messageFrequency:new Dt(this._transport),channelMessageFrequency:new kt(this._transport)}}};var Ht=class{constructor(t){this._transport=t}send({account:t,files:e,request:n={}}){let r=new FormData;for(let i of e)r.append("file",i);return this._transport.send("v1/uploads",{...n,method:"POST",body:r,searchParams:{account:t}})}};var Kt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Vt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var Wt=class{constructor(t){this._transport=t}get api(){return{get:new Vt(this._transport),create:new Ht(this._transport),delete:new Kt(this._transport)}}};var Yt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var zt=class{constructor(t){this._transport=t}get api(){return{notification:{get:new Yt(this._transport)}}}};var Jt=class o{static DEFAULT_BASE_URL=Le;_transport;_account;_accountAccessToken;_accountConversationSettings;_action;_boilerplate;_boilerplateCategory;_channel;_compositionSection;_contact;_conversation;_label;_message;_model;_note;_source;_statistics;_upload;_webhook;_wellKnown;constructor(t,{baseURL:e,...n}={}){this._transport=new O({requestFilterables:[new h,t],...n,baseURL:e?.toString()??o.getBaseURL()}),this._account=new v(this._transport),this._accountAccessToken=new S(this._transport),this._accountConversationSettings=new L(this._transport),this._action=new A(this._transport),this._boilerplate=new D(this._transport),this._boilerplateCategory=new N(this._transport),this._channel=new J(this._transport),this._compositionSection=new et(this._transport),this._contact=new mt(this._transport),this._conversation=new bt(this._transport),this._label=new wt(this._transport),this._message=new Lt(this._transport),this._model=new Gt(this._transport),this._note=new Nt(this._transport),this._source=new jt(this._transport),this._statistics=new Qt(this._transport),this._upload=new Wt(this._transport),this._webhook=new b(this),this._wellKnown=new zt(this._transport)}static getBaseURL(){return process.env[Fe]??this.DEFAULT_BASE_URL}get account(){return this._account.api}get accountAccessToken(){return this._accountAccessToken.api}get accountConversationSettings(){return this._accountConversationSettings.api}get action(){return this._action.api}get boilerplate(){return this._boilerplate.api}get boilerplateCategory(){return this._boilerplateCategory.api}get channel(){return this._channel.api}get compositionSection(){return this._compositionSection.api}get contact(){return this._contact.api}get conversation(){return this._conversation.api}get label(){return this._label.api}get message(){return this._message.api}get model(){return this._model.api}get note(){return this._note.api}get source(){return this._source.api}get statistics(){return this._statistics.api}get upload(){return this._upload.api}get webhook(){return this._webhook}get wellKnown(){return this._wellKnown.api}};var ce=require("commander"),Ee=require("ora");function de({client:o,ora:t}){let e=new ce.Command("actions").description("Actions");return e.addCommand(new ce.Command("list").description("List actions").action(async()=>{let n=await(0,Ee.oraPromise)(()=>o.action.list.send().json(),{...t,text:"Finding actions"});console.log(n)})),e}var le=require("commander"),Pe=require("ora");function me({client:o,ora:t}){let e=new le.Command("channels").description("Channels");return e.addCommand(new le.Command("list").description("List channels").action(async()=>{let n=await(0,Pe.oraPromise)(()=>o.channel.list.send().json(),{...t,text:"Finding channels"});console.log(n)})),e}var $t=require("commander"),oe=require("ora");function ue({client:o,ora:t}){let e=new $t.Command("contacts").description("Contacts");return e.addCommand(new $t.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async n=>{let r=await(0,oe.oraPromise)(()=>o.contact.get.send(n).json(),{...t,text:"Finding contact"});console.log(r)})),e.addCommand(new $t.Command("list").description("List contacts").action(async()=>{let n=await(0,oe.oraPromise)(()=>o.contact.list.send().json(),{...t,text:"Finding contacts"});console.log(n)})),e.addCommand(new $t.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async n=>{let r=await(0,oe.oraPromise)(()=>o.contact.vcf.get.send({id:n}).response(),{...t,text:"Exporting contact"});console.log(r)})),e}var ne=require("commander"),he=require("ora");function fe({client:o,ora:t}){let e=new ne.Command("conversations").description("Conversations");return e.addCommand(new ne.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let r=await(0,he.oraPromise)(()=>o.conversation.get.send(n).json(),{...t,text:"Finding conversation"});console.log(r)})),e.addCommand(new ne.Command("list").description("List conversations").action(async()=>{let n=await(0,he.oraPromise)(()=>o.conversation.list.send().json(),{...t,text:"Finding conversations"});console.log(n)})),e}var Xt=require("commander"),re=require("ora");function Ce({client:o,ora:t}){let e=new Xt.Command("labels").description("Labels");return e.addCommand(new Xt.Command("get").description("Find label").argument("<label>","Label ID").action(async n=>{let r=await(0,re.oraPromise)(()=>o.label.get.send(n).json(),{...t,text:"Finding label"});console.log(r)})),e.addCommand(new Xt.Command("list").description("List labels").action(async()=>{let n=await(0,re.oraPromise)(()=>o.label.list.send().json(),{...t,text:"Finding labels"});console.log(n)})),e.addCommand(new Xt.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async n=>{let r=await(0,re.oraPromise)(()=>o.label.conversation.list.send(n).json(),{...t,text:"Finding conversations"});console.log(r)})),e}var ge=require("commander"),Ge=require("ora");function Oe({client:o,ora:t}){let e=new ge.Command("messages").description("Messages");return e.addCommand(new ge.Command("list").description("List messages").action(async()=>{let n=await(0,Ge.oraPromise)(()=>o.message.list.send().json(),{...t,text:"Finding messages"});console.log(n)})),e}var se=require("commander"),be=require("ora");function ye({client:o,ora:t}){let e=new se.Command("models").description("Models");return e.addCommand(new se.Command("get").description("Find model").argument("<model>","Model ID").action(async n=>{let r=await(0,be.oraPromise)(()=>o.model.get.send(n).json(),{...t,text:"Finding model"});console.log(r)})),e.addCommand(new se.Command("list").description("List models").action(async()=>{let n=await(0,be.oraPromise)(()=>o.model.list.send().json(),{...t,text:"Finding models"});console.log(n)})),e}var ie=require("commander"),xe=require("ora");function _e({client:o,ora:t}){let e=new ie.Command("sources").description("Sources");return e.addCommand(new ie.Command("get").description("Find source").argument("<source>","Source ID").action(async n=>{let r=await(0,xe.oraPromise)(()=>o.source.get.send(n).json(),{...t,text:"Finding source"});console.log(r)})),e.addCommand(new ie.Command("list").description("List sources").action(async()=>{let n=await(0,xe.oraPromise)(()=>o.source.list.send().json(),{...t,text:"Finding sources"});console.log(n)})),e}var qe=require("commander");var Se=require("commander"),Ie=require("ora");function Te({client:o,ora:t}){let e=new Se.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new Se.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let n=await(0,Ie.oraPromise)(()=>o.wellKnown.notification.get.send().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(n)})),e}function Re({client:o,ora:t}){let e=new qe.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(Te({client:o,ora:t})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new Jt(new u)},Ve=new Ne.Command("gds").description("Great Detail Support System").addCommand(de(p)).addCommand(me(p)).addCommand(ue(p)).addCommand(fe(p)).addCommand(Ce(p)).addCommand(Oe(p)).addCommand(ye(p)).addCommand(_e(p)).addCommand(Re(p)),We=Ve;
1
+ "use strict";var ke=Object.create;var ee=Object.defineProperty;var je=Object.getOwnPropertyDescriptor;var De=Object.getOwnPropertyNames;var Qe=Object.getPrototypeOf,He=Object.prototype.hasOwnProperty;var Ke=(o,t)=>{for(var e in t)ee(o,e,{get:t[e],enumerable:!0})},we=(o,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of De(t))!He.call(o,r)&&r!==e&&ee(o,r,{get:()=>t[r],enumerable:!(n=je(t,r))||n.enumerable});return o};var Fe=(o,t,e)=>(e=o!=null?ke(Qe(o)):{},we(t||!o||!o.__esModule?ee(e,"default",{value:o,enumerable:!0}):e,o)),Ve=o=>we(ee({},"__esModule",{value:!0}),o);var ze={};Ke(ze,{default:()=>Ye});module.exports=Ve(ze);var Be=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var pe="SUPPORT_SIGNING_KEY",Le="SUPPORT_BASE_URL";var Ae="https://api.support.greatdetail.com",Ue={"X-Powered-By":"GDSupport/JavaScript"};var h=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Ue;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var Ee=Fe(require("is-network-error"),1),oe=Fe(require("ky"),1);var a=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var d=class extends a{};var f=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var C=class extends d{static forbidden(){return new this("A forbidden request occurred")}};var c=class extends a{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var g=class extends a{};var l=class extends a{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var O=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=oe.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[n=>{for(let r of this.options.requestFilterables){let i=r.getHeaders();for(let[te,Me]of Object.entries(i))n.headers.has(te)||n.headers.set(te,Me)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[n,r]of Object.entries(t))r!==void 0&&e.push(["sort",r+n]);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 n of Object.keys(t))e.push(["include",n]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let n=this.client(t,e).catch(r=>{if((0,Ee.default)(r))throw new g("A network error occurred",{cause:r});if(r instanceof oe.HTTPError){let i=r.response.status;switch(console.error(JSON.stringify(r.response)),i){case 400:throw l.badRequest();case 401:throw f.unauthenticated();case 403:throw C.forbidden();case 404:throw c.notFound(t);case 405:throw c.forbiddenMethod(t,e.method??"GET");case 415:throw l.unsupportedMediaType();case 418:throw c.teapot();case 429:throw c.rateLimited()}if(i>=500&&i<600)throw a.serverError(i)}throw r});return{response:()=>n,json:async()=>(await n).json()}}};var s=require("zod");var b=class o{constructor(t){this._client=t}static SCHEMA=s.z.object({data:s.z.object({event:s.z.intersection(s.z.object({id:s.z.string(),createdAt:s.z.string().datetime()}),s.z.union([s.z.object({type:s.z.union([s.z.literal("account.created"),s.z.literal("account.updated")]),payload:s.z.object({account:s.z.string()})}),s.z.object({type:s.z.union([s.z.literal("accountAccessToken.created"),s.z.literal("accountAccessToken.updated"),s.z.literal("accountAccessToken.deleted")]),payload:s.z.object({accountAccessToken:s.z.string()})}),s.z.object({type:s.z.union([s.z.literal("contact.created"),s.z.literal("contact.updated")]),payload:s.z.object({contact:s.z.string()})}),s.z.object({type:s.z.union([s.z.literal("conversation.created"),s.z.literal("conversation.updated"),s.z.literal("conversation.closed"),s.z.literal("conversation.received"),s.z.literal("conversation.resolved"),s.z.literal("conversation.sent")]),payload:s.z.object({conversation:s.z.string()})}),s.z.object({type:s.z.union([s.z.literal("message.created"),s.z.literal("message.updated"),s.z.literal("message.delivered"),s.z.literal("message.failed"),s.z.literal("message.read"),s.z.literal("message.received"),s.z.literal("message.sent")]),payload:s.z.object({message:s.z.string()})})]))})});async event({key:t=process.env[pe],maxSignatures:e=3,request:n}){let r=n.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+pe);if(!r)throw new Error("Missing signature header");if(!this._verifySignature(t,n.body,Array.isArray(r)?r.slice(0,e):[r]))throw new Error("Untrusted signature")}let{data:i}=o.SCHEMA.parse(n.body);return{event:i.event}}async _verifySignature(t,e,n){let r=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let i of n)if(await crypto.subtle.verify("HMAC",r,new TextEncoder().encode(atob(i)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var y=class{constructor(t){this._transport=t}send(t,{body:e={},request:n={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...n,method:"POST",json:e})}};var x=class{constructor(t){this._transport=t}send(t,e,{body:n,request:r={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...r,method:"DELETE",json:n})}};var _=class{constructor(t){this._transport=t}send(t,e,{request:n={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...n,method:"GET"})}};var S=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}};var T=class{constructor(t){this._transport=t}get api(){return{get:new _(this._transport),list:new S(this._transport),create:new y(this._transport),delete:new x(this._transport)}}};var R=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}};var v=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var w=class{constructor(t){this._transport=t}get api(){return{get:new R(this._transport),update:new v(this._transport)}}};var F=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}};var L=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...n,method:"PATCH",json:e})}};var A=class{constructor(t){this._transport=t}get api(){return{get:new F(this._transport),update:new L(this._transport)}}};var U=class{constructor(t){this._transport=t}send({limit:t,sort:e,request:n={}}={}){return this._transport.send("v1/actions",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var E=class{constructor(t){this._transport=t}get api(){return{list:new U(this._transport)}}};var G=class{constructor(t){this._transport=t}send(t,{limit:e,request:n={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var P=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",json:t})}};var I=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var q=class{constructor(t){this._transport=t}send({limit:t,include:e,request:n={}}={}){return this._transport.send("v1/boilerplate-categories",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var N=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var B=class{constructor(t){this._transport=t}get api(){return{get:new I(this._transport),list:new q(this._transport),create:new P(this._transport),update:new N(this._transport),boilerplate:{list:new G(this._transport)}}}};var M=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",json:t})}};var k=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var j=class{constructor(t){this._transport=t}send({limit:t,query:e,request:n={}}={}){return this._transport.send("v1/boilerplates",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var D=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var Q=class{constructor(t){this._transport=t}get api(){return{get:new k(this._transport),list:new j(this._transport),update:new D(this._transport),create:new M(this._transport)}}};var H=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}};var K=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var V=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var ce=require("zod"),W=class o{constructor(t){this._transport=t}static SCHEMA=ce.z.object({overwrite:ce.z.boolean().optional()});send(t,{body:e,request:n={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...n,method:"POST",json:o.SCHEMA.parse(e)})}};var Y=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var z=class{constructor(t){this._transport=t}send(t,{limit:e,request:n={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var J=class{constructor(t){this._transport=t}send(t,{limit:e,include:n,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(n)]})}};var $=class{constructor(t){this._transport=t}get api(){return{get:new K(this._transport),list:new V(this._transport),update:new Y(this._transport),create:new H(this._transport),compositionSection:{list:new z(this._transport)},message:{list:new J(this._transport)},twilioSendgrid:{sync:new W(this._transport)}}}};var X=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}};var Z=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var tt=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var et=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var ot=class{constructor(t){this._transport=t}get api(){return{get:new Z(this._transport),list:new tt(this._transport),create:new X(this._transport),update:new et(this._transport)}}};var nt=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let n=e.variant??"vcard",r=e.format??(n==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(n)+"&format="+encodeURIComponent(r)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var rt=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}};var st=class{constructor(t){this._transport=t}send(t,{include:e,request:n={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var it=class{constructor(t){this._transport=t}send({limit:t,query:e,request:n={}}={}){return this._transport.send("v1/contacts",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var at=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var pt=class{constructor(t){this._transport=t}send(t,{limit:e,request:n={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var ct=class{constructor(t){this._transport=t}send(t,{limit:e,request:n={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var dt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...n,method:"POST",json:e})}};var lt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var mt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...n,method:"POST",json:e})}};var ut=class{constructor(t){this._transport=t}get api(){return{get:new st(this._transport),list:new it(this._transport),update:new at(this._transport),create:new rt(this._transport),conversation:{list:new pt(this._transport)},label:{list:new ct(this._transport)},note:{list:new lt(this._transport),create:new dt(this._transport)},notificationSubscription:{create:new mt(this._transport)},vcf:{get:new nt(this._transport)}}}};var ht=class{constructor(t){this._transport=t}send(t,{include:e,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var ft=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:n,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(n??{})]})}};var Ct=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var gt=class{constructor(t){this._transport=t}send(t,{limit:e,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Ot=class{constructor(t){this._transport=t}send(t,{limit:e,include:n,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(n??{})]})}};var m=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...n,method:"POST",json:e})}};var bt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var yt=class{constructor(t){this._transport=t}get api(){return{get:new ht(this._transport),list:new ft(this._transport),update:new Ct(this._transport),create:new m(this._transport),label:{list:new gt(this._transport)},message:{list:new Ot(this._transport)},note:{list:new bt(this._transport),create:new m(this._transport)}}}};var xt=class{constructor(t){this._transport=t}send(t,{limit:e,request:n={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var _t=class{constructor(t){this._transport=t}send(t,{limit:e,request:n={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var St=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}};var Tt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Rt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var vt=class{constructor(t){this._transport=t}send({limit:t,query:e,include:n,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(n??{})]})}};var wt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var Ft=class{constructor(t){this._transport=t}get api(){return{create:new St(this._transport),get:new Rt(this._transport),list:new vt(this._transport),update:new wt(this._transport),delete:new Tt(this._transport),contact:{list:new xt(this._transport)},conversation:{list:new _t(this._transport)}}}};var Lt=class{constructor(t){this._transport=t}send({limit:t,include:e,request:n={}}={}){return this._transport.send("v1/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var At=class{constructor(t){this._transport=t}get api(){return{list:new Lt(this._transport)}}};var Ut=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...n,method:"POST",json:e})}};var Et=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var Gt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var Pt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...n,method:"POST",timeout:12e4,json:e})}};var It=class{constructor(t){this._transport=t}get api(){return{get:new Et(this._transport),list:new Gt(this._transport),response:{create:new Pt(this._transport)},correction:{create:new Ut(this._transport)}}}};var qt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var Nt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var Bt=class{constructor(t){this._transport=t}get api(){return{get:new qt(this._transport),update:new Nt(this._transport)}}};var Mt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var kt=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let n=[];if(t){let r=Array.isArray(t)?t:[t];for(let i of r)n.push(["category",i])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:n})}};var jt=class{constructor(t){this._transport=t}get api(){return{get:new Mt(this._transport),list:new kt(this._transport)}}};var Dt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}};var Qt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}};var Ht=class{constructor(t){this._transport=t}get api(){return{messageFrequency:new Qt(this._transport),channelMessageFrequency:new Dt(this._transport)}}};var Kt=class{constructor(t){this._transport=t}send({account:t,files:e,request:n={}}){let r=new FormData;for(let i of e)r.append("file",i);return this._transport.send("v1/uploads",{...n,method:"POST",body:r,searchParams:{account:t}})}};var Vt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Wt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var Yt=class{constructor(t){this._transport=t}get api(){return{get:new Wt(this._transport),create:new Kt(this._transport),delete:new Vt(this._transport)}}};var zt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var Jt=class{constructor(t){this._transport=t}get api(){return{notification:{get:new zt(this._transport)}}}};var $t=class o{static DEFAULT_BASE_URL=Ae;_transport;_account;_accountAccessToken;_accountConversationSettings;_action;_boilerplate;_boilerplateCategory;_channel;_compositionSection;_contact;_conversation;_label;_message;_model;_note;_source;_statistics;_upload;_webhook;_wellKnown;constructor(t,{baseURL:e,...n}={}){this._transport=new O({requestFilterables:[new h,t],...n,baseURL:e?.toString()??o.getBaseURL()}),this._account=new w(this._transport),this._accountAccessToken=new T(this._transport),this._accountConversationSettings=new A(this._transport),this._action=new E(this._transport),this._boilerplate=new Q(this._transport),this._boilerplateCategory=new B(this._transport),this._channel=new $(this._transport),this._compositionSection=new ot(this._transport),this._contact=new ut(this._transport),this._conversation=new yt(this._transport),this._label=new Ft(this._transport),this._message=new At(this._transport),this._model=new It(this._transport),this._note=new Bt(this._transport),this._source=new jt(this._transport),this._statistics=new Ht(this._transport),this._upload=new Yt(this._transport),this._webhook=new b(this),this._wellKnown=new Jt(this._transport)}static getBaseURL(){return process.env[Le]??this.DEFAULT_BASE_URL}get account(){return this._account.api}get accountAccessToken(){return this._accountAccessToken.api}get accountConversationSettings(){return this._accountConversationSettings.api}get action(){return this._action.api}get boilerplate(){return this._boilerplate.api}get boilerplateCategory(){return this._boilerplateCategory.api}get channel(){return this._channel.api}get compositionSection(){return this._compositionSection.api}get contact(){return this._contact.api}get conversation(){return this._conversation.api}get label(){return this._label.api}get message(){return this._message.api}get model(){return this._model.api}get note(){return this._note.api}get source(){return this._source.api}get statistics(){return this._statistics.api}get upload(){return this._upload.api}get webhook(){return this._webhook}get wellKnown(){return this._wellKnown.api}};var de=require("commander"),Ge=require("ora");function le({client:o,ora:t}){let e=new de.Command("actions").description("Actions");return e.addCommand(new de.Command("list").description("List actions").action(async()=>{let n=await(0,Ge.oraPromise)(()=>o.action.list.send().json(),{...t,text:"Finding actions"});console.log(n)})),e}var me=require("commander"),Pe=require("ora");function ue({client:o,ora:t}){let e=new me.Command("channels").description("Channels");return e.addCommand(new me.Command("list").description("List channels").action(async()=>{let n=await(0,Pe.oraPromise)(()=>o.channel.list.send().json(),{...t,text:"Finding channels"});console.log(n)})),e}var Xt=require("commander"),ne=require("ora");function he({client:o,ora:t}){let e=new Xt.Command("contacts").description("Contacts");return e.addCommand(new Xt.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async n=>{let r=await(0,ne.oraPromise)(()=>o.contact.get.send(n).json(),{...t,text:"Finding contact"});console.log(r)})),e.addCommand(new Xt.Command("list").description("List contacts").action(async()=>{let n=await(0,ne.oraPromise)(()=>o.contact.list.send().json(),{...t,text:"Finding contacts"});console.log(n)})),e.addCommand(new Xt.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async n=>{let r=await(0,ne.oraPromise)(()=>o.contact.vcf.get.send({id:n}).response(),{...t,text:"Exporting contact"});console.log(r)})),e}var re=require("commander"),fe=require("ora");function Ce({client:o,ora:t}){let e=new re.Command("conversations").description("Conversations");return e.addCommand(new re.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let r=await(0,fe.oraPromise)(()=>o.conversation.get.send(n).json(),{...t,text:"Finding conversation"});console.log(r)})),e.addCommand(new re.Command("list").description("List conversations").action(async()=>{let n=await(0,fe.oraPromise)(()=>o.conversation.list.send().json(),{...t,text:"Finding conversations"});console.log(n)})),e}var Zt=require("commander"),se=require("ora");function ge({client:o,ora:t}){let e=new Zt.Command("labels").description("Labels");return e.addCommand(new Zt.Command("get").description("Find label").argument("<label>","Label ID").action(async n=>{let r=await(0,se.oraPromise)(()=>o.label.get.send(n).json(),{...t,text:"Finding label"});console.log(r)})),e.addCommand(new Zt.Command("list").description("List labels").action(async()=>{let n=await(0,se.oraPromise)(()=>o.label.list.send().json(),{...t,text:"Finding labels"});console.log(n)})),e.addCommand(new Zt.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async n=>{let r=await(0,se.oraPromise)(()=>o.label.conversation.list.send(n).json(),{...t,text:"Finding conversations"});console.log(r)})),e}var Oe=require("commander"),Ie=require("ora");function be({client:o,ora:t}){let e=new Oe.Command("messages").description("Messages");return e.addCommand(new Oe.Command("list").description("List messages").action(async()=>{let n=await(0,Ie.oraPromise)(()=>o.message.list.send().json(),{...t,text:"Finding messages"});console.log(n)})),e}var ie=require("commander"),ye=require("ora");function xe({client:o,ora:t}){let e=new ie.Command("models").description("Models");return e.addCommand(new ie.Command("get").description("Find model").argument("<model>","Model ID").action(async n=>{let r=await(0,ye.oraPromise)(()=>o.model.get.send(n).json(),{...t,text:"Finding model"});console.log(r)})),e.addCommand(new ie.Command("list").description("List models").action(async()=>{let n=await(0,ye.oraPromise)(()=>o.model.list.send().json(),{...t,text:"Finding models"});console.log(n)})),e}var ae=require("commander"),_e=require("ora");function Se({client:o,ora:t}){let e=new ae.Command("sources").description("Sources");return e.addCommand(new ae.Command("get").description("Find source").argument("<source>","Source ID").action(async n=>{let r=await(0,_e.oraPromise)(()=>o.source.get.send(n).json(),{...t,text:"Finding source"});console.log(r)})),e.addCommand(new ae.Command("list").description("List sources").action(async()=>{let n=await(0,_e.oraPromise)(()=>o.source.list.send().json(),{...t,text:"Finding sources"});console.log(n)})),e}var Ne=require("commander");var Te=require("commander"),qe=require("ora");function Re({client:o,ora:t}){let e=new Te.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new Te.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let n=await(0,qe.oraPromise)(()=>o.wellKnown.notification.get.send().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(n)})),e}function ve({client:o,ora:t}){let e=new Ne.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(Re({client:o,ora:t})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new $t(new u)},We=new Be.Command("gds").description("Great Detail Support System").addCommand(le(p)).addCommand(ue(p)).addCommand(he(p)).addCommand(Ce(p)).addCommand(ge(p)).addCommand(be(p)).addCommand(xe(p)).addCommand(Se(p)).addCommand(ve(p)),Ye=We;
@@ -1,5 +1,5 @@
1
1
  import { Command } from 'commander';
2
- import { C as Client } from '../index-DVSbPCnA.cjs';
2
+ import { C as Client } from '../index-BXPbn8t9.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 '../index-DVSbPCnA.js';
2
+ import { C as Client } from '../index-BXPbn8t9.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-KI5HOMAH.js";import"../chunk-JSOIYG5K.js";export{a as default};
1
+ import{a}from"../chunk-LOXZ4PTM.js";import"../chunk-5TRP4ZAD.js";export{a as default};
package/dist/cli.cjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var Me=Object.create;var Re=Object.defineProperty;var je=Object.getOwnPropertyDescriptor;var ke=Object.getOwnPropertyNames;var De=Object.getPrototypeOf,Qe=Object.prototype.hasOwnProperty;var He=(o,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ke(t))!Qe.call(o,r)&&r!==e&&Re(o,r,{get:()=>t[r],enumerable:!(n=je(t,r))||n.enumerable});return o};var ve=(o,t,e)=>(e=o!=null?Me(De(o)):{},He(t||!o||!o.__esModule?Re(e,"default",{value:o,enumerable:!0}):e,o));var qe=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var ie="SUPPORT_SIGNING_KEY",we="SUPPORT_BASE_URL";var Fe="https://api.support.greatdetail.com",Le={"X-Powered-By":"GDSupport/JavaScript"};var h=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Le;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var Ue=ve(require("is-network-error"),1),te=ve(require("ky"),1);var a=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var d=class extends a{};var f=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var C=class extends d{static forbidden(){return new this("A forbidden request occurred")}};var c=class extends a{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var g=class extends a{};var l=class extends a{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var O=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=te.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[n=>{for(let r of this.options.requestFilterables){let i=r.getHeaders();for(let[Zt,Be]of Object.entries(i))n.headers.has(Zt)||n.headers.set(Zt,Be)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[n,r]of Object.entries(t))r!==void 0&&e.push(["sort",r+n]);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 n of Object.keys(t))e.push(["include",n]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let n=this.client(t,e).catch(r=>{if((0,Ue.default)(r))throw new g("A network error occurred",{cause:r});if(r instanceof te.HTTPError){let i=r.response.status;switch(console.error(JSON.stringify(r.response)),i){case 400:throw l.badRequest();case 401:throw f.unauthenticated();case 403:throw C.forbidden();case 404:throw c.notFound(t);case 405:throw c.forbiddenMethod(t,e.method??"GET");case 415:throw l.unsupportedMediaType();case 418:throw c.teapot();case 429:throw c.rateLimited()}if(i>=500&&i<600)throw a.serverError(i)}throw r});return{response:()=>n,json:async()=>(await n).json()}}};var s=require("zod");var b=class o{constructor(t){this._client=t}static SCHEMA=s.z.object({data:s.z.object({event:s.z.intersection(s.z.object({id:s.z.string(),createdAt:s.z.string().datetime()}),s.z.union([s.z.object({type:s.z.union([s.z.literal("account.created"),s.z.literal("account.updated")]),payload:s.z.object({account:s.z.string()})}),s.z.object({type:s.z.union([s.z.literal("contact.created"),s.z.literal("contact.updated")]),payload:s.z.object({contact:s.z.string()})}),s.z.object({type:s.z.union([s.z.literal("conversation.created"),s.z.literal("conversation.updated"),s.z.literal("conversation.closed"),s.z.literal("conversation.received"),s.z.literal("conversation.resolved"),s.z.literal("conversation.sent")]),payload:s.z.object({conversation:s.z.string()})}),s.z.object({type:s.z.union([s.z.literal("message.created"),s.z.literal("message.updated"),s.z.literal("message.delivered"),s.z.literal("message.failed"),s.z.literal("message.read"),s.z.literal("message.received"),s.z.literal("message.sent")]),payload:s.z.object({message:s.z.string()})})]))})});async event({key:t=process.env[ie],maxSignatures:e=3,request:n}){let r=n.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+ie);if(!r)throw new Error("Missing signature header");if(!this._verifySignature(t,n.body,Array.isArray(r)?r.slice(0,e):[r]))throw new Error("Untrusted signature")}let{data:i}=o.SCHEMA.parse(n.body);return{event:i.event}}async _verifySignature(t,e,n){let r=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let i of n)if(await crypto.subtle.verify("HMAC",r,new TextEncoder().encode(atob(i)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var y=class{constructor(t){this._transport=t}send(t,{body:e={},request:n={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...n,method:"POST",json:e})}};var x=class{constructor(t){this._transport=t}send(t,e,{body:n,request:r={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...r,method:"DELETE",json:n})}};var _=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}};var S=class{constructor(t){this._transport=t}get api(){return{list:new _(this._transport),create:new y(this._transport),delete:new x(this._transport)}}};var T=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}};var R=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var v=class{constructor(t){this._transport=t}get api(){return{get:new T(this._transport),update:new R(this._transport)}}};var w=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}};var F=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...n,method:"PATCH",json:e})}};var L=class{constructor(t){this._transport=t}get api(){return{get:new w(this._transport),update:new F(this._transport)}}};var U=class{constructor(t){this._transport=t}send({limit:t,sort:e,request:n={}}={}){return this._transport.send("v1/actions",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var A=class{constructor(t){this._transport=t}get api(){return{list:new U(this._transport)}}};var E=class{constructor(t){this._transport=t}send(t,{limit:e,request:n={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var P=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",json:t})}};var G=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var I=class{constructor(t){this._transport=t}send({limit:t,include:e,request:n={}}={}){return this._transport.send("v1/boilerplate-categories",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var q=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var N=class{constructor(t){this._transport=t}get api(){return{get:new G(this._transport),list:new I(this._transport),create:new P(this._transport),update:new q(this._transport),boilerplate:{list:new E(this._transport)}}}};var B=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",json:t})}};var M=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var j=class{constructor(t){this._transport=t}send({limit:t,query:e,request:n={}}={}){return this._transport.send("v1/boilerplates",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var k=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var D=class{constructor(t){this._transport=t}get api(){return{get:new M(this._transport),list:new j(this._transport),update:new k(this._transport),create:new B(this._transport)}}};var Q=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}};var H=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var K=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var ae=require("zod"),V=class o{constructor(t){this._transport=t}static SCHEMA=ae.z.object({overwrite:ae.z.boolean().optional()});send(t,{body:e,request:n={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...n,method:"POST",json:o.SCHEMA.parse(e)})}};var W=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var Y=class{constructor(t){this._transport=t}send(t,{limit:e,request:n={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var z=class{constructor(t){this._transport=t}send(t,{limit:e,include:n,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(n)]})}};var J=class{constructor(t){this._transport=t}get api(){return{get:new H(this._transport),list:new K(this._transport),update:new W(this._transport),create:new Q(this._transport),compositionSection:{list:new Y(this._transport)},message:{list:new z(this._transport)},twilioSendgrid:{sync:new V(this._transport)}}}};var $=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}};var X=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var Z=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var tt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var et=class{constructor(t){this._transport=t}get api(){return{get:new X(this._transport),list:new Z(this._transport),create:new $(this._transport),update:new tt(this._transport)}}};var ot=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let n=e.variant??"vcard",r=e.format??(n==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(n)+"&format="+encodeURIComponent(r)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var nt=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}};var rt=class{constructor(t){this._transport=t}send(t,{include:e,request:n={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var st=class{constructor(t){this._transport=t}send({limit:t,query:e,request:n={}}={}){return this._transport.send("v1/contacts",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var it=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var at=class{constructor(t){this._transport=t}send(t,{limit:e,request:n={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var pt=class{constructor(t){this._transport=t}send(t,{limit:e,request:n={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var ct=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...n,method:"POST",json:e})}};var dt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var lt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...n,method:"POST",json:e})}};var mt=class{constructor(t){this._transport=t}get api(){return{get:new rt(this._transport),list:new st(this._transport),update:new it(this._transport),create:new nt(this._transport),conversation:{list:new at(this._transport)},label:{list:new pt(this._transport)},note:{list:new dt(this._transport),create:new ct(this._transport)},notificationSubscription:{create:new lt(this._transport)},vcf:{get:new ot(this._transport)}}}};var ut=class{constructor(t){this._transport=t}send(t,{include:e,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var ht=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:n,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(n??{})]})}};var ft=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var Ct=class{constructor(t){this._transport=t}send(t,{limit:e,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var gt=class{constructor(t){this._transport=t}send(t,{limit:e,include:n,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(n??{})]})}};var m=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...n,method:"POST",json:e})}};var Ot=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var bt=class{constructor(t){this._transport=t}get api(){return{get:new ut(this._transport),list:new ht(this._transport),update:new ft(this._transport),create:new m(this._transport),label:{list:new Ct(this._transport)},message:{list:new gt(this._transport)},note:{list:new Ot(this._transport),create:new m(this._transport)}}}};var yt=class{constructor(t){this._transport=t}send(t,{limit:e,request:n={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var xt=class{constructor(t){this._transport=t}send(t,{limit:e,request:n={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var _t=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}};var St=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Tt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var Rt=class{constructor(t){this._transport=t}send({limit:t,query:e,include:n,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(n??{})]})}};var vt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var wt=class{constructor(t){this._transport=t}get api(){return{create:new _t(this._transport),get:new Tt(this._transport),list:new Rt(this._transport),update:new vt(this._transport),delete:new St(this._transport),contact:{list:new yt(this._transport)},conversation:{list:new xt(this._transport)}}}};var Ft=class{constructor(t){this._transport=t}send({limit:t,include:e,request:n={}}={}){return this._transport.send("v1/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var Lt=class{constructor(t){this._transport=t}get api(){return{list:new Ft(this._transport)}}};var Ut=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...n,method:"POST",json:e})}};var At=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var Et=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var Pt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...n,method:"POST",timeout:12e4,json:e})}};var Gt=class{constructor(t){this._transport=t}get api(){return{get:new At(this._transport),list:new Et(this._transport),response:{create:new Pt(this._transport)},correction:{create:new Ut(this._transport)}}}};var It=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var qt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var Nt=class{constructor(t){this._transport=t}get api(){return{get:new It(this._transport),update:new qt(this._transport)}}};var Bt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var Mt=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let n=[];if(t){let r=Array.isArray(t)?t:[t];for(let i of r)n.push(["category",i])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:n})}};var jt=class{constructor(t){this._transport=t}get api(){return{get:new Bt(this._transport),list:new Mt(this._transport)}}};var kt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}};var Dt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}};var Qt=class{constructor(t){this._transport=t}get api(){return{messageFrequency:new Dt(this._transport),channelMessageFrequency:new kt(this._transport)}}};var Ht=class{constructor(t){this._transport=t}send({account:t,files:e,request:n={}}){let r=new FormData;for(let i of e)r.append("file",i);return this._transport.send("v1/uploads",{...n,method:"POST",body:r,searchParams:{account:t}})}};var Kt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Vt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var Wt=class{constructor(t){this._transport=t}get api(){return{get:new Vt(this._transport),create:new Ht(this._transport),delete:new Kt(this._transport)}}};var Yt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var zt=class{constructor(t){this._transport=t}get api(){return{notification:{get:new Yt(this._transport)}}}};var Jt=class o{static DEFAULT_BASE_URL=Fe;_transport;_account;_accountAccessToken;_accountConversationSettings;_action;_boilerplate;_boilerplateCategory;_channel;_compositionSection;_contact;_conversation;_label;_message;_model;_note;_source;_statistics;_upload;_webhook;_wellKnown;constructor(t,{baseURL:e,...n}={}){this._transport=new O({requestFilterables:[new h,t],...n,baseURL:e?.toString()??o.getBaseURL()}),this._account=new v(this._transport),this._accountAccessToken=new S(this._transport),this._accountConversationSettings=new L(this._transport),this._action=new A(this._transport),this._boilerplate=new D(this._transport),this._boilerplateCategory=new N(this._transport),this._channel=new J(this._transport),this._compositionSection=new et(this._transport),this._contact=new mt(this._transport),this._conversation=new bt(this._transport),this._label=new wt(this._transport),this._message=new Lt(this._transport),this._model=new Gt(this._transport),this._note=new Nt(this._transport),this._source=new jt(this._transport),this._statistics=new Qt(this._transport),this._upload=new Wt(this._transport),this._webhook=new b(this),this._wellKnown=new zt(this._transport)}static getBaseURL(){return process.env[we]??this.DEFAULT_BASE_URL}get account(){return this._account.api}get accountAccessToken(){return this._accountAccessToken.api}get accountConversationSettings(){return this._accountConversationSettings.api}get action(){return this._action.api}get boilerplate(){return this._boilerplate.api}get boilerplateCategory(){return this._boilerplateCategory.api}get channel(){return this._channel.api}get compositionSection(){return this._compositionSection.api}get contact(){return this._contact.api}get conversation(){return this._conversation.api}get label(){return this._label.api}get message(){return this._message.api}get model(){return this._model.api}get note(){return this._note.api}get source(){return this._source.api}get statistics(){return this._statistics.api}get upload(){return this._upload.api}get webhook(){return this._webhook}get wellKnown(){return this._wellKnown.api}};var pe=require("commander"),Ae=require("ora");function ce({client:o,ora:t}){let e=new pe.Command("actions").description("Actions");return e.addCommand(new pe.Command("list").description("List actions").action(async()=>{let n=await(0,Ae.oraPromise)(()=>o.action.list.send().json(),{...t,text:"Finding actions"});console.log(n)})),e}var de=require("commander"),Ee=require("ora");function le({client:o,ora:t}){let e=new de.Command("channels").description("Channels");return e.addCommand(new de.Command("list").description("List channels").action(async()=>{let n=await(0,Ee.oraPromise)(()=>o.channel.list.send().json(),{...t,text:"Finding channels"});console.log(n)})),e}var $t=require("commander"),ee=require("ora");function me({client:o,ora:t}){let e=new $t.Command("contacts").description("Contacts");return e.addCommand(new $t.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async n=>{let r=await(0,ee.oraPromise)(()=>o.contact.get.send(n).json(),{...t,text:"Finding contact"});console.log(r)})),e.addCommand(new $t.Command("list").description("List contacts").action(async()=>{let n=await(0,ee.oraPromise)(()=>o.contact.list.send().json(),{...t,text:"Finding contacts"});console.log(n)})),e.addCommand(new $t.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async n=>{let r=await(0,ee.oraPromise)(()=>o.contact.vcf.get.send({id:n}).response(),{...t,text:"Exporting contact"});console.log(r)})),e}var oe=require("commander"),ue=require("ora");function he({client:o,ora:t}){let e=new oe.Command("conversations").description("Conversations");return e.addCommand(new oe.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let r=await(0,ue.oraPromise)(()=>o.conversation.get.send(n).json(),{...t,text:"Finding conversation"});console.log(r)})),e.addCommand(new oe.Command("list").description("List conversations").action(async()=>{let n=await(0,ue.oraPromise)(()=>o.conversation.list.send().json(),{...t,text:"Finding conversations"});console.log(n)})),e}var Xt=require("commander"),ne=require("ora");function fe({client:o,ora:t}){let e=new Xt.Command("labels").description("Labels");return e.addCommand(new Xt.Command("get").description("Find label").argument("<label>","Label ID").action(async n=>{let r=await(0,ne.oraPromise)(()=>o.label.get.send(n).json(),{...t,text:"Finding label"});console.log(r)})),e.addCommand(new Xt.Command("list").description("List labels").action(async()=>{let n=await(0,ne.oraPromise)(()=>o.label.list.send().json(),{...t,text:"Finding labels"});console.log(n)})),e.addCommand(new Xt.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async n=>{let r=await(0,ne.oraPromise)(()=>o.label.conversation.list.send(n).json(),{...t,text:"Finding conversations"});console.log(r)})),e}var Ce=require("commander"),Pe=require("ora");function ge({client:o,ora:t}){let e=new Ce.Command("messages").description("Messages");return e.addCommand(new Ce.Command("list").description("List messages").action(async()=>{let n=await(0,Pe.oraPromise)(()=>o.message.list.send().json(),{...t,text:"Finding messages"});console.log(n)})),e}var re=require("commander"),Oe=require("ora");function be({client:o,ora:t}){let e=new re.Command("models").description("Models");return e.addCommand(new re.Command("get").description("Find model").argument("<model>","Model ID").action(async n=>{let r=await(0,Oe.oraPromise)(()=>o.model.get.send(n).json(),{...t,text:"Finding model"});console.log(r)})),e.addCommand(new re.Command("list").description("List models").action(async()=>{let n=await(0,Oe.oraPromise)(()=>o.model.list.send().json(),{...t,text:"Finding models"});console.log(n)})),e}var se=require("commander"),ye=require("ora");function xe({client:o,ora:t}){let e=new se.Command("sources").description("Sources");return e.addCommand(new se.Command("get").description("Find source").argument("<source>","Source ID").action(async n=>{let r=await(0,ye.oraPromise)(()=>o.source.get.send(n).json(),{...t,text:"Finding source"});console.log(r)})),e.addCommand(new se.Command("list").description("List sources").action(async()=>{let n=await(0,ye.oraPromise)(()=>o.source.list.send().json(),{...t,text:"Finding sources"});console.log(n)})),e}var Ie=require("commander");var _e=require("commander"),Ge=require("ora");function Se({client:o,ora:t}){let e=new _e.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new _e.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let n=await(0,Ge.oraPromise)(()=>o.wellKnown.notification.get.send().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(n)})),e}function Te({client:o,ora:t}){let e=new Ie.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(Se({client:o,ora:t})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new Jt(new u)},Ke=new qe.Command("gds").description("Great Detail Support System").addCommand(ce(p)).addCommand(le(p)).addCommand(me(p)).addCommand(he(p)).addCommand(fe(p)).addCommand(ge(p)).addCommand(be(p)).addCommand(xe(p)).addCommand(Te(p)),Ne=Ke;Ne.parseAsync(process.argv);
2
+ "use strict";var ke=Object.create;var ve=Object.defineProperty;var je=Object.getOwnPropertyDescriptor;var De=Object.getOwnPropertyNames;var Qe=Object.getPrototypeOf,He=Object.prototype.hasOwnProperty;var Ke=(o,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of De(t))!He.call(o,r)&&r!==e&&ve(o,r,{get:()=>t[r],enumerable:!(n=je(t,r))||n.enumerable});return o};var we=(o,t,e)=>(e=o!=null?ke(Qe(o)):{},Ke(t||!o||!o.__esModule?ve(e,"default",{value:o,enumerable:!0}):e,o));var Ne=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var ae="SUPPORT_SIGNING_KEY",Fe="SUPPORT_BASE_URL";var Le="https://api.support.greatdetail.com",Ae={"X-Powered-By":"GDSupport/JavaScript"};var h=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Ae;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var Ue=we(require("is-network-error"),1),ee=we(require("ky"),1);var a=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var d=class extends a{};var f=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var C=class extends d{static forbidden(){return new this("A forbidden request occurred")}};var c=class extends a{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var g=class extends a{};var l=class extends a{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var O=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=ee.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[n=>{for(let r of this.options.requestFilterables){let i=r.getHeaders();for(let[te,Me]of Object.entries(i))n.headers.has(te)||n.headers.set(te,Me)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[n,r]of Object.entries(t))r!==void 0&&e.push(["sort",r+n]);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 n of Object.keys(t))e.push(["include",n]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let n=this.client(t,e).catch(r=>{if((0,Ue.default)(r))throw new g("A network error occurred",{cause:r});if(r instanceof ee.HTTPError){let i=r.response.status;switch(console.error(JSON.stringify(r.response)),i){case 400:throw l.badRequest();case 401:throw f.unauthenticated();case 403:throw C.forbidden();case 404:throw c.notFound(t);case 405:throw c.forbiddenMethod(t,e.method??"GET");case 415:throw l.unsupportedMediaType();case 418:throw c.teapot();case 429:throw c.rateLimited()}if(i>=500&&i<600)throw a.serverError(i)}throw r});return{response:()=>n,json:async()=>(await n).json()}}};var s=require("zod");var b=class o{constructor(t){this._client=t}static SCHEMA=s.z.object({data:s.z.object({event:s.z.intersection(s.z.object({id:s.z.string(),createdAt:s.z.string().datetime()}),s.z.union([s.z.object({type:s.z.union([s.z.literal("account.created"),s.z.literal("account.updated")]),payload:s.z.object({account:s.z.string()})}),s.z.object({type:s.z.union([s.z.literal("accountAccessToken.created"),s.z.literal("accountAccessToken.updated"),s.z.literal("accountAccessToken.deleted")]),payload:s.z.object({accountAccessToken:s.z.string()})}),s.z.object({type:s.z.union([s.z.literal("contact.created"),s.z.literal("contact.updated")]),payload:s.z.object({contact:s.z.string()})}),s.z.object({type:s.z.union([s.z.literal("conversation.created"),s.z.literal("conversation.updated"),s.z.literal("conversation.closed"),s.z.literal("conversation.received"),s.z.literal("conversation.resolved"),s.z.literal("conversation.sent")]),payload:s.z.object({conversation:s.z.string()})}),s.z.object({type:s.z.union([s.z.literal("message.created"),s.z.literal("message.updated"),s.z.literal("message.delivered"),s.z.literal("message.failed"),s.z.literal("message.read"),s.z.literal("message.received"),s.z.literal("message.sent")]),payload:s.z.object({message:s.z.string()})})]))})});async event({key:t=process.env[ae],maxSignatures:e=3,request:n}){let r=n.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+ae);if(!r)throw new Error("Missing signature header");if(!this._verifySignature(t,n.body,Array.isArray(r)?r.slice(0,e):[r]))throw new Error("Untrusted signature")}let{data:i}=o.SCHEMA.parse(n.body);return{event:i.event}}async _verifySignature(t,e,n){let r=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let i of n)if(await crypto.subtle.verify("HMAC",r,new TextEncoder().encode(atob(i)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var y=class{constructor(t){this._transport=t}send(t,{body:e={},request:n={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...n,method:"POST",json:e})}};var x=class{constructor(t){this._transport=t}send(t,e,{body:n,request:r={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...r,method:"DELETE",json:n})}};var _=class{constructor(t){this._transport=t}send(t,e,{request:n={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...n,method:"GET"})}};var S=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}};var T=class{constructor(t){this._transport=t}get api(){return{get:new _(this._transport),list:new S(this._transport),create:new y(this._transport),delete:new x(this._transport)}}};var R=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}};var v=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var w=class{constructor(t){this._transport=t}get api(){return{get:new R(this._transport),update:new v(this._transport)}}};var F=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}};var L=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...n,method:"PATCH",json:e})}};var A=class{constructor(t){this._transport=t}get api(){return{get:new F(this._transport),update:new L(this._transport)}}};var U=class{constructor(t){this._transport=t}send({limit:t,sort:e,request:n={}}={}){return this._transport.send("v1/actions",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var E=class{constructor(t){this._transport=t}get api(){return{list:new U(this._transport)}}};var G=class{constructor(t){this._transport=t}send(t,{limit:e,request:n={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var P=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",json:t})}};var I=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var q=class{constructor(t){this._transport=t}send({limit:t,include:e,request:n={}}={}){return this._transport.send("v1/boilerplate-categories",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var N=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var B=class{constructor(t){this._transport=t}get api(){return{get:new I(this._transport),list:new q(this._transport),create:new P(this._transport),update:new N(this._transport),boilerplate:{list:new G(this._transport)}}}};var M=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",json:t})}};var k=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var j=class{constructor(t){this._transport=t}send({limit:t,query:e,request:n={}}={}){return this._transport.send("v1/boilerplates",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var D=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var Q=class{constructor(t){this._transport=t}get api(){return{get:new k(this._transport),list:new j(this._transport),update:new D(this._transport),create:new M(this._transport)}}};var H=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}};var K=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var V=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var pe=require("zod"),W=class o{constructor(t){this._transport=t}static SCHEMA=pe.z.object({overwrite:pe.z.boolean().optional()});send(t,{body:e,request:n={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...n,method:"POST",json:o.SCHEMA.parse(e)})}};var Y=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var z=class{constructor(t){this._transport=t}send(t,{limit:e,request:n={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var J=class{constructor(t){this._transport=t}send(t,{limit:e,include:n,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(n)]})}};var $=class{constructor(t){this._transport=t}get api(){return{get:new K(this._transport),list:new V(this._transport),update:new Y(this._transport),create:new H(this._transport),compositionSection:{list:new z(this._transport)},message:{list:new J(this._transport)},twilioSendgrid:{sync:new W(this._transport)}}}};var X=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}};var Z=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var tt=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var et=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var ot=class{constructor(t){this._transport=t}get api(){return{get:new Z(this._transport),list:new tt(this._transport),create:new X(this._transport),update:new et(this._transport)}}};var nt=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let n=e.variant??"vcard",r=e.format??(n==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(n)+"&format="+encodeURIComponent(r)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var rt=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}};var st=class{constructor(t){this._transport=t}send(t,{include:e,request:n={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var it=class{constructor(t){this._transport=t}send({limit:t,query:e,request:n={}}={}){return this._transport.send("v1/contacts",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var at=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var pt=class{constructor(t){this._transport=t}send(t,{limit:e,request:n={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var ct=class{constructor(t){this._transport=t}send(t,{limit:e,request:n={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var dt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...n,method:"POST",json:e})}};var lt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var mt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...n,method:"POST",json:e})}};var ut=class{constructor(t){this._transport=t}get api(){return{get:new st(this._transport),list:new it(this._transport),update:new at(this._transport),create:new rt(this._transport),conversation:{list:new pt(this._transport)},label:{list:new ct(this._transport)},note:{list:new lt(this._transport),create:new dt(this._transport)},notificationSubscription:{create:new mt(this._transport)},vcf:{get:new nt(this._transport)}}}};var ht=class{constructor(t){this._transport=t}send(t,{include:e,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var ft=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:n,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(n??{})]})}};var Ct=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var gt=class{constructor(t){this._transport=t}send(t,{limit:e,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Ot=class{constructor(t){this._transport=t}send(t,{limit:e,include:n,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(n??{})]})}};var m=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...n,method:"POST",json:e})}};var bt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var yt=class{constructor(t){this._transport=t}get api(){return{get:new ht(this._transport),list:new ft(this._transport),update:new Ct(this._transport),create:new m(this._transport),label:{list:new gt(this._transport)},message:{list:new Ot(this._transport)},note:{list:new bt(this._transport),create:new m(this._transport)}}}};var xt=class{constructor(t){this._transport=t}send(t,{limit:e,request:n={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var _t=class{constructor(t){this._transport=t}send(t,{limit:e,request:n={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var St=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}};var Tt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Rt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var vt=class{constructor(t){this._transport=t}send({limit:t,query:e,include:n,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(n??{})]})}};var wt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var Ft=class{constructor(t){this._transport=t}get api(){return{create:new St(this._transport),get:new Rt(this._transport),list:new vt(this._transport),update:new wt(this._transport),delete:new Tt(this._transport),contact:{list:new xt(this._transport)},conversation:{list:new _t(this._transport)}}}};var Lt=class{constructor(t){this._transport=t}send({limit:t,include:e,request:n={}}={}){return this._transport.send("v1/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var At=class{constructor(t){this._transport=t}get api(){return{list:new Lt(this._transport)}}};var Ut=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...n,method:"POST",json:e})}};var Et=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var Gt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var Pt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...n,method:"POST",timeout:12e4,json:e})}};var It=class{constructor(t){this._transport=t}get api(){return{get:new Et(this._transport),list:new Gt(this._transport),response:{create:new Pt(this._transport)},correction:{create:new Ut(this._transport)}}}};var qt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var Nt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...n,method:"PATCH",json:e})}};var Bt=class{constructor(t){this._transport=t}get api(){return{get:new qt(this._transport),update:new Nt(this._transport)}}};var Mt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var kt=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let n=[];if(t){let r=Array.isArray(t)?t:[t];for(let i of r)n.push(["category",i])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:n})}};var jt=class{constructor(t){this._transport=t}get api(){return{get:new Mt(this._transport),list:new kt(this._transport)}}};var Dt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}};var Qt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}};var Ht=class{constructor(t){this._transport=t}get api(){return{messageFrequency:new Qt(this._transport),channelMessageFrequency:new Dt(this._transport)}}};var Kt=class{constructor(t){this._transport=t}send({account:t,files:e,request:n={}}){let r=new FormData;for(let i of e)r.append("file",i);return this._transport.send("v1/uploads",{...n,method:"POST",body:r,searchParams:{account:t}})}};var Vt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Wt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var Yt=class{constructor(t){this._transport=t}get api(){return{get:new Wt(this._transport),create:new Kt(this._transport),delete:new Vt(this._transport)}}};var zt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var Jt=class{constructor(t){this._transport=t}get api(){return{notification:{get:new zt(this._transport)}}}};var $t=class o{static DEFAULT_BASE_URL=Le;_transport;_account;_accountAccessToken;_accountConversationSettings;_action;_boilerplate;_boilerplateCategory;_channel;_compositionSection;_contact;_conversation;_label;_message;_model;_note;_source;_statistics;_upload;_webhook;_wellKnown;constructor(t,{baseURL:e,...n}={}){this._transport=new O({requestFilterables:[new h,t],...n,baseURL:e?.toString()??o.getBaseURL()}),this._account=new w(this._transport),this._accountAccessToken=new T(this._transport),this._accountConversationSettings=new A(this._transport),this._action=new E(this._transport),this._boilerplate=new Q(this._transport),this._boilerplateCategory=new B(this._transport),this._channel=new $(this._transport),this._compositionSection=new ot(this._transport),this._contact=new ut(this._transport),this._conversation=new yt(this._transport),this._label=new Ft(this._transport),this._message=new At(this._transport),this._model=new It(this._transport),this._note=new Bt(this._transport),this._source=new jt(this._transport),this._statistics=new Ht(this._transport),this._upload=new Yt(this._transport),this._webhook=new b(this),this._wellKnown=new Jt(this._transport)}static getBaseURL(){return process.env[Fe]??this.DEFAULT_BASE_URL}get account(){return this._account.api}get accountAccessToken(){return this._accountAccessToken.api}get accountConversationSettings(){return this._accountConversationSettings.api}get action(){return this._action.api}get boilerplate(){return this._boilerplate.api}get boilerplateCategory(){return this._boilerplateCategory.api}get channel(){return this._channel.api}get compositionSection(){return this._compositionSection.api}get contact(){return this._contact.api}get conversation(){return this._conversation.api}get label(){return this._label.api}get message(){return this._message.api}get model(){return this._model.api}get note(){return this._note.api}get source(){return this._source.api}get statistics(){return this._statistics.api}get upload(){return this._upload.api}get webhook(){return this._webhook}get wellKnown(){return this._wellKnown.api}};var ce=require("commander"),Ee=require("ora");function de({client:o,ora:t}){let e=new ce.Command("actions").description("Actions");return e.addCommand(new ce.Command("list").description("List actions").action(async()=>{let n=await(0,Ee.oraPromise)(()=>o.action.list.send().json(),{...t,text:"Finding actions"});console.log(n)})),e}var le=require("commander"),Ge=require("ora");function me({client:o,ora:t}){let e=new le.Command("channels").description("Channels");return e.addCommand(new le.Command("list").description("List channels").action(async()=>{let n=await(0,Ge.oraPromise)(()=>o.channel.list.send().json(),{...t,text:"Finding channels"});console.log(n)})),e}var Xt=require("commander"),oe=require("ora");function ue({client:o,ora:t}){let e=new Xt.Command("contacts").description("Contacts");return e.addCommand(new Xt.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async n=>{let r=await(0,oe.oraPromise)(()=>o.contact.get.send(n).json(),{...t,text:"Finding contact"});console.log(r)})),e.addCommand(new Xt.Command("list").description("List contacts").action(async()=>{let n=await(0,oe.oraPromise)(()=>o.contact.list.send().json(),{...t,text:"Finding contacts"});console.log(n)})),e.addCommand(new Xt.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async n=>{let r=await(0,oe.oraPromise)(()=>o.contact.vcf.get.send({id:n}).response(),{...t,text:"Exporting contact"});console.log(r)})),e}var ne=require("commander"),he=require("ora");function fe({client:o,ora:t}){let e=new ne.Command("conversations").description("Conversations");return e.addCommand(new ne.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let r=await(0,he.oraPromise)(()=>o.conversation.get.send(n).json(),{...t,text:"Finding conversation"});console.log(r)})),e.addCommand(new ne.Command("list").description("List conversations").action(async()=>{let n=await(0,he.oraPromise)(()=>o.conversation.list.send().json(),{...t,text:"Finding conversations"});console.log(n)})),e}var Zt=require("commander"),re=require("ora");function Ce({client:o,ora:t}){let e=new Zt.Command("labels").description("Labels");return e.addCommand(new Zt.Command("get").description("Find label").argument("<label>","Label ID").action(async n=>{let r=await(0,re.oraPromise)(()=>o.label.get.send(n).json(),{...t,text:"Finding label"});console.log(r)})),e.addCommand(new Zt.Command("list").description("List labels").action(async()=>{let n=await(0,re.oraPromise)(()=>o.label.list.send().json(),{...t,text:"Finding labels"});console.log(n)})),e.addCommand(new Zt.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async n=>{let r=await(0,re.oraPromise)(()=>o.label.conversation.list.send(n).json(),{...t,text:"Finding conversations"});console.log(r)})),e}var ge=require("commander"),Pe=require("ora");function Oe({client:o,ora:t}){let e=new ge.Command("messages").description("Messages");return e.addCommand(new ge.Command("list").description("List messages").action(async()=>{let n=await(0,Pe.oraPromise)(()=>o.message.list.send().json(),{...t,text:"Finding messages"});console.log(n)})),e}var se=require("commander"),be=require("ora");function ye({client:o,ora:t}){let e=new se.Command("models").description("Models");return e.addCommand(new se.Command("get").description("Find model").argument("<model>","Model ID").action(async n=>{let r=await(0,be.oraPromise)(()=>o.model.get.send(n).json(),{...t,text:"Finding model"});console.log(r)})),e.addCommand(new se.Command("list").description("List models").action(async()=>{let n=await(0,be.oraPromise)(()=>o.model.list.send().json(),{...t,text:"Finding models"});console.log(n)})),e}var ie=require("commander"),xe=require("ora");function _e({client:o,ora:t}){let e=new ie.Command("sources").description("Sources");return e.addCommand(new ie.Command("get").description("Find source").argument("<source>","Source ID").action(async n=>{let r=await(0,xe.oraPromise)(()=>o.source.get.send(n).json(),{...t,text:"Finding source"});console.log(r)})),e.addCommand(new ie.Command("list").description("List sources").action(async()=>{let n=await(0,xe.oraPromise)(()=>o.source.list.send().json(),{...t,text:"Finding sources"});console.log(n)})),e}var qe=require("commander");var Se=require("commander"),Ie=require("ora");function Te({client:o,ora:t}){let e=new Se.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new Se.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let n=await(0,Ie.oraPromise)(()=>o.wellKnown.notification.get.send().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(n)})),e}function Re({client:o,ora:t}){let e=new qe.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(Te({client:o,ora:t})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new $t(new u)},Ve=new Ne.Command("gds").description("Great Detail Support System").addCommand(de(p)).addCommand(me(p)).addCommand(ue(p)).addCommand(fe(p)).addCommand(Ce(p)).addCommand(Oe(p)).addCommand(ye(p)).addCommand(_e(p)).addCommand(Re(p)),Be=Ve;Be.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-KI5HOMAH.js";import"./chunk-JSOIYG5K.js";r.parseAsync(process.argv);
2
+ import{a as r}from"./chunk-LOXZ4PTM.js";import"./chunk-5TRP4ZAD.js";r.parseAsync(process.argv);
@@ -1748,6 +1748,23 @@ declare class ListAccountAccessTokens {
1748
1748
  };
1749
1749
  }
1750
1750
 
1751
+ interface GetAccountAccessTokenOptions {
1752
+ request?: SendOptions;
1753
+ }
1754
+ type GetAccountAccessTokenResponse = {
1755
+ data: {
1756
+ accountAccessToken: AccountAccessToken;
1757
+ };
1758
+ };
1759
+ declare class GetAccountAccessToken {
1760
+ protected _transport: FetchTransport;
1761
+ constructor(_transport: FetchTransport);
1762
+ send(account: string, accountAccessToken: string, { request }?: GetAccountAccessTokenOptions): {
1763
+ response: () => Promise<ky.KyResponse<GetAccountAccessTokenResponse>>;
1764
+ json: () => Promise<GetAccountAccessTokenResponse>;
1765
+ };
1766
+ }
1767
+
1751
1768
  /**
1752
1769
  * Great Detail Support System.
1753
1770
  *
@@ -1885,6 +1902,25 @@ declare class Webhook {
1885
1902
  payload: {
1886
1903
  account: string;
1887
1904
  };
1905
+ }>, z.ZodObject<{
1906
+ type: z.ZodUnion<[z.ZodLiteral<"accountAccessToken.created">, z.ZodLiteral<"accountAccessToken.updated">, z.ZodLiteral<"accountAccessToken.deleted">]>;
1907
+ payload: z.ZodObject<{
1908
+ accountAccessToken: z.ZodString;
1909
+ }, "strip", z.ZodTypeAny, {
1910
+ accountAccessToken: string;
1911
+ }, {
1912
+ accountAccessToken: string;
1913
+ }>;
1914
+ }, "strip", z.ZodTypeAny, {
1915
+ type: "accountAccessToken.created" | "accountAccessToken.updated" | "accountAccessToken.deleted";
1916
+ payload: {
1917
+ accountAccessToken: string;
1918
+ };
1919
+ }, {
1920
+ type: "accountAccessToken.created" | "accountAccessToken.updated" | "accountAccessToken.deleted";
1921
+ payload: {
1922
+ accountAccessToken: string;
1923
+ };
1888
1924
  }>, z.ZodObject<{
1889
1925
  type: z.ZodUnion<[z.ZodLiteral<"contact.created">, z.ZodLiteral<"contact.updated">]>;
1890
1926
  payload: z.ZodObject<{
@@ -1952,6 +1988,11 @@ declare class Webhook {
1952
1988
  payload: {
1953
1989
  account: string;
1954
1990
  };
1991
+ } | {
1992
+ type: "accountAccessToken.created" | "accountAccessToken.updated" | "accountAccessToken.deleted";
1993
+ payload: {
1994
+ accountAccessToken: string;
1995
+ };
1955
1996
  } | {
1956
1997
  type: "contact.created" | "contact.updated";
1957
1998
  payload: {
@@ -1977,6 +2018,11 @@ declare class Webhook {
1977
2018
  payload: {
1978
2019
  account: string;
1979
2020
  };
2021
+ } | {
2022
+ type: "accountAccessToken.created" | "accountAccessToken.updated" | "accountAccessToken.deleted";
2023
+ payload: {
2024
+ accountAccessToken: string;
2025
+ };
1980
2026
  } | {
1981
2027
  type: "contact.created" | "contact.updated";
1982
2028
  payload: {
@@ -2004,6 +2050,11 @@ declare class Webhook {
2004
2050
  payload: {
2005
2051
  account: string;
2006
2052
  };
2053
+ } | {
2054
+ type: "accountAccessToken.created" | "accountAccessToken.updated" | "accountAccessToken.deleted";
2055
+ payload: {
2056
+ accountAccessToken: string;
2057
+ };
2007
2058
  } | {
2008
2059
  type: "contact.created" | "contact.updated";
2009
2060
  payload: {
@@ -2031,6 +2082,11 @@ declare class Webhook {
2031
2082
  payload: {
2032
2083
  account: string;
2033
2084
  };
2085
+ } | {
2086
+ type: "accountAccessToken.created" | "accountAccessToken.updated" | "accountAccessToken.deleted";
2087
+ payload: {
2088
+ accountAccessToken: string;
2089
+ };
2034
2090
  } | {
2035
2091
  type: "contact.created" | "contact.updated";
2036
2092
  payload: {
@@ -2141,6 +2197,11 @@ declare class Webhook {
2141
2197
  payload: {
2142
2198
  account: string;
2143
2199
  };
2200
+ } | {
2201
+ type: "accountAccessToken.created" | "accountAccessToken.updated" | "accountAccessToken.deleted";
2202
+ payload: {
2203
+ accountAccessToken: string;
2204
+ };
2144
2205
  } | {
2145
2206
  type: "contact.created" | "contact.updated";
2146
2207
  payload: {
@@ -2174,6 +2235,7 @@ declare class AccountAccessTokenClient {
2174
2235
  protected _transport: FetchTransport;
2175
2236
  constructor(_transport: FetchTransport);
2176
2237
  get api(): {
2238
+ get: GetAccountAccessToken;
2177
2239
  list: ListAccountAccessTokens;
2178
2240
  create: CreateAccountAccessToken;
2179
2241
  delete: DeleteAccountAccessToken;
@@ -2583,6 +2645,7 @@ declare class Client {
2583
2645
  update: UpdateAccount;
2584
2646
  };
2585
2647
  get accountAccessToken(): {
2648
+ get: GetAccountAccessToken;
2586
2649
  list: ListAccountAccessTokens;
2587
2650
  create: CreateAccountAccessToken;
2588
2651
  delete: DeleteAccountAccessToken;
@@ -2719,4 +2782,4 @@ declare class Client {
2719
2782
  };
2720
2783
  }
2721
2784
 
2722
- export { type Label as $, type Authentication as A, type Boilerplate as B, Client as C, type DeleteAccountAccessTokenResponse as D, type GetCompositionSectionResponse as E, type ListCompositionSectionsResponse as F, type GetAccountResponse as G, type CreateCompositionSectionResponse as H, type ListChannelCompositionSectionsResponse as I, type UpdateCompositionSectionResponse as J, type Contact as K, type ListAccountAccessTokensResponse as L, type CreateContactResponse as M, type GetContactResponse as N, type Options as O, type ListContactsResponse as P, type ListLabelContactsResponse as Q, type RequestFilterable as R, type UpdateContactResponse as S, type TwilioSendgridChannelSyncResponse as T, type UpdateAccountResponse as U, type GetConversationResponse as V, type WebhookResponse as W, type ListConversationsResponse as X, type ListLabelConversationsResponse as Y, type UpdateConversationResponse as Z, type ListContactConversationsResponse as _, type Account as a, type CreateLabelResponse as a0, type DeleteLabelResponse as a1, type GetLabelResponse as a2, type ListLabelsResponse as a3, type UpdateLabelResponse as a4, type ListConversationLabelsResponse as a5, type ListContactLabelsResponse as a6, type Message as a7, type ListConversationMessagesResponse as a8, type ListMessagesResponse as a9, type ListChannelMessagesResponse as aa, type Model as ab, type GetModelResponse as ac, type ListModelsResponse as ad, type CreateCorrectionResponse as ae, type CreateResponseResponse as af, type Note as ag, type CreateContactNoteResponse as ah, type CreateConversationNoteResponse as ai, type GetNoteResponse as aj, type ListContactNotesResponse as ak, type ListConversationNotesResponse as al, type UpdateNoteResponse as am, type Source as an, type GetSourceResponse as ao, type ListSourcesResponse as ap, type NotificationSubscription as aq, type CreateContactNotificationSubscriptionResponse as ar, type Upload as as, type CreateUploadResponse as at, type GetUploadResponse as au, type DeleteUploadResponse as av, type GetNotificationWellKnownResponse as aw, type Conversation as b, type Options$3 as c, type AccountAccessToken as d, type CreateAccountAccessTokenResponse as e, type AccountConversationSettings as f, type GetAccountConversationSettingsResponse as g, type UpdateAccountConversationSettingsResponse as h, type Action as i, type ListActionsResponse as j, type CreateBoilerplateResponse as k, type ListBoilerplateCategoryBoilerplatesResponse as l, type GetBoilerplateResponse as m, type ListBoilerplatesResponse as n, type UpdateBoilerplateResponse as o, type BoilerplateCategory as p, type CreateBoilerplateCategoryResponse as q, type GetBoilerplateCategoryResponse as r, type ListBoilerplateCategoriesResponse as s, type UpdateBoilerplateCategoryResponse as t, type Channel as u, type ListChannelsResponse as v, type GetChannelResponse as w, type UpdateChannelResponse as x, type CreateChannelResponse as y, type CompositionSection as z };
2785
+ export { type ListContactConversationsResponse as $, type Authentication as A, type Boilerplate as B, Client as C, type DeleteAccountAccessTokenResponse as D, type CompositionSection as E, type GetCompositionSectionResponse as F, type GetAccountResponse as G, type ListCompositionSectionsResponse as H, type CreateCompositionSectionResponse as I, type ListChannelCompositionSectionsResponse as J, type UpdateCompositionSectionResponse as K, type ListAccountAccessTokensResponse as L, type Contact as M, type CreateContactResponse as N, type Options as O, type GetContactResponse as P, type ListContactsResponse as Q, type RequestFilterable as R, type ListLabelContactsResponse as S, type TwilioSendgridChannelSyncResponse as T, type UpdateAccountResponse as U, type UpdateContactResponse as V, type WebhookResponse as W, type GetConversationResponse as X, type ListConversationsResponse as Y, type ListLabelConversationsResponse as Z, type UpdateConversationResponse as _, type Account as a, type Label as a0, type CreateLabelResponse as a1, type DeleteLabelResponse as a2, type GetLabelResponse as a3, type ListLabelsResponse as a4, type UpdateLabelResponse as a5, type ListConversationLabelsResponse as a6, type ListContactLabelsResponse as a7, type Message as a8, type ListConversationMessagesResponse as a9, type ListMessagesResponse as aa, type ListChannelMessagesResponse as ab, type Model as ac, type GetModelResponse as ad, type ListModelsResponse as ae, type CreateCorrectionResponse as af, type CreateResponseResponse as ag, type Note as ah, type CreateContactNoteResponse as ai, type CreateConversationNoteResponse as aj, type GetNoteResponse as ak, type ListContactNotesResponse as al, type ListConversationNotesResponse as am, type UpdateNoteResponse as an, type Source as ao, type GetSourceResponse as ap, type ListSourcesResponse as aq, type NotificationSubscription as ar, type CreateContactNotificationSubscriptionResponse as as, type Upload as at, type CreateUploadResponse as au, type GetUploadResponse as av, type DeleteUploadResponse as aw, type GetNotificationWellKnownResponse as ax, type Conversation as b, type Options$3 as c, type AccountAccessToken as d, type CreateAccountAccessTokenResponse as e, type GetAccountAccessTokenResponse as f, type AccountConversationSettings as g, type GetAccountConversationSettingsResponse as h, type UpdateAccountConversationSettingsResponse as i, type Action as j, type ListActionsResponse as k, type CreateBoilerplateResponse as l, type ListBoilerplateCategoryBoilerplatesResponse as m, type GetBoilerplateResponse as n, type ListBoilerplatesResponse as o, type UpdateBoilerplateResponse as p, type BoilerplateCategory as q, type CreateBoilerplateCategoryResponse as r, type GetBoilerplateCategoryResponse as s, type ListBoilerplateCategoriesResponse as t, type UpdateBoilerplateCategoryResponse as u, type Channel as v, type ListChannelsResponse as w, type GetChannelResponse as x, type UpdateChannelResponse as y, type CreateChannelResponse as z };
@@ -1748,6 +1748,23 @@ declare class ListAccountAccessTokens {
1748
1748
  };
1749
1749
  }
1750
1750
 
1751
+ interface GetAccountAccessTokenOptions {
1752
+ request?: SendOptions;
1753
+ }
1754
+ type GetAccountAccessTokenResponse = {
1755
+ data: {
1756
+ accountAccessToken: AccountAccessToken;
1757
+ };
1758
+ };
1759
+ declare class GetAccountAccessToken {
1760
+ protected _transport: FetchTransport;
1761
+ constructor(_transport: FetchTransport);
1762
+ send(account: string, accountAccessToken: string, { request }?: GetAccountAccessTokenOptions): {
1763
+ response: () => Promise<ky.KyResponse<GetAccountAccessTokenResponse>>;
1764
+ json: () => Promise<GetAccountAccessTokenResponse>;
1765
+ };
1766
+ }
1767
+
1751
1768
  /**
1752
1769
  * Great Detail Support System.
1753
1770
  *
@@ -1885,6 +1902,25 @@ declare class Webhook {
1885
1902
  payload: {
1886
1903
  account: string;
1887
1904
  };
1905
+ }>, z.ZodObject<{
1906
+ type: z.ZodUnion<[z.ZodLiteral<"accountAccessToken.created">, z.ZodLiteral<"accountAccessToken.updated">, z.ZodLiteral<"accountAccessToken.deleted">]>;
1907
+ payload: z.ZodObject<{
1908
+ accountAccessToken: z.ZodString;
1909
+ }, "strip", z.ZodTypeAny, {
1910
+ accountAccessToken: string;
1911
+ }, {
1912
+ accountAccessToken: string;
1913
+ }>;
1914
+ }, "strip", z.ZodTypeAny, {
1915
+ type: "accountAccessToken.created" | "accountAccessToken.updated" | "accountAccessToken.deleted";
1916
+ payload: {
1917
+ accountAccessToken: string;
1918
+ };
1919
+ }, {
1920
+ type: "accountAccessToken.created" | "accountAccessToken.updated" | "accountAccessToken.deleted";
1921
+ payload: {
1922
+ accountAccessToken: string;
1923
+ };
1888
1924
  }>, z.ZodObject<{
1889
1925
  type: z.ZodUnion<[z.ZodLiteral<"contact.created">, z.ZodLiteral<"contact.updated">]>;
1890
1926
  payload: z.ZodObject<{
@@ -1952,6 +1988,11 @@ declare class Webhook {
1952
1988
  payload: {
1953
1989
  account: string;
1954
1990
  };
1991
+ } | {
1992
+ type: "accountAccessToken.created" | "accountAccessToken.updated" | "accountAccessToken.deleted";
1993
+ payload: {
1994
+ accountAccessToken: string;
1995
+ };
1955
1996
  } | {
1956
1997
  type: "contact.created" | "contact.updated";
1957
1998
  payload: {
@@ -1977,6 +2018,11 @@ declare class Webhook {
1977
2018
  payload: {
1978
2019
  account: string;
1979
2020
  };
2021
+ } | {
2022
+ type: "accountAccessToken.created" | "accountAccessToken.updated" | "accountAccessToken.deleted";
2023
+ payload: {
2024
+ accountAccessToken: string;
2025
+ };
1980
2026
  } | {
1981
2027
  type: "contact.created" | "contact.updated";
1982
2028
  payload: {
@@ -2004,6 +2050,11 @@ declare class Webhook {
2004
2050
  payload: {
2005
2051
  account: string;
2006
2052
  };
2053
+ } | {
2054
+ type: "accountAccessToken.created" | "accountAccessToken.updated" | "accountAccessToken.deleted";
2055
+ payload: {
2056
+ accountAccessToken: string;
2057
+ };
2007
2058
  } | {
2008
2059
  type: "contact.created" | "contact.updated";
2009
2060
  payload: {
@@ -2031,6 +2082,11 @@ declare class Webhook {
2031
2082
  payload: {
2032
2083
  account: string;
2033
2084
  };
2085
+ } | {
2086
+ type: "accountAccessToken.created" | "accountAccessToken.updated" | "accountAccessToken.deleted";
2087
+ payload: {
2088
+ accountAccessToken: string;
2089
+ };
2034
2090
  } | {
2035
2091
  type: "contact.created" | "contact.updated";
2036
2092
  payload: {
@@ -2141,6 +2197,11 @@ declare class Webhook {
2141
2197
  payload: {
2142
2198
  account: string;
2143
2199
  };
2200
+ } | {
2201
+ type: "accountAccessToken.created" | "accountAccessToken.updated" | "accountAccessToken.deleted";
2202
+ payload: {
2203
+ accountAccessToken: string;
2204
+ };
2144
2205
  } | {
2145
2206
  type: "contact.created" | "contact.updated";
2146
2207
  payload: {
@@ -2174,6 +2235,7 @@ declare class AccountAccessTokenClient {
2174
2235
  protected _transport: FetchTransport;
2175
2236
  constructor(_transport: FetchTransport);
2176
2237
  get api(): {
2238
+ get: GetAccountAccessToken;
2177
2239
  list: ListAccountAccessTokens;
2178
2240
  create: CreateAccountAccessToken;
2179
2241
  delete: DeleteAccountAccessToken;
@@ -2583,6 +2645,7 @@ declare class Client {
2583
2645
  update: UpdateAccount;
2584
2646
  };
2585
2647
  get accountAccessToken(): {
2648
+ get: GetAccountAccessToken;
2586
2649
  list: ListAccountAccessTokens;
2587
2650
  create: CreateAccountAccessToken;
2588
2651
  delete: DeleteAccountAccessToken;
@@ -2719,4 +2782,4 @@ declare class Client {
2719
2782
  };
2720
2783
  }
2721
2784
 
2722
- export { type Label as $, type Authentication as A, type Boilerplate as B, Client as C, type DeleteAccountAccessTokenResponse as D, type GetCompositionSectionResponse as E, type ListCompositionSectionsResponse as F, type GetAccountResponse as G, type CreateCompositionSectionResponse as H, type ListChannelCompositionSectionsResponse as I, type UpdateCompositionSectionResponse as J, type Contact as K, type ListAccountAccessTokensResponse as L, type CreateContactResponse as M, type GetContactResponse as N, type Options as O, type ListContactsResponse as P, type ListLabelContactsResponse as Q, type RequestFilterable as R, type UpdateContactResponse as S, type TwilioSendgridChannelSyncResponse as T, type UpdateAccountResponse as U, type GetConversationResponse as V, type WebhookResponse as W, type ListConversationsResponse as X, type ListLabelConversationsResponse as Y, type UpdateConversationResponse as Z, type ListContactConversationsResponse as _, type Account as a, type CreateLabelResponse as a0, type DeleteLabelResponse as a1, type GetLabelResponse as a2, type ListLabelsResponse as a3, type UpdateLabelResponse as a4, type ListConversationLabelsResponse as a5, type ListContactLabelsResponse as a6, type Message as a7, type ListConversationMessagesResponse as a8, type ListMessagesResponse as a9, type ListChannelMessagesResponse as aa, type Model as ab, type GetModelResponse as ac, type ListModelsResponse as ad, type CreateCorrectionResponse as ae, type CreateResponseResponse as af, type Note as ag, type CreateContactNoteResponse as ah, type CreateConversationNoteResponse as ai, type GetNoteResponse as aj, type ListContactNotesResponse as ak, type ListConversationNotesResponse as al, type UpdateNoteResponse as am, type Source as an, type GetSourceResponse as ao, type ListSourcesResponse as ap, type NotificationSubscription as aq, type CreateContactNotificationSubscriptionResponse as ar, type Upload as as, type CreateUploadResponse as at, type GetUploadResponse as au, type DeleteUploadResponse as av, type GetNotificationWellKnownResponse as aw, type Conversation as b, type Options$3 as c, type AccountAccessToken as d, type CreateAccountAccessTokenResponse as e, type AccountConversationSettings as f, type GetAccountConversationSettingsResponse as g, type UpdateAccountConversationSettingsResponse as h, type Action as i, type ListActionsResponse as j, type CreateBoilerplateResponse as k, type ListBoilerplateCategoryBoilerplatesResponse as l, type GetBoilerplateResponse as m, type ListBoilerplatesResponse as n, type UpdateBoilerplateResponse as o, type BoilerplateCategory as p, type CreateBoilerplateCategoryResponse as q, type GetBoilerplateCategoryResponse as r, type ListBoilerplateCategoriesResponse as s, type UpdateBoilerplateCategoryResponse as t, type Channel as u, type ListChannelsResponse as v, type GetChannelResponse as w, type UpdateChannelResponse as x, type CreateChannelResponse as y, type CompositionSection as z };
2785
+ export { type ListContactConversationsResponse as $, type Authentication as A, type Boilerplate as B, Client as C, type DeleteAccountAccessTokenResponse as D, type CompositionSection as E, type GetCompositionSectionResponse as F, type GetAccountResponse as G, type ListCompositionSectionsResponse as H, type CreateCompositionSectionResponse as I, type ListChannelCompositionSectionsResponse as J, type UpdateCompositionSectionResponse as K, type ListAccountAccessTokensResponse as L, type Contact as M, type CreateContactResponse as N, type Options as O, type GetContactResponse as P, type ListContactsResponse as Q, type RequestFilterable as R, type ListLabelContactsResponse as S, type TwilioSendgridChannelSyncResponse as T, type UpdateAccountResponse as U, type UpdateContactResponse as V, type WebhookResponse as W, type GetConversationResponse as X, type ListConversationsResponse as Y, type ListLabelConversationsResponse as Z, type UpdateConversationResponse as _, type Account as a, type Label as a0, type CreateLabelResponse as a1, type DeleteLabelResponse as a2, type GetLabelResponse as a3, type ListLabelsResponse as a4, type UpdateLabelResponse as a5, type ListConversationLabelsResponse as a6, type ListContactLabelsResponse as a7, type Message as a8, type ListConversationMessagesResponse as a9, type ListMessagesResponse as aa, type ListChannelMessagesResponse as ab, type Model as ac, type GetModelResponse as ad, type ListModelsResponse as ae, type CreateCorrectionResponse as af, type CreateResponseResponse as ag, type Note as ah, type CreateContactNoteResponse as ai, type CreateConversationNoteResponse as aj, type GetNoteResponse as ak, type ListContactNotesResponse as al, type ListConversationNotesResponse as am, type UpdateNoteResponse as an, type Source as ao, type GetSourceResponse as ap, type ListSourcesResponse as aq, type NotificationSubscription as ar, type CreateContactNotificationSubscriptionResponse as as, type Upload as at, type CreateUploadResponse as au, type GetUploadResponse as av, type DeleteUploadResponse as aw, type GetNotificationWellKnownResponse as ax, type Conversation as b, type Options$3 as c, type AccountAccessToken as d, type CreateAccountAccessTokenResponse as e, type GetAccountAccessTokenResponse as f, type AccountConversationSettings as g, type GetAccountConversationSettingsResponse as h, type UpdateAccountConversationSettingsResponse as i, type Action as j, type ListActionsResponse as k, type CreateBoilerplateResponse as l, type ListBoilerplateCategoryBoilerplatesResponse as m, type GetBoilerplateResponse as n, type ListBoilerplatesResponse as o, type UpdateBoilerplateResponse as p, type BoilerplateCategory as q, type CreateBoilerplateCategoryResponse as r, type GetBoilerplateCategoryResponse as s, type ListBoilerplateCategoriesResponse as t, type UpdateBoilerplateCategoryResponse as u, type Channel as v, type ListChannelsResponse as w, type GetChannelResponse as x, type UpdateChannelResponse as y, type CreateChannelResponse as z };
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var Ce=Object.create;var Zt=Object.defineProperty;var ge=Object.getOwnPropertyDescriptor;var be=Object.getOwnPropertyNames;var _e=Object.getPrototypeOf,xe=Object.prototype.hasOwnProperty;var se=(o,t)=>{for(var e in t)Zt(o,e,{get:t[e],enumerable:!0})},ie=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of be(t))!xe.call(o,n)&&n!==e&&Zt(o,n,{get:()=>t[n],enumerable:!(r=ge(t,n))||r.enumerable});return o};var pe=(o,t,e)=>(e=o!=null?Ce(_e(o)):{},ie(t||!o||!o.__esModule?Zt(e,"default",{value:o,enumerable:!0}):e,o)),Oe=o=>ie(Zt({},"__esModule",{value:!0}),o);var ye={};se(ye,{BearerAuthentication:()=>$t,Client:()=>f,DEFAULT_SUPPORT_BASE_URL:()=>te,Error:()=>ne,KeyAuthentication:()=>zt,PublicAuthentication:()=>Jt,default:()=>f});module.exports=Oe(ye);var te="https://api.support.greatdetail.com",ae={"X-Powered-By":"GDSupport/JavaScript"},ce="api-key";var de="SUPPORT_ACCESS_TOKEN",le="SUPPORT_API_KEY",ue="SUPPORT_KEY_NAME",oe="SUPPORT_SIGNING_KEY",me="SUPPORT_BASE_URL";var C=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=ae;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var he=pe(require("is-network-error"),1),ee=pe(require("ky"),1);var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends i{};var l=class extends c{static unauthenticated(){return new this("An unauthenticated request occurred")}};var u=class extends c{static forbidden(){return new this("A forbidden request occurred")}};var a=class extends i{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var m=class extends i{};var d=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var g=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=ee.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[r=>{for(let n of this.options.requestFilterables){let p=n.getHeaders();for(let[Xt,fe]of Object.entries(p))r.headers.has(Xt)||r.headers.set(Xt,fe)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[r,n]of Object.entries(t))n!==void 0&&e.push(["sort",n+r]);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 r of Object.keys(t))e.push(["include",r]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let r=this.client(t,e).catch(n=>{if((0,he.default)(n))throw new m("A network error occurred",{cause:n});if(n instanceof ee.HTTPError){let p=n.response.status;switch(console.error(JSON.stringify(n.response)),p){case 400:throw d.badRequest();case 401:throw l.unauthenticated();case 403:throw u.forbidden();case 404:throw a.notFound(t);case 405:throw a.forbiddenMethod(t,e.method??"GET");case 415:throw d.unsupportedMediaType();case 418:throw a.teapot();case 429:throw a.rateLimited()}if(p>=500&&p<600)throw i.serverError(p)}throw n});return{response:()=>r,json:async()=>(await r).json()}}};var s=require("zod");var b=class o{constructor(t){this._client=t}static SCHEMA=s.z.object({data:s.z.object({event:s.z.intersection(s.z.object({id:s.z.string(),createdAt:s.z.string().datetime()}),s.z.union([s.z.object({type:s.z.union([s.z.literal("account.created"),s.z.literal("account.updated")]),payload:s.z.object({account:s.z.string()})}),s.z.object({type:s.z.union([s.z.literal("contact.created"),s.z.literal("contact.updated")]),payload:s.z.object({contact:s.z.string()})}),s.z.object({type:s.z.union([s.z.literal("conversation.created"),s.z.literal("conversation.updated"),s.z.literal("conversation.closed"),s.z.literal("conversation.received"),s.z.literal("conversation.resolved"),s.z.literal("conversation.sent")]),payload:s.z.object({conversation:s.z.string()})}),s.z.object({type:s.z.union([s.z.literal("message.created"),s.z.literal("message.updated"),s.z.literal("message.delivered"),s.z.literal("message.failed"),s.z.literal("message.read"),s.z.literal("message.received"),s.z.literal("message.sent")]),payload:s.z.object({message:s.z.string()})})]))})});async event({key:t=process.env[oe],maxSignatures:e=3,request:r}){let n=r.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+oe);if(!n)throw new Error("Missing signature header");if(!this._verifySignature(t,r.body,Array.isArray(n)?n.slice(0,e):[n]))throw new Error("Untrusted signature")}let{data:p}=o.SCHEMA.parse(r.body);return{event:p.event}}async _verifySignature(t,e,r){let n=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let p of r)if(await crypto.subtle.verify("HMAC",n,new TextEncoder().encode(atob(p)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var _=class{constructor(t){this._transport=t}send(t,{body:e={},request:r={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...r,method:"POST",json:e})}};var x=class{constructor(t){this._transport=t}send(t,e,{body:r,request:n={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...n,method:"DELETE",json:r})}};var O=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}};var y=class{constructor(t){this._transport=t}get api(){return{list:new O(this._transport),create:new _(this._transport),delete:new x(this._transport)}}};var S=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}};var T=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var R=class{constructor(t){this._transport=t}get api(){return{get:new S(this._transport),update:new T(this._transport)}}};var v=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}};var F=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...r,method:"PATCH",json:e})}};var A=class{constructor(t){this._transport=t}get api(){return{get:new v(this._transport),update:new F(this._transport)}}};var L=class{constructor(t){this._transport=t}send({limit:t,sort:e,request:r={}}={}){return this._transport.send("v1/actions",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var w=class{constructor(t){this._transport=t}get api(){return{list:new L(this._transport)}}};var U=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var E=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",json:t})}};var G=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var P=class{constructor(t){this._transport=t}send({limit:t,include:e,request:r={}}={}){return this._transport.send("v1/boilerplate-categories",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var q=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var I=class{constructor(t){this._transport=t}get api(){return{get:new G(this._transport),list:new P(this._transport),create:new E(this._transport),update:new q(this._transport),boilerplate:{list:new U(this._transport)}}}};var N=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",json:t})}};var B=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var M=class{constructor(t){this._transport=t}send({limit:t,query:e,request:r={}}={}){return this._transport.send("v1/boilerplates",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var k=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var j=class{constructor(t){this._transport=t}get api(){return{get:new B(this._transport),list:new M(this._transport),update:new k(this._transport),create:new N(this._transport)}}};var D=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}};var Q=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var re=require("zod"),K=class o{constructor(t){this._transport=t}static SCHEMA=re.z.object({overwrite:re.z.boolean().optional()});send(t,{body:e,request:r={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...r,method:"POST",json:o.SCHEMA.parse(e)})}};var V=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var W=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Y=class{constructor(t){this._transport=t}send(t,{limit:e,include:r,request:n={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(r)]})}};var z=class{constructor(t){this._transport=t}get api(){return{get:new Q(this._transport),list:new H(this._transport),update:new V(this._transport),create:new D(this._transport),compositionSection:{list:new W(this._transport)},message:{list:new Y(this._transport)},twilioSendgrid:{sync:new K(this._transport)}}}};var $=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}};var J=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var X=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var Z=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var tt=class{constructor(t){this._transport=t}get api(){return{get:new J(this._transport),list:new X(this._transport),create:new $(this._transport),update:new Z(this._transport)}}};var et=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let r=e.variant??"vcard",n=e.format??(r==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var ot=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}};var rt=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var nt=class{constructor(t){this._transport=t}send({limit:t,query:e,request:r={}}={}){return this._transport.send("v1/contacts",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var st=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var it=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var pt=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var at=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",json:e})}};var ct=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var dt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...r,method:"POST",json:e})}};var lt=class{constructor(t){this._transport=t}get api(){return{get:new rt(this._transport),list:new nt(this._transport),update:new st(this._transport),create:new ot(this._transport),conversation:{list:new it(this._transport)},label:{list:new pt(this._transport)},note:{list:new ct(this._transport),create:new at(this._transport)},notificationSubscription:{create:new dt(this._transport)},vcf:{get:new et(this._transport)}}}};var ut=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var mt=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:r,request:n={}}={}){return this._transport.send("v1/conversations",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(r??{})]})}};var ht=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var ft=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Ct=class{constructor(t){this._transport=t}send(t,{limit:e,include:r,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(r??{})]})}};var h=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",json:e})}};var gt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var bt=class{constructor(t){this._transport=t}get api(){return{get:new ut(this._transport),list:new mt(this._transport),update:new ht(this._transport),create:new h(this._transport),label:{list:new ft(this._transport)},message:{list:new Ct(this._transport)},note:{list:new gt(this._transport),create:new h(this._transport)}}}};var _t=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var xt=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Ot=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}};var yt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var St=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var Tt=class{constructor(t){this._transport=t}send({limit:t,query:e,include:r,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(r??{})]})}};var Rt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var vt=class{constructor(t){this._transport=t}get api(){return{create:new Ot(this._transport),get:new St(this._transport),list:new Tt(this._transport),update:new Rt(this._transport),delete:new yt(this._transport),contact:{list:new _t(this._transport)},conversation:{list:new xt(this._transport)}}}};var Ft=class{constructor(t){this._transport=t}send({limit:t,include:e,request:r={}}={}){return this._transport.send("v1/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var At=class{constructor(t){this._transport=t}get api(){return{list:new Ft(this._transport)}}};var Lt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",json:e})}};var wt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var Ut=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var Et=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",timeout:12e4,json:e})}};var Gt=class{constructor(t){this._transport=t}get api(){return{get:new wt(this._transport),list:new Ut(this._transport),response:{create:new Et(this._transport)},correction:{create:new Lt(this._transport)}}}};var Pt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var qt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var It=class{constructor(t){this._transport=t}get api(){return{get:new Pt(this._transport),update:new qt(this._transport)}}};var Nt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var Bt=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let r=[];if(t){let n=Array.isArray(t)?t:[t];for(let p of n)r.push(["category",p])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:r})}};var Mt=class{constructor(t){this._transport=t}get api(){return{get:new Nt(this._transport),list:new Bt(this._transport)}}};var kt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}};var jt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}};var Dt=class{constructor(t){this._transport=t}get api(){return{messageFrequency:new jt(this._transport),channelMessageFrequency:new kt(this._transport)}}};var Qt=class{constructor(t){this._transport=t}send({account:t,files:e,request:r={}}){let n=new FormData;for(let p of e)n.append("file",p);return this._transport.send("v1/uploads",{...r,method:"POST",body:n,searchParams:{account:t}})}};var Ht=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Kt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var Vt=class{constructor(t){this._transport=t}get api(){return{get:new Kt(this._transport),create:new Qt(this._transport),delete:new Ht(this._transport)}}};var Wt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var Yt=class{constructor(t){this._transport=t}get api(){return{notification:{get:new Wt(this._transport)}}}};var f=class o{static DEFAULT_BASE_URL=te;_transport;_account;_accountAccessToken;_accountConversationSettings;_action;_boilerplate;_boilerplateCategory;_channel;_compositionSection;_contact;_conversation;_label;_message;_model;_note;_source;_statistics;_upload;_webhook;_wellKnown;constructor(t,{baseURL:e,...r}={}){this._transport=new g({requestFilterables:[new C,t],...r,baseURL:e?.toString()??o.getBaseURL()}),this._account=new R(this._transport),this._accountAccessToken=new y(this._transport),this._accountConversationSettings=new A(this._transport),this._action=new w(this._transport),this._boilerplate=new j(this._transport),this._boilerplateCategory=new I(this._transport),this._channel=new z(this._transport),this._compositionSection=new tt(this._transport),this._contact=new lt(this._transport),this._conversation=new bt(this._transport),this._label=new vt(this._transport),this._message=new At(this._transport),this._model=new Gt(this._transport),this._note=new It(this._transport),this._source=new Mt(this._transport),this._statistics=new Dt(this._transport),this._upload=new Vt(this._transport),this._webhook=new b(this),this._wellKnown=new Yt(this._transport)}static getBaseURL(){return process.env[me]??this.DEFAULT_BASE_URL}get account(){return this._account.api}get accountAccessToken(){return this._accountAccessToken.api}get accountConversationSettings(){return this._accountConversationSettings.api}get action(){return this._action.api}get boilerplate(){return this._boilerplate.api}get boilerplateCategory(){return this._boilerplateCategory.api}get channel(){return this._channel.api}get compositionSection(){return this._compositionSection.api}get contact(){return this._contact.api}get conversation(){return this._conversation.api}get label(){return this._label.api}get message(){return this._message.api}get model(){return this._model.api}get note(){return this._note.api}get source(){return this._source.api}get statistics(){return this._statistics.api}get upload(){return this._upload.api}get webhook(){return this._webhook}get wellKnown(){return this._wellKnown.api}};var ne={};se(ne,{AuthError:()=>c,AuthenticationError:()=>l,AuthorizationError:()=>u,LogicError:()=>a,NetworkError:()=>m,SupportError:()=>i,ValidationError:()=>d});var zt=class o{static DEFAULT_NAME=ce;name;#t;constructor({name:t=process.env[ue]??o.DEFAULT_NAME,key:e=process.env[le]}={}){if(!e)throw new Error("API Key option must be specified when using Key Authentication");this.name=t,this.#t=e}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var $t=class{#t;constructor({token:t=process.env[de]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var Jt=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};0&&(module.exports={BearerAuthentication,Client,DEFAULT_SUPPORT_BASE_URL,Error,KeyAuthentication,PublicAuthentication});
1
+ "use strict";var ge=Object.create;var te=Object.defineProperty;var be=Object.getOwnPropertyDescriptor;var _e=Object.getOwnPropertyNames;var Oe=Object.getPrototypeOf,xe=Object.prototype.hasOwnProperty;var ie=(o,t)=>{for(var e in t)te(o,e,{get:t[e],enumerable:!0})},pe=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of _e(t))!xe.call(o,s)&&s!==e&&te(o,s,{get:()=>t[s],enumerable:!(r=be(t,s))||r.enumerable});return o};var ae=(o,t,e)=>(e=o!=null?ge(Oe(o)):{},pe(t||!o||!o.__esModule?te(e,"default",{value:o,enumerable:!0}):e,o)),ye=o=>pe(te({},"__esModule",{value:!0}),o);var Se={};ie(Se,{BasicAuthentication:()=>C,BearerAuthentication:()=>Jt,Client:()=>f,DEFAULT_SUPPORT_BASE_URL:()=>ee,Error:()=>se,KeyAuthentication:()=>C,PublicAuthentication:()=>Xt,default:()=>f});module.exports=ye(Se);var ee="https://api.support.greatdetail.com",ce={"X-Powered-By":"GDSupport/JavaScript"},de="api-key";var le="SUPPORT_ACCESS_TOKEN",ue="SUPPORT_API_KEY",me="SUPPORT_KEY_NAME",re="SUPPORT_SIGNING_KEY",he="SUPPORT_BASE_URL";var g=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=ce;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var fe=ae(require("is-network-error"),1),oe=ae(require("ky"),1);var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends i{};var l=class extends c{static unauthenticated(){return new this("An unauthenticated request occurred")}};var u=class extends c{static forbidden(){return new this("A forbidden request occurred")}};var a=class extends i{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var m=class extends i{};var d=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var b=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=oe.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[r=>{for(let s of this.options.requestFilterables){let p=s.getHeaders();for(let[Zt,Ce]of Object.entries(p))r.headers.has(Zt)||r.headers.set(Zt,Ce)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[r,s]of Object.entries(t))s!==void 0&&e.push(["sort",s+r]);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 r of Object.keys(t))e.push(["include",r]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let r=this.client(t,e).catch(s=>{if((0,fe.default)(s))throw new m("A network error occurred",{cause:s});if(s instanceof oe.HTTPError){let p=s.response.status;switch(console.error(JSON.stringify(s.response)),p){case 400:throw d.badRequest();case 401:throw l.unauthenticated();case 403:throw u.forbidden();case 404:throw a.notFound(t);case 405:throw a.forbiddenMethod(t,e.method??"GET");case 415:throw d.unsupportedMediaType();case 418:throw a.teapot();case 429:throw a.rateLimited()}if(p>=500&&p<600)throw i.serverError(p)}throw s});return{response:()=>r,json:async()=>(await r).json()}}};var n=require("zod");var _=class o{constructor(t){this._client=t}static SCHEMA=n.z.object({data:n.z.object({event:n.z.intersection(n.z.object({id:n.z.string(),createdAt:n.z.string().datetime()}),n.z.union([n.z.object({type:n.z.union([n.z.literal("account.created"),n.z.literal("account.updated")]),payload:n.z.object({account:n.z.string()})}),n.z.object({type:n.z.union([n.z.literal("accountAccessToken.created"),n.z.literal("accountAccessToken.updated"),n.z.literal("accountAccessToken.deleted")]),payload:n.z.object({accountAccessToken:n.z.string()})}),n.z.object({type:n.z.union([n.z.literal("contact.created"),n.z.literal("contact.updated")]),payload:n.z.object({contact:n.z.string()})}),n.z.object({type:n.z.union([n.z.literal("conversation.created"),n.z.literal("conversation.updated"),n.z.literal("conversation.closed"),n.z.literal("conversation.received"),n.z.literal("conversation.resolved"),n.z.literal("conversation.sent")]),payload:n.z.object({conversation:n.z.string()})}),n.z.object({type:n.z.union([n.z.literal("message.created"),n.z.literal("message.updated"),n.z.literal("message.delivered"),n.z.literal("message.failed"),n.z.literal("message.read"),n.z.literal("message.received"),n.z.literal("message.sent")]),payload:n.z.object({message:n.z.string()})})]))})});async event({key:t=process.env[re],maxSignatures:e=3,request:r}){let s=r.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+re);if(!s)throw new Error("Missing signature header");if(!this._verifySignature(t,r.body,Array.isArray(s)?s.slice(0,e):[s]))throw new Error("Untrusted signature")}let{data:p}=o.SCHEMA.parse(r.body);return{event:p.event}}async _verifySignature(t,e,r){let s=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let p of r)if(await crypto.subtle.verify("HMAC",s,new TextEncoder().encode(atob(p)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var O=class{constructor(t){this._transport=t}send(t,{body:e={},request:r={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...r,method:"POST",json:e})}};var x=class{constructor(t){this._transport=t}send(t,e,{body:r,request:s={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...s,method:"DELETE",json:r})}};var y=class{constructor(t){this._transport=t}send(t,e,{request:r={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...r,method:"GET"})}};var S=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}};var T=class{constructor(t){this._transport=t}get api(){return{get:new y(this._transport),list:new S(this._transport),create:new O(this._transport),delete:new x(this._transport)}}};var R=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}};var v=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var A=class{constructor(t){this._transport=t}get api(){return{get:new R(this._transport),update:new v(this._transport)}}};var F=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}};var L=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...r,method:"PATCH",json:e})}};var w=class{constructor(t){this._transport=t}get api(){return{get:new F(this._transport),update:new L(this._transport)}}};var U=class{constructor(t){this._transport=t}send({limit:t,sort:e,request:r={}}={}){return this._transport.send("v1/actions",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var E=class{constructor(t){this._transport=t}get api(){return{list:new U(this._transport)}}};var G=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var P=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",json:t})}};var q=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var I=class{constructor(t){this._transport=t}send({limit:t,include:e,request:r={}}={}){return this._transport.send("v1/boilerplate-categories",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var N=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var B=class{constructor(t){this._transport=t}get api(){return{get:new q(this._transport),list:new I(this._transport),create:new P(this._transport),update:new N(this._transport),boilerplate:{list:new G(this._transport)}}}};var k=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",json:t})}};var M=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var j=class{constructor(t){this._transport=t}send({limit:t,query:e,request:r={}}={}){return this._transport.send("v1/boilerplates",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var D=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var Q=class{constructor(t){this._transport=t}get api(){return{get:new M(this._transport),list:new j(this._transport),update:new D(this._transport),create:new k(this._transport)}}};var H=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}};var K=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var V=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var ne=require("zod"),W=class o{constructor(t){this._transport=t}static SCHEMA=ne.z.object({overwrite:ne.z.boolean().optional()});send(t,{body:e,request:r={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...r,method:"POST",json:o.SCHEMA.parse(e)})}};var Y=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var z=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var $=class{constructor(t){this._transport=t}send(t,{limit:e,include:r,request:s={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(r)]})}};var J=class{constructor(t){this._transport=t}get api(){return{get:new K(this._transport),list:new V(this._transport),update:new Y(this._transport),create:new H(this._transport),compositionSection:{list:new z(this._transport)},message:{list:new $(this._transport)},twilioSendgrid:{sync:new W(this._transport)}}}};var X=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}};var Z=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var tt=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var et=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var ot=class{constructor(t){this._transport=t}get api(){return{get:new Z(this._transport),list:new tt(this._transport),create:new X(this._transport),update:new et(this._transport)}}};var rt=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let r=e.variant??"vcard",s=e.format??(r==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(s)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var nt=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}};var st=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var it=class{constructor(t){this._transport=t}send({limit:t,query:e,request:r={}}={}){return this._transport.send("v1/contacts",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var pt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var at=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var ct=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var dt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",json:e})}};var lt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var ut=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...r,method:"POST",json:e})}};var mt=class{constructor(t){this._transport=t}get api(){return{get:new st(this._transport),list:new it(this._transport),update:new pt(this._transport),create:new nt(this._transport),conversation:{list:new at(this._transport)},label:{list:new ct(this._transport)},note:{list:new lt(this._transport),create:new dt(this._transport)},notificationSubscription:{create:new ut(this._transport)},vcf:{get:new rt(this._transport)}}}};var ht=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var ft=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:r,request:s={}}={}){return this._transport.send("v1/conversations",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(r??{})]})}};var Ct=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var gt=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var bt=class{constructor(t){this._transport=t}send(t,{limit:e,include:r,request:s={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(r??{})]})}};var h=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",json:e})}};var _t=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var Ot=class{constructor(t){this._transport=t}get api(){return{get:new ht(this._transport),list:new ft(this._transport),update:new Ct(this._transport),create:new h(this._transport),label:{list:new gt(this._transport)},message:{list:new bt(this._transport)},note:{list:new _t(this._transport),create:new h(this._transport)}}}};var xt=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var yt=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var St=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}};var Tt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Rt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var vt=class{constructor(t){this._transport=t}send({limit:t,query:e,include:r,request:s={}}={}){return this._transport.send("v1/labels",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(r??{})]})}};var At=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var Ft=class{constructor(t){this._transport=t}get api(){return{create:new St(this._transport),get:new Rt(this._transport),list:new vt(this._transport),update:new At(this._transport),delete:new Tt(this._transport),contact:{list:new xt(this._transport)},conversation:{list:new yt(this._transport)}}}};var Lt=class{constructor(t){this._transport=t}send({limit:t,include:e,request:r={}}={}){return this._transport.send("v1/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var wt=class{constructor(t){this._transport=t}get api(){return{list:new Lt(this._transport)}}};var Ut=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",json:e})}};var Et=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var Gt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var Pt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",timeout:12e4,json:e})}};var qt=class{constructor(t){this._transport=t}get api(){return{get:new Et(this._transport),list:new Gt(this._transport),response:{create:new Pt(this._transport)},correction:{create:new Ut(this._transport)}}}};var It=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var Nt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var Bt=class{constructor(t){this._transport=t}get api(){return{get:new It(this._transport),update:new Nt(this._transport)}}};var kt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var Mt=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let r=[];if(t){let s=Array.isArray(t)?t:[t];for(let p of s)r.push(["category",p])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:r})}};var jt=class{constructor(t){this._transport=t}get api(){return{get:new kt(this._transport),list:new Mt(this._transport)}}};var Dt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}};var Qt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}};var Ht=class{constructor(t){this._transport=t}get api(){return{messageFrequency:new Qt(this._transport),channelMessageFrequency:new Dt(this._transport)}}};var Kt=class{constructor(t){this._transport=t}send({account:t,files:e,request:r={}}){let s=new FormData;for(let p of e)s.append("file",p);return this._transport.send("v1/uploads",{...r,method:"POST",body:s,searchParams:{account:t}})}};var Vt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Wt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var Yt=class{constructor(t){this._transport=t}get api(){return{get:new Wt(this._transport),create:new Kt(this._transport),delete:new Vt(this._transport)}}};var zt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var $t=class{constructor(t){this._transport=t}get api(){return{notification:{get:new zt(this._transport)}}}};var f=class o{static DEFAULT_BASE_URL=ee;_transport;_account;_accountAccessToken;_accountConversationSettings;_action;_boilerplate;_boilerplateCategory;_channel;_compositionSection;_contact;_conversation;_label;_message;_model;_note;_source;_statistics;_upload;_webhook;_wellKnown;constructor(t,{baseURL:e,...r}={}){this._transport=new b({requestFilterables:[new g,t],...r,baseURL:e?.toString()??o.getBaseURL()}),this._account=new A(this._transport),this._accountAccessToken=new T(this._transport),this._accountConversationSettings=new w(this._transport),this._action=new E(this._transport),this._boilerplate=new Q(this._transport),this._boilerplateCategory=new B(this._transport),this._channel=new J(this._transport),this._compositionSection=new ot(this._transport),this._contact=new mt(this._transport),this._conversation=new Ot(this._transport),this._label=new Ft(this._transport),this._message=new wt(this._transport),this._model=new qt(this._transport),this._note=new Bt(this._transport),this._source=new jt(this._transport),this._statistics=new Ht(this._transport),this._upload=new Yt(this._transport),this._webhook=new _(this),this._wellKnown=new $t(this._transport)}static getBaseURL(){return process.env[he]??this.DEFAULT_BASE_URL}get account(){return this._account.api}get accountAccessToken(){return this._accountAccessToken.api}get accountConversationSettings(){return this._accountConversationSettings.api}get action(){return this._action.api}get boilerplate(){return this._boilerplate.api}get boilerplateCategory(){return this._boilerplateCategory.api}get channel(){return this._channel.api}get compositionSection(){return this._compositionSection.api}get contact(){return this._contact.api}get conversation(){return this._conversation.api}get label(){return this._label.api}get message(){return this._message.api}get model(){return this._model.api}get note(){return this._note.api}get source(){return this._source.api}get statistics(){return this._statistics.api}get upload(){return this._upload.api}get webhook(){return this._webhook}get wellKnown(){return this._wellKnown.api}};var se={};ie(se,{AuthError:()=>c,AuthenticationError:()=>l,AuthorizationError:()=>u,LogicError:()=>a,NetworkError:()=>m,SupportError:()=>i,ValidationError:()=>d});var C=class o{static DEFAULT_NAME=de;name;#t;constructor({name:t=process.env[me]??o.DEFAULT_NAME,key:e=process.env[ue]}={}){if(!e)throw new Error("API Key option must be specified when using Key Authentication");this.name=t,this.#t=e}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var Jt=class{#t;constructor({token:t=process.env[le]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var Xt=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};0&&(module.exports={BasicAuthentication,BearerAuthentication,Client,DEFAULT_SUPPORT_BASE_URL,Error,KeyAuthentication,PublicAuthentication});
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as Authentication, a as Account, b as Conversation } from './index-DVSbPCnA.cjs';
2
- export { d as AccountAccessToken, f as AccountConversationSettings, i as Action, B as Boilerplate, p as BoilerplateCategory, u as Channel, C as Client, z as CompositionSection, K as Contact, e as CreateAccountAccessTokenResponse, q as CreateBoilerplateCategoryResponse, k as CreateBoilerplateResponse, y as CreateChannelResponse, H as CreateCompositionSectionResponse, ah as CreateContactNoteResponse, ar as CreateContactNotificationSubscriptionResponse, M as CreateContactResponse, ai as CreateConversationNoteResponse, ae as CreateCorrectionResponse, a0 as CreateLabelResponse, af as CreateResponseResponse, at as CreateUploadResponse, D as DeleteAccountAccessTokenResponse, a1 as DeleteLabelResponse, av as DeleteUploadResponse, g as GetAccountConversationSettingsResponse, G as GetAccountResponse, r as GetBoilerplateCategoryResponse, m as GetBoilerplateResponse, w as GetChannelResponse, E as GetCompositionSectionResponse, N as GetContactResponse, V as GetConversationResponse, a2 as GetLabelResponse, ac as GetModelResponse, aj as GetNoteResponse, aw as GetNotificationWellKnownResponse, ao as GetSourceResponse, au as GetUploadResponse, $ as Label, L as ListAccountAccessTokensResponse, j as ListActionsResponse, s as ListBoilerplateCategoriesResponse, l as ListBoilerplateCategoryBoilerplatesResponse, n as ListBoilerplatesResponse, I as ListChannelCompositionSectionsResponse, aa as ListChannelMessagesResponse, v as ListChannelsResponse, F as ListCompositionSectionsResponse, _ as ListContactConversationsResponse, a6 as ListContactLabelsResponse, ak as ListContactNotesResponse, P as ListContactsResponse, a5 as ListConversationLabelsResponse, a8 as ListConversationMessagesResponse, al as ListConversationNotesResponse, X as ListConversationsResponse, Q as ListLabelContactsResponse, Y as ListLabelConversationsResponse, a3 as ListLabelsResponse, a9 as ListMessagesResponse, ad as ListModelsResponse, ap as ListSourcesResponse, a7 as Message, ab as Model, ag as Note, aq as NotificationSubscription, O as Options, R as RequestFilterable, an as Source, c as TransportOptions, T as TwilioSendgridChannelSyncResponse, h as UpdateAccountConversationSettingsResponse, U as UpdateAccountResponse, t as UpdateBoilerplateCategoryResponse, o as UpdateBoilerplateResponse, x as UpdateChannelResponse, J as UpdateCompositionSectionResponse, S as UpdateContactResponse, Z as UpdateConversationResponse, a4 as UpdateLabelResponse, am as UpdateNoteResponse, as as Upload, W as WebhookResponse, C as default } from './index-DVSbPCnA.cjs';
1
+ import { A as Authentication, a as Account, b as Conversation } from './index-BXPbn8t9.cjs';
2
+ export { d as AccountAccessToken, g as AccountConversationSettings, j as Action, B as Boilerplate, q as BoilerplateCategory, v as Channel, C as Client, E as CompositionSection, M as Contact, e as CreateAccountAccessTokenResponse, r as CreateBoilerplateCategoryResponse, l as CreateBoilerplateResponse, z as CreateChannelResponse, I as CreateCompositionSectionResponse, ai as CreateContactNoteResponse, as as CreateContactNotificationSubscriptionResponse, N as CreateContactResponse, aj as CreateConversationNoteResponse, af as CreateCorrectionResponse, a1 as CreateLabelResponse, ag as CreateResponseResponse, au as CreateUploadResponse, D as DeleteAccountAccessTokenResponse, a2 as DeleteLabelResponse, aw as DeleteUploadResponse, f as GetAccountAccessTokenResponse, h as GetAccountConversationSettingsResponse, G as GetAccountResponse, s as GetBoilerplateCategoryResponse, n as GetBoilerplateResponse, x as GetChannelResponse, F as GetCompositionSectionResponse, P as GetContactResponse, X as GetConversationResponse, a3 as GetLabelResponse, ad as GetModelResponse, ak as GetNoteResponse, ax as GetNotificationWellKnownResponse, ap as GetSourceResponse, av as GetUploadResponse, a0 as Label, L as ListAccountAccessTokensResponse, k as ListActionsResponse, t as ListBoilerplateCategoriesResponse, m as ListBoilerplateCategoryBoilerplatesResponse, o as ListBoilerplatesResponse, J as ListChannelCompositionSectionsResponse, ab as ListChannelMessagesResponse, w as ListChannelsResponse, H as ListCompositionSectionsResponse, $ as ListContactConversationsResponse, a7 as ListContactLabelsResponse, al as ListContactNotesResponse, Q as ListContactsResponse, a6 as ListConversationLabelsResponse, a9 as ListConversationMessagesResponse, am as ListConversationNotesResponse, Y as ListConversationsResponse, S as ListLabelContactsResponse, Z as ListLabelConversationsResponse, a4 as ListLabelsResponse, aa as ListMessagesResponse, ae as ListModelsResponse, aq as ListSourcesResponse, a8 as Message, ac as Model, ah as Note, ar as NotificationSubscription, O as Options, R as RequestFilterable, ao as Source, c as TransportOptions, T as TwilioSendgridChannelSyncResponse, i as UpdateAccountConversationSettingsResponse, U as UpdateAccountResponse, u as UpdateBoilerplateCategoryResponse, p as UpdateBoilerplateResponse, y as UpdateChannelResponse, K as UpdateCompositionSectionResponse, V as UpdateContactResponse, _ as UpdateConversationResponse, a5 as UpdateLabelResponse, an as UpdateNoteResponse, at as Upload, W as WebhookResponse, C as default } from './index-BXPbn8t9.cjs';
3
3
  import 'ky';
4
4
  import 'zod';
5
5
 
@@ -150,7 +150,7 @@ interface Options$1 {
150
150
  name?: string;
151
151
  key?: string;
152
152
  }
153
- declare class KeyAuthentication implements Authentication {
153
+ declare class BasicAuthentication implements Authentication {
154
154
  #private;
155
155
  static DEFAULT_NAME: string;
156
156
  name: string;
@@ -228,4 +228,4 @@ type CreateConversationResponse = {
228
228
  };
229
229
  };
230
230
 
231
- export { Account, BearerAuthentication, Conversation, type CreateAccountResponse, type CreateConversationResponse, DEFAULT_SUPPORT_BASE_URL, index as Error, KeyAuthentication, PublicAuthentication };
231
+ export { Account, BasicAuthentication, BearerAuthentication, Conversation, type CreateAccountResponse, type CreateConversationResponse, DEFAULT_SUPPORT_BASE_URL, index as Error, BasicAuthentication as KeyAuthentication, PublicAuthentication };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as Authentication, a as Account, b as Conversation } from './index-DVSbPCnA.js';
2
- export { d as AccountAccessToken, f as AccountConversationSettings, i as Action, B as Boilerplate, p as BoilerplateCategory, u as Channel, C as Client, z as CompositionSection, K as Contact, e as CreateAccountAccessTokenResponse, q as CreateBoilerplateCategoryResponse, k as CreateBoilerplateResponse, y as CreateChannelResponse, H as CreateCompositionSectionResponse, ah as CreateContactNoteResponse, ar as CreateContactNotificationSubscriptionResponse, M as CreateContactResponse, ai as CreateConversationNoteResponse, ae as CreateCorrectionResponse, a0 as CreateLabelResponse, af as CreateResponseResponse, at as CreateUploadResponse, D as DeleteAccountAccessTokenResponse, a1 as DeleteLabelResponse, av as DeleteUploadResponse, g as GetAccountConversationSettingsResponse, G as GetAccountResponse, r as GetBoilerplateCategoryResponse, m as GetBoilerplateResponse, w as GetChannelResponse, E as GetCompositionSectionResponse, N as GetContactResponse, V as GetConversationResponse, a2 as GetLabelResponse, ac as GetModelResponse, aj as GetNoteResponse, aw as GetNotificationWellKnownResponse, ao as GetSourceResponse, au as GetUploadResponse, $ as Label, L as ListAccountAccessTokensResponse, j as ListActionsResponse, s as ListBoilerplateCategoriesResponse, l as ListBoilerplateCategoryBoilerplatesResponse, n as ListBoilerplatesResponse, I as ListChannelCompositionSectionsResponse, aa as ListChannelMessagesResponse, v as ListChannelsResponse, F as ListCompositionSectionsResponse, _ as ListContactConversationsResponse, a6 as ListContactLabelsResponse, ak as ListContactNotesResponse, P as ListContactsResponse, a5 as ListConversationLabelsResponse, a8 as ListConversationMessagesResponse, al as ListConversationNotesResponse, X as ListConversationsResponse, Q as ListLabelContactsResponse, Y as ListLabelConversationsResponse, a3 as ListLabelsResponse, a9 as ListMessagesResponse, ad as ListModelsResponse, ap as ListSourcesResponse, a7 as Message, ab as Model, ag as Note, aq as NotificationSubscription, O as Options, R as RequestFilterable, an as Source, c as TransportOptions, T as TwilioSendgridChannelSyncResponse, h as UpdateAccountConversationSettingsResponse, U as UpdateAccountResponse, t as UpdateBoilerplateCategoryResponse, o as UpdateBoilerplateResponse, x as UpdateChannelResponse, J as UpdateCompositionSectionResponse, S as UpdateContactResponse, Z as UpdateConversationResponse, a4 as UpdateLabelResponse, am as UpdateNoteResponse, as as Upload, W as WebhookResponse, C as default } from './index-DVSbPCnA.js';
1
+ import { A as Authentication, a as Account, b as Conversation } from './index-BXPbn8t9.js';
2
+ export { d as AccountAccessToken, g as AccountConversationSettings, j as Action, B as Boilerplate, q as BoilerplateCategory, v as Channel, C as Client, E as CompositionSection, M as Contact, e as CreateAccountAccessTokenResponse, r as CreateBoilerplateCategoryResponse, l as CreateBoilerplateResponse, z as CreateChannelResponse, I as CreateCompositionSectionResponse, ai as CreateContactNoteResponse, as as CreateContactNotificationSubscriptionResponse, N as CreateContactResponse, aj as CreateConversationNoteResponse, af as CreateCorrectionResponse, a1 as CreateLabelResponse, ag as CreateResponseResponse, au as CreateUploadResponse, D as DeleteAccountAccessTokenResponse, a2 as DeleteLabelResponse, aw as DeleteUploadResponse, f as GetAccountAccessTokenResponse, h as GetAccountConversationSettingsResponse, G as GetAccountResponse, s as GetBoilerplateCategoryResponse, n as GetBoilerplateResponse, x as GetChannelResponse, F as GetCompositionSectionResponse, P as GetContactResponse, X as GetConversationResponse, a3 as GetLabelResponse, ad as GetModelResponse, ak as GetNoteResponse, ax as GetNotificationWellKnownResponse, ap as GetSourceResponse, av as GetUploadResponse, a0 as Label, L as ListAccountAccessTokensResponse, k as ListActionsResponse, t as ListBoilerplateCategoriesResponse, m as ListBoilerplateCategoryBoilerplatesResponse, o as ListBoilerplatesResponse, J as ListChannelCompositionSectionsResponse, ab as ListChannelMessagesResponse, w as ListChannelsResponse, H as ListCompositionSectionsResponse, $ as ListContactConversationsResponse, a7 as ListContactLabelsResponse, al as ListContactNotesResponse, Q as ListContactsResponse, a6 as ListConversationLabelsResponse, a9 as ListConversationMessagesResponse, am as ListConversationNotesResponse, Y as ListConversationsResponse, S as ListLabelContactsResponse, Z as ListLabelConversationsResponse, a4 as ListLabelsResponse, aa as ListMessagesResponse, ae as ListModelsResponse, aq as ListSourcesResponse, a8 as Message, ac as Model, ah as Note, ar as NotificationSubscription, O as Options, R as RequestFilterable, ao as Source, c as TransportOptions, T as TwilioSendgridChannelSyncResponse, i as UpdateAccountConversationSettingsResponse, U as UpdateAccountResponse, u as UpdateBoilerplateCategoryResponse, p as UpdateBoilerplateResponse, y as UpdateChannelResponse, K as UpdateCompositionSectionResponse, V as UpdateContactResponse, _ as UpdateConversationResponse, a5 as UpdateLabelResponse, an as UpdateNoteResponse, at as Upload, W as WebhookResponse, C as default } from './index-BXPbn8t9.js';
3
3
  import 'ky';
4
4
  import 'zod';
5
5
 
@@ -150,7 +150,7 @@ interface Options$1 {
150
150
  name?: string;
151
151
  key?: string;
152
152
  }
153
- declare class KeyAuthentication implements Authentication {
153
+ declare class BasicAuthentication implements Authentication {
154
154
  #private;
155
155
  static DEFAULT_NAME: string;
156
156
  name: string;
@@ -228,4 +228,4 @@ type CreateConversationResponse = {
228
228
  };
229
229
  };
230
230
 
231
- export { Account, BearerAuthentication, Conversation, type CreateAccountResponse, type CreateConversationResponse, DEFAULT_SUPPORT_BASE_URL, index as Error, KeyAuthentication, PublicAuthentication };
231
+ export { Account, BasicAuthentication, BearerAuthentication, Conversation, type CreateAccountResponse, type CreateConversationResponse, DEFAULT_SUPPORT_BASE_URL, index as Error, BasicAuthentication as KeyAuthentication, PublicAuthentication };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{a as d,b as g,c as p,d as s,e as n,f as _,g as a,h as f,i as m,j as u,k as x,l as c,m as l,n as h,o as A}from"./chunk-JSOIYG5K.js";var E={};d(E,{AuthError:()=>m,AuthenticationError:()=>u,AuthorizationError:()=>x,LogicError:()=>c,NetworkError:()=>l,SupportError:()=>f,ValidationError:()=>h});var t=class e{static DEFAULT_NAME=a;name;#r;constructor({name:r=process.env[n]??e.DEFAULT_NAME,key:i=process.env[s]}={}){if(!i)throw new Error("API Key option must be specified when using Key Authentication");this.name=r,this.#r=i}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#r)}`}}};var o=class{#r;constructor({token:r=process.env[p]}={}){if(!r)throw new Error("Access Token option must be specified when using Token Authentication");this.#r=r}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Bearer ${this.#r}`}}};export{o as BearerAuthentication,A as Client,_ as DEFAULT_SUPPORT_BASE_URL,E as Error,t as KeyAuthentication,g as PublicAuthentication,A as default};
1
+ import{a as d,b as g,c as p,d as s,e as n,f as _,g as a,h as f,i as m,j as u,k as x,l as c,m as l,n as h,o as A}from"./chunk-5TRP4ZAD.js";var E={};d(E,{AuthError:()=>m,AuthenticationError:()=>u,AuthorizationError:()=>x,LogicError:()=>c,NetworkError:()=>l,SupportError:()=>f,ValidationError:()=>h});var r=class e{static DEFAULT_NAME=a;name;#r;constructor({name:t=process.env[n]??e.DEFAULT_NAME,key:i=process.env[s]}={}){if(!i)throw new Error("API Key option must be specified when using Key Authentication");this.name=t,this.#r=i}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#r)}`}}};var o=class{#r;constructor({token:t=process.env[p]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#r=t}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Bearer ${this.#r}`}}};export{r as BasicAuthentication,o as BearerAuthentication,A as Client,_ as DEFAULT_SUPPORT_BASE_URL,E as Error,r as KeyAuthentication,g as PublicAuthentication,A as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@great-detail/support-sdk",
3
- "version": "0.12.4",
3
+ "version": "0.12.5",
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 re=Object.defineProperty;var pe=(o,t)=>{for(var e in t)re(o,e,{get:t[e],enumerable:!0})};var zt=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var Xt="https://api.support.greatdetail.com",Zt={"X-Powered-By":"GDSupport/JavaScript"},de="api-key";import{z as n}from"zod";var ue="SUPPORT_ACCESS_TOKEN",me="SUPPORT_API_KEY",he="SUPPORT_KEY_NAME",Jt="SUPPORT_SIGNING_KEY",te="SUPPORT_BASE_URL";var u=class o{constructor(t){this._client=t}static SCHEMA=n.object({data:n.object({event:n.intersection(n.object({id:n.string(),createdAt:n.string().datetime()}),n.union([n.object({type:n.union([n.literal("account.created"),n.literal("account.updated")]),payload:n.object({account:n.string()})}),n.object({type:n.union([n.literal("contact.created"),n.literal("contact.updated")]),payload:n.object({contact:n.string()})}),n.object({type:n.union([n.literal("conversation.created"),n.literal("conversation.updated"),n.literal("conversation.closed"),n.literal("conversation.received"),n.literal("conversation.resolved"),n.literal("conversation.sent")]),payload:n.object({conversation:n.string()})}),n.object({type:n.union([n.literal("message.created"),n.literal("message.updated"),n.literal("message.delivered"),n.literal("message.failed"),n.literal("message.read"),n.literal("message.received"),n.literal("message.sent")]),payload:n.object({message:n.string()})})]))})});async event({key:t=process.env[Jt],maxSignatures:e=3,request:r}){let s=r.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+Jt);if(!s)throw new Error("Missing signature header");if(!this._verifySignature(t,r.body,Array.isArray(s)?s.slice(0,e):[s]))throw new Error("Untrusted signature")}let{data:i}=o.SCHEMA.parse(r.body);return{event:i.event}}async _verifySignature(t,e,r){let s=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let i of r)if(await crypto.subtle.verify("HMAC",s,new TextEncoder().encode(atob(i)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var m=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Zt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};import ne from"is-network-error";import se,{HTTPError as ie}from"ky";var p=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends p{};var h=class extends c{static unauthenticated(){return new this("An unauthenticated request occurred")}};var f=class extends c{static forbidden(){return new this("A forbidden request occurred")}};var a=class extends p{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var C=class extends p{};var d=class extends p{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var g=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=se.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[r=>{for(let s of this.options.requestFilterables){let i=s.getHeaders();for(let[Yt,oe]of Object.entries(i))r.headers.has(Yt)||r.headers.set(Yt,oe)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[r,s]of Object.entries(t))s!==void 0&&e.push(["sort",s+r]);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 r of Object.keys(t))e.push(["include",r]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let r=this.client(t,e).catch(s=>{if(ne(s))throw new C("A network error occurred",{cause:s});if(s instanceof ie){let i=s.response.status;switch(console.error(JSON.stringify(s.response)),i){case 400:throw d.badRequest();case 401:throw h.unauthenticated();case 403:throw f.forbidden();case 404:throw a.notFound(t);case 405:throw a.forbiddenMethod(t,e.method??"GET");case 415:throw d.unsupportedMediaType();case 418:throw a.teapot();case 429:throw a.rateLimited()}if(i>=500&&i<600)throw p.serverError(i)}throw s});return{response:()=>r,json:async()=>(await r).json()}}};var b=class{constructor(t){this._transport=t}send(t,{body:e={},request:r={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...r,method:"POST",json:e})}};var _=class{constructor(t){this._transport=t}send(t,e,{body:r,request:s={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...s,method:"DELETE",json:r})}};var O=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}};var y=class{constructor(t){this._transport=t}get api(){return{list:new O(this._transport),create:new b(this._transport),delete:new _(this._transport)}}};var x=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}};var S=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var T=class{constructor(t){this._transport=t}get api(){return{get:new x(this._transport),update:new S(this._transport)}}};var R=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}};var v=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...r,method:"PATCH",json:e})}};var F=class{constructor(t){this._transport=t}get api(){return{get:new R(this._transport),update:new v(this._transport)}}};var L=class{constructor(t){this._transport=t}send({limit:t,sort:e,request:r={}}={}){return this._transport.send("v1/actions",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var w=class{constructor(t){this._transport=t}get api(){return{list:new L(this._transport)}}};var U=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var A=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",json:t})}};var E=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var G=class{constructor(t){this._transport=t}send({limit:t,include:e,request:r={}}={}){return this._transport.send("v1/boilerplate-categories",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var P=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var q=class{constructor(t){this._transport=t}get api(){return{get:new E(this._transport),list:new G(this._transport),create:new A(this._transport),update:new P(this._transport),boilerplate:{list:new U(this._transport)}}}};var I=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",json:t})}};var N=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var B=class{constructor(t){this._transport=t}send({limit:t,query:e,request:r={}}={}){return this._transport.send("v1/boilerplates",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var M=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var k=class{constructor(t){this._transport=t}get api(){return{get:new N(this._transport),list:new B(this._transport),update:new M(this._transport),create:new I(this._transport)}}};var j=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}};var Q=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var D=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};import{z as ee}from"zod";var H=class o{constructor(t){this._transport=t}static SCHEMA=ee.object({overwrite:ee.boolean().optional()});send(t,{body:e,request:r={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...r,method:"POST",json:o.SCHEMA.parse(e)})}};var K=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var V=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var W=class{constructor(t){this._transport=t}send(t,{limit:e,include:r,request:s={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(r)]})}};var Y=class{constructor(t){this._transport=t}get api(){return{get:new Q(this._transport),list:new D(this._transport),update:new K(this._transport),create:new j(this._transport),compositionSection:{list:new V(this._transport)},message:{list:new W(this._transport)},twilioSendgrid:{sync:new H(this._transport)}}}};var z=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}};var J=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var $=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var X=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var Z=class{constructor(t){this._transport=t}get api(){return{get:new J(this._transport),list:new $(this._transport),create:new z(this._transport),update:new X(this._transport)}}};var tt=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let r=e.variant??"vcard",s=e.format??(r==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(s)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var et=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}};var ot=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var rt=class{constructor(t){this._transport=t}send({limit:t,query:e,request:r={}}={}){return this._transport.send("v1/contacts",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var nt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var st=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var it=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var pt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",json:e})}};var at=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var ct=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...r,method:"POST",json:e})}};var dt=class{constructor(t){this._transport=t}get api(){return{get:new ot(this._transport),list:new rt(this._transport),update:new nt(this._transport),create:new et(this._transport),conversation:{list:new st(this._transport)},label:{list:new it(this._transport)},note:{list:new at(this._transport),create:new pt(this._transport)},notificationSubscription:{create:new ct(this._transport)},vcf:{get:new tt(this._transport)}}}};var lt=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var ut=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:r,request:s={}}={}){return this._transport.send("v1/conversations",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(r??{})]})}};var mt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var ht=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var ft=class{constructor(t){this._transport=t}send(t,{limit:e,include:r,request:s={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(r??{})]})}};var l=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",json:e})}};var Ct=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var gt=class{constructor(t){this._transport=t}get api(){return{get:new lt(this._transport),list:new ut(this._transport),update:new mt(this._transport),create:new l(this._transport),label:{list:new ht(this._transport)},message:{list:new ft(this._transport)},note:{list:new Ct(this._transport),create:new l(this._transport)}}}};var bt=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var _t=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Ot=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}};var yt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var xt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var St=class{constructor(t){this._transport=t}send({limit:t,query:e,include:r,request:s={}}={}){return this._transport.send("v1/labels",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(r??{})]})}};var Tt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var Rt=class{constructor(t){this._transport=t}get api(){return{create:new Ot(this._transport),get:new xt(this._transport),list:new St(this._transport),update:new Tt(this._transport),delete:new yt(this._transport),contact:{list:new bt(this._transport)},conversation:{list:new _t(this._transport)}}}};var vt=class{constructor(t){this._transport=t}send({limit:t,include:e,request:r={}}={}){return this._transport.send("v1/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var Ft=class{constructor(t){this._transport=t}get api(){return{list:new vt(this._transport)}}};var Lt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",json:e})}};var wt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var Ut=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var At=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",timeout:12e4,json:e})}};var Et=class{constructor(t){this._transport=t}get api(){return{get:new wt(this._transport),list:new Ut(this._transport),response:{create:new At(this._transport)},correction:{create:new Lt(this._transport)}}}};var Gt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var Pt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var qt=class{constructor(t){this._transport=t}get api(){return{get:new Gt(this._transport),update:new Pt(this._transport)}}};var It=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var Nt=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let r=[];if(t){let s=Array.isArray(t)?t:[t];for(let i of s)r.push(["category",i])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:r})}};var Bt=class{constructor(t){this._transport=t}get api(){return{get:new It(this._transport),list:new Nt(this._transport)}}};var Mt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}};var kt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}};var jt=class{constructor(t){this._transport=t}get api(){return{messageFrequency:new kt(this._transport),channelMessageFrequency:new Mt(this._transport)}}};var Qt=class{constructor(t){this._transport=t}send({account:t,files:e,request:r={}}){let s=new FormData;for(let i of e)s.append("file",i);return this._transport.send("v1/uploads",{...r,method:"POST",body:s,searchParams:{account:t}})}};var Dt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Ht=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var Kt=class{constructor(t){this._transport=t}get api(){return{get:new Ht(this._transport),create:new Qt(this._transport),delete:new Dt(this._transport)}}};var Vt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var Wt=class{constructor(t){this._transport=t}get api(){return{notification:{get:new Vt(this._transport)}}}};var $t=class o{static DEFAULT_BASE_URL=Xt;_transport;_account;_accountAccessToken;_accountConversationSettings;_action;_boilerplate;_boilerplateCategory;_channel;_compositionSection;_contact;_conversation;_label;_message;_model;_note;_source;_statistics;_upload;_webhook;_wellKnown;constructor(t,{baseURL:e,...r}={}){this._transport=new g({requestFilterables:[new m,t],...r,baseURL:e?.toString()??o.getBaseURL()}),this._account=new T(this._transport),this._accountAccessToken=new y(this._transport),this._accountConversationSettings=new F(this._transport),this._action=new w(this._transport),this._boilerplate=new k(this._transport),this._boilerplateCategory=new q(this._transport),this._channel=new Y(this._transport),this._compositionSection=new Z(this._transport),this._contact=new dt(this._transport),this._conversation=new gt(this._transport),this._label=new Rt(this._transport),this._message=new Ft(this._transport),this._model=new Et(this._transport),this._note=new qt(this._transport),this._source=new Bt(this._transport),this._statistics=new jt(this._transport),this._upload=new Kt(this._transport),this._webhook=new u(this),this._wellKnown=new Wt(this._transport)}static getBaseURL(){return process.env[te]??this.DEFAULT_BASE_URL}get account(){return this._account.api}get accountAccessToken(){return this._accountAccessToken.api}get accountConversationSettings(){return this._accountConversationSettings.api}get action(){return this._action.api}get boilerplate(){return this._boilerplate.api}get boilerplateCategory(){return this._boilerplateCategory.api}get channel(){return this._channel.api}get compositionSection(){return this._compositionSection.api}get contact(){return this._contact.api}get conversation(){return this._conversation.api}get label(){return this._label.api}get message(){return this._message.api}get model(){return this._model.api}get note(){return this._note.api}get source(){return this._source.api}get statistics(){return this._statistics.api}get upload(){return this._upload.api}get webhook(){return this._webhook}get wellKnown(){return this._wellKnown.api}};export{pe as a,zt as b,ue as c,me as d,he as e,Xt as f,de as g,p as h,c as i,h as j,f as k,a as l,C as m,d as n,$t as o};