@great-detail/support-sdk 0.10.8 → 0.10.10

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.
@@ -1 +1 @@
1
- import{b as v,o as b}from"./chunk-NSQETRTT.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-7KWFLNLZ.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};
@@ -0,0 +1 @@
1
+ var St=Object.defineProperty;var Pt=(r,t)=>{for(var e in t)St(r,e,{get:t[e],enumerable:!0})};var _t=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var Lt="https://api.support.greatdetail.com",vt={"X-Powered-By":"GDSupport/JavaScript"},Nt="api-key";import{z as s}from"zod";var u=class r{constructor(t){this._client=t}static SCHEMA=s.object({data:s.object({event:s.intersection(s.object({id:s.string(),createdAt:s.string().datetime()}),s.discriminatedUnion("type",[s.object({type:s.literal("contact.created"),payload:s.object({contact:s.string()})}),s.object({type:s.literal("message.created"),payload:s.object({message:s.string()})})]))})});async event({request:t}){let{data:e}=r.SCHEMA.parse(t.body);return{event:e.event}}};var m=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}};var h=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/actions",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var C=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var f=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(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var g=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var y=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var R=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var x=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var _=class{constructor(t){this._transport=t}send({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var T=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var O=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var L=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)]})}};import{z as Ut}from"zod";var U=class r{constructor(t){this._transport=t}static SCHEMA=Ut.object({overwrite:Ut.boolean().optional()});send(t,{body:e,request:o={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:r.SCHEMA.parse(e)})}};var F=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var I=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var S=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var w=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var q=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 E=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var ce="SUPPORT_ACCESS_TOKEN",le="SUPPORT_API_KEY",de="SUPPORT_KEY_NAME",Ft="SUPPORT_BASE_URL";var P=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let o=e.variant??"vcard",n=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var G=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var A=class{constructor(t){this._transport=t}send(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var N=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var B=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var M=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var j=class{constructor(t){this._transport=t}send(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var Q=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var H=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:o,request:n={}}={}){return this._transport.send("v1/conversations",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}};var D=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var k=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var K=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var V=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var W=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var z=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Y=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var $=class{constructor(t){this._transport=t}send({limit:t,query:e,include:o,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}};var J=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var X=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Z=class{constructor(t){this._transport=t}send(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}};var tt=class{constructor(t){this._transport=t}send({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var et=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var ot=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var rt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var nt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var st=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var l=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var it=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};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 pt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var ct=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var lt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var dt=class r{constructor(t=r.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=vt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var ut=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 o=[];if(t){let n=Array.isArray(t)?t:[t];for(let a of n)o.push(["category",a])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:o})}};import wt from"is-network-error";import qt,{HTTPError as Et}from"ky";var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends i{};var ht=class extends c{static unauthenticated(){return new this("An unauthenticated request occurred")}};var Ct=class extends c{static forbidden(){return new this("A forbidden request occurred")}};var p=class extends i{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var ft=class extends i{};var d=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var bt=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=qt.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let n of this.options.requestFilterables){let a=n.getHeaders();for(let[Ot,It]of Object.entries(a))o.headers.has(Ot)||o.headers.set(Ot,It)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}limitQuery(t){let e=[];return t&&e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let o=this.client(t,e).catch(n=>{if(wt(n))throw new ft("A network error occurred",{cause:n});if(n instanceof Et){let a=n.response.status;switch(console.error(JSON.stringify(n.response)),a){case 400:throw d.badRequest();case 401:throw ht.unauthenticated();case 403:throw Ct.forbidden();case 404:throw p.notFound(t);case 405:throw p.forbiddenMethod(t,e.method??"GET");case 415:throw d.unsupportedMediaType();case 418:throw p.teapot();case 429:throw p.rateLimited()}if(a>=500&&a<600)throw i.serverError(a)}throw n});return{response:()=>o,json:async()=>(await o).json()}}};var gt=class{constructor(t){this._transport=t}send({account:t,files:e,request:o={}}){let n=new FormData;for(let a of e)n.append("file",a);return this._transport.send("v1/uploads",{...o,method:"POST",body:n,searchParams:{account:t}})}};var yt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Rt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var xt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var Tt=class r{static DEFAULT_BASE_URL=Lt;_transport;constructor(t,{baseURL:e,...o}={}){this._transport=new bt({requestFilterables:[new dt,t],...o,baseURL:e?.toString()??r.getBaseURL()})}static getBaseURL(){return process.env[Ft]??this.DEFAULT_BASE_URL}get account(){return{get:new m(this._transport)}}get action(){return{list:new h(this._transport)}}get boilerplate(){return{get:new f(this._transport),list:new g(this._transport),update:new y(this._transport),create:new C(this._transport)}}get boilerplateCategory(){return{get:new x(this._transport),list:new _(this._transport),create:new R(this._transport),update:new T(this._transport),boilerplate:{list:new b(this._transport)}}}get channel(){return{get:new L(this._transport),list:new v(this._transport),update:new F(this._transport),create:new O(this._transport),compositionSection:{list:new w(this._transport)},message:{list:new X(this._transport)},twilioSendgrid:{sync:new U(this._transport)}}}get compositionSection(){return{get:new S(this._transport),list:new q(this._transport),create:new I(this._transport),update:new E(this._transport)}}get contact(){return{get:new A(this._transport),list:new N(this._transport),update:new M(this._transport),create:new G(this._transport),conversation:{list:new Q(this._transport)},label:{list:new z(this._transport)},note:{list:new at(this._transport),create:new st(this._transport)},notificationSubscription:{create:new lt(this._transport)},vcf:{get:new P(this._transport)}}}get conversation(){return{get:new j(this._transport),list:new H(this._transport),update:new k(this._transport),create:new l(this._transport),label:{list:new Y(this._transport)},message:{list:new Z(this._transport)},note:{list:new pt(this._transport),create:new l(this._transport)}}}get label(){return{create:new K(this._transport),get:new W(this._transport),list:new $(this._transport),update:new J(this._transport),delete:new V(this._transport),contact:{list:new B(this._transport)},conversation:{list:new D(this._transport)}}}get message(){return{list:new tt(this._transport)}}get model(){return{get:new ot(this._transport),list:new rt(this._transport),response:{create:new nt(this._transport)},correction:{create:new et(this._transport)}}}get note(){return{get:new it(this._transport),update:new ct(this._transport)}}get source(){return{get:new ut(this._transport),list:new mt(this._transport)}}get upload(){return{get:new Rt(this._transport),create:new gt(this._transport),delete:new yt(this._transport)}}get webhook(){return new u(this)}get wellKnown(){return{notification:{get:new xt(this._transport)}}}};export{Pt as a,_t as b,ce as c,le as d,de as e,Lt as f,Nt as g,i as h,c as i,ht as j,Ct as k,p as l,ft as m,d as n,Tt as o};
@@ -1 +1 @@
1
- "use strict";var le=Object.create;var Lt=Object.defineProperty;var me=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var Ce=Object.getPrototypeOf,he=Object.prototype.hasOwnProperty;var fe=(n,t)=>{for(var e in t)Lt(n,e,{get:t[e],enumerable:!0})},Xt=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ue(t))!he.call(n,r)&&r!==e&&Lt(n,r,{get:()=>t[r],enumerable:!(o=me(t,r))||o.enumerable});return n};var Zt=(n,t,e)=>(e=n!=null?le(Ce(n)):{},Xt(t||!n||!n.__esModule?Lt(e,"default",{value:n,enumerable:!0}):e,n)),ge=n=>Xt(Lt({},"__esModule",{value:!0}),n);var xe={};fe(xe,{default:()=>ye});module.exports=ge(xe);var ce=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var C=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/actions",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var h=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var f=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var g=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var b=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var y=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var x=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var R=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var O=class{constructor(t){this._transport=t}send({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var _=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var T=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var v=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var L=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 Pt=require("zod"),w=class n{constructor(t){this._transport=t}static SCHEMA=Pt.z.object({overwrite:Pt.z.boolean().optional()});send(t,{body:e,request:o={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:n.SCHEMA.parse(e)})}};var F=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var U=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var I=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var S=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var q=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 P=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var te="SUPPORT_BASE_URL";var ee="https://api.support.greatdetail.com",oe={"X-Powered-By":"GDSupport/JavaScript"};var E=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let o=e.variant??"vcard",r=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(r)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var G=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var N=class{constructor(t){this._transport=t}send(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var j=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var A=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var B=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var M=class{constructor(t){this._transport=t}send(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var D=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Q=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:o,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}};var H=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var K=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var k=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var V=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var W=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var z=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Y=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var $=class{constructor(t){this._transport=t}send({limit:t,query:e,include:o,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}};var J=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var X=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Z=class{constructor(t){this._transport=t}send(t,{limit:e,include:o,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}};var tt=class{constructor(t){this._transport=t}send({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var et=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var ot=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var nt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var rt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var st=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var l=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var it=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};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 pt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var ct=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var dt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var lt=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=oe;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var mt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var ut=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let o=[];if(t){let r=Array.isArray(t)?t:[t];for(let a of r)o.push(["category",a])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:o})}};var ne=Zt(require("is-network-error"),1),wt=Zt(require("ky"),1);var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var d=class extends i{};var Ct=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var ht=class extends d{static forbidden(){return new this("A forbidden request occurred")}};var c=class extends i{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var ft=class extends i{};var m=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var gt=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=wt.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let r of this.options.requestFilterables){let a=r.getHeaders();for(let[Jt,de]of Object.entries(a))o.headers.has(Jt)||o.headers.set(Jt,de)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}limitQuery(t){let e=[];return t&&e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let o=this.client(t,e).catch(r=>{if((0,ne.default)(r))throw new ft("A network error occurred",{cause:r});if(r instanceof wt.HTTPError){let a=r.response.status;switch(console.error(JSON.stringify(r.response)),a){case 400:throw m.badRequest();case 401:throw Ct.unauthenticated();case 403:throw ht.forbidden();case 404:throw c.notFound(t);case 405:throw c.forbiddenMethod(t,e.method??"GET");case 415:throw m.unsupportedMediaType();case 418:throw c.teapot();case 429:throw c.rateLimited()}if(a>=500&&a<600)throw i.serverError(a)}throw r});return{response:()=>o,json:async()=>(await o).json()}}};var bt=class{constructor(t){this._transport=t}send({account:t,files:e,request:o={}}){let r=new FormData;for(let a of e)r.append("file",a);return this._transport.send("v1/uploads",{...o,method:"POST",body:r,searchParams:{account:t}})}};var yt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var xt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var s=require("zod"),Rt=class n{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.discriminatedUnion("type",[s.z.object({type:s.z.literal("contact.created"),payload:s.z.object({contact:s.z.string()})}),s.z.object({type:s.z.literal("message.created"),payload:s.z.object({message:s.z.string()})})]))})});async event({request:t}){let{data:e}=n.SCHEMA.parse(t.body);return{event:e.event}}};var Ot=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var _t=class n{static DEFAULT_BASE_URL=ee;_transport;constructor(t,{baseURL:e,...o}={}){this._transport=new gt({requestFilterables:[new lt,t],...o,baseURL:e?.toString()??n.getBaseURL()})}static getBaseURL(){return process.env[te]??this.DEFAULT_BASE_URL}get action(){return{list:new C(this._transport)}}get boilerplate(){return{get:new f(this._transport),list:new b(this._transport),update:new y(this._transport),create:new h(this._transport)}}get boilerplateCategory(){return{get:new R(this._transport),list:new O(this._transport),create:new x(this._transport),update:new _(this._transport),boilerplate:{list:new g(this._transport)}}}get channel(){return{get:new v(this._transport),list:new L(this._transport),update:new F(this._transport),create:new T(this._transport),compositionSection:{list:new S(this._transport)},message:{list:new X(this._transport)},twilioSendgrid:{sync:new w(this._transport)}}}get compositionSection(){return{get:new I(this._transport),list:new q(this._transport),create:new U(this._transport),update:new P(this._transport)}}get contact(){return{get:new N(this._transport),list:new j(this._transport),update:new B(this._transport),create:new G(this._transport),conversation:{list:new D(this._transport)},label:{label:new z(this._transport)},note:{list:new at(this._transport),create:new st(this._transport)},notificationSubscription:{create:new dt(this._transport)},vcf:{get:new E(this._transport)}}}get conversation(){return{get:new M(this._transport),list:new Q(this._transport),update:new K(this._transport),create:new l(this._transport),label:{list:new Y(this._transport)},message:{list:new Z(this._transport)},note:{list:new pt(this._transport),create:new l(this._transport)}}}get label(){return{create:new k(this._transport),get:new W(this._transport),list:new $(this._transport),update:new J(this._transport),delete:new V(this._transport),contact:{list:new A(this._transport)},conversation:{list:new H(this._transport)}}}get message(){return{list:new tt(this._transport)}}get model(){return{get:new ot(this._transport),list:new nt(this._transport),response:{create:new rt(this._transport)},correction:{create:new et(this._transport)}}}get note(){return{get:new it(this._transport),update:new ct(this._transport)}}get source(){return{get:new mt(this._transport),list:new ut(this._transport)}}get upload(){return{get:new xt(this._transport),create:new bt(this._transport),delete:new yt(this._transport)}}get webhook(){return new Rt(this)}get wellKnown(){return{notification:{get:new Ot(this._transport)}}}};var Et=require("commander"),re=require("ora");function Gt({client:n,ora:t}){let e=new Et.Command("actions").description("Actions");return e.addCommand(new Et.Command("list").description("List actions").action(async()=>{let o=await(0,re.oraPromise)(()=>n.action.list.send().json(),{...t,text:"Finding actions"});console.log(o)})),e}var Nt=require("commander"),se=require("ora");function jt({client:n,ora:t}){let e=new Nt.Command("channels").description("Channels");return e.addCommand(new Nt.Command("list").description("List channels").action(async()=>{let o=await(0,se.oraPromise)(()=>n.channel.list.send().json(),{...t,text:"Finding channels"});console.log(o)})),e}var Tt=require("commander"),Ft=require("ora");function At({client:n,ora:t}){let e=new Tt.Command("contacts").description("Contacts");return e.addCommand(new Tt.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async o=>{let r=await(0,Ft.oraPromise)(()=>n.contact.get.send(o).json(),{...t,text:"Finding contact"});console.log(r)})),e.addCommand(new Tt.Command("list").description("List contacts").action(async()=>{let o=await(0,Ft.oraPromise)(()=>n.contact.list.send().json(),{...t,text:"Finding contacts"});console.log(o)})),e.addCommand(new Tt.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async o=>{let r=await(0,Ft.oraPromise)(()=>n.contact.vcf.get.send({id:o}).response(),{...t,text:"Exporting contact"});console.log(r)})),e}var Ut=require("commander"),Bt=require("ora");function Mt({client:n,ora:t}){let e=new Ut.Command("conversations").description("Conversations");return e.addCommand(new Ut.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async o=>{let r=await(0,Bt.oraPromise)(()=>n.conversation.get.send(o).json(),{...t,text:"Finding conversation"});console.log(r)})),e.addCommand(new Ut.Command("list").description("List conversations").action(async()=>{let o=await(0,Bt.oraPromise)(()=>n.conversation.list.send().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var vt=require("commander"),It=require("ora");function Dt({client:n,ora:t}){let e=new vt.Command("labels").description("Labels");return e.addCommand(new vt.Command("get").description("Find label").argument("<label>","Label ID").action(async o=>{let r=await(0,It.oraPromise)(()=>n.label.get.send(o).json(),{...t,text:"Finding label"});console.log(r)})),e.addCommand(new vt.Command("list").description("List labels").action(async()=>{let o=await(0,It.oraPromise)(()=>n.label.list.send().json(),{...t,text:"Finding labels"});console.log(o)})),e.addCommand(new vt.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async o=>{let r=await(0,It.oraPromise)(()=>n.label.conversation.list.send(o).json(),{...t,text:"Finding conversations"});console.log(r)})),e}var Qt=require("commander"),ie=require("ora");function Ht({client:n,ora:t}){let e=new Qt.Command("messages").description("Messages");return e.addCommand(new Qt.Command("list").description("List messages").action(async()=>{let o=await(0,ie.oraPromise)(()=>n.message.list.send().json(),{...t,text:"Finding messages"});console.log(o)})),e}var St=require("commander"),Kt=require("ora");function kt({client:n,ora:t}){let e=new St.Command("models").description("Models");return e.addCommand(new St.Command("get").description("Find model").argument("<model>","Model ID").action(async o=>{let r=await(0,Kt.oraPromise)(()=>n.model.get.send(o).json(),{...t,text:"Finding model"});console.log(r)})),e.addCommand(new St.Command("list").description("List models").action(async()=>{let o=await(0,Kt.oraPromise)(()=>n.model.list.send().json(),{...t,text:"Finding models"});console.log(o)})),e}var qt=require("commander"),Vt=require("ora");function Wt({client:n,ora:t}){let e=new qt.Command("sources").description("Sources");return e.addCommand(new qt.Command("get").description("Find source").argument("<source>","Source ID").action(async o=>{let r=await(0,Vt.oraPromise)(()=>n.source.get.send(o).json(),{...t,text:"Finding source"});console.log(r)})),e.addCommand(new qt.Command("list").description("List sources").action(async()=>{let o=await(0,Vt.oraPromise)(()=>n.source.list.send().json(),{...t,text:"Finding sources"});console.log(o)})),e}var pe=require("commander");var zt=require("commander"),ae=require("ora");function Yt({client:n,ora:t}){let e=new zt.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new zt.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let o=await(0,ae.oraPromise)(()=>n.wellKnown.notification.get.send().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(o)})),e}function $t({client:n,ora:t}){let e=new pe.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(Yt({client:n,ora:t})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new _t(new u)},be=new ce.Command("gds").description("Great Detail Support System").addCommand(Gt(p)).addCommand(jt(p)).addCommand(At(p)).addCommand(Mt(p)).addCommand(Dt(p)).addCommand(Ht(p)).addCommand(kt(p)).addCommand(Wt(p)).addCommand($t(p)),ye=be;
1
+ "use strict";var me=Object.create;var wt=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var Ce=Object.getOwnPropertyNames;var he=Object.getPrototypeOf,fe=Object.prototype.hasOwnProperty;var ge=(n,t)=>{for(var e in t)wt(n,e,{get:t[e],enumerable:!0})},Zt=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ce(t))!fe.call(n,r)&&r!==e&&wt(n,r,{get:()=>t[r],enumerable:!(o=ue(t,r))||o.enumerable});return n};var te=(n,t,e)=>(e=n!=null?me(he(n)):{},Zt(t||!n||!n.__esModule?wt(e,"default",{value:n,enumerable:!0}):e,n)),be=n=>Zt(wt({},"__esModule",{value:!0}),n);var Re={};ge(Re,{default:()=>xe});module.exports=be(Re);var de=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var C=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}};var h=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/actions",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var f=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var g=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(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var y=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var x=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var R=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var O=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var _=class{constructor(t){this._transport=t}send({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var T=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var v=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var L=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var w=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 Et=require("zod"),F=class n{constructor(t){this._transport=t}static SCHEMA=Et.z.object({overwrite:Et.z.boolean().optional()});send(t,{body:e,request:o={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:n.SCHEMA.parse(e)})}};var U=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var I=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var S=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var q=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var P=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 E=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var ee="SUPPORT_BASE_URL";var oe="https://api.support.greatdetail.com",ne={"X-Powered-By":"GDSupport/JavaScript"};var G=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let o=e.variant??"vcard",r=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(r)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var A=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var N=class{constructor(t){this._transport=t}send(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var j=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var B=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var M=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var D=class{constructor(t){this._transport=t}send(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var Q=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var H=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:o,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}};var K=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var k=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var V=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var W=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var z=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var Y=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var $=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var J=class{constructor(t){this._transport=t}send({limit:t,query:e,include:o,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}};var X=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var Z=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var tt=class{constructor(t){this._transport=t}send(t,{limit:e,include:o,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}};var et=class{constructor(t){this._transport=t}send({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var ot=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var nt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var rt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var st=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var it=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var l=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var at=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,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};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 dt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var lt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var mt=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=ne;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var ut=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var Ct=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let o=[];if(t){let r=Array.isArray(t)?t:[t];for(let a of r)o.push(["category",a])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:o})}};var re=te(require("is-network-error"),1),Ft=te(require("ky"),1);var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var d=class extends i{};var ht=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var ft=class extends d{static forbidden(){return new this("A forbidden request occurred")}};var c=class extends i{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var gt=class extends i{};var m=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var bt=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Ft.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let r of this.options.requestFilterables){let a=r.getHeaders();for(let[Xt,le]of Object.entries(a))o.headers.has(Xt)||o.headers.set(Xt,le)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}limitQuery(t){let e=[];return t&&e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let o=this.client(t,e).catch(r=>{if((0,re.default)(r))throw new gt("A network error occurred",{cause:r});if(r instanceof Ft.HTTPError){let a=r.response.status;switch(console.error(JSON.stringify(r.response)),a){case 400:throw m.badRequest();case 401:throw ht.unauthenticated();case 403:throw ft.forbidden();case 404:throw c.notFound(t);case 405:throw c.forbiddenMethod(t,e.method??"GET");case 415:throw m.unsupportedMediaType();case 418:throw c.teapot();case 429:throw c.rateLimited()}if(a>=500&&a<600)throw i.serverError(a)}throw r});return{response:()=>o,json:async()=>(await o).json()}}};var yt=class{constructor(t){this._transport=t}send({account:t,files:e,request:o={}}){let r=new FormData;for(let a of e)r.append("file",a);return this._transport.send("v1/uploads",{...o,method:"POST",body:r,searchParams:{account:t}})}};var xt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Rt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var s=require("zod"),Ot=class n{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.discriminatedUnion("type",[s.z.object({type:s.z.literal("contact.created"),payload:s.z.object({contact:s.z.string()})}),s.z.object({type:s.z.literal("message.created"),payload:s.z.object({message:s.z.string()})})]))})});async event({request:t}){let{data:e}=n.SCHEMA.parse(t.body);return{event:e.event}}};var _t=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var Tt=class n{static DEFAULT_BASE_URL=oe;_transport;constructor(t,{baseURL:e,...o}={}){this._transport=new bt({requestFilterables:[new mt,t],...o,baseURL:e?.toString()??n.getBaseURL()})}static getBaseURL(){return process.env[ee]??this.DEFAULT_BASE_URL}get account(){return{get:new C(this._transport)}}get action(){return{list:new h(this._transport)}}get boilerplate(){return{get:new g(this._transport),list:new y(this._transport),update:new x(this._transport),create:new f(this._transport)}}get boilerplateCategory(){return{get:new O(this._transport),list:new _(this._transport),create:new R(this._transport),update:new T(this._transport),boilerplate:{list:new b(this._transport)}}}get channel(){return{get:new L(this._transport),list:new w(this._transport),update:new U(this._transport),create:new v(this._transport),compositionSection:{list:new q(this._transport)},message:{list:new Z(this._transport)},twilioSendgrid:{sync:new F(this._transport)}}}get compositionSection(){return{get:new S(this._transport),list:new P(this._transport),create:new I(this._transport),update:new E(this._transport)}}get contact(){return{get:new N(this._transport),list:new j(this._transport),update:new M(this._transport),create:new A(this._transport),conversation:{list:new Q(this._transport)},label:{list:new Y(this._transport)},note:{list:new pt(this._transport),create:new it(this._transport)},notificationSubscription:{create:new lt(this._transport)},vcf:{get:new G(this._transport)}}}get conversation(){return{get:new D(this._transport),list:new H(this._transport),update:new k(this._transport),create:new l(this._transport),label:{list:new $(this._transport)},message:{list:new tt(this._transport)},note:{list:new ct(this._transport),create:new l(this._transport)}}}get label(){return{create:new V(this._transport),get:new z(this._transport),list:new J(this._transport),update:new X(this._transport),delete:new W(this._transport),contact:{list:new B(this._transport)},conversation:{list:new K(this._transport)}}}get message(){return{list:new et(this._transport)}}get model(){return{get:new nt(this._transport),list:new rt(this._transport),response:{create:new st(this._transport)},correction:{create:new ot(this._transport)}}}get note(){return{get:new at(this._transport),update:new dt(this._transport)}}get source(){return{get:new ut(this._transport),list:new Ct(this._transport)}}get upload(){return{get:new Rt(this._transport),create:new yt(this._transport),delete:new xt(this._transport)}}get webhook(){return new Ot(this)}get wellKnown(){return{notification:{get:new _t(this._transport)}}}};var Gt=require("commander"),se=require("ora");function At({client:n,ora:t}){let e=new Gt.Command("actions").description("Actions");return e.addCommand(new Gt.Command("list").description("List actions").action(async()=>{let o=await(0,se.oraPromise)(()=>n.action.list.send().json(),{...t,text:"Finding actions"});console.log(o)})),e}var Nt=require("commander"),ie=require("ora");function jt({client:n,ora:t}){let e=new Nt.Command("channels").description("Channels");return e.addCommand(new Nt.Command("list").description("List channels").action(async()=>{let o=await(0,ie.oraPromise)(()=>n.channel.list.send().json(),{...t,text:"Finding channels"});console.log(o)})),e}var vt=require("commander"),Ut=require("ora");function Bt({client:n,ora:t}){let e=new vt.Command("contacts").description("Contacts");return e.addCommand(new vt.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async o=>{let r=await(0,Ut.oraPromise)(()=>n.contact.get.send(o).json(),{...t,text:"Finding contact"});console.log(r)})),e.addCommand(new vt.Command("list").description("List contacts").action(async()=>{let o=await(0,Ut.oraPromise)(()=>n.contact.list.send().json(),{...t,text:"Finding contacts"});console.log(o)})),e.addCommand(new vt.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async o=>{let r=await(0,Ut.oraPromise)(()=>n.contact.vcf.get.send({id:o}).response(),{...t,text:"Exporting contact"});console.log(r)})),e}var It=require("commander"),Mt=require("ora");function Dt({client:n,ora:t}){let e=new It.Command("conversations").description("Conversations");return e.addCommand(new It.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async o=>{let r=await(0,Mt.oraPromise)(()=>n.conversation.get.send(o).json(),{...t,text:"Finding conversation"});console.log(r)})),e.addCommand(new It.Command("list").description("List conversations").action(async()=>{let o=await(0,Mt.oraPromise)(()=>n.conversation.list.send().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var Lt=require("commander"),St=require("ora");function Qt({client:n,ora:t}){let e=new Lt.Command("labels").description("Labels");return e.addCommand(new Lt.Command("get").description("Find label").argument("<label>","Label ID").action(async o=>{let r=await(0,St.oraPromise)(()=>n.label.get.send(o).json(),{...t,text:"Finding label"});console.log(r)})),e.addCommand(new Lt.Command("list").description("List labels").action(async()=>{let o=await(0,St.oraPromise)(()=>n.label.list.send().json(),{...t,text:"Finding labels"});console.log(o)})),e.addCommand(new Lt.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async o=>{let r=await(0,St.oraPromise)(()=>n.label.conversation.list.send(o).json(),{...t,text:"Finding conversations"});console.log(r)})),e}var Ht=require("commander"),ae=require("ora");function Kt({client:n,ora:t}){let e=new Ht.Command("messages").description("Messages");return e.addCommand(new Ht.Command("list").description("List messages").action(async()=>{let o=await(0,ae.oraPromise)(()=>n.message.list.send().json(),{...t,text:"Finding messages"});console.log(o)})),e}var qt=require("commander"),kt=require("ora");function Vt({client:n,ora:t}){let e=new qt.Command("models").description("Models");return e.addCommand(new qt.Command("get").description("Find model").argument("<model>","Model ID").action(async o=>{let r=await(0,kt.oraPromise)(()=>n.model.get.send(o).json(),{...t,text:"Finding model"});console.log(r)})),e.addCommand(new qt.Command("list").description("List models").action(async()=>{let o=await(0,kt.oraPromise)(()=>n.model.list.send().json(),{...t,text:"Finding models"});console.log(o)})),e}var Pt=require("commander"),Wt=require("ora");function zt({client:n,ora:t}){let e=new Pt.Command("sources").description("Sources");return e.addCommand(new Pt.Command("get").description("Find source").argument("<source>","Source ID").action(async o=>{let r=await(0,Wt.oraPromise)(()=>n.source.get.send(o).json(),{...t,text:"Finding source"});console.log(r)})),e.addCommand(new Pt.Command("list").description("List sources").action(async()=>{let o=await(0,Wt.oraPromise)(()=>n.source.list.send().json(),{...t,text:"Finding sources"});console.log(o)})),e}var ce=require("commander");var Yt=require("commander"),pe=require("ora");function $t({client:n,ora:t}){let e=new Yt.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new Yt.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let o=await(0,pe.oraPromise)(()=>n.wellKnown.notification.get.send().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(o)})),e}function Jt({client:n,ora:t}){let e=new ce.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand($t({client:n,ora:t})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new Tt(new u)},ye=new de.Command("gds").description("Great Detail Support System").addCommand(At(p)).addCommand(jt(p)).addCommand(Bt(p)).addCommand(Dt(p)).addCommand(Qt(p)).addCommand(Kt(p)).addCommand(Vt(p)).addCommand(zt(p)).addCommand(Jt(p)),xe=ye;
@@ -1,5 +1,5 @@
1
1
  import { Command } from 'commander';
2
- import { C as Client } from '../index-ylqKeL9v.cjs';
2
+ import { C as Client } from '../index-C_0hTzbe.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-ylqKeL9v.js';
2
+ import { C as Client } from '../index-C_0hTzbe.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-WWEXNIIV.js";import"../chunk-NSQETRTT.js";export{a as default};
1
+ import{a}from"../chunk-5ZXWERBD.js";import"../chunk-7KWFLNLZ.js";export{a as default};
package/dist/cli.cjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var le=Object.create;var Jt=Object.defineProperty;var me=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var Ce=Object.getPrototypeOf,he=Object.prototype.hasOwnProperty;var fe=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ue(t))!he.call(n,r)&&r!==e&&Jt(n,r,{get:()=>t[r],enumerable:!(o=me(t,r))||o.enumerable});return n};var Xt=(n,t,e)=>(e=n!=null?le(Ce(n)):{},fe(t||!n||!n.__esModule?Jt(e,"default",{value:n,enumerable:!0}):e,n));var pe=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var C=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/actions",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var h=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var f=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var g=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var b=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var y=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var x=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var R=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var O=class{constructor(t){this._transport=t}send({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var _=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var T=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var v=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var L=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 qt=require("zod"),w=class n{constructor(t){this._transport=t}static SCHEMA=qt.z.object({overwrite:qt.z.boolean().optional()});send(t,{body:e,request:o={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:n.SCHEMA.parse(e)})}};var F=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var U=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var I=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var S=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var q=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 P=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var Zt="SUPPORT_BASE_URL";var te="https://api.support.greatdetail.com",ee={"X-Powered-By":"GDSupport/JavaScript"};var E=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let o=e.variant??"vcard",r=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(r)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var G=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var N=class{constructor(t){this._transport=t}send(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var j=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var A=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var B=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var M=class{constructor(t){this._transport=t}send(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var D=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Q=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:o,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}};var H=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var K=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var k=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var V=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var W=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var z=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Y=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var $=class{constructor(t){this._transport=t}send({limit:t,query:e,include:o,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}};var J=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var X=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Z=class{constructor(t){this._transport=t}send(t,{limit:e,include:o,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}};var tt=class{constructor(t){this._transport=t}send({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var et=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var ot=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var nt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var rt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var st=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var l=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var it=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};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 pt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var ct=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var dt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var lt=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=ee;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var mt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var ut=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let o=[];if(t){let r=Array.isArray(t)?t:[t];for(let a of r)o.push(["category",a])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:o})}};var oe=Xt(require("is-network-error"),1),Lt=Xt(require("ky"),1);var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var d=class extends i{};var Ct=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var ht=class extends d{static forbidden(){return new this("A forbidden request occurred")}};var c=class extends i{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var ft=class extends i{};var m=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var gt=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Lt.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let r of this.options.requestFilterables){let a=r.getHeaders();for(let[$t,de]of Object.entries(a))o.headers.has($t)||o.headers.set($t,de)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}limitQuery(t){let e=[];return t&&e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let o=this.client(t,e).catch(r=>{if((0,oe.default)(r))throw new ft("A network error occurred",{cause:r});if(r instanceof Lt.HTTPError){let a=r.response.status;switch(console.error(JSON.stringify(r.response)),a){case 400:throw m.badRequest();case 401:throw Ct.unauthenticated();case 403:throw ht.forbidden();case 404:throw c.notFound(t);case 405:throw c.forbiddenMethod(t,e.method??"GET");case 415:throw m.unsupportedMediaType();case 418:throw c.teapot();case 429:throw c.rateLimited()}if(a>=500&&a<600)throw i.serverError(a)}throw r});return{response:()=>o,json:async()=>(await o).json()}}};var bt=class{constructor(t){this._transport=t}send({account:t,files:e,request:o={}}){let r=new FormData;for(let a of e)r.append("file",a);return this._transport.send("v1/uploads",{...o,method:"POST",body:r,searchParams:{account:t}})}};var yt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var xt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var s=require("zod"),Rt=class n{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.discriminatedUnion("type",[s.z.object({type:s.z.literal("contact.created"),payload:s.z.object({contact:s.z.string()})}),s.z.object({type:s.z.literal("message.created"),payload:s.z.object({message:s.z.string()})})]))})});async event({request:t}){let{data:e}=n.SCHEMA.parse(t.body);return{event:e.event}}};var Ot=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var _t=class n{static DEFAULT_BASE_URL=te;_transport;constructor(t,{baseURL:e,...o}={}){this._transport=new gt({requestFilterables:[new lt,t],...o,baseURL:e?.toString()??n.getBaseURL()})}static getBaseURL(){return process.env[Zt]??this.DEFAULT_BASE_URL}get action(){return{list:new C(this._transport)}}get boilerplate(){return{get:new f(this._transport),list:new b(this._transport),update:new y(this._transport),create:new h(this._transport)}}get boilerplateCategory(){return{get:new R(this._transport),list:new O(this._transport),create:new x(this._transport),update:new _(this._transport),boilerplate:{list:new g(this._transport)}}}get channel(){return{get:new v(this._transport),list:new L(this._transport),update:new F(this._transport),create:new T(this._transport),compositionSection:{list:new S(this._transport)},message:{list:new X(this._transport)},twilioSendgrid:{sync:new w(this._transport)}}}get compositionSection(){return{get:new I(this._transport),list:new q(this._transport),create:new U(this._transport),update:new P(this._transport)}}get contact(){return{get:new N(this._transport),list:new j(this._transport),update:new B(this._transport),create:new G(this._transport),conversation:{list:new D(this._transport)},label:{label:new z(this._transport)},note:{list:new at(this._transport),create:new st(this._transport)},notificationSubscription:{create:new dt(this._transport)},vcf:{get:new E(this._transport)}}}get conversation(){return{get:new M(this._transport),list:new Q(this._transport),update:new K(this._transport),create:new l(this._transport),label:{list:new Y(this._transport)},message:{list:new Z(this._transport)},note:{list:new pt(this._transport),create:new l(this._transport)}}}get label(){return{create:new k(this._transport),get:new W(this._transport),list:new $(this._transport),update:new J(this._transport),delete:new V(this._transport),contact:{list:new A(this._transport)},conversation:{list:new H(this._transport)}}}get message(){return{list:new tt(this._transport)}}get model(){return{get:new ot(this._transport),list:new nt(this._transport),response:{create:new rt(this._transport)},correction:{create:new et(this._transport)}}}get note(){return{get:new it(this._transport),update:new ct(this._transport)}}get source(){return{get:new mt(this._transport),list:new ut(this._transport)}}get upload(){return{get:new xt(this._transport),create:new bt(this._transport),delete:new yt(this._transport)}}get webhook(){return new Rt(this)}get wellKnown(){return{notification:{get:new Ot(this._transport)}}}};var Pt=require("commander"),ne=require("ora");function Et({client:n,ora:t}){let e=new Pt.Command("actions").description("Actions");return e.addCommand(new Pt.Command("list").description("List actions").action(async()=>{let o=await(0,ne.oraPromise)(()=>n.action.list.send().json(),{...t,text:"Finding actions"});console.log(o)})),e}var Gt=require("commander"),re=require("ora");function Nt({client:n,ora:t}){let e=new Gt.Command("channels").description("Channels");return e.addCommand(new Gt.Command("list").description("List channels").action(async()=>{let o=await(0,re.oraPromise)(()=>n.channel.list.send().json(),{...t,text:"Finding channels"});console.log(o)})),e}var Tt=require("commander"),wt=require("ora");function jt({client:n,ora:t}){let e=new Tt.Command("contacts").description("Contacts");return e.addCommand(new Tt.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async o=>{let r=await(0,wt.oraPromise)(()=>n.contact.get.send(o).json(),{...t,text:"Finding contact"});console.log(r)})),e.addCommand(new Tt.Command("list").description("List contacts").action(async()=>{let o=await(0,wt.oraPromise)(()=>n.contact.list.send().json(),{...t,text:"Finding contacts"});console.log(o)})),e.addCommand(new Tt.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async o=>{let r=await(0,wt.oraPromise)(()=>n.contact.vcf.get.send({id:o}).response(),{...t,text:"Exporting contact"});console.log(r)})),e}var Ft=require("commander"),At=require("ora");function Bt({client:n,ora:t}){let e=new Ft.Command("conversations").description("Conversations");return e.addCommand(new Ft.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async o=>{let r=await(0,At.oraPromise)(()=>n.conversation.get.send(o).json(),{...t,text:"Finding conversation"});console.log(r)})),e.addCommand(new Ft.Command("list").description("List conversations").action(async()=>{let o=await(0,At.oraPromise)(()=>n.conversation.list.send().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var vt=require("commander"),Ut=require("ora");function Mt({client:n,ora:t}){let e=new vt.Command("labels").description("Labels");return e.addCommand(new vt.Command("get").description("Find label").argument("<label>","Label ID").action(async o=>{let r=await(0,Ut.oraPromise)(()=>n.label.get.send(o).json(),{...t,text:"Finding label"});console.log(r)})),e.addCommand(new vt.Command("list").description("List labels").action(async()=>{let o=await(0,Ut.oraPromise)(()=>n.label.list.send().json(),{...t,text:"Finding labels"});console.log(o)})),e.addCommand(new vt.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async o=>{let r=await(0,Ut.oraPromise)(()=>n.label.conversation.list.send(o).json(),{...t,text:"Finding conversations"});console.log(r)})),e}var Dt=require("commander"),se=require("ora");function Qt({client:n,ora:t}){let e=new Dt.Command("messages").description("Messages");return e.addCommand(new Dt.Command("list").description("List messages").action(async()=>{let o=await(0,se.oraPromise)(()=>n.message.list.send().json(),{...t,text:"Finding messages"});console.log(o)})),e}var It=require("commander"),Ht=require("ora");function Kt({client:n,ora:t}){let e=new It.Command("models").description("Models");return e.addCommand(new It.Command("get").description("Find model").argument("<model>","Model ID").action(async o=>{let r=await(0,Ht.oraPromise)(()=>n.model.get.send(o).json(),{...t,text:"Finding model"});console.log(r)})),e.addCommand(new It.Command("list").description("List models").action(async()=>{let o=await(0,Ht.oraPromise)(()=>n.model.list.send().json(),{...t,text:"Finding models"});console.log(o)})),e}var St=require("commander"),kt=require("ora");function Vt({client:n,ora:t}){let e=new St.Command("sources").description("Sources");return e.addCommand(new St.Command("get").description("Find source").argument("<source>","Source ID").action(async o=>{let r=await(0,kt.oraPromise)(()=>n.source.get.send(o).json(),{...t,text:"Finding source"});console.log(r)})),e.addCommand(new St.Command("list").description("List sources").action(async()=>{let o=await(0,kt.oraPromise)(()=>n.source.list.send().json(),{...t,text:"Finding sources"});console.log(o)})),e}var ae=require("commander");var Wt=require("commander"),ie=require("ora");function zt({client:n,ora:t}){let e=new Wt.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new Wt.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let o=await(0,ie.oraPromise)(()=>n.wellKnown.notification.get.send().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(o)})),e}function Yt({client:n,ora:t}){let e=new ae.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(zt({client:n,ora:t})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new _t(new u)},ge=new pe.Command("gds").description("Great Detail Support System").addCommand(Et(p)).addCommand(Nt(p)).addCommand(jt(p)).addCommand(Bt(p)).addCommand(Mt(p)).addCommand(Qt(p)).addCommand(Kt(p)).addCommand(Vt(p)).addCommand(Yt(p)),ce=ge;ce.parseAsync(process.argv);
2
+ "use strict";var me=Object.create;var Xt=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var Ce=Object.getOwnPropertyNames;var he=Object.getPrototypeOf,fe=Object.prototype.hasOwnProperty;var ge=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ce(t))!fe.call(n,r)&&r!==e&&Xt(n,r,{get:()=>t[r],enumerable:!(o=ue(t,r))||o.enumerable});return n};var Zt=(n,t,e)=>(e=n!=null?me(he(n)):{},ge(t||!n||!n.__esModule?Xt(e,"default",{value:n,enumerable:!0}):e,n));var ce=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var C=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}};var h=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/actions",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var f=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var g=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(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var y=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var x=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var R=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var O=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var _=class{constructor(t){this._transport=t}send({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var T=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var v=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var L=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var w=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 Pt=require("zod"),F=class n{constructor(t){this._transport=t}static SCHEMA=Pt.z.object({overwrite:Pt.z.boolean().optional()});send(t,{body:e,request:o={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:n.SCHEMA.parse(e)})}};var U=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var I=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var S=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var q=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var P=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 E=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var te="SUPPORT_BASE_URL";var ee="https://api.support.greatdetail.com",oe={"X-Powered-By":"GDSupport/JavaScript"};var G=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let o=e.variant??"vcard",r=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(r)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var A=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var N=class{constructor(t){this._transport=t}send(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var j=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var B=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var M=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var D=class{constructor(t){this._transport=t}send(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var Q=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var H=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:o,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}};var K=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var k=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var V=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var W=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var z=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var Y=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var $=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var J=class{constructor(t){this._transport=t}send({limit:t,query:e,include:o,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}};var X=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var Z=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var tt=class{constructor(t){this._transport=t}send(t,{limit:e,include:o,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}};var et=class{constructor(t){this._transport=t}send({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var ot=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var nt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var rt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var st=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var it=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var l=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var at=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,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};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 dt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var lt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var mt=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=oe;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var ut=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var Ct=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let o=[];if(t){let r=Array.isArray(t)?t:[t];for(let a of r)o.push(["category",a])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:o})}};var ne=Zt(require("is-network-error"),1),wt=Zt(require("ky"),1);var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var d=class extends i{};var ht=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var ft=class extends d{static forbidden(){return new this("A forbidden request occurred")}};var c=class extends i{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var gt=class extends i{};var m=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var bt=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=wt.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let r of this.options.requestFilterables){let a=r.getHeaders();for(let[Jt,le]of Object.entries(a))o.headers.has(Jt)||o.headers.set(Jt,le)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}limitQuery(t){let e=[];return t&&e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let o=this.client(t,e).catch(r=>{if((0,ne.default)(r))throw new gt("A network error occurred",{cause:r});if(r instanceof wt.HTTPError){let a=r.response.status;switch(console.error(JSON.stringify(r.response)),a){case 400:throw m.badRequest();case 401:throw ht.unauthenticated();case 403:throw ft.forbidden();case 404:throw c.notFound(t);case 405:throw c.forbiddenMethod(t,e.method??"GET");case 415:throw m.unsupportedMediaType();case 418:throw c.teapot();case 429:throw c.rateLimited()}if(a>=500&&a<600)throw i.serverError(a)}throw r});return{response:()=>o,json:async()=>(await o).json()}}};var yt=class{constructor(t){this._transport=t}send({account:t,files:e,request:o={}}){let r=new FormData;for(let a of e)r.append("file",a);return this._transport.send("v1/uploads",{...o,method:"POST",body:r,searchParams:{account:t}})}};var xt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Rt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var s=require("zod"),Ot=class n{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.discriminatedUnion("type",[s.z.object({type:s.z.literal("contact.created"),payload:s.z.object({contact:s.z.string()})}),s.z.object({type:s.z.literal("message.created"),payload:s.z.object({message:s.z.string()})})]))})});async event({request:t}){let{data:e}=n.SCHEMA.parse(t.body);return{event:e.event}}};var _t=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var Tt=class n{static DEFAULT_BASE_URL=ee;_transport;constructor(t,{baseURL:e,...o}={}){this._transport=new bt({requestFilterables:[new mt,t],...o,baseURL:e?.toString()??n.getBaseURL()})}static getBaseURL(){return process.env[te]??this.DEFAULT_BASE_URL}get account(){return{get:new C(this._transport)}}get action(){return{list:new h(this._transport)}}get boilerplate(){return{get:new g(this._transport),list:new y(this._transport),update:new x(this._transport),create:new f(this._transport)}}get boilerplateCategory(){return{get:new O(this._transport),list:new _(this._transport),create:new R(this._transport),update:new T(this._transport),boilerplate:{list:new b(this._transport)}}}get channel(){return{get:new L(this._transport),list:new w(this._transport),update:new U(this._transport),create:new v(this._transport),compositionSection:{list:new q(this._transport)},message:{list:new Z(this._transport)},twilioSendgrid:{sync:new F(this._transport)}}}get compositionSection(){return{get:new S(this._transport),list:new P(this._transport),create:new I(this._transport),update:new E(this._transport)}}get contact(){return{get:new N(this._transport),list:new j(this._transport),update:new M(this._transport),create:new A(this._transport),conversation:{list:new Q(this._transport)},label:{list:new Y(this._transport)},note:{list:new pt(this._transport),create:new it(this._transport)},notificationSubscription:{create:new lt(this._transport)},vcf:{get:new G(this._transport)}}}get conversation(){return{get:new D(this._transport),list:new H(this._transport),update:new k(this._transport),create:new l(this._transport),label:{list:new $(this._transport)},message:{list:new tt(this._transport)},note:{list:new ct(this._transport),create:new l(this._transport)}}}get label(){return{create:new V(this._transport),get:new z(this._transport),list:new J(this._transport),update:new X(this._transport),delete:new W(this._transport),contact:{list:new B(this._transport)},conversation:{list:new K(this._transport)}}}get message(){return{list:new et(this._transport)}}get model(){return{get:new nt(this._transport),list:new rt(this._transport),response:{create:new st(this._transport)},correction:{create:new ot(this._transport)}}}get note(){return{get:new at(this._transport),update:new dt(this._transport)}}get source(){return{get:new ut(this._transport),list:new Ct(this._transport)}}get upload(){return{get:new Rt(this._transport),create:new yt(this._transport),delete:new xt(this._transport)}}get webhook(){return new Ot(this)}get wellKnown(){return{notification:{get:new _t(this._transport)}}}};var Et=require("commander"),re=require("ora");function Gt({client:n,ora:t}){let e=new Et.Command("actions").description("Actions");return e.addCommand(new Et.Command("list").description("List actions").action(async()=>{let o=await(0,re.oraPromise)(()=>n.action.list.send().json(),{...t,text:"Finding actions"});console.log(o)})),e}var At=require("commander"),se=require("ora");function Nt({client:n,ora:t}){let e=new At.Command("channels").description("Channels");return e.addCommand(new At.Command("list").description("List channels").action(async()=>{let o=await(0,se.oraPromise)(()=>n.channel.list.send().json(),{...t,text:"Finding channels"});console.log(o)})),e}var vt=require("commander"),Ft=require("ora");function jt({client:n,ora:t}){let e=new vt.Command("contacts").description("Contacts");return e.addCommand(new vt.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async o=>{let r=await(0,Ft.oraPromise)(()=>n.contact.get.send(o).json(),{...t,text:"Finding contact"});console.log(r)})),e.addCommand(new vt.Command("list").description("List contacts").action(async()=>{let o=await(0,Ft.oraPromise)(()=>n.contact.list.send().json(),{...t,text:"Finding contacts"});console.log(o)})),e.addCommand(new vt.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async o=>{let r=await(0,Ft.oraPromise)(()=>n.contact.vcf.get.send({id:o}).response(),{...t,text:"Exporting contact"});console.log(r)})),e}var Ut=require("commander"),Bt=require("ora");function Mt({client:n,ora:t}){let e=new Ut.Command("conversations").description("Conversations");return e.addCommand(new Ut.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async o=>{let r=await(0,Bt.oraPromise)(()=>n.conversation.get.send(o).json(),{...t,text:"Finding conversation"});console.log(r)})),e.addCommand(new Ut.Command("list").description("List conversations").action(async()=>{let o=await(0,Bt.oraPromise)(()=>n.conversation.list.send().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var Lt=require("commander"),It=require("ora");function Dt({client:n,ora:t}){let e=new Lt.Command("labels").description("Labels");return e.addCommand(new Lt.Command("get").description("Find label").argument("<label>","Label ID").action(async o=>{let r=await(0,It.oraPromise)(()=>n.label.get.send(o).json(),{...t,text:"Finding label"});console.log(r)})),e.addCommand(new Lt.Command("list").description("List labels").action(async()=>{let o=await(0,It.oraPromise)(()=>n.label.list.send().json(),{...t,text:"Finding labels"});console.log(o)})),e.addCommand(new Lt.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async o=>{let r=await(0,It.oraPromise)(()=>n.label.conversation.list.send(o).json(),{...t,text:"Finding conversations"});console.log(r)})),e}var Qt=require("commander"),ie=require("ora");function Ht({client:n,ora:t}){let e=new Qt.Command("messages").description("Messages");return e.addCommand(new Qt.Command("list").description("List messages").action(async()=>{let o=await(0,ie.oraPromise)(()=>n.message.list.send().json(),{...t,text:"Finding messages"});console.log(o)})),e}var St=require("commander"),Kt=require("ora");function kt({client:n,ora:t}){let e=new St.Command("models").description("Models");return e.addCommand(new St.Command("get").description("Find model").argument("<model>","Model ID").action(async o=>{let r=await(0,Kt.oraPromise)(()=>n.model.get.send(o).json(),{...t,text:"Finding model"});console.log(r)})),e.addCommand(new St.Command("list").description("List models").action(async()=>{let o=await(0,Kt.oraPromise)(()=>n.model.list.send().json(),{...t,text:"Finding models"});console.log(o)})),e}var qt=require("commander"),Vt=require("ora");function Wt({client:n,ora:t}){let e=new qt.Command("sources").description("Sources");return e.addCommand(new qt.Command("get").description("Find source").argument("<source>","Source ID").action(async o=>{let r=await(0,Vt.oraPromise)(()=>n.source.get.send(o).json(),{...t,text:"Finding source"});console.log(r)})),e.addCommand(new qt.Command("list").description("List sources").action(async()=>{let o=await(0,Vt.oraPromise)(()=>n.source.list.send().json(),{...t,text:"Finding sources"});console.log(o)})),e}var pe=require("commander");var zt=require("commander"),ae=require("ora");function Yt({client:n,ora:t}){let e=new zt.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new zt.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let o=await(0,ae.oraPromise)(()=>n.wellKnown.notification.get.send().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(o)})),e}function $t({client:n,ora:t}){let e=new pe.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(Yt({client:n,ora:t})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new Tt(new u)},be=new ce.Command("gds").description("Great Detail Support System").addCommand(Gt(p)).addCommand(Nt(p)).addCommand(jt(p)).addCommand(Mt(p)).addCommand(Dt(p)).addCommand(Ht(p)).addCommand(kt(p)).addCommand(Wt(p)).addCommand($t(p)),de=be;de.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-WWEXNIIV.js";import"./chunk-NSQETRTT.js";r.parseAsync(process.argv);
2
+ import{a as r}from"./chunk-5ZXWERBD.js";import"./chunk-7KWFLNLZ.js";r.parseAsync(process.argv);
@@ -58,6 +58,39 @@ declare class FetchTransport implements Transport {
58
58
  };
59
59
  }
60
60
 
61
+ /**
62
+ * Great Detail Support System.
63
+ *
64
+ * @copyright 2024 Great Detail Ltd
65
+ * @author Great Detail Ltd <info@greatdetail.com>
66
+ * @author Dom Webber <dom.webber@greatdetail.com>
67
+ * @see https://greatdetail.com
68
+ */
69
+ type Account = {
70
+ id: string;
71
+ name: string;
72
+ status: "PotentialAccountStatus" | "ActiveAccountStatus" | "DisabledAccountStatus";
73
+ legalName?: string;
74
+ emailAddress: string;
75
+ } & ResponseType;
76
+
77
+ interface GetAccountOptions {
78
+ request?: RequestInit;
79
+ }
80
+ type GetAccountResponse = {
81
+ data: {
82
+ account: Account;
83
+ };
84
+ };
85
+ declare class GetAccount {
86
+ protected _transport: FetchTransport;
87
+ constructor(_transport: FetchTransport);
88
+ send(id: string, { request }?: GetAccountOptions): {
89
+ response: () => Promise<ky.KyResponse<GetAccountResponse>>;
90
+ json: () => Promise<GetAccountResponse>;
91
+ };
92
+ }
93
+
61
94
  /**
62
95
  * Great Detail Support System.
63
96
  *
@@ -1810,6 +1843,9 @@ declare class Client {
1810
1843
  _transport: FetchTransport;
1811
1844
  constructor(authentication: Authentication, { baseURL, ...options }?: Options);
1812
1845
  static getBaseURL(): string;
1846
+ get account(): {
1847
+ get: GetAccount;
1848
+ };
1813
1849
  get action(): {
1814
1850
  list: ListActions;
1815
1851
  };
@@ -1858,7 +1894,7 @@ declare class Client {
1858
1894
  list: ListContactConversations;
1859
1895
  };
1860
1896
  label: {
1861
- label: ListContactLabels;
1897
+ list: ListContactLabels;
1862
1898
  };
1863
1899
  note: {
1864
1900
  list: ListContactNotes;
@@ -1934,4 +1970,4 @@ declare class Client {
1934
1970
  };
1935
1971
  }
1936
1972
 
1937
- export { type ListMessagesResponse as $, type Authentication as A, type Boilerplate as B, Client as C, type ListLabelContactsResponse as D, type UpdateContactResponse as E, type GetConversationResponse as F, type GetBoilerplateResponse as G, type ListConversationsResponse as H, type ListLabelConversationsResponse as I, type UpdateConversationResponse as J, type ListContactConversationsResponse as K, type ListActionsResponse as L, type Label as M, type CreateLabelResponse as N, type Options as O, type DeleteLabelResponse as P, type GetLabelResponse as Q, type RequestFilterable as R, type ListLabelsResponse as S, type TwilioSendgridChannelSyncResponse as T, type UpdateBoilerplateResponse as U, type UpdateLabelResponse as V, type WebhookResponse as W, type ListConversationLabelsResponse as X, type ListContactLabelsResponse as Y, type Message as Z, type ListConversationMessagesResponse as _, type Conversation as a, type ListChannelMessagesResponse as a0, type Model as a1, type GetModelResponse as a2, type ListModelsResponse as a3, type CreateCorrectionResponse as a4, type CreateResponseResponse as a5, type Note as a6, type CreateContactNoteResponse as a7, type CreateConversationNoteResponse as a8, type GetNoteResponse as a9, type ListContactNotesResponse as aa, type ListConversationNotesResponse as ab, type UpdateNoteResponse as ac, type Source as ad, type GetSourceResponse as ae, type ListSourcesResponse as af, type NotificationSubscription as ag, type CreateContactNotificationSubscriptionResponse as ah, type Upload as ai, type CreateUploadResponse as aj, type GetUploadResponse as ak, type DeleteUploadResponse as al, type GetNotificationWellKnownResponse as am, type Options$3 as b, type Action as c, type CreateBoilerplateResponse as d, type ListBoilerplateCategoryBoilerplatesResponse as e, type ListBoilerplatesResponse as f, type BoilerplateCategory as g, type CreateBoilerplateCategoryResponse as h, type GetBoilerplateCategoryResponse as i, type ListBoilerplateCategoriesResponse as j, type UpdateBoilerplateCategoryResponse as k, type Channel as l, type ListChannelsResponse as m, type GetChannelResponse as n, type UpdateChannelResponse as o, type CreateChannelResponse as p, type CompositionSection as q, type GetCompositionSectionResponse as r, type ListCompositionSectionsResponse as s, type CreateCompositionSectionResponse as t, type ListChannelCompositionSectionsResponse as u, type UpdateCompositionSectionResponse as v, type Contact as w, type CreateContactResponse as x, type GetContactResponse as y, type ListContactsResponse as z };
1973
+ export { type Message as $, type Authentication as A, type Boilerplate as B, Client as C, type GetContactResponse as D, type ListContactsResponse as E, type ListLabelContactsResponse as F, type GetAccountResponse as G, type UpdateContactResponse as H, type GetConversationResponse as I, type ListConversationsResponse as J, type ListLabelConversationsResponse as K, type ListActionsResponse as L, type UpdateConversationResponse as M, type ListContactConversationsResponse as N, type Options as O, type Label as P, type CreateLabelResponse as Q, type RequestFilterable as R, type DeleteLabelResponse as S, type TwilioSendgridChannelSyncResponse as T, type UpdateBoilerplateResponse as U, type GetLabelResponse as V, type WebhookResponse as W, type ListLabelsResponse as X, type UpdateLabelResponse as Y, type ListConversationLabelsResponse as Z, type ListContactLabelsResponse as _, type Conversation as a, type ListConversationMessagesResponse as a0, type ListMessagesResponse as a1, type ListChannelMessagesResponse as a2, type Model as a3, type GetModelResponse as a4, type ListModelsResponse as a5, type CreateCorrectionResponse as a6, type CreateResponseResponse as a7, type Note as a8, type CreateContactNoteResponse as a9, type CreateConversationNoteResponse as aa, type GetNoteResponse as ab, type ListContactNotesResponse as ac, type ListConversationNotesResponse as ad, type UpdateNoteResponse as ae, type Source as af, type GetSourceResponse as ag, type ListSourcesResponse as ah, type NotificationSubscription as ai, type CreateContactNotificationSubscriptionResponse as aj, type Upload as ak, type CreateUploadResponse as al, type GetUploadResponse as am, type DeleteUploadResponse as an, type GetNotificationWellKnownResponse as ao, type Options$3 as b, type Account as c, type Action as d, type CreateBoilerplateResponse as e, type ListBoilerplateCategoryBoilerplatesResponse as f, type GetBoilerplateResponse as g, type ListBoilerplatesResponse as h, type BoilerplateCategory as i, type CreateBoilerplateCategoryResponse as j, type GetBoilerplateCategoryResponse as k, type ListBoilerplateCategoriesResponse as l, type UpdateBoilerplateCategoryResponse as m, type Channel as n, type ListChannelsResponse as o, type GetChannelResponse as p, type UpdateChannelResponse as q, type CreateChannelResponse as r, type CompositionSection as s, type GetCompositionSectionResponse as t, type ListCompositionSectionsResponse as u, type CreateCompositionSectionResponse as v, type ListChannelCompositionSectionsResponse as w, type UpdateCompositionSectionResponse as x, type Contact as y, type CreateContactResponse as z };
@@ -58,6 +58,39 @@ declare class FetchTransport implements Transport {
58
58
  };
59
59
  }
60
60
 
61
+ /**
62
+ * Great Detail Support System.
63
+ *
64
+ * @copyright 2024 Great Detail Ltd
65
+ * @author Great Detail Ltd <info@greatdetail.com>
66
+ * @author Dom Webber <dom.webber@greatdetail.com>
67
+ * @see https://greatdetail.com
68
+ */
69
+ type Account = {
70
+ id: string;
71
+ name: string;
72
+ status: "PotentialAccountStatus" | "ActiveAccountStatus" | "DisabledAccountStatus";
73
+ legalName?: string;
74
+ emailAddress: string;
75
+ } & ResponseType;
76
+
77
+ interface GetAccountOptions {
78
+ request?: RequestInit;
79
+ }
80
+ type GetAccountResponse = {
81
+ data: {
82
+ account: Account;
83
+ };
84
+ };
85
+ declare class GetAccount {
86
+ protected _transport: FetchTransport;
87
+ constructor(_transport: FetchTransport);
88
+ send(id: string, { request }?: GetAccountOptions): {
89
+ response: () => Promise<ky.KyResponse<GetAccountResponse>>;
90
+ json: () => Promise<GetAccountResponse>;
91
+ };
92
+ }
93
+
61
94
  /**
62
95
  * Great Detail Support System.
63
96
  *
@@ -1810,6 +1843,9 @@ declare class Client {
1810
1843
  _transport: FetchTransport;
1811
1844
  constructor(authentication: Authentication, { baseURL, ...options }?: Options);
1812
1845
  static getBaseURL(): string;
1846
+ get account(): {
1847
+ get: GetAccount;
1848
+ };
1813
1849
  get action(): {
1814
1850
  list: ListActions;
1815
1851
  };
@@ -1858,7 +1894,7 @@ declare class Client {
1858
1894
  list: ListContactConversations;
1859
1895
  };
1860
1896
  label: {
1861
- label: ListContactLabels;
1897
+ list: ListContactLabels;
1862
1898
  };
1863
1899
  note: {
1864
1900
  list: ListContactNotes;
@@ -1934,4 +1970,4 @@ declare class Client {
1934
1970
  };
1935
1971
  }
1936
1972
 
1937
- export { type ListMessagesResponse as $, type Authentication as A, type Boilerplate as B, Client as C, type ListLabelContactsResponse as D, type UpdateContactResponse as E, type GetConversationResponse as F, type GetBoilerplateResponse as G, type ListConversationsResponse as H, type ListLabelConversationsResponse as I, type UpdateConversationResponse as J, type ListContactConversationsResponse as K, type ListActionsResponse as L, type Label as M, type CreateLabelResponse as N, type Options as O, type DeleteLabelResponse as P, type GetLabelResponse as Q, type RequestFilterable as R, type ListLabelsResponse as S, type TwilioSendgridChannelSyncResponse as T, type UpdateBoilerplateResponse as U, type UpdateLabelResponse as V, type WebhookResponse as W, type ListConversationLabelsResponse as X, type ListContactLabelsResponse as Y, type Message as Z, type ListConversationMessagesResponse as _, type Conversation as a, type ListChannelMessagesResponse as a0, type Model as a1, type GetModelResponse as a2, type ListModelsResponse as a3, type CreateCorrectionResponse as a4, type CreateResponseResponse as a5, type Note as a6, type CreateContactNoteResponse as a7, type CreateConversationNoteResponse as a8, type GetNoteResponse as a9, type ListContactNotesResponse as aa, type ListConversationNotesResponse as ab, type UpdateNoteResponse as ac, type Source as ad, type GetSourceResponse as ae, type ListSourcesResponse as af, type NotificationSubscription as ag, type CreateContactNotificationSubscriptionResponse as ah, type Upload as ai, type CreateUploadResponse as aj, type GetUploadResponse as ak, type DeleteUploadResponse as al, type GetNotificationWellKnownResponse as am, type Options$3 as b, type Action as c, type CreateBoilerplateResponse as d, type ListBoilerplateCategoryBoilerplatesResponse as e, type ListBoilerplatesResponse as f, type BoilerplateCategory as g, type CreateBoilerplateCategoryResponse as h, type GetBoilerplateCategoryResponse as i, type ListBoilerplateCategoriesResponse as j, type UpdateBoilerplateCategoryResponse as k, type Channel as l, type ListChannelsResponse as m, type GetChannelResponse as n, type UpdateChannelResponse as o, type CreateChannelResponse as p, type CompositionSection as q, type GetCompositionSectionResponse as r, type ListCompositionSectionsResponse as s, type CreateCompositionSectionResponse as t, type ListChannelCompositionSectionsResponse as u, type UpdateCompositionSectionResponse as v, type Contact as w, type CreateContactResponse as x, type GetContactResponse as y, type ListContactsResponse as z };
1973
+ export { type Message as $, type Authentication as A, type Boilerplate as B, Client as C, type GetContactResponse as D, type ListContactsResponse as E, type ListLabelContactsResponse as F, type GetAccountResponse as G, type UpdateContactResponse as H, type GetConversationResponse as I, type ListConversationsResponse as J, type ListLabelConversationsResponse as K, type ListActionsResponse as L, type UpdateConversationResponse as M, type ListContactConversationsResponse as N, type Options as O, type Label as P, type CreateLabelResponse as Q, type RequestFilterable as R, type DeleteLabelResponse as S, type TwilioSendgridChannelSyncResponse as T, type UpdateBoilerplateResponse as U, type GetLabelResponse as V, type WebhookResponse as W, type ListLabelsResponse as X, type UpdateLabelResponse as Y, type ListConversationLabelsResponse as Z, type ListContactLabelsResponse as _, type Conversation as a, type ListConversationMessagesResponse as a0, type ListMessagesResponse as a1, type ListChannelMessagesResponse as a2, type Model as a3, type GetModelResponse as a4, type ListModelsResponse as a5, type CreateCorrectionResponse as a6, type CreateResponseResponse as a7, type Note as a8, type CreateContactNoteResponse as a9, type CreateConversationNoteResponse as aa, type GetNoteResponse as ab, type ListContactNotesResponse as ac, type ListConversationNotesResponse as ad, type UpdateNoteResponse as ae, type Source as af, type GetSourceResponse as ag, type ListSourcesResponse as ah, type NotificationSubscription as ai, type CreateContactNotificationSubscriptionResponse as aj, type Upload as ak, type CreateUploadResponse as al, type GetUploadResponse as am, type DeleteUploadResponse as an, type GetNotificationWellKnownResponse as ao, type Options$3 as b, type Account as c, type Action as d, type CreateBoilerplateResponse as e, type ListBoilerplateCategoryBoilerplatesResponse as f, type GetBoilerplateResponse as g, type ListBoilerplatesResponse as h, type BoilerplateCategory as i, type CreateBoilerplateCategoryResponse as j, type GetBoilerplateCategoryResponse as k, type ListBoilerplateCategoriesResponse as l, type UpdateBoilerplateCategoryResponse as m, type Channel as n, type ListChannelsResponse as o, type GetChannelResponse as p, type UpdateChannelResponse as q, type CreateChannelResponse as r, type CompositionSection as s, type GetCompositionSectionResponse as t, type ListCompositionSectionsResponse as u, type CreateCompositionSectionResponse as v, type ListChannelCompositionSectionsResponse as w, type UpdateCompositionSectionResponse as x, type Contact as y, type CreateContactResponse as z };
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var Dt=Object.create;var Lt=Object.defineProperty;var kt=Object.getOwnPropertyDescriptor;var Qt=Object.getOwnPropertyNames;var Kt=Object.getPrototypeOf,Vt=Object.prototype.hasOwnProperty;var wt=(r,t)=>{for(var e in t)Lt(r,e,{get:t[e],enumerable:!0})},Et=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Qt(t))!Vt.call(r,n)&&n!==e&&Lt(r,n,{get:()=>t[n],enumerable:!(o=kt(t,n))||o.enumerable});return r};var qt=(r,t,e)=>(e=r!=null?Dt(Kt(r)):{},Et(t||!r||!r.__esModule?Lt(e,"default",{value:r,enumerable:!0}):e,r)),zt=r=>Et(Lt({},"__esModule",{value:!0}),r);var Wt={};wt(Wt,{Client:()=>f,DEFAULT_SUPPORT_BASE_URL:()=>vt,Error:()=>St,KeyAuthentication:()=>_t,PublicAuthentication:()=>Ot,TokenAuthentication:()=>Tt,default:()=>f});module.exports=zt(Wt);var vt="https://api.support.greatdetail.com",At={"X-Powered-By":"GDSupport/JavaScript"},Pt="api-key";var C=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/actions",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var b=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var g=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var x=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var y=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var R=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var _=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var T=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var O=class{constructor(t){this._transport=t}send({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var L=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var v=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var U=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var F=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 Ft=require("zod"),S=class r{constructor(t){this._transport=t}static SCHEMA=Ft.z.object({overwrite:Ft.z.boolean().optional()});send(t,{body:e,request:o={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:r.SCHEMA.parse(e)})}};var I=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var w=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var E=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var q=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var A=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 P=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var Gt="SUPPORT_ACCESS_TOKEN",Nt="SUPPORT_API_KEY",Bt="SUPPORT_KEY_NAME",Mt="SUPPORT_BASE_URL";var G=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let o=e.variant??"vcard",n=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var N=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var B=class{constructor(t){this._transport=t}send(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var M=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var j=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var H=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var D=class{constructor(t){this._transport=t}send(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var k=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Q=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:o,request:n={}}={}){return this._transport.send("v1/conversations",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}};var K=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var V=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var z=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var W=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Y=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var $=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var J=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var X=class{constructor(t){this._transport=t}send({limit:t,query:e,include:o,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}};var Z=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var tt=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var et=class{constructor(t){this._transport=t}send(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}};var ot=class{constructor(t){this._transport=t}send({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var rt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var nt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var st=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var it=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var at=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var h=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var pt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};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 lt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var dt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var ut=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var mt=class r{constructor(t=r.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=At;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var ht=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var ft=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let o=[];if(t){let n=Array.isArray(t)?t:[t];for(let a of n)o.push(["category",a])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:o})}};var jt=qt(require("is-network-error"),1),Ut=qt(require("ky"),1);var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends i{};var d=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 p=class extends i{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var m=class extends i{};var l=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var Ct=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Ut.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let n of this.options.requestFilterables){let a=n.getHeaders();for(let[It,Ht]of Object.entries(a))o.headers.has(It)||o.headers.set(It,Ht)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}limitQuery(t){let e=[];return t&&e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let o=this.client(t,e).catch(n=>{if((0,jt.default)(n))throw new m("A network error occurred",{cause:n});if(n instanceof Ut.HTTPError){let a=n.response.status;switch(console.error(JSON.stringify(n.response)),a){case 400:throw l.badRequest();case 401:throw d.unauthenticated();case 403:throw u.forbidden();case 404:throw p.notFound(t);case 405:throw p.forbiddenMethod(t,e.method??"GET");case 415:throw l.unsupportedMediaType();case 418:throw p.teapot();case 429:throw p.rateLimited()}if(a>=500&&a<600)throw i.serverError(a)}throw n});return{response:()=>o,json:async()=>(await o).json()}}};var bt=class{constructor(t){this._transport=t}send({account:t,files:e,request:o={}}){let n=new FormData;for(let a of e)n.append("file",a);return this._transport.send("v1/uploads",{...o,method:"POST",body:n,searchParams:{account:t}})}};var gt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var xt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var s=require("zod"),yt=class r{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.discriminatedUnion("type",[s.z.object({type:s.z.literal("contact.created"),payload:s.z.object({contact:s.z.string()})}),s.z.object({type:s.z.literal("message.created"),payload:s.z.object({message:s.z.string()})})]))})});async event({request:t}){let{data:e}=r.SCHEMA.parse(t.body);return{event:e.event}}};var Rt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var f=class r{static DEFAULT_BASE_URL=vt;_transport;constructor(t,{baseURL:e,...o}={}){this._transport=new Ct({requestFilterables:[new mt,t],...o,baseURL:e?.toString()??r.getBaseURL()})}static getBaseURL(){return process.env[Mt]??this.DEFAULT_BASE_URL}get action(){return{list:new C(this._transport)}}get boilerplate(){return{get:new g(this._transport),list:new y(this._transport),update:new R(this._transport),create:new b(this._transport)}}get boilerplateCategory(){return{get:new T(this._transport),list:new O(this._transport),create:new _(this._transport),update:new L(this._transport),boilerplate:{list:new x(this._transport)}}}get channel(){return{get:new U(this._transport),list:new F(this._transport),update:new I(this._transport),create:new v(this._transport),compositionSection:{list:new q(this._transport)},message:{list:new tt(this._transport)},twilioSendgrid:{sync:new S(this._transport)}}}get compositionSection(){return{get:new E(this._transport),list:new A(this._transport),create:new w(this._transport),update:new P(this._transport)}}get contact(){return{get:new B(this._transport),list:new M(this._transport),update:new H(this._transport),create:new N(this._transport),conversation:{list:new k(this._transport)},label:{label:new $(this._transport)},note:{list:new ct(this._transport),create:new at(this._transport)},notificationSubscription:{create:new ut(this._transport)},vcf:{get:new G(this._transport)}}}get conversation(){return{get:new D(this._transport),list:new Q(this._transport),update:new V(this._transport),create:new h(this._transport),label:{list:new J(this._transport)},message:{list:new et(this._transport)},note:{list:new lt(this._transport),create:new h(this._transport)}}}get label(){return{create:new z(this._transport),get:new Y(this._transport),list:new X(this._transport),update:new Z(this._transport),delete:new W(this._transport),contact:{list:new j(this._transport)},conversation:{list:new K(this._transport)}}}get message(){return{list:new ot(this._transport)}}get model(){return{get:new nt(this._transport),list:new st(this._transport),response:{create:new it(this._transport)},correction:{create:new rt(this._transport)}}}get note(){return{get:new pt(this._transport),update:new dt(this._transport)}}get source(){return{get:new ht(this._transport),list:new ft(this._transport)}}get upload(){return{get:new xt(this._transport),create:new bt(this._transport),delete:new gt(this._transport)}}get webhook(){return new yt(this)}get wellKnown(){return{notification:{get:new Rt(this._transport)}}}};var St={};wt(St,{AuthError:()=>c,AuthenticationError:()=>d,AuthorizationError:()=>u,LogicError:()=>p,NetworkError:()=>m,SupportError:()=>i,ValidationError:()=>l});var _t=class r{static DEFAULT_NAME=Pt;name;#t;constructor({name:t=process.env[Bt]??r.DEFAULT_NAME,key:e=process.env[Nt]}={}){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 Tt=class{#t;constructor({token:t=process.env[Gt]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var Ot=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,Error,KeyAuthentication,PublicAuthentication,TokenAuthentication});
1
+ "use strict";var kt=Object.create;var vt=Object.defineProperty;var Qt=Object.getOwnPropertyDescriptor;var Kt=Object.getOwnPropertyNames;var Vt=Object.getPrototypeOf,zt=Object.prototype.hasOwnProperty;var Et=(r,t)=>{for(var e in t)vt(r,e,{get:t[e],enumerable:!0})},qt=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Kt(t))!zt.call(r,n)&&n!==e&&vt(r,n,{get:()=>t[n],enumerable:!(o=Qt(t,n))||o.enumerable});return r};var At=(r,t,e)=>(e=r!=null?kt(Vt(r)):{},qt(t||!r||!r.__esModule?vt(e,"default",{value:r,enumerable:!0}):e,r)),Wt=r=>qt(vt({},"__esModule",{value:!0}),r);var Yt={};Et(Yt,{Client:()=>f,DEFAULT_SUPPORT_BASE_URL:()=>Ut,Error:()=>St,KeyAuthentication:()=>Tt,PublicAuthentication:()=>Lt,TokenAuthentication:()=>Ot,default:()=>f});module.exports=Wt(Yt);var Ut="https://api.support.greatdetail.com",Pt={"X-Powered-By":"GDSupport/JavaScript"},Gt="api-key";var C=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}};var b=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/actions",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var g=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var x=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var y=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var R=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var _=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var T=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var O=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var L=class{constructor(t){this._transport=t}send({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var v=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var U=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var F=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var I=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 It=require("zod"),S=class r{constructor(t){this._transport=t}static SCHEMA=It.z.object({overwrite:It.z.boolean().optional()});send(t,{body:e,request:o={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:r.SCHEMA.parse(e)})}};var w=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var E=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var q=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var A=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var P=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 G=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var Nt="SUPPORT_ACCESS_TOKEN",Bt="SUPPORT_API_KEY",Mt="SUPPORT_KEY_NAME",jt="SUPPORT_BASE_URL";var N=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let o=e.variant??"vcard",n=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var B=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var M=class{constructor(t){this._transport=t}send(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var j=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var H=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var D=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var k=class{constructor(t){this._transport=t}send(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var Q=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var K=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:o,request:n={}}={}){return this._transport.send("v1/conversations",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}};var V=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var z=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var W=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var Y=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var $=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var J=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var X=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Z=class{constructor(t){this._transport=t}send({limit:t,query:e,include:o,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}};var tt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var et=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var ot=class{constructor(t){this._transport=t}send(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}};var rt=class{constructor(t){this._transport=t}send({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var nt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var st=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var it=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:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var pt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var h=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var ct=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};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 dt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var ut=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var mt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var ht=class r{constructor(t=r.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Pt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var ft=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var Ct=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let o=[];if(t){let n=Array.isArray(t)?t:[t];for(let a of n)o.push(["category",a])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:o})}};var Ht=At(require("is-network-error"),1),Ft=At(require("ky"),1);var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends i{};var d=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 p=class extends i{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var m=class extends i{};var l=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var bt=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Ft.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let n of this.options.requestFilterables){let a=n.getHeaders();for(let[wt,Dt]of Object.entries(a))o.headers.has(wt)||o.headers.set(wt,Dt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}limitQuery(t){let e=[];return t&&e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let o=this.client(t,e).catch(n=>{if((0,Ht.default)(n))throw new m("A network error occurred",{cause:n});if(n instanceof Ft.HTTPError){let a=n.response.status;switch(console.error(JSON.stringify(n.response)),a){case 400:throw l.badRequest();case 401:throw d.unauthenticated();case 403:throw u.forbidden();case 404:throw p.notFound(t);case 405:throw p.forbiddenMethod(t,e.method??"GET");case 415:throw l.unsupportedMediaType();case 418:throw p.teapot();case 429:throw p.rateLimited()}if(a>=500&&a<600)throw i.serverError(a)}throw n});return{response:()=>o,json:async()=>(await o).json()}}};var gt=class{constructor(t){this._transport=t}send({account:t,files:e,request:o={}}){let n=new FormData;for(let a of e)n.append("file",a);return this._transport.send("v1/uploads",{...o,method:"POST",body:n,searchParams:{account:t}})}};var xt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var yt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var s=require("zod"),Rt=class r{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.discriminatedUnion("type",[s.z.object({type:s.z.literal("contact.created"),payload:s.z.object({contact:s.z.string()})}),s.z.object({type:s.z.literal("message.created"),payload:s.z.object({message:s.z.string()})})]))})});async event({request:t}){let{data:e}=r.SCHEMA.parse(t.body);return{event:e.event}}};var _t=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var f=class r{static DEFAULT_BASE_URL=Ut;_transport;constructor(t,{baseURL:e,...o}={}){this._transport=new bt({requestFilterables:[new ht,t],...o,baseURL:e?.toString()??r.getBaseURL()})}static getBaseURL(){return process.env[jt]??this.DEFAULT_BASE_URL}get account(){return{get:new C(this._transport)}}get action(){return{list:new b(this._transport)}}get boilerplate(){return{get:new x(this._transport),list:new R(this._transport),update:new _(this._transport),create:new g(this._transport)}}get boilerplateCategory(){return{get:new O(this._transport),list:new L(this._transport),create:new T(this._transport),update:new v(this._transport),boilerplate:{list:new y(this._transport)}}}get channel(){return{get:new F(this._transport),list:new I(this._transport),update:new w(this._transport),create:new U(this._transport),compositionSection:{list:new A(this._transport)},message:{list:new et(this._transport)},twilioSendgrid:{sync:new S(this._transport)}}}get compositionSection(){return{get:new q(this._transport),list:new P(this._transport),create:new E(this._transport),update:new G(this._transport)}}get contact(){return{get:new M(this._transport),list:new j(this._transport),update:new D(this._transport),create:new B(this._transport),conversation:{list:new Q(this._transport)},label:{list:new J(this._transport)},note:{list:new lt(this._transport),create:new pt(this._transport)},notificationSubscription:{create:new mt(this._transport)},vcf:{get:new N(this._transport)}}}get conversation(){return{get:new k(this._transport),list:new K(this._transport),update:new z(this._transport),create:new h(this._transport),label:{list:new X(this._transport)},message:{list:new ot(this._transport)},note:{list:new dt(this._transport),create:new h(this._transport)}}}get label(){return{create:new W(this._transport),get:new $(this._transport),list:new Z(this._transport),update:new tt(this._transport),delete:new Y(this._transport),contact:{list:new H(this._transport)},conversation:{list:new V(this._transport)}}}get message(){return{list:new rt(this._transport)}}get model(){return{get:new st(this._transport),list:new it(this._transport),response:{create:new at(this._transport)},correction:{create:new nt(this._transport)}}}get note(){return{get:new ct(this._transport),update:new ut(this._transport)}}get source(){return{get:new ft(this._transport),list:new Ct(this._transport)}}get upload(){return{get:new yt(this._transport),create:new gt(this._transport),delete:new xt(this._transport)}}get webhook(){return new Rt(this)}get wellKnown(){return{notification:{get:new _t(this._transport)}}}};var St={};Et(St,{AuthError:()=>c,AuthenticationError:()=>d,AuthorizationError:()=>u,LogicError:()=>p,NetworkError:()=>m,SupportError:()=>i,ValidationError:()=>l});var Tt=class r{static DEFAULT_NAME=Gt;name;#t;constructor({name:t=process.env[Mt]??r.DEFAULT_NAME,key:e=process.env[Bt]}={}){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 Ot=class{#t;constructor({token:t=process.env[Nt]}={}){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 Lt=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,Error,KeyAuthentication,PublicAuthentication,TokenAuthentication});
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as Authentication, a as Conversation } from './index-ylqKeL9v.cjs';
2
- export { c as Action, B as Boilerplate, g as BoilerplateCategory, l as Channel, C as Client, q as CompositionSection, w as Contact, h as CreateBoilerplateCategoryResponse, d as CreateBoilerplateResponse, p as CreateChannelResponse, t as CreateCompositionSectionResponse, a7 as CreateContactNoteResponse, ah as CreateContactNotificationSubscriptionResponse, x as CreateContactResponse, a8 as CreateConversationNoteResponse, a4 as CreateCorrectionResponse, N as CreateLabelResponse, a5 as CreateResponseResponse, aj as CreateUploadResponse, P as DeleteLabelResponse, al as DeleteUploadResponse, i as GetBoilerplateCategoryResponse, G as GetBoilerplateResponse, n as GetChannelResponse, r as GetCompositionSectionResponse, y as GetContactResponse, F as GetConversationResponse, Q as GetLabelResponse, a2 as GetModelResponse, a9 as GetNoteResponse, am as GetNotificationWellKnownResponse, ae as GetSourceResponse, ak as GetUploadResponse, M as Label, L as ListActionsResponse, j as ListBoilerplateCategoriesResponse, e as ListBoilerplateCategoryBoilerplatesResponse, f as ListBoilerplatesResponse, u as ListChannelCompositionSectionsResponse, a0 as ListChannelMessagesResponse, m as ListChannelsResponse, s as ListCompositionSectionsResponse, K as ListContactConversationsResponse, Y as ListContactLabelsResponse, aa as ListContactNotesResponse, z as ListContactsResponse, X as ListConversationLabelsResponse, _ as ListConversationMessagesResponse, ab as ListConversationNotesResponse, H as ListConversationsResponse, D as ListLabelContactsResponse, I as ListLabelConversationsResponse, S as ListLabelsResponse, $ as ListMessagesResponse, a3 as ListModelsResponse, af as ListSourcesResponse, Z as Message, a1 as Model, a6 as Note, ag as NotificationSubscription, O as Options, R as RequestFilterable, ad as Source, b as TransportOptions, T as TwilioSendgridChannelSyncResponse, k as UpdateBoilerplateCategoryResponse, U as UpdateBoilerplateResponse, o as UpdateChannelResponse, v as UpdateCompositionSectionResponse, E as UpdateContactResponse, J as UpdateConversationResponse, V as UpdateLabelResponse, ac as UpdateNoteResponse, ai as Upload, W as WebhookResponse, C as default } from './index-ylqKeL9v.cjs';
1
+ import { A as Authentication, a as Conversation } from './index-C_0hTzbe.cjs';
2
+ export { c as Account, d as Action, B as Boilerplate, i as BoilerplateCategory, n as Channel, C as Client, s as CompositionSection, y as Contact, j as CreateBoilerplateCategoryResponse, e as CreateBoilerplateResponse, r as CreateChannelResponse, v as CreateCompositionSectionResponse, a9 as CreateContactNoteResponse, aj as CreateContactNotificationSubscriptionResponse, z as CreateContactResponse, aa as CreateConversationNoteResponse, a6 as CreateCorrectionResponse, Q as CreateLabelResponse, a7 as CreateResponseResponse, al as CreateUploadResponse, S as DeleteLabelResponse, an as DeleteUploadResponse, G as GetAccountResponse, k as GetBoilerplateCategoryResponse, g as GetBoilerplateResponse, p as GetChannelResponse, t as GetCompositionSectionResponse, D as GetContactResponse, I as GetConversationResponse, V as GetLabelResponse, a4 as GetModelResponse, ab as GetNoteResponse, ao as GetNotificationWellKnownResponse, ag as GetSourceResponse, am as GetUploadResponse, P as Label, L as ListActionsResponse, l as ListBoilerplateCategoriesResponse, f as ListBoilerplateCategoryBoilerplatesResponse, h as ListBoilerplatesResponse, w as ListChannelCompositionSectionsResponse, a2 as ListChannelMessagesResponse, o as ListChannelsResponse, u as ListCompositionSectionsResponse, N as ListContactConversationsResponse, _ as ListContactLabelsResponse, ac as ListContactNotesResponse, E as ListContactsResponse, Z as ListConversationLabelsResponse, a0 as ListConversationMessagesResponse, ad as ListConversationNotesResponse, J as ListConversationsResponse, F as ListLabelContactsResponse, K as ListLabelConversationsResponse, X as ListLabelsResponse, a1 as ListMessagesResponse, a5 as ListModelsResponse, ah as ListSourcesResponse, $ as Message, a3 as Model, a8 as Note, ai as NotificationSubscription, O as Options, R as RequestFilterable, af as Source, b as TransportOptions, T as TwilioSendgridChannelSyncResponse, m as UpdateBoilerplateCategoryResponse, U as UpdateBoilerplateResponse, q as UpdateChannelResponse, x as UpdateCompositionSectionResponse, H as UpdateContactResponse, M as UpdateConversationResponse, Y as UpdateLabelResponse, ae as UpdateNoteResponse, ak as Upload, W as WebhookResponse, C as default } from './index-C_0hTzbe.cjs';
3
3
  import 'ky';
4
4
  import 'zod';
5
5
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as Authentication, a as Conversation } from './index-ylqKeL9v.js';
2
- export { c as Action, B as Boilerplate, g as BoilerplateCategory, l as Channel, C as Client, q as CompositionSection, w as Contact, h as CreateBoilerplateCategoryResponse, d as CreateBoilerplateResponse, p as CreateChannelResponse, t as CreateCompositionSectionResponse, a7 as CreateContactNoteResponse, ah as CreateContactNotificationSubscriptionResponse, x as CreateContactResponse, a8 as CreateConversationNoteResponse, a4 as CreateCorrectionResponse, N as CreateLabelResponse, a5 as CreateResponseResponse, aj as CreateUploadResponse, P as DeleteLabelResponse, al as DeleteUploadResponse, i as GetBoilerplateCategoryResponse, G as GetBoilerplateResponse, n as GetChannelResponse, r as GetCompositionSectionResponse, y as GetContactResponse, F as GetConversationResponse, Q as GetLabelResponse, a2 as GetModelResponse, a9 as GetNoteResponse, am as GetNotificationWellKnownResponse, ae as GetSourceResponse, ak as GetUploadResponse, M as Label, L as ListActionsResponse, j as ListBoilerplateCategoriesResponse, e as ListBoilerplateCategoryBoilerplatesResponse, f as ListBoilerplatesResponse, u as ListChannelCompositionSectionsResponse, a0 as ListChannelMessagesResponse, m as ListChannelsResponse, s as ListCompositionSectionsResponse, K as ListContactConversationsResponse, Y as ListContactLabelsResponse, aa as ListContactNotesResponse, z as ListContactsResponse, X as ListConversationLabelsResponse, _ as ListConversationMessagesResponse, ab as ListConversationNotesResponse, H as ListConversationsResponse, D as ListLabelContactsResponse, I as ListLabelConversationsResponse, S as ListLabelsResponse, $ as ListMessagesResponse, a3 as ListModelsResponse, af as ListSourcesResponse, Z as Message, a1 as Model, a6 as Note, ag as NotificationSubscription, O as Options, R as RequestFilterable, ad as Source, b as TransportOptions, T as TwilioSendgridChannelSyncResponse, k as UpdateBoilerplateCategoryResponse, U as UpdateBoilerplateResponse, o as UpdateChannelResponse, v as UpdateCompositionSectionResponse, E as UpdateContactResponse, J as UpdateConversationResponse, V as UpdateLabelResponse, ac as UpdateNoteResponse, ai as Upload, W as WebhookResponse, C as default } from './index-ylqKeL9v.js';
1
+ import { A as Authentication, a as Conversation } from './index-C_0hTzbe.js';
2
+ export { c as Account, d as Action, B as Boilerplate, i as BoilerplateCategory, n as Channel, C as Client, s as CompositionSection, y as Contact, j as CreateBoilerplateCategoryResponse, e as CreateBoilerplateResponse, r as CreateChannelResponse, v as CreateCompositionSectionResponse, a9 as CreateContactNoteResponse, aj as CreateContactNotificationSubscriptionResponse, z as CreateContactResponse, aa as CreateConversationNoteResponse, a6 as CreateCorrectionResponse, Q as CreateLabelResponse, a7 as CreateResponseResponse, al as CreateUploadResponse, S as DeleteLabelResponse, an as DeleteUploadResponse, G as GetAccountResponse, k as GetBoilerplateCategoryResponse, g as GetBoilerplateResponse, p as GetChannelResponse, t as GetCompositionSectionResponse, D as GetContactResponse, I as GetConversationResponse, V as GetLabelResponse, a4 as GetModelResponse, ab as GetNoteResponse, ao as GetNotificationWellKnownResponse, ag as GetSourceResponse, am as GetUploadResponse, P as Label, L as ListActionsResponse, l as ListBoilerplateCategoriesResponse, f as ListBoilerplateCategoryBoilerplatesResponse, h as ListBoilerplatesResponse, w as ListChannelCompositionSectionsResponse, a2 as ListChannelMessagesResponse, o as ListChannelsResponse, u as ListCompositionSectionsResponse, N as ListContactConversationsResponse, _ as ListContactLabelsResponse, ac as ListContactNotesResponse, E as ListContactsResponse, Z as ListConversationLabelsResponse, a0 as ListConversationMessagesResponse, ad as ListConversationNotesResponse, J as ListConversationsResponse, F as ListLabelContactsResponse, K as ListLabelConversationsResponse, X as ListLabelsResponse, a1 as ListMessagesResponse, a5 as ListModelsResponse, ah as ListSourcesResponse, $ as Message, a3 as Model, a8 as Note, ai as NotificationSubscription, O as Options, R as RequestFilterable, af as Source, b as TransportOptions, T as TwilioSendgridChannelSyncResponse, m as UpdateBoilerplateCategoryResponse, U as UpdateBoilerplateResponse, q as UpdateChannelResponse, x as UpdateCompositionSectionResponse, H as UpdateContactResponse, M as UpdateConversationResponse, Y as UpdateLabelResponse, ae as UpdateNoteResponse, ak as Upload, W as WebhookResponse, C as default } from './index-C_0hTzbe.js';
3
3
  import 'ky';
4
4
  import 'zod';
5
5
 
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{a as d,b as g,c as s,d as p,e as n,f as _,g as a,h as f,i as m,j as u,k as c,l as x,m as l,n as h,o as A}from"./chunk-NSQETRTT.js";var E={};d(E,{AuthError:()=>m,AuthenticationError:()=>u,AuthorizationError:()=>c,LogicError:()=>x,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[p]}={}){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[s]}={}){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{A as Client,_ as DEFAULT_SUPPORT_BASE_URL,E as Error,t as KeyAuthentication,g as PublicAuthentication,o as TokenAuthentication,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-7KWFLNLZ.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{A as Client,_ as DEFAULT_SUPPORT_BASE_URL,E as Error,t as KeyAuthentication,g as PublicAuthentication,o as TokenAuthentication,A as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@great-detail/support-sdk",
3
- "version": "0.10.8",
3
+ "version": "0.10.10",
4
4
  "type": "module",
5
5
  "description": "JavaScript SDK for the Great Detail Support System",
6
6
  "author": "Great Detail Ltd <info@greatdetail.com>",
@@ -74,7 +74,7 @@
74
74
  "cross-env": "^7.0.3",
75
75
  "eslint": "^9.12.0",
76
76
  "jest": "^29.7.0",
77
- "npm-run-all2": "^6.2.3",
77
+ "npm-run-all2": "^7.0.0",
78
78
  "openapi-typescript": "^7.4.1",
79
79
  "prettier": "^3.3.3",
80
80
  "publint": "^0.2.11",
@@ -1 +0,0 @@
1
- var It=Object.defineProperty;var Et=(r,t)=>{for(var e in t)It(r,e,{get:t[e],enumerable:!0})};var xt=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var Ot="https://api.support.greatdetail.com",Lt={"X-Powered-By":"GDSupport/JavaScript"},Nt="api-key";import{z as s}from"zod";var u=class r{constructor(t){this._client=t}static SCHEMA=s.object({data:s.object({event:s.intersection(s.object({id:s.string(),createdAt:s.string().datetime()}),s.discriminatedUnion("type",[s.object({type:s.literal("contact.created"),payload:s.object({contact:s.string()})}),s.object({type:s.literal("message.created"),payload:s.object({message:s.string()})})]))})});async event({request:t}){let{data:e}=r.SCHEMA.parse(t.body);return{event:e.event}}};var m=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/actions",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var h=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var C=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var f=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var b=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var g=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var y=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var R=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var x=class{constructor(t){this._transport=t}send({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var _=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var T=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var O=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var L=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 vt}from"zod";var v=class r{constructor(t){this._transport=t}static SCHEMA=vt.object({overwrite:vt.boolean().optional()});send(t,{body:e,request:o={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:r.SCHEMA.parse(e)})}};var U=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var F=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var I=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var S=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var w=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 q=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var ae="SUPPORT_ACCESS_TOKEN",pe="SUPPORT_API_KEY",ce="SUPPORT_KEY_NAME",Ut="SUPPORT_BASE_URL";var E=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let o=e.variant??"vcard",n=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var P=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var G=class{constructor(t){this._transport=t}send(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var N=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var B=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var A=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var M=class{constructor(t){this._transport=t}send(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var j=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Q=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:o,request:n={}}={}){return this._transport.send("v1/conversations",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}};var H=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var D=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var k=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var K=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var V=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var W=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var z=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Y=class{constructor(t){this._transport=t}send({limit:t,query:e,include:o,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}};var $=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var J=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var X=class{constructor(t){this._transport=t}send(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}};var Z=class{constructor(t){this._transport=t}send({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var tt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},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 ot=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var rt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var nt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var l=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var st=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var it=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var at=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var pt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var ct=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var lt=class r{constructor(t=r.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Lt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var dt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var ut=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let o=[];if(t){let n=Array.isArray(t)?t:[t];for(let a of n)o.push(["category",a])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:o})}};import St from"is-network-error";import wt,{HTTPError as qt}from"ky";var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends i{};var mt=class extends c{static unauthenticated(){return new this("An unauthenticated request occurred")}};var ht=class extends c{static forbidden(){return new this("A forbidden request occurred")}};var p=class extends i{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var Ct=class extends i{};var d=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var ft=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=wt.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let n of this.options.requestFilterables){let a=n.getHeaders();for(let[Tt,Ft]of Object.entries(a))o.headers.has(Tt)||o.headers.set(Tt,Ft)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}limitQuery(t){let e=[];return t&&e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let o=this.client(t,e).catch(n=>{if(St(n))throw new Ct("A network error occurred",{cause:n});if(n instanceof qt){let a=n.response.status;switch(console.error(JSON.stringify(n.response)),a){case 400:throw d.badRequest();case 401:throw mt.unauthenticated();case 403:throw ht.forbidden();case 404:throw p.notFound(t);case 405:throw p.forbiddenMethod(t,e.method??"GET");case 415:throw d.unsupportedMediaType();case 418:throw p.teapot();case 429:throw p.rateLimited()}if(a>=500&&a<600)throw i.serverError(a)}throw n});return{response:()=>o,json:async()=>(await o).json()}}};var bt=class{constructor(t){this._transport=t}send({account:t,files:e,request:o={}}){let n=new FormData;for(let a of e)n.append("file",a);return this._transport.send("v1/uploads",{...o,method:"POST",body:n,searchParams:{account:t}})}};var gt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var yt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var Rt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var _t=class r{static DEFAULT_BASE_URL=Ot;_transport;constructor(t,{baseURL:e,...o}={}){this._transport=new ft({requestFilterables:[new lt,t],...o,baseURL:e?.toString()??r.getBaseURL()})}static getBaseURL(){return process.env[Ut]??this.DEFAULT_BASE_URL}get action(){return{list:new m(this._transport)}}get boilerplate(){return{get:new C(this._transport),list:new b(this._transport),update:new g(this._transport),create:new h(this._transport)}}get boilerplateCategory(){return{get:new R(this._transport),list:new x(this._transport),create:new y(this._transport),update:new _(this._transport),boilerplate:{list:new f(this._transport)}}}get channel(){return{get:new O(this._transport),list:new L(this._transport),update:new U(this._transport),create:new T(this._transport),compositionSection:{list:new S(this._transport)},message:{list:new J(this._transport)},twilioSendgrid:{sync:new v(this._transport)}}}get compositionSection(){return{get:new I(this._transport),list:new w(this._transport),create:new F(this._transport),update:new q(this._transport)}}get contact(){return{get:new G(this._transport),list:new N(this._transport),update:new A(this._transport),create:new P(this._transport),conversation:{list:new j(this._transport)},label:{label:new W(this._transport)},note:{list:new it(this._transport),create:new nt(this._transport)},notificationSubscription:{create:new ct(this._transport)},vcf:{get:new E(this._transport)}}}get conversation(){return{get:new M(this._transport),list:new Q(this._transport),update:new D(this._transport),create:new l(this._transport),label:{list:new z(this._transport)},message:{list:new X(this._transport)},note:{list:new at(this._transport),create:new l(this._transport)}}}get label(){return{create:new k(this._transport),get:new V(this._transport),list:new Y(this._transport),update:new $(this._transport),delete:new K(this._transport),contact:{list:new B(this._transport)},conversation:{list:new H(this._transport)}}}get message(){return{list:new Z(this._transport)}}get model(){return{get:new et(this._transport),list:new ot(this._transport),response:{create:new rt(this._transport)},correction:{create:new tt(this._transport)}}}get note(){return{get:new st(this._transport),update:new pt(this._transport)}}get source(){return{get:new dt(this._transport),list:new ut(this._transport)}}get upload(){return{get:new yt(this._transport),create:new bt(this._transport),delete:new gt(this._transport)}}get webhook(){return new u(this)}get wellKnown(){return{notification:{get:new Rt(this._transport)}}}};export{Et as a,xt as b,ae as c,pe as d,ce as e,Ot as f,Nt as g,i as h,c as i,mt as j,ht as k,p as l,Ct as m,d as n,_t as o};