@great-detail/support-sdk 0.10.14 → 0.10.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-24FIFAFF.js → chunk-TE6LGPCC.js} +1 -1
- package/dist/chunk-TMJDTCSK.js +1 -0
- package/dist/cli/index.cjs +1 -1
- package/dist/cli/index.d.cts +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/{index-DaQPTGW3.d.cts → index-Bz_QURtQ.d.cts} +77 -2
- package/dist/{index-DaQPTGW3.d.ts → index-Bz_QURtQ.d.ts} +77 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-4NDRZLWQ.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as v,o as b}from"./chunk-
|
|
1
|
+
import{b as v,o as b}from"./chunk-TMJDTCSK.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 Yt=Object.defineProperty;var Zt=(o,t)=>{for(var e in t)Yt(o,e,{get:t[e],enumerable:!0})};var Ht=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var Dt="https://api.support.greatdetail.com",Kt={"X-Powered-By":"GDSupport/JavaScript"},oe="api-key";import{z as s}from"zod";var u=class o{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}=o.SCHEMA.parse(t.body);return{event:e.event}}};var ie="SUPPORT_ACCESS_TOKEN",ae="SUPPORT_API_KEY",pe="SUPPORT_KEY_NAME",Vt="SUPPORT_BASE_URL";var m=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Kt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};import $t from"is-network-error";import Jt,{HTTPError as Xt}from"ky";var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends i{};var h=class extends c{static unauthenticated(){return new this("An unauthenticated request occurred")}};var C=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 f=class extends i{};var l=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var b=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Jt.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[r=>{for(let n of this.options.requestFilterables){let a=n.getHeaders();for(let[kt,zt]of Object.entries(a))r.headers.has(kt)||r.headers.set(kt,zt)}}]}})}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 r of Object.keys(t))e.push(["include",r]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let r=this.client(t,e).catch(n=>{if($t(n))throw new f("A network error occurred",{cause:n});if(n instanceof Xt){let a=n.response.status;switch(console.error(JSON.stringify(n.response)),a){case 400:throw l.badRequest();case 401:throw h.unauthenticated();case 403:throw C.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:()=>r,json:async()=>(await r).json()}}};var g=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}};var _=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var x=class{constructor(t){this._transport=t}get api(){return{get:new g(this._transport),update:new _(this._transport)}}};var R=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}};var y=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...r,method:"PATCH",json:e})}};var T=class{constructor(t){this._transport=t}get api(){return{get:new R(this._transport),update:new y(this._transport)}}};var v=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 O=class{constructor(t){this._transport=t}get api(){return{list:new v(this._transport)}}};var F=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var L=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",json:t})}};var U=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var S=class{constructor(t){this._transport=t}send({limit:t,include:e,request:r={}}={}){return this._transport.send("v1/boilerplate-categories",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var w=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var q=class{constructor(t){this._transport=t}get api(){return{get:new U(this._transport),list:new S(this._transport),create:new L(this._transport),update:new w(this._transport),boilerplate:{list:new F(this._transport)}}}};var I=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",json:t})}};var A=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var E=class{constructor(t){this._transport=t}send({limit:t,query:e,request:r={}}={}){return this._transport.send("v1/boilerplates",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var P=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var G=class{constructor(t){this._transport=t}get api(){return{get:new A(this._transport),list:new E(this._transport),update:new P(this._transport),create:new I(this._transport)}}};var N=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}};var B=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var M=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 Wt}from"zod";var j=class o{constructor(t){this._transport=t}static SCHEMA=Wt.object({overwrite:Wt.boolean().optional()});send(t,{body:e,request:r={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...r,method:"POST",json:o.SCHEMA.parse(e)})}};var H=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var Q=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var k=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var D=class{constructor(t){this._transport=t}get api(){return{get:new B(this._transport),list:new M(this._transport),update:new H(this._transport),create:new N(this._transport),compositionSection:{list:new Q(this._transport)},message:{list:new k(this._transport)},twilioSendgrid:{sync:new j(this._transport)}}}};var K=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}};var V=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({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var z=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var Y=class{constructor(t){this._transport=t}get api(){return{get:new V(this._transport),list:new W(this._transport),create:new K(this._transport),update:new z(this._transport)}}};var $=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let r=e.variant??"vcard",n=e.format??(r==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var J=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}};var X=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var Z=class{constructor(t){this._transport=t}send({limit:t,query:e,request:r={}}={}){return this._transport.send("v1/contacts",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var tt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var et=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var ot=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var rt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",json:e})}};var nt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var st=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...r,method:"POST",json:e})}};var it=class{constructor(t){this._transport=t}get api(){return{get:new X(this._transport),list:new Z(this._transport),update:new tt(this._transport),create:new J(this._transport),conversation:{list:new et(this._transport)},label:{list:new ot(this._transport)},note:{list:new nt(this._transport),create:new rt(this._transport)},notificationSubscription:{create:new st(this._transport)},vcf:{get:new $(this._transport)}}}};var at=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var pt=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:r,request:n={}}={}){return this._transport.send("v1/conversations",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(r??{})]})}};var ct=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var lt=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var dt=class{constructor(t){this._transport=t}send(t,{limit:e,include:r,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(r??{})]})}};var d=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",json:e})}};var ut=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var mt=class{constructor(t){this._transport=t}get api(){return{get:new at(this._transport),list:new pt(this._transport),update:new ct(this._transport),create:new d(this._transport),label:{list:new lt(this._transport)},message:{list:new dt(this._transport)},note:{list:new ut(this._transport),create:new d(this._transport)}}}};var ht=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Ct=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var ft=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}};var bt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var gt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var _t=class{constructor(t){this._transport=t}send({limit:t,query:e,include:r,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(r??{})]})}};var xt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var Rt=class{constructor(t){this._transport=t}get api(){return{create:new ft(this._transport),get:new gt(this._transport),list:new _t(this._transport),update:new xt(this._transport),delete:new bt(this._transport),contact:{list:new ht(this._transport)},conversation:{list:new Ct(this._transport)}}}};var yt=class{constructor(t){this._transport=t}send({limit:t,include:e,request:r={}}={}){return this._transport.send("v1/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var Tt=class{constructor(t){this._transport=t}get api(){return{list:new yt(this._transport)}}};var vt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",json:e})}};var Ot=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var Ft=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var Lt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",timeout:12e4,json:e})}};var Ut=class{constructor(t){this._transport=t}get api(){return{get:new Ot(this._transport),list:new Ft(this._transport),response:{create:new Lt(this._transport)},correction:{create:new vt(this._transport)}}}};var St=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var wt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var qt=class{constructor(t){this._transport=t}get api(){return{get:new St(this._transport),update:new wt(this._transport)}}};var It=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var At=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let r=[];if(t){let n=Array.isArray(t)?t:[t];for(let a of n)r.push(["category",a])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:r})}};var Et=class{constructor(t){this._transport=t}get api(){return{get:new It(this._transport),list:new At(this._transport)}}};var Pt=class{constructor(t){this._transport=t}send({account:t,files:e,request:r={}}){let n=new FormData;for(let a of e)n.append("file",a);return this._transport.send("v1/uploads",{...r,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 Nt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var Bt=class{constructor(t){this._transport=t}get api(){return{get:new Nt(this._transport),create:new Pt(this._transport),delete:new Gt(this._transport)}}};var Mt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var jt=class{constructor(t){this._transport=t}get api(){return{notification:{get:new Mt(this._transport)}}}};var Qt=class o{static DEFAULT_BASE_URL=Dt;_transport;_account;_accountConversationSettings;_action;_boilerplate;_boilerplateCategory;_channel;_compositionSection;_contact;_conversation;_label;_message;_model;_note;_source;_upload;_webhook;_wellKnown;constructor(t,{baseURL:e,...r}={}){this._transport=new b({requestFilterables:[new m,t],...r,baseURL:e?.toString()??o.getBaseURL()}),this._account=new x(this._transport),this._accountConversationSettings=new T(this._transport),this._action=new O(this._transport),this._boilerplate=new G(this._transport),this._boilerplateCategory=new q(this._transport),this._channel=new D(this._transport),this._compositionSection=new Y(this._transport),this._contact=new it(this._transport),this._conversation=new mt(this._transport),this._label=new Rt(this._transport),this._message=new Tt(this._transport),this._model=new Ut(this._transport),this._note=new qt(this._transport),this._source=new Et(this._transport),this._upload=new Bt(this._transport),this._webhook=new u(this),this._wellKnown=new jt(this._transport)}static getBaseURL(){return process.env[Vt]??this.DEFAULT_BASE_URL}get account(){return this._account.api}get accountConversationSettings(){return this._accountConversationSettings.api}get action(){return this._action.api}get boilerplate(){return this._boilerplate.api}get boilerplateCategory(){return this._boilerplateCategory.api}get channel(){return this._channel.api}get compositionSection(){return this._compositionSection.api}get contact(){return this._contact.api}get conversation(){return this._conversation.api}get label(){return this._label.api}get message(){return this._message.api}get model(){return this._model.api}get note(){return this._note.api}get source(){return this._source.api}get upload(){return this._upload.api}get webhook(){return this._webhook}get wellKnown(){return this._wellKnown.api}};export{Zt as a,Ht as b,ie as c,ae as d,pe as e,Dt as f,oe as g,i as h,c as i,h as j,C as k,p as l,f as m,l as n,Qt as o};
|
package/dist/cli/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Le=Object.create;var Kt=Object.defineProperty;var Ue=Object.getOwnPropertyDescriptor;var Ie=Object.getOwnPropertyNames;var Se=Object.getPrototypeOf,qe=Object.prototype.hasOwnProperty;var Pe=(o,t)=>{for(var e in t)Kt(o,e,{get:t[e],enumerable:!0})},fe=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ie(t))!qe.call(o,n)&&n!==e&&Kt(o,n,{get:()=>t[n],enumerable:!(r=Ue(t,n))||r.enumerable});return o};var Ce=(o,t,e)=>(e=o!=null?Le(Se(o)):{},fe(t||!o||!o.__esModule?Kt(e,"default",{value:o,enumerable:!0}):e,o)),Ee=o=>fe(Kt({},"__esModule",{value:!0}),o);var Ne={};Pe(Ne,{default:()=>Ge});module.exports=Ee(Ne);var ve=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var ge="SUPPORT_BASE_URL";var be="https://api.support.greatdetail.com",xe={"X-Powered-By":"GDSupport/JavaScript"};var h=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=xe;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var _e=Ce(require("is-network-error"),1),Qt=Ce(require("ky"),1);var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var l=class extends i{};var f=class extends l{static unauthenticated(){return new this("An unauthenticated request occurred")}};var C=class extends l{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 g=class extends i{};var d=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var b=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Qt.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[r=>{for(let n of this.options.requestFilterables){let a=n.getHeaders();for(let[he,Fe]of Object.entries(a))r.headers.has(he)||r.headers.set(he,Fe)}}]}})}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 r of Object.keys(t))e.push(["include",r]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let r=this.client(t,e).catch(n=>{if((0,_e.default)(n))throw new g("A network error occurred",{cause:n});if(n instanceof Qt.HTTPError){let a=n.response.status;switch(console.error(JSON.stringify(n.response)),a){case 400:throw d.badRequest();case 401:throw f.unauthenticated();case 403:throw C.forbidden();case 404:throw c.notFound(t);case 405:throw c.forbiddenMethod(t,e.method??"GET");case 415:throw d.unsupportedMediaType();case 418:throw c.teapot();case 429:throw c.rateLimited()}if(a>=500&&a<600)throw i.serverError(a)}throw n});return{response:()=>r,json:async()=>(await r).json()}}};var s=require("zod"),x=class o{constructor(t){this._client=t}static SCHEMA=s.z.object({data:s.z.object({event:s.z.intersection(s.z.object({id:s.z.string(),createdAt:s.z.string().datetime()}),s.z.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}=o.SCHEMA.parse(t.body);return{event:e.event}}};var _=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}};var y=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var R=class{constructor(t){this._transport=t}get api(){return{get:new _(this._transport),update:new y(this._transport)}}};var O=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 T=class{constructor(t){this._transport=t}get api(){return{list:new O(this._transport)}}};var w=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var v=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",json:t})}};var F=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:r={}}={}){return this._transport.send("v1/boilerplate-categories",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var U=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var I=class{constructor(t){this._transport=t}get api(){return{get:new F(this._transport),list:new L(this._transport),create:new v(this._transport),update:new U(this._transport),boilerplate:{list:new w(this._transport)}}}};var S=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",json:t})}};var q=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var P=class{constructor(t){this._transport=t}send({limit:t,query:e,request:r={}}={}){return this._transport.send("v1/boilerplates",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var E=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var A=class{constructor(t){this._transport=t}get api(){return{get:new q(this._transport),list:new P(this._transport),update:new E(this._transport),create:new S(this._transport)}}};var G=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}};var N=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var B=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 $t=require("zod"),M=class o{constructor(t){this._transport=t}static SCHEMA=$t.z.object({overwrite:$t.z.boolean().optional()});send(t,{body:e,request:r={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...r,method:"POST",json:o.SCHEMA.parse(e)})}};var j=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var D=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var H=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var K=class{constructor(t){this._transport=t}get api(){return{get:new N(this._transport),list:new B(this._transport),update:new j(this._transport),create:new G(this._transport),compositionSection:{list:new D(this._transport)},message:{list:new H(this._transport)},twilioSendgrid:{sync:new M(this._transport)}}}};var Q=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}};var k=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var V=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 W=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var z=class{constructor(t){this._transport=t}get api(){return{get:new k(this._transport),list:new V(this._transport),create:new Q(this._transport),update:new W(this._transport)}}};var Y=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let r=e.variant??"vcard",n=e.format??(r==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var $=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}};var J=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var X=class{constructor(t){this._transport=t}send({limit:t,query:e,request:r={}}={}){return this._transport.send("v1/contacts",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var Z=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var tt=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var et=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var ot=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",json:e})}};var rt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var nt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...r,method:"POST",json:e})}};var st=class{constructor(t){this._transport=t}get api(){return{get:new J(this._transport),list:new X(this._transport),update:new Z(this._transport),create:new $(this._transport),conversation:{list:new tt(this._transport)},label:{list:new et(this._transport)},note:{list:new rt(this._transport),create:new ot(this._transport)},notificationSubscription:{create:new nt(this._transport)},vcf:{get:new Y(this._transport)}}}};var it=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var at=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:r,request:n={}}={}){return this._transport.send("v1/conversations",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(r??{})]})}};var pt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var ct=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var lt=class{constructor(t){this._transport=t}send(t,{limit:e,include:r,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(r??{})]})}};var m=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",json:e})}};var dt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var mt=class{constructor(t){this._transport=t}get api(){return{get:new it(this._transport),list:new at(this._transport),update:new pt(this._transport),create:new m(this._transport),label:{list:new ct(this._transport)},message:{list:new lt(this._transport)},note:{list:new dt(this._transport),create:new m(this._transport)}}}};var ut=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var ht=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var ft=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}};var Ct=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var gt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var bt=class{constructor(t){this._transport=t}send({limit:t,query:e,include:r,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(r??{})]})}};var xt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var _t=class{constructor(t){this._transport=t}get api(){return{create:new ft(this._transport),get:new gt(this._transport),list:new bt(this._transport),update:new xt(this._transport),delete:new Ct(this._transport),contact:{list:new ut(this._transport)},conversation:{list:new ht(this._transport)}}}};var yt=class{constructor(t){this._transport=t}send({limit:t,include:e,request:r={}}={}){return this._transport.send("v1/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var Rt=class{constructor(t){this._transport=t}get api(){return{list:new yt(this._transport)}}};var Ot=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",json:e})}};var Tt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var wt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var vt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",timeout:12e4,json:e})}};var Ft=class{constructor(t){this._transport=t}get api(){return{get:new Tt(this._transport),list:new wt(this._transport),response:{create:new vt(this._transport)},correction:{create:new Ot(this._transport)}}}};var Lt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var Ut=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var It=class{constructor(t){this._transport=t}get api(){return{get:new Lt(this._transport),update:new Ut(this._transport)}}};var St=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var qt=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let r=[];if(t){let n=Array.isArray(t)?t:[t];for(let a of n)r.push(["category",a])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:r})}};var Pt=class{constructor(t){this._transport=t}get api(){return{get:new St(this._transport),list:new qt(this._transport)}}};var Et=class{constructor(t){this._transport=t}send({account:t,files:e,request:r={}}){let n=new FormData;for(let a of e)n.append("file",a);return this._transport.send("v1/uploads",{...r,method:"POST",body:n,searchParams:{account:t}})}};var At=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Gt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var Nt=class{constructor(t){this._transport=t}get api(){return{get:new Gt(this._transport),create:new Et(this._transport),delete:new At(this._transport)}}};var Bt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var Mt=class{constructor(t){this._transport=t}get api(){return{notification:{get:new Bt(this._transport)}}}};var jt=class o{static DEFAULT_BASE_URL=be;_transport;_account;_action;_boilerplate;_boilerplateCategory;_channel;_compositionSection;_contact;_conversation;_label;_message;_model;_note;_source;_upload;_webhook;_wellKnown;constructor(t,{baseURL:e,...r}={}){this._transport=new b({requestFilterables:[new h,t],...r,baseURL:e?.toString()??o.getBaseURL()}),this._account=new R(this._transport),this._action=new T(this._transport),this._boilerplate=new A(this._transport),this._boilerplateCategory=new I(this._transport),this._channel=new K(this._transport),this._compositionSection=new z(this._transport),this._contact=new st(this._transport),this._conversation=new mt(this._transport),this._label=new _t(this._transport),this._message=new Rt(this._transport),this._model=new Ft(this._transport),this._note=new It(this._transport),this._source=new Pt(this._transport),this._upload=new Nt(this._transport),this._webhook=new x(this),this._wellKnown=new Mt(this._transport)}static getBaseURL(){return process.env[ge]??this.DEFAULT_BASE_URL}get account(){return this._account.api}get action(){return this._action.api}get boilerplate(){return this._boilerplate.api}get boilerplateCategory(){return this._boilerplateCategory.api}get channel(){return this._channel.api}get compositionSection(){return this._compositionSection.api}get contact(){return this._contact.api}get conversation(){return this._conversation.api}get label(){return this._label.api}get message(){return this._message.api}get model(){return this._model.api}get note(){return this._note.api}get source(){return this._source.api}get upload(){return this._upload.api}get webhook(){return this._webhook}get wellKnown(){return this._wellKnown.api}};var Jt=require("commander"),ye=require("ora");function Xt({client:o,ora:t}){let e=new Jt.Command("actions").description("Actions");return e.addCommand(new Jt.Command("list").description("List actions").action(async()=>{let r=await(0,ye.oraPromise)(()=>o.action.list.send().json(),{...t,text:"Finding actions"});console.log(r)})),e}var Zt=require("commander"),Re=require("ora");function te({client:o,ora:t}){let e=new Zt.Command("channels").description("Channels");return e.addCommand(new Zt.Command("list").description("List channels").action(async()=>{let r=await(0,Re.oraPromise)(()=>o.channel.list.send().json(),{...t,text:"Finding channels"});console.log(r)})),e}var Dt=require("commander"),kt=require("ora");function ee({client:o,ora:t}){let e=new Dt.Command("contacts").description("Contacts");return e.addCommand(new Dt.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async r=>{let n=await(0,kt.oraPromise)(()=>o.contact.get.send(r).json(),{...t,text:"Finding contact"});console.log(n)})),e.addCommand(new Dt.Command("list").description("List contacts").action(async()=>{let r=await(0,kt.oraPromise)(()=>o.contact.list.send().json(),{...t,text:"Finding contacts"});console.log(r)})),e.addCommand(new Dt.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async r=>{let n=await(0,kt.oraPromise)(()=>o.contact.vcf.get.send({id:r}).response(),{...t,text:"Exporting contact"});console.log(n)})),e}var Vt=require("commander"),oe=require("ora");function re({client:o,ora:t}){let e=new Vt.Command("conversations").description("Conversations");return e.addCommand(new Vt.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async r=>{let n=await(0,oe.oraPromise)(()=>o.conversation.get.send(r).json(),{...t,text:"Finding conversation"});console.log(n)})),e.addCommand(new Vt.Command("list").description("List conversations").action(async()=>{let r=await(0,oe.oraPromise)(()=>o.conversation.list.send().json(),{...t,text:"Finding conversations"});console.log(r)})),e}var Ht=require("commander"),Wt=require("ora");function ne({client:o,ora:t}){let e=new Ht.Command("labels").description("Labels");return e.addCommand(new Ht.Command("get").description("Find label").argument("<label>","Label ID").action(async r=>{let n=await(0,Wt.oraPromise)(()=>o.label.get.send(r).json(),{...t,text:"Finding label"});console.log(n)})),e.addCommand(new Ht.Command("list").description("List labels").action(async()=>{let r=await(0,Wt.oraPromise)(()=>o.label.list.send().json(),{...t,text:"Finding labels"});console.log(r)})),e.addCommand(new Ht.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async r=>{let n=await(0,Wt.oraPromise)(()=>o.label.conversation.list.send(r).json(),{...t,text:"Finding conversations"});console.log(n)})),e}var se=require("commander"),Oe=require("ora");function ie({client:o,ora:t}){let e=new se.Command("messages").description("Messages");return e.addCommand(new se.Command("list").description("List messages").action(async()=>{let r=await(0,Oe.oraPromise)(()=>o.message.list.send().json(),{...t,text:"Finding messages"});console.log(r)})),e}var zt=require("commander"),ae=require("ora");function pe({client:o,ora:t}){let e=new zt.Command("models").description("Models");return e.addCommand(new zt.Command("get").description("Find model").argument("<model>","Model ID").action(async r=>{let n=await(0,ae.oraPromise)(()=>o.model.get.send(r).json(),{...t,text:"Finding model"});console.log(n)})),e.addCommand(new zt.Command("list").description("List models").action(async()=>{let r=await(0,ae.oraPromise)(()=>o.model.list.send().json(),{...t,text:"Finding models"});console.log(r)})),e}var Yt=require("commander"),ce=require("ora");function le({client:o,ora:t}){let e=new Yt.Command("sources").description("Sources");return e.addCommand(new Yt.Command("get").description("Find source").argument("<source>","Source ID").action(async r=>{let n=await(0,ce.oraPromise)(()=>o.source.get.send(r).json(),{...t,text:"Finding source"});console.log(n)})),e.addCommand(new Yt.Command("list").description("List sources").action(async()=>{let r=await(0,ce.oraPromise)(()=>o.source.list.send().json(),{...t,text:"Finding sources"});console.log(r)})),e}var we=require("commander");var de=require("commander"),Te=require("ora");function me({client:o,ora:t}){let e=new de.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new de.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let r=await(0,Te.oraPromise)(()=>o.wellKnown.notification.get.send().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(r)})),e}function ue({client:o,ora:t}){let e=new we.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(me({client:o,ora:t})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new jt(new u)},Ae=new ve.Command("gds").description("Great Detail Support System").addCommand(Xt(p)).addCommand(te(p)).addCommand(ee(p)).addCommand(re(p)).addCommand(ne(p)).addCommand(ie(p)).addCommand(pe(p)).addCommand(le(p)).addCommand(ue(p)),Ge=Ae;
|
|
1
|
+
"use strict";var Ie=Object.create;var Vt=Object.defineProperty;var qe=Object.getOwnPropertyDescriptor;var Ae=Object.getOwnPropertyNames;var Pe=Object.getPrototypeOf,Ee=Object.prototype.hasOwnProperty;var Ge=(o,t)=>{for(var e in t)Vt(o,e,{get:t[e],enumerable:!0})},be=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ae(t))!Ee.call(o,n)&&n!==e&&Vt(o,n,{get:()=>t[n],enumerable:!(r=qe(t,n))||r.enumerable});return o};var xe=(o,t,e)=>(e=o!=null?Ie(Pe(o)):{},be(t||!o||!o.__esModule?Vt(e,"default",{value:o,enumerable:!0}):e,o)),Ne=o=>be(Vt({},"__esModule",{value:!0}),o);var Me={};Ge(Me,{default:()=>je});module.exports=Ne(Me);var Se=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var _e="SUPPORT_BASE_URL";var ye="https://api.support.greatdetail.com",Re={"X-Powered-By":"GDSupport/JavaScript"};var h=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Re;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var Te=xe(require("is-network-error"),1),Wt=xe(require("ky"),1);var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var l=class extends i{};var f=class extends l{static unauthenticated(){return new this("An unauthenticated request occurred")}};var C=class extends l{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 g=class extends i{};var d=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var b=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Wt.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[r=>{for(let n of this.options.requestFilterables){let a=n.getHeaders();for(let[ge,Ue]of Object.entries(a))r.headers.has(ge)||r.headers.set(ge,Ue)}}]}})}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 r of Object.keys(t))e.push(["include",r]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let r=this.client(t,e).catch(n=>{if((0,Te.default)(n))throw new g("A network error occurred",{cause:n});if(n instanceof Wt.HTTPError){let a=n.response.status;switch(console.error(JSON.stringify(n.response)),a){case 400:throw d.badRequest();case 401:throw f.unauthenticated();case 403:throw C.forbidden();case 404:throw c.notFound(t);case 405:throw c.forbiddenMethod(t,e.method??"GET");case 415:throw d.unsupportedMediaType();case 418:throw c.teapot();case 429:throw c.rateLimited()}if(a>=500&&a<600)throw i.serverError(a)}throw n});return{response:()=>r,json:async()=>(await r).json()}}};var s=require("zod"),x=class o{constructor(t){this._client=t}static SCHEMA=s.z.object({data:s.z.object({event:s.z.intersection(s.z.object({id:s.z.string(),createdAt:s.z.string().datetime()}),s.z.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}=o.SCHEMA.parse(t.body);return{event:e.event}}};var _=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}};var y=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var R=class{constructor(t){this._transport=t}get api(){return{get:new _(this._transport),update:new y(this._transport)}}};var T=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}};var O=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...r,method:"PATCH",json:e})}};var v=class{constructor(t){this._transport=t}get api(){return{get:new T(this._transport),update:new O(this._transport)}}};var w=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}get api(){return{list:new w(this._transport)}}};var L=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var S=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",json:t})}};var U=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var I=class{constructor(t){this._transport=t}send({limit:t,include:e,request:r={}}={}){return this._transport.send("v1/boilerplate-categories",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var q=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var A=class{constructor(t){this._transport=t}get api(){return{get:new U(this._transport),list:new I(this._transport),create:new S(this._transport),update:new q(this._transport),boilerplate:{list:new L(this._transport)}}}};var P=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",json:t})}};var E=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({limit:t,query:e,request:r={}}={}){return this._transport.send("v1/boilerplates",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var N=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var B=class{constructor(t){this._transport=t}get api(){return{get:new E(this._transport),list:new G(this._transport),update:new N(this._transport),create:new P(this._transport)}}};var j=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}};var M=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var D=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var Zt=require("zod"),H=class o{constructor(t){this._transport=t}static SCHEMA=Zt.z.object({overwrite:Zt.z.boolean().optional()});send(t,{body:e,request:r={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...r,method:"POST",json:o.SCHEMA.parse(e)})}};var K=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var Q=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var k=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var V=class{constructor(t){this._transport=t}get api(){return{get:new M(this._transport),list:new D(this._transport),update:new K(this._transport),create:new j(this._transport),compositionSection:{list:new Q(this._transport)},message:{list:new k(this._transport)},twilioSendgrid:{sync:new H(this._transport)}}}};var W=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}};var z=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var Y=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 $=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var J=class{constructor(t){this._transport=t}get api(){return{get:new z(this._transport),list:new Y(this._transport),create:new W(this._transport),update:new $(this._transport)}}};var X=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let r=e.variant??"vcard",n=e.format??(r==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var Z=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}};var tt=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var et=class{constructor(t){this._transport=t}send({limit:t,query:e,request:r={}}={}){return this._transport.send("v1/contacts",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var ot=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var rt=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var nt=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var st=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",json:e})}};var 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,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...r,method:"POST",json:e})}};var pt=class{constructor(t){this._transport=t}get api(){return{get:new tt(this._transport),list:new et(this._transport),update:new ot(this._transport),create:new Z(this._transport),conversation:{list:new rt(this._transport)},label:{list:new nt(this._transport)},note:{list:new it(this._transport),create:new st(this._transport)},notificationSubscription:{create:new at(this._transport)},vcf:{get:new X(this._transport)}}}};var ct=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var lt=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:r,request:n={}}={}){return this._transport.send("v1/conversations",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(r??{})]})}};var dt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var mt=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var ut=class{constructor(t){this._transport=t}send(t,{limit:e,include:r,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(r??{})]})}};var m=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",json:e})}};var ht=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var ft=class{constructor(t){this._transport=t}get api(){return{get:new ct(this._transport),list:new lt(this._transport),update:new dt(this._transport),create:new m(this._transport),label:{list:new mt(this._transport)},message:{list:new ut(this._transport)},note:{list:new ht(this._transport),create:new m(this._transport)}}}};var Ct=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var gt=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var bt=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}};var xt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var _t=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var yt=class{constructor(t){this._transport=t}send({limit:t,query:e,include:r,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(r??{})]})}};var Rt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var Tt=class{constructor(t){this._transport=t}get api(){return{create:new bt(this._transport),get:new _t(this._transport),list:new yt(this._transport),update:new Rt(this._transport),delete:new xt(this._transport),contact:{list:new Ct(this._transport)},conversation:{list:new gt(this._transport)}}}};var Ot=class{constructor(t){this._transport=t}send({limit:t,include:e,request:r={}}={}){return this._transport.send("v1/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var vt=class{constructor(t){this._transport=t}get api(){return{list:new Ot(this._transport)}}};var wt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",json:e})}};var Ft=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var Lt=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:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",timeout:12e4,json:e})}};var Ut=class{constructor(t){this._transport=t}get api(){return{get:new Ft(this._transport),list:new Lt(this._transport),response:{create:new St(this._transport)},correction:{create:new wt(this._transport)}}}};var It=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var qt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var At=class{constructor(t){this._transport=t}get api(){return{get:new It(this._transport),update:new qt(this._transport)}}};var Pt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var Et=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let r=[];if(t){let n=Array.isArray(t)?t:[t];for(let a of n)r.push(["category",a])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:r})}};var Gt=class{constructor(t){this._transport=t}get api(){return{get:new Pt(this._transport),list:new Et(this._transport)}}};var Nt=class{constructor(t){this._transport=t}send({account:t,files:e,request:r={}}){let n=new FormData;for(let a of e)n.append("file",a);return this._transport.send("v1/uploads",{...r,method:"POST",body:n,searchParams:{account:t}})}};var Bt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var jt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var Mt=class{constructor(t){this._transport=t}get api(){return{get:new jt(this._transport),create:new Nt(this._transport),delete:new Bt(this._transport)}}};var Dt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var Ht=class{constructor(t){this._transport=t}get api(){return{notification:{get:new Dt(this._transport)}}}};var Kt=class o{static DEFAULT_BASE_URL=ye;_transport;_account;_accountConversationSettings;_action;_boilerplate;_boilerplateCategory;_channel;_compositionSection;_contact;_conversation;_label;_message;_model;_note;_source;_upload;_webhook;_wellKnown;constructor(t,{baseURL:e,...r}={}){this._transport=new b({requestFilterables:[new h,t],...r,baseURL:e?.toString()??o.getBaseURL()}),this._account=new R(this._transport),this._accountConversationSettings=new v(this._transport),this._action=new F(this._transport),this._boilerplate=new B(this._transport),this._boilerplateCategory=new A(this._transport),this._channel=new V(this._transport),this._compositionSection=new J(this._transport),this._contact=new pt(this._transport),this._conversation=new ft(this._transport),this._label=new Tt(this._transport),this._message=new vt(this._transport),this._model=new Ut(this._transport),this._note=new At(this._transport),this._source=new Gt(this._transport),this._upload=new Mt(this._transport),this._webhook=new x(this),this._wellKnown=new Ht(this._transport)}static getBaseURL(){return process.env[_e]??this.DEFAULT_BASE_URL}get account(){return this._account.api}get accountConversationSettings(){return this._accountConversationSettings.api}get action(){return this._action.api}get boilerplate(){return this._boilerplate.api}get boilerplateCategory(){return this._boilerplateCategory.api}get channel(){return this._channel.api}get compositionSection(){return this._compositionSection.api}get contact(){return this._contact.api}get conversation(){return this._conversation.api}get label(){return this._label.api}get message(){return this._message.api}get model(){return this._model.api}get note(){return this._note.api}get source(){return this._source.api}get upload(){return this._upload.api}get webhook(){return this._webhook}get wellKnown(){return this._wellKnown.api}};var te=require("commander"),Oe=require("ora");function ee({client:o,ora:t}){let e=new te.Command("actions").description("Actions");return e.addCommand(new te.Command("list").description("List actions").action(async()=>{let r=await(0,Oe.oraPromise)(()=>o.action.list.send().json(),{...t,text:"Finding actions"});console.log(r)})),e}var oe=require("commander"),ve=require("ora");function re({client:o,ora:t}){let e=new oe.Command("channels").description("Channels");return e.addCommand(new oe.Command("list").description("List channels").action(async()=>{let r=await(0,ve.oraPromise)(()=>o.channel.list.send().json(),{...t,text:"Finding channels"});console.log(r)})),e}var Qt=require("commander"),zt=require("ora");function ne({client:o,ora:t}){let e=new Qt.Command("contacts").description("Contacts");return e.addCommand(new Qt.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async r=>{let n=await(0,zt.oraPromise)(()=>o.contact.get.send(r).json(),{...t,text:"Finding contact"});console.log(n)})),e.addCommand(new Qt.Command("list").description("List contacts").action(async()=>{let r=await(0,zt.oraPromise)(()=>o.contact.list.send().json(),{...t,text:"Finding contacts"});console.log(r)})),e.addCommand(new Qt.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async r=>{let n=await(0,zt.oraPromise)(()=>o.contact.vcf.get.send({id:r}).response(),{...t,text:"Exporting contact"});console.log(n)})),e}var Yt=require("commander"),se=require("ora");function ie({client:o,ora:t}){let e=new Yt.Command("conversations").description("Conversations");return e.addCommand(new Yt.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async r=>{let n=await(0,se.oraPromise)(()=>o.conversation.get.send(r).json(),{...t,text:"Finding conversation"});console.log(n)})),e.addCommand(new Yt.Command("list").description("List conversations").action(async()=>{let r=await(0,se.oraPromise)(()=>o.conversation.list.send().json(),{...t,text:"Finding conversations"});console.log(r)})),e}var kt=require("commander"),$t=require("ora");function ae({client:o,ora:t}){let e=new kt.Command("labels").description("Labels");return e.addCommand(new kt.Command("get").description("Find label").argument("<label>","Label ID").action(async r=>{let n=await(0,$t.oraPromise)(()=>o.label.get.send(r).json(),{...t,text:"Finding label"});console.log(n)})),e.addCommand(new kt.Command("list").description("List labels").action(async()=>{let r=await(0,$t.oraPromise)(()=>o.label.list.send().json(),{...t,text:"Finding labels"});console.log(r)})),e.addCommand(new kt.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async r=>{let n=await(0,$t.oraPromise)(()=>o.label.conversation.list.send(r).json(),{...t,text:"Finding conversations"});console.log(n)})),e}var pe=require("commander"),we=require("ora");function ce({client:o,ora:t}){let e=new pe.Command("messages").description("Messages");return e.addCommand(new pe.Command("list").description("List messages").action(async()=>{let r=await(0,we.oraPromise)(()=>o.message.list.send().json(),{...t,text:"Finding messages"});console.log(r)})),e}var Jt=require("commander"),le=require("ora");function de({client:o,ora:t}){let e=new Jt.Command("models").description("Models");return e.addCommand(new Jt.Command("get").description("Find model").argument("<model>","Model ID").action(async r=>{let n=await(0,le.oraPromise)(()=>o.model.get.send(r).json(),{...t,text:"Finding model"});console.log(n)})),e.addCommand(new Jt.Command("list").description("List models").action(async()=>{let r=await(0,le.oraPromise)(()=>o.model.list.send().json(),{...t,text:"Finding models"});console.log(r)})),e}var Xt=require("commander"),me=require("ora");function ue({client:o,ora:t}){let e=new Xt.Command("sources").description("Sources");return e.addCommand(new Xt.Command("get").description("Find source").argument("<source>","Source ID").action(async r=>{let n=await(0,me.oraPromise)(()=>o.source.get.send(r).json(),{...t,text:"Finding source"});console.log(n)})),e.addCommand(new Xt.Command("list").description("List sources").action(async()=>{let r=await(0,me.oraPromise)(()=>o.source.list.send().json(),{...t,text:"Finding sources"});console.log(r)})),e}var Le=require("commander");var he=require("commander"),Fe=require("ora");function fe({client:o,ora:t}){let e=new he.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new he.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let r=await(0,Fe.oraPromise)(()=>o.wellKnown.notification.get.send().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(r)})),e}function Ce({client:o,ora:t}){let e=new Le.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(fe({client:o,ora:t})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new Kt(new u)},Be=new Se.Command("gds").description("Great Detail Support System").addCommand(ee(p)).addCommand(re(p)).addCommand(ne(p)).addCommand(ie(p)).addCommand(ae(p)).addCommand(ce(p)).addCommand(de(p)).addCommand(ue(p)).addCommand(Ce(p)),je=Be;
|
package/dist/cli/index.d.cts
CHANGED
package/dist/cli/index.d.ts
CHANGED
package/dist/cli/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-TE6LGPCC.js";import"../chunk-TMJDTCSK.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 he=Object.defineProperty;var Ue=Object.getOwnPropertyDescriptor;var Ie=Object.getOwnPropertyNames;var Se=Object.getPrototypeOf,qe=Object.prototype.hasOwnProperty;var Pe=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ie(t))!qe.call(o,n)&&n!==e&&he(o,n,{get:()=>t[n],enumerable:!(r=Ue(t,n))||r.enumerable});return o};var fe=(o,t,e)=>(e=o!=null?Le(Se(o)):{},Pe(t||!o||!o.__esModule?he(e,"default",{value:o,enumerable:!0}):e,o));var we=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var Ce="SUPPORT_BASE_URL";var ge="https://api.support.greatdetail.com",be={"X-Powered-By":"GDSupport/JavaScript"};var h=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=be;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var xe=fe(require("is-network-error"),1),Kt=fe(require("ky"),1);var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var l=class extends i{};var f=class extends l{static unauthenticated(){return new this("An unauthenticated request occurred")}};var C=class extends l{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 g=class extends i{};var d=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var b=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Kt.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[r=>{for(let n of this.options.requestFilterables){let a=n.getHeaders();for(let[ue,Fe]of Object.entries(a))r.headers.has(ue)||r.headers.set(ue,Fe)}}]}})}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 r of Object.keys(t))e.push(["include",r]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let r=this.client(t,e).catch(n=>{if((0,xe.default)(n))throw new g("A network error occurred",{cause:n});if(n instanceof Kt.HTTPError){let a=n.response.status;switch(console.error(JSON.stringify(n.response)),a){case 400:throw d.badRequest();case 401:throw f.unauthenticated();case 403:throw C.forbidden();case 404:throw c.notFound(t);case 405:throw c.forbiddenMethod(t,e.method??"GET");case 415:throw d.unsupportedMediaType();case 418:throw c.teapot();case 429:throw c.rateLimited()}if(a>=500&&a<600)throw i.serverError(a)}throw n});return{response:()=>r,json:async()=>(await r).json()}}};var s=require("zod"),x=class o{constructor(t){this._client=t}static SCHEMA=s.z.object({data:s.z.object({event:s.z.intersection(s.z.object({id:s.z.string(),createdAt:s.z.string().datetime()}),s.z.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}=o.SCHEMA.parse(t.body);return{event:e.event}}};var _=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}};var y=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var R=class{constructor(t){this._transport=t}get api(){return{get:new _(this._transport),update:new y(this._transport)}}};var O=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 T=class{constructor(t){this._transport=t}get api(){return{list:new O(this._transport)}}};var w=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var v=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",json:t})}};var F=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:r={}}={}){return this._transport.send("v1/boilerplate-categories",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var U=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var I=class{constructor(t){this._transport=t}get api(){return{get:new F(this._transport),list:new L(this._transport),create:new v(this._transport),update:new U(this._transport),boilerplate:{list:new w(this._transport)}}}};var S=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",json:t})}};var q=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var P=class{constructor(t){this._transport=t}send({limit:t,query:e,request:r={}}={}){return this._transport.send("v1/boilerplates",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var E=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var A=class{constructor(t){this._transport=t}get api(){return{get:new q(this._transport),list:new P(this._transport),update:new E(this._transport),create:new S(this._transport)}}};var G=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}};var N=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var B=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 Yt=require("zod"),M=class o{constructor(t){this._transport=t}static SCHEMA=Yt.z.object({overwrite:Yt.z.boolean().optional()});send(t,{body:e,request:r={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...r,method:"POST",json:o.SCHEMA.parse(e)})}};var j=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var D=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var H=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var K=class{constructor(t){this._transport=t}get api(){return{get:new N(this._transport),list:new B(this._transport),update:new j(this._transport),create:new G(this._transport),compositionSection:{list:new D(this._transport)},message:{list:new H(this._transport)},twilioSendgrid:{sync:new M(this._transport)}}}};var Q=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}};var k=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var V=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 W=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var z=class{constructor(t){this._transport=t}get api(){return{get:new k(this._transport),list:new V(this._transport),create:new Q(this._transport),update:new W(this._transport)}}};var Y=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let r=e.variant??"vcard",n=e.format??(r==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var $=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}};var J=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var X=class{constructor(t){this._transport=t}send({limit:t,query:e,request:r={}}={}){return this._transport.send("v1/contacts",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var Z=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var tt=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var et=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var ot=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",json:e})}};var rt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var nt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...r,method:"POST",json:e})}};var st=class{constructor(t){this._transport=t}get api(){return{get:new J(this._transport),list:new X(this._transport),update:new Z(this._transport),create:new $(this._transport),conversation:{list:new tt(this._transport)},label:{list:new et(this._transport)},note:{list:new rt(this._transport),create:new ot(this._transport)},notificationSubscription:{create:new nt(this._transport)},vcf:{get:new Y(this._transport)}}}};var it=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var at=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:r,request:n={}}={}){return this._transport.send("v1/conversations",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(r??{})]})}};var pt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var ct=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var lt=class{constructor(t){this._transport=t}send(t,{limit:e,include:r,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(r??{})]})}};var m=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",json:e})}};var dt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var mt=class{constructor(t){this._transport=t}get api(){return{get:new it(this._transport),list:new at(this._transport),update:new pt(this._transport),create:new m(this._transport),label:{list:new ct(this._transport)},message:{list:new lt(this._transport)},note:{list:new dt(this._transport),create:new m(this._transport)}}}};var ut=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var ht=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var ft=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}};var Ct=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var gt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var bt=class{constructor(t){this._transport=t}send({limit:t,query:e,include:r,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(r??{})]})}};var xt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var _t=class{constructor(t){this._transport=t}get api(){return{create:new ft(this._transport),get:new gt(this._transport),list:new bt(this._transport),update:new xt(this._transport),delete:new Ct(this._transport),contact:{list:new ut(this._transport)},conversation:{list:new ht(this._transport)}}}};var yt=class{constructor(t){this._transport=t}send({limit:t,include:e,request:r={}}={}){return this._transport.send("v1/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var Rt=class{constructor(t){this._transport=t}get api(){return{list:new yt(this._transport)}}};var Ot=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",json:e})}};var Tt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var wt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var vt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",timeout:12e4,json:e})}};var Ft=class{constructor(t){this._transport=t}get api(){return{get:new Tt(this._transport),list:new wt(this._transport),response:{create:new vt(this._transport)},correction:{create:new Ot(this._transport)}}}};var Lt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var Ut=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var It=class{constructor(t){this._transport=t}get api(){return{get:new Lt(this._transport),update:new Ut(this._transport)}}};var St=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var qt=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let r=[];if(t){let n=Array.isArray(t)?t:[t];for(let a of n)r.push(["category",a])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:r})}};var Pt=class{constructor(t){this._transport=t}get api(){return{get:new St(this._transport),list:new qt(this._transport)}}};var Et=class{constructor(t){this._transport=t}send({account:t,files:e,request:r={}}){let n=new FormData;for(let a of e)n.append("file",a);return this._transport.send("v1/uploads",{...r,method:"POST",body:n,searchParams:{account:t}})}};var At=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Gt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var Nt=class{constructor(t){this._transport=t}get api(){return{get:new Gt(this._transport),create:new Et(this._transport),delete:new At(this._transport)}}};var Bt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var Mt=class{constructor(t){this._transport=t}get api(){return{notification:{get:new Bt(this._transport)}}}};var jt=class o{static DEFAULT_BASE_URL=ge;_transport;_account;_action;_boilerplate;_boilerplateCategory;_channel;_compositionSection;_contact;_conversation;_label;_message;_model;_note;_source;_upload;_webhook;_wellKnown;constructor(t,{baseURL:e,...r}={}){this._transport=new b({requestFilterables:[new h,t],...r,baseURL:e?.toString()??o.getBaseURL()}),this._account=new R(this._transport),this._action=new T(this._transport),this._boilerplate=new A(this._transport),this._boilerplateCategory=new I(this._transport),this._channel=new K(this._transport),this._compositionSection=new z(this._transport),this._contact=new st(this._transport),this._conversation=new mt(this._transport),this._label=new _t(this._transport),this._message=new Rt(this._transport),this._model=new Ft(this._transport),this._note=new It(this._transport),this._source=new Pt(this._transport),this._upload=new Nt(this._transport),this._webhook=new x(this),this._wellKnown=new Mt(this._transport)}static getBaseURL(){return process.env[Ce]??this.DEFAULT_BASE_URL}get account(){return this._account.api}get action(){return this._action.api}get boilerplate(){return this._boilerplate.api}get boilerplateCategory(){return this._boilerplateCategory.api}get channel(){return this._channel.api}get compositionSection(){return this._compositionSection.api}get contact(){return this._contact.api}get conversation(){return this._conversation.api}get label(){return this._label.api}get message(){return this._message.api}get model(){return this._model.api}get note(){return this._note.api}get source(){return this._source.api}get upload(){return this._upload.api}get webhook(){return this._webhook}get wellKnown(){return this._wellKnown.api}};var $t=require("commander"),_e=require("ora");function Jt({client:o,ora:t}){let e=new $t.Command("actions").description("Actions");return e.addCommand(new $t.Command("list").description("List actions").action(async()=>{let r=await(0,_e.oraPromise)(()=>o.action.list.send().json(),{...t,text:"Finding actions"});console.log(r)})),e}var Xt=require("commander"),ye=require("ora");function Zt({client:o,ora:t}){let e=new Xt.Command("channels").description("Channels");return e.addCommand(new Xt.Command("list").description("List channels").action(async()=>{let r=await(0,ye.oraPromise)(()=>o.channel.list.send().json(),{...t,text:"Finding channels"});console.log(r)})),e}var Dt=require("commander"),Qt=require("ora");function te({client:o,ora:t}){let e=new Dt.Command("contacts").description("Contacts");return e.addCommand(new Dt.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async r=>{let n=await(0,Qt.oraPromise)(()=>o.contact.get.send(r).json(),{...t,text:"Finding contact"});console.log(n)})),e.addCommand(new Dt.Command("list").description("List contacts").action(async()=>{let r=await(0,Qt.oraPromise)(()=>o.contact.list.send().json(),{...t,text:"Finding contacts"});console.log(r)})),e.addCommand(new Dt.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async r=>{let n=await(0,Qt.oraPromise)(()=>o.contact.vcf.get.send({id:r}).response(),{...t,text:"Exporting contact"});console.log(n)})),e}var kt=require("commander"),ee=require("ora");function oe({client:o,ora:t}){let e=new kt.Command("conversations").description("Conversations");return e.addCommand(new kt.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async r=>{let n=await(0,ee.oraPromise)(()=>o.conversation.get.send(r).json(),{...t,text:"Finding conversation"});console.log(n)})),e.addCommand(new kt.Command("list").description("List conversations").action(async()=>{let r=await(0,ee.oraPromise)(()=>o.conversation.list.send().json(),{...t,text:"Finding conversations"});console.log(r)})),e}var Ht=require("commander"),Vt=require("ora");function re({client:o,ora:t}){let e=new Ht.Command("labels").description("Labels");return e.addCommand(new Ht.Command("get").description("Find label").argument("<label>","Label ID").action(async r=>{let n=await(0,Vt.oraPromise)(()=>o.label.get.send(r).json(),{...t,text:"Finding label"});console.log(n)})),e.addCommand(new Ht.Command("list").description("List labels").action(async()=>{let r=await(0,Vt.oraPromise)(()=>o.label.list.send().json(),{...t,text:"Finding labels"});console.log(r)})),e.addCommand(new Ht.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async r=>{let n=await(0,Vt.oraPromise)(()=>o.label.conversation.list.send(r).json(),{...t,text:"Finding conversations"});console.log(n)})),e}var ne=require("commander"),Re=require("ora");function se({client:o,ora:t}){let e=new ne.Command("messages").description("Messages");return e.addCommand(new ne.Command("list").description("List messages").action(async()=>{let r=await(0,Re.oraPromise)(()=>o.message.list.send().json(),{...t,text:"Finding messages"});console.log(r)})),e}var Wt=require("commander"),ie=require("ora");function ae({client:o,ora:t}){let e=new Wt.Command("models").description("Models");return e.addCommand(new Wt.Command("get").description("Find model").argument("<model>","Model ID").action(async r=>{let n=await(0,ie.oraPromise)(()=>o.model.get.send(r).json(),{...t,text:"Finding model"});console.log(n)})),e.addCommand(new Wt.Command("list").description("List models").action(async()=>{let r=await(0,ie.oraPromise)(()=>o.model.list.send().json(),{...t,text:"Finding models"});console.log(r)})),e}var zt=require("commander"),pe=require("ora");function ce({client:o,ora:t}){let e=new zt.Command("sources").description("Sources");return e.addCommand(new zt.Command("get").description("Find source").argument("<source>","Source ID").action(async r=>{let n=await(0,pe.oraPromise)(()=>o.source.get.send(r).json(),{...t,text:"Finding source"});console.log(n)})),e.addCommand(new zt.Command("list").description("List sources").action(async()=>{let r=await(0,pe.oraPromise)(()=>o.source.list.send().json(),{...t,text:"Finding sources"});console.log(r)})),e}var Te=require("commander");var le=require("commander"),Oe=require("ora");function de({client:o,ora:t}){let e=new le.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new le.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let r=await(0,Oe.oraPromise)(()=>o.wellKnown.notification.get.send().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(r)})),e}function me({client:o,ora:t}){let e=new Te.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(de({client:o,ora:t})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new jt(new u)},Ee=new we.Command("gds").description("Great Detail Support System").addCommand(Jt(p)).addCommand(Zt(p)).addCommand(te(p)).addCommand(oe(p)).addCommand(re(p)).addCommand(se(p)).addCommand(ae(p)).addCommand(ce(p)).addCommand(me(p)),ve=Ee;ve.parseAsync(process.argv);
|
|
2
|
+
"use strict";var Ie=Object.create;var ge=Object.defineProperty;var qe=Object.getOwnPropertyDescriptor;var Ae=Object.getOwnPropertyNames;var Pe=Object.getPrototypeOf,Ee=Object.prototype.hasOwnProperty;var Ge=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ae(t))!Ee.call(o,n)&&n!==e&&ge(o,n,{get:()=>t[n],enumerable:!(r=qe(t,n))||r.enumerable});return o};var be=(o,t,e)=>(e=o!=null?Ie(Pe(o)):{},Ge(t||!o||!o.__esModule?ge(e,"default",{value:o,enumerable:!0}):e,o));var Le=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var xe="SUPPORT_BASE_URL";var _e="https://api.support.greatdetail.com",ye={"X-Powered-By":"GDSupport/JavaScript"};var h=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=ye;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var Re=be(require("is-network-error"),1),Vt=be(require("ky"),1);var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var l=class extends i{};var f=class extends l{static unauthenticated(){return new this("An unauthenticated request occurred")}};var C=class extends l{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 g=class extends i{};var d=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var b=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Vt.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[r=>{for(let n of this.options.requestFilterables){let a=n.getHeaders();for(let[Ce,Ue]of Object.entries(a))r.headers.has(Ce)||r.headers.set(Ce,Ue)}}]}})}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 r of Object.keys(t))e.push(["include",r]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let r=this.client(t,e).catch(n=>{if((0,Re.default)(n))throw new g("A network error occurred",{cause:n});if(n instanceof Vt.HTTPError){let a=n.response.status;switch(console.error(JSON.stringify(n.response)),a){case 400:throw d.badRequest();case 401:throw f.unauthenticated();case 403:throw C.forbidden();case 404:throw c.notFound(t);case 405:throw c.forbiddenMethod(t,e.method??"GET");case 415:throw d.unsupportedMediaType();case 418:throw c.teapot();case 429:throw c.rateLimited()}if(a>=500&&a<600)throw i.serverError(a)}throw n});return{response:()=>r,json:async()=>(await r).json()}}};var s=require("zod"),x=class o{constructor(t){this._client=t}static SCHEMA=s.z.object({data:s.z.object({event:s.z.intersection(s.z.object({id:s.z.string(),createdAt:s.z.string().datetime()}),s.z.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}=o.SCHEMA.parse(t.body);return{event:e.event}}};var _=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}};var y=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var R=class{constructor(t){this._transport=t}get api(){return{get:new _(this._transport),update:new y(this._transport)}}};var T=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}};var O=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...r,method:"PATCH",json:e})}};var v=class{constructor(t){this._transport=t}get api(){return{get:new T(this._transport),update:new O(this._transport)}}};var w=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}get api(){return{list:new w(this._transport)}}};var L=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var S=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",json:t})}};var U=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var I=class{constructor(t){this._transport=t}send({limit:t,include:e,request:r={}}={}){return this._transport.send("v1/boilerplate-categories",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var q=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var A=class{constructor(t){this._transport=t}get api(){return{get:new U(this._transport),list:new I(this._transport),create:new S(this._transport),update:new q(this._transport),boilerplate:{list:new L(this._transport)}}}};var P=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",json:t})}};var E=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({limit:t,query:e,request:r={}}={}){return this._transport.send("v1/boilerplates",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var N=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var B=class{constructor(t){this._transport=t}get api(){return{get:new E(this._transport),list:new G(this._transport),update:new N(this._transport),create:new P(this._transport)}}};var j=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}};var M=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var D=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var Xt=require("zod"),H=class o{constructor(t){this._transport=t}static SCHEMA=Xt.z.object({overwrite:Xt.z.boolean().optional()});send(t,{body:e,request:r={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...r,method:"POST",json:o.SCHEMA.parse(e)})}};var K=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var Q=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var k=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var V=class{constructor(t){this._transport=t}get api(){return{get:new M(this._transport),list:new D(this._transport),update:new K(this._transport),create:new j(this._transport),compositionSection:{list:new Q(this._transport)},message:{list:new k(this._transport)},twilioSendgrid:{sync:new H(this._transport)}}}};var W=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}};var z=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var Y=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 $=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var J=class{constructor(t){this._transport=t}get api(){return{get:new z(this._transport),list:new Y(this._transport),create:new W(this._transport),update:new $(this._transport)}}};var X=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let r=e.variant??"vcard",n=e.format??(r==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var Z=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}};var tt=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var et=class{constructor(t){this._transport=t}send({limit:t,query:e,request:r={}}={}){return this._transport.send("v1/contacts",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var ot=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var rt=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var nt=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var st=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",json:e})}};var 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,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...r,method:"POST",json:e})}};var pt=class{constructor(t){this._transport=t}get api(){return{get:new tt(this._transport),list:new et(this._transport),update:new ot(this._transport),create:new Z(this._transport),conversation:{list:new rt(this._transport)},label:{list:new nt(this._transport)},note:{list:new it(this._transport),create:new st(this._transport)},notificationSubscription:{create:new at(this._transport)},vcf:{get:new X(this._transport)}}}};var ct=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var lt=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:r,request:n={}}={}){return this._transport.send("v1/conversations",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(r??{})]})}};var dt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var mt=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var ut=class{constructor(t){this._transport=t}send(t,{limit:e,include:r,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(r??{})]})}};var m=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",json:e})}};var ht=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var ft=class{constructor(t){this._transport=t}get api(){return{get:new ct(this._transport),list:new lt(this._transport),update:new dt(this._transport),create:new m(this._transport),label:{list:new mt(this._transport)},message:{list:new ut(this._transport)},note:{list:new ht(this._transport),create:new m(this._transport)}}}};var Ct=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var gt=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var bt=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}};var xt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var _t=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var yt=class{constructor(t){this._transport=t}send({limit:t,query:e,include:r,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(r??{})]})}};var Rt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var Tt=class{constructor(t){this._transport=t}get api(){return{create:new bt(this._transport),get:new _t(this._transport),list:new yt(this._transport),update:new Rt(this._transport),delete:new xt(this._transport),contact:{list:new Ct(this._transport)},conversation:{list:new gt(this._transport)}}}};var Ot=class{constructor(t){this._transport=t}send({limit:t,include:e,request:r={}}={}){return this._transport.send("v1/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var vt=class{constructor(t){this._transport=t}get api(){return{list:new Ot(this._transport)}}};var wt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",json:e})}};var Ft=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var Lt=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:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",timeout:12e4,json:e})}};var Ut=class{constructor(t){this._transport=t}get api(){return{get:new Ft(this._transport),list:new Lt(this._transport),response:{create:new St(this._transport)},correction:{create:new wt(this._transport)}}}};var It=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var qt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var At=class{constructor(t){this._transport=t}get api(){return{get:new It(this._transport),update:new qt(this._transport)}}};var Pt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var Et=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let r=[];if(t){let n=Array.isArray(t)?t:[t];for(let a of n)r.push(["category",a])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:r})}};var Gt=class{constructor(t){this._transport=t}get api(){return{get:new Pt(this._transport),list:new Et(this._transport)}}};var Nt=class{constructor(t){this._transport=t}send({account:t,files:e,request:r={}}){let n=new FormData;for(let a of e)n.append("file",a);return this._transport.send("v1/uploads",{...r,method:"POST",body:n,searchParams:{account:t}})}};var Bt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var jt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var Mt=class{constructor(t){this._transport=t}get api(){return{get:new jt(this._transport),create:new Nt(this._transport),delete:new Bt(this._transport)}}};var Dt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var Ht=class{constructor(t){this._transport=t}get api(){return{notification:{get:new Dt(this._transport)}}}};var Kt=class o{static DEFAULT_BASE_URL=_e;_transport;_account;_accountConversationSettings;_action;_boilerplate;_boilerplateCategory;_channel;_compositionSection;_contact;_conversation;_label;_message;_model;_note;_source;_upload;_webhook;_wellKnown;constructor(t,{baseURL:e,...r}={}){this._transport=new b({requestFilterables:[new h,t],...r,baseURL:e?.toString()??o.getBaseURL()}),this._account=new R(this._transport),this._accountConversationSettings=new v(this._transport),this._action=new F(this._transport),this._boilerplate=new B(this._transport),this._boilerplateCategory=new A(this._transport),this._channel=new V(this._transport),this._compositionSection=new J(this._transport),this._contact=new pt(this._transport),this._conversation=new ft(this._transport),this._label=new Tt(this._transport),this._message=new vt(this._transport),this._model=new Ut(this._transport),this._note=new At(this._transport),this._source=new Gt(this._transport),this._upload=new Mt(this._transport),this._webhook=new x(this),this._wellKnown=new Ht(this._transport)}static getBaseURL(){return process.env[xe]??this.DEFAULT_BASE_URL}get account(){return this._account.api}get accountConversationSettings(){return this._accountConversationSettings.api}get action(){return this._action.api}get boilerplate(){return this._boilerplate.api}get boilerplateCategory(){return this._boilerplateCategory.api}get channel(){return this._channel.api}get compositionSection(){return this._compositionSection.api}get contact(){return this._contact.api}get conversation(){return this._conversation.api}get label(){return this._label.api}get message(){return this._message.api}get model(){return this._model.api}get note(){return this._note.api}get source(){return this._source.api}get upload(){return this._upload.api}get webhook(){return this._webhook}get wellKnown(){return this._wellKnown.api}};var Zt=require("commander"),Te=require("ora");function te({client:o,ora:t}){let e=new Zt.Command("actions").description("Actions");return e.addCommand(new Zt.Command("list").description("List actions").action(async()=>{let r=await(0,Te.oraPromise)(()=>o.action.list.send().json(),{...t,text:"Finding actions"});console.log(r)})),e}var ee=require("commander"),Oe=require("ora");function oe({client:o,ora:t}){let e=new ee.Command("channels").description("Channels");return e.addCommand(new ee.Command("list").description("List channels").action(async()=>{let r=await(0,Oe.oraPromise)(()=>o.channel.list.send().json(),{...t,text:"Finding channels"});console.log(r)})),e}var Qt=require("commander"),Wt=require("ora");function re({client:o,ora:t}){let e=new Qt.Command("contacts").description("Contacts");return e.addCommand(new Qt.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async r=>{let n=await(0,Wt.oraPromise)(()=>o.contact.get.send(r).json(),{...t,text:"Finding contact"});console.log(n)})),e.addCommand(new Qt.Command("list").description("List contacts").action(async()=>{let r=await(0,Wt.oraPromise)(()=>o.contact.list.send().json(),{...t,text:"Finding contacts"});console.log(r)})),e.addCommand(new Qt.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async r=>{let n=await(0,Wt.oraPromise)(()=>o.contact.vcf.get.send({id:r}).response(),{...t,text:"Exporting contact"});console.log(n)})),e}var zt=require("commander"),ne=require("ora");function se({client:o,ora:t}){let e=new zt.Command("conversations").description("Conversations");return e.addCommand(new zt.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async r=>{let n=await(0,ne.oraPromise)(()=>o.conversation.get.send(r).json(),{...t,text:"Finding conversation"});console.log(n)})),e.addCommand(new zt.Command("list").description("List conversations").action(async()=>{let r=await(0,ne.oraPromise)(()=>o.conversation.list.send().json(),{...t,text:"Finding conversations"});console.log(r)})),e}var kt=require("commander"),Yt=require("ora");function ie({client:o,ora:t}){let e=new kt.Command("labels").description("Labels");return e.addCommand(new kt.Command("get").description("Find label").argument("<label>","Label ID").action(async r=>{let n=await(0,Yt.oraPromise)(()=>o.label.get.send(r).json(),{...t,text:"Finding label"});console.log(n)})),e.addCommand(new kt.Command("list").description("List labels").action(async()=>{let r=await(0,Yt.oraPromise)(()=>o.label.list.send().json(),{...t,text:"Finding labels"});console.log(r)})),e.addCommand(new kt.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async r=>{let n=await(0,Yt.oraPromise)(()=>o.label.conversation.list.send(r).json(),{...t,text:"Finding conversations"});console.log(n)})),e}var ae=require("commander"),ve=require("ora");function pe({client:o,ora:t}){let e=new ae.Command("messages").description("Messages");return e.addCommand(new ae.Command("list").description("List messages").action(async()=>{let r=await(0,ve.oraPromise)(()=>o.message.list.send().json(),{...t,text:"Finding messages"});console.log(r)})),e}var $t=require("commander"),ce=require("ora");function le({client:o,ora:t}){let e=new $t.Command("models").description("Models");return e.addCommand(new $t.Command("get").description("Find model").argument("<model>","Model ID").action(async r=>{let n=await(0,ce.oraPromise)(()=>o.model.get.send(r).json(),{...t,text:"Finding model"});console.log(n)})),e.addCommand(new $t.Command("list").description("List models").action(async()=>{let r=await(0,ce.oraPromise)(()=>o.model.list.send().json(),{...t,text:"Finding models"});console.log(r)})),e}var Jt=require("commander"),de=require("ora");function me({client:o,ora:t}){let e=new Jt.Command("sources").description("Sources");return e.addCommand(new Jt.Command("get").description("Find source").argument("<source>","Source ID").action(async r=>{let n=await(0,de.oraPromise)(()=>o.source.get.send(r).json(),{...t,text:"Finding source"});console.log(n)})),e.addCommand(new Jt.Command("list").description("List sources").action(async()=>{let r=await(0,de.oraPromise)(()=>o.source.list.send().json(),{...t,text:"Finding sources"});console.log(r)})),e}var Fe=require("commander");var ue=require("commander"),we=require("ora");function he({client:o,ora:t}){let e=new ue.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new ue.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let r=await(0,we.oraPromise)(()=>o.wellKnown.notification.get.send().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(r)})),e}function fe({client:o,ora:t}){let e=new Fe.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(he({client:o,ora:t})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new Kt(new u)},Ne=new Le.Command("gds").description("Great Detail Support System").addCommand(te(p)).addCommand(oe(p)).addCommand(re(p)).addCommand(se(p)).addCommand(ie(p)).addCommand(pe(p)).addCommand(le(p)).addCommand(me(p)).addCommand(fe(p)),Se=Ne;Se.parseAsync(process.argv);
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as r}from"./chunk-
|
|
2
|
+
import{a as r}from"./chunk-TE6LGPCC.js";import"./chunk-TMJDTCSK.js";r.parseAsync(process.argv);
|
|
@@ -1533,7 +1533,7 @@ declare class GetBoilerplate {
|
|
|
1533
1533
|
|
|
1534
1534
|
type Action = {
|
|
1535
1535
|
id: string;
|
|
1536
|
-
status:
|
|
1536
|
+
status: "PotentialActionStatus" | "ActiveActionStatus" | "CompletedActionStatus" | "FailedActionStatus";
|
|
1537
1537
|
message: string;
|
|
1538
1538
|
name: string;
|
|
1539
1539
|
object?: string;
|
|
@@ -1560,6 +1560,58 @@ declare class ListActions {
|
|
|
1560
1560
|
};
|
|
1561
1561
|
}
|
|
1562
1562
|
|
|
1563
|
+
/**
|
|
1564
|
+
* Great Detail Support System.
|
|
1565
|
+
*
|
|
1566
|
+
* @copyright 2024 Great Detail Ltd
|
|
1567
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
1568
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
1569
|
+
* @see https://greatdetail.com
|
|
1570
|
+
*/
|
|
1571
|
+
|
|
1572
|
+
type AccountConversationSettings = {
|
|
1573
|
+
account: string;
|
|
1574
|
+
defaultName?: string;
|
|
1575
|
+
} & ResponseTimestamp;
|
|
1576
|
+
|
|
1577
|
+
type UpdateAccountConversationSettingsPayload = {
|
|
1578
|
+
defaultName?: string;
|
|
1579
|
+
};
|
|
1580
|
+
interface UpdateAccountConversationSettingsOptions {
|
|
1581
|
+
body: UpdateAccountConversationSettingsPayload;
|
|
1582
|
+
request?: RequestInit;
|
|
1583
|
+
}
|
|
1584
|
+
type UpdateAccountConversationSettingsResponse = {
|
|
1585
|
+
data: {
|
|
1586
|
+
accountConversationSettings: AccountConversationSettings;
|
|
1587
|
+
};
|
|
1588
|
+
};
|
|
1589
|
+
declare class UpdateAccountConversationSettings {
|
|
1590
|
+
protected _transport: FetchTransport;
|
|
1591
|
+
constructor(_transport: FetchTransport);
|
|
1592
|
+
send(account: string, { body, request }: UpdateAccountConversationSettingsOptions): {
|
|
1593
|
+
response: () => Promise<ky.KyResponse<UpdateAccountConversationSettingsResponse>>;
|
|
1594
|
+
json: () => Promise<UpdateAccountConversationSettingsResponse>;
|
|
1595
|
+
};
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
interface GetAccountConversationSettingsOptions {
|
|
1599
|
+
request?: RequestInit;
|
|
1600
|
+
}
|
|
1601
|
+
type GetAccountConversationSettingsResponse = {
|
|
1602
|
+
data: {
|
|
1603
|
+
accountConversationSettings: AccountConversationSettings;
|
|
1604
|
+
};
|
|
1605
|
+
};
|
|
1606
|
+
declare class GetAccountConversationSettings {
|
|
1607
|
+
protected _transport: FetchTransport;
|
|
1608
|
+
constructor(_transport: FetchTransport);
|
|
1609
|
+
send(account: string, { request }?: GetAccountConversationSettingsOptions): {
|
|
1610
|
+
response: () => Promise<ky.KyResponse<GetAccountConversationSettingsResponse>>;
|
|
1611
|
+
json: () => Promise<GetAccountConversationSettingsResponse>;
|
|
1612
|
+
};
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1563
1615
|
/**
|
|
1564
1616
|
* Great Detail Support System.
|
|
1565
1617
|
*
|
|
@@ -1868,6 +1920,24 @@ declare class AccountClient {
|
|
|
1868
1920
|
};
|
|
1869
1921
|
}
|
|
1870
1922
|
|
|
1923
|
+
/**
|
|
1924
|
+
* Great Detail Support System.
|
|
1925
|
+
*
|
|
1926
|
+
* @copyright 2024 Great Detail Ltd
|
|
1927
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
1928
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
1929
|
+
* @see https://greatdetail.com
|
|
1930
|
+
*/
|
|
1931
|
+
|
|
1932
|
+
declare class AccountConversationSettingsClient {
|
|
1933
|
+
protected _transport: FetchTransport;
|
|
1934
|
+
constructor(_transport: FetchTransport);
|
|
1935
|
+
get api(): {
|
|
1936
|
+
get: GetAccountConversationSettings;
|
|
1937
|
+
update: UpdateAccountConversationSettings;
|
|
1938
|
+
};
|
|
1939
|
+
}
|
|
1940
|
+
|
|
1871
1941
|
/**
|
|
1872
1942
|
* Great Detail Support System.
|
|
1873
1943
|
*
|
|
@@ -2192,6 +2262,7 @@ declare class Client {
|
|
|
2192
2262
|
static DEFAULT_BASE_URL: string;
|
|
2193
2263
|
_transport: FetchTransport;
|
|
2194
2264
|
protected _account: AccountClient;
|
|
2265
|
+
protected _accountConversationSettings: AccountConversationSettingsClient;
|
|
2195
2266
|
protected _action: ActionClient;
|
|
2196
2267
|
protected _boilerplate: BoilerplateClient;
|
|
2197
2268
|
protected _boilerplateCategory: BoilerplateCategoryClient;
|
|
@@ -2213,6 +2284,10 @@ declare class Client {
|
|
|
2213
2284
|
get: GetAccount;
|
|
2214
2285
|
update: UpdateAccount;
|
|
2215
2286
|
};
|
|
2287
|
+
get accountConversationSettings(): {
|
|
2288
|
+
get: GetAccountConversationSettings;
|
|
2289
|
+
update: UpdateAccountConversationSettings;
|
|
2290
|
+
};
|
|
2216
2291
|
get action(): {
|
|
2217
2292
|
list: ListActions;
|
|
2218
2293
|
};
|
|
@@ -2337,4 +2412,4 @@ declare class Client {
|
|
|
2337
2412
|
};
|
|
2338
2413
|
}
|
|
2339
2414
|
|
|
2340
|
-
export { type
|
|
2415
|
+
export { type ListLabelsResponse as $, type Authentication as A, type Boilerplate as B, Client as C, type ListChannelCompositionSectionsResponse as D, type UpdateCompositionSectionResponse as E, type Contact as F, type GetAccountResponse as G, type CreateContactResponse as H, type GetContactResponse as I, type ListContactsResponse as J, type ListLabelContactsResponse as K, type ListActionsResponse as L, type UpdateContactResponse as M, type GetConversationResponse as N, type Options as O, type ListConversationsResponse as P, type ListLabelConversationsResponse as Q, type RequestFilterable as R, type UpdateConversationResponse as S, type TwilioSendgridChannelSyncResponse as T, type UpdateAccountResponse as U, type ListContactConversationsResponse as V, type WebhookResponse as W, type Label as X, type CreateLabelResponse as Y, type DeleteLabelResponse as Z, type GetLabelResponse as _, type Account as a, type UpdateLabelResponse as a0, type ListConversationLabelsResponse as a1, type ListContactLabelsResponse as a2, type Message as a3, type ListConversationMessagesResponse as a4, type ListMessagesResponse as a5, type ListChannelMessagesResponse as a6, type Model as a7, type GetModelResponse as a8, type ListModelsResponse as a9, type CreateCorrectionResponse as aa, type CreateResponseResponse as ab, type Note as ac, type CreateContactNoteResponse as ad, type CreateConversationNoteResponse as ae, type GetNoteResponse as af, type ListContactNotesResponse as ag, type ListConversationNotesResponse as ah, type UpdateNoteResponse as ai, type Source as aj, type GetSourceResponse as ak, type ListSourcesResponse as al, type NotificationSubscription as am, type CreateContactNotificationSubscriptionResponse as an, type Upload as ao, type CreateUploadResponse as ap, type GetUploadResponse as aq, type DeleteUploadResponse as ar, type GetNotificationWellKnownResponse as as, type Conversation as b, type Options$3 as c, type AccountConversationSettings as d, type GetAccountConversationSettingsResponse as e, type UpdateAccountConversationSettingsResponse as f, type Action as g, type CreateBoilerplateResponse as h, type ListBoilerplateCategoryBoilerplatesResponse as i, type GetBoilerplateResponse as j, type ListBoilerplatesResponse as k, type UpdateBoilerplateResponse as l, type BoilerplateCategory as m, type CreateBoilerplateCategoryResponse as n, type GetBoilerplateCategoryResponse as o, type ListBoilerplateCategoriesResponse as p, type UpdateBoilerplateCategoryResponse as q, type Channel as r, type ListChannelsResponse as s, type GetChannelResponse as t, type UpdateChannelResponse as u, type CreateChannelResponse as v, type CompositionSection as w, type GetCompositionSectionResponse as x, type ListCompositionSectionsResponse as y, type CreateCompositionSectionResponse as z };
|
|
@@ -1533,7 +1533,7 @@ declare class GetBoilerplate {
|
|
|
1533
1533
|
|
|
1534
1534
|
type Action = {
|
|
1535
1535
|
id: string;
|
|
1536
|
-
status:
|
|
1536
|
+
status: "PotentialActionStatus" | "ActiveActionStatus" | "CompletedActionStatus" | "FailedActionStatus";
|
|
1537
1537
|
message: string;
|
|
1538
1538
|
name: string;
|
|
1539
1539
|
object?: string;
|
|
@@ -1560,6 +1560,58 @@ declare class ListActions {
|
|
|
1560
1560
|
};
|
|
1561
1561
|
}
|
|
1562
1562
|
|
|
1563
|
+
/**
|
|
1564
|
+
* Great Detail Support System.
|
|
1565
|
+
*
|
|
1566
|
+
* @copyright 2024 Great Detail Ltd
|
|
1567
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
1568
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
1569
|
+
* @see https://greatdetail.com
|
|
1570
|
+
*/
|
|
1571
|
+
|
|
1572
|
+
type AccountConversationSettings = {
|
|
1573
|
+
account: string;
|
|
1574
|
+
defaultName?: string;
|
|
1575
|
+
} & ResponseTimestamp;
|
|
1576
|
+
|
|
1577
|
+
type UpdateAccountConversationSettingsPayload = {
|
|
1578
|
+
defaultName?: string;
|
|
1579
|
+
};
|
|
1580
|
+
interface UpdateAccountConversationSettingsOptions {
|
|
1581
|
+
body: UpdateAccountConversationSettingsPayload;
|
|
1582
|
+
request?: RequestInit;
|
|
1583
|
+
}
|
|
1584
|
+
type UpdateAccountConversationSettingsResponse = {
|
|
1585
|
+
data: {
|
|
1586
|
+
accountConversationSettings: AccountConversationSettings;
|
|
1587
|
+
};
|
|
1588
|
+
};
|
|
1589
|
+
declare class UpdateAccountConversationSettings {
|
|
1590
|
+
protected _transport: FetchTransport;
|
|
1591
|
+
constructor(_transport: FetchTransport);
|
|
1592
|
+
send(account: string, { body, request }: UpdateAccountConversationSettingsOptions): {
|
|
1593
|
+
response: () => Promise<ky.KyResponse<UpdateAccountConversationSettingsResponse>>;
|
|
1594
|
+
json: () => Promise<UpdateAccountConversationSettingsResponse>;
|
|
1595
|
+
};
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
interface GetAccountConversationSettingsOptions {
|
|
1599
|
+
request?: RequestInit;
|
|
1600
|
+
}
|
|
1601
|
+
type GetAccountConversationSettingsResponse = {
|
|
1602
|
+
data: {
|
|
1603
|
+
accountConversationSettings: AccountConversationSettings;
|
|
1604
|
+
};
|
|
1605
|
+
};
|
|
1606
|
+
declare class GetAccountConversationSettings {
|
|
1607
|
+
protected _transport: FetchTransport;
|
|
1608
|
+
constructor(_transport: FetchTransport);
|
|
1609
|
+
send(account: string, { request }?: GetAccountConversationSettingsOptions): {
|
|
1610
|
+
response: () => Promise<ky.KyResponse<GetAccountConversationSettingsResponse>>;
|
|
1611
|
+
json: () => Promise<GetAccountConversationSettingsResponse>;
|
|
1612
|
+
};
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1563
1615
|
/**
|
|
1564
1616
|
* Great Detail Support System.
|
|
1565
1617
|
*
|
|
@@ -1868,6 +1920,24 @@ declare class AccountClient {
|
|
|
1868
1920
|
};
|
|
1869
1921
|
}
|
|
1870
1922
|
|
|
1923
|
+
/**
|
|
1924
|
+
* Great Detail Support System.
|
|
1925
|
+
*
|
|
1926
|
+
* @copyright 2024 Great Detail Ltd
|
|
1927
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
1928
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
1929
|
+
* @see https://greatdetail.com
|
|
1930
|
+
*/
|
|
1931
|
+
|
|
1932
|
+
declare class AccountConversationSettingsClient {
|
|
1933
|
+
protected _transport: FetchTransport;
|
|
1934
|
+
constructor(_transport: FetchTransport);
|
|
1935
|
+
get api(): {
|
|
1936
|
+
get: GetAccountConversationSettings;
|
|
1937
|
+
update: UpdateAccountConversationSettings;
|
|
1938
|
+
};
|
|
1939
|
+
}
|
|
1940
|
+
|
|
1871
1941
|
/**
|
|
1872
1942
|
* Great Detail Support System.
|
|
1873
1943
|
*
|
|
@@ -2192,6 +2262,7 @@ declare class Client {
|
|
|
2192
2262
|
static DEFAULT_BASE_URL: string;
|
|
2193
2263
|
_transport: FetchTransport;
|
|
2194
2264
|
protected _account: AccountClient;
|
|
2265
|
+
protected _accountConversationSettings: AccountConversationSettingsClient;
|
|
2195
2266
|
protected _action: ActionClient;
|
|
2196
2267
|
protected _boilerplate: BoilerplateClient;
|
|
2197
2268
|
protected _boilerplateCategory: BoilerplateCategoryClient;
|
|
@@ -2213,6 +2284,10 @@ declare class Client {
|
|
|
2213
2284
|
get: GetAccount;
|
|
2214
2285
|
update: UpdateAccount;
|
|
2215
2286
|
};
|
|
2287
|
+
get accountConversationSettings(): {
|
|
2288
|
+
get: GetAccountConversationSettings;
|
|
2289
|
+
update: UpdateAccountConversationSettings;
|
|
2290
|
+
};
|
|
2216
2291
|
get action(): {
|
|
2217
2292
|
list: ListActions;
|
|
2218
2293
|
};
|
|
@@ -2337,4 +2412,4 @@ declare class Client {
|
|
|
2337
2412
|
};
|
|
2338
2413
|
}
|
|
2339
2414
|
|
|
2340
|
-
export { type
|
|
2415
|
+
export { type ListLabelsResponse as $, type Authentication as A, type Boilerplate as B, Client as C, type ListChannelCompositionSectionsResponse as D, type UpdateCompositionSectionResponse as E, type Contact as F, type GetAccountResponse as G, type CreateContactResponse as H, type GetContactResponse as I, type ListContactsResponse as J, type ListLabelContactsResponse as K, type ListActionsResponse as L, type UpdateContactResponse as M, type GetConversationResponse as N, type Options as O, type ListConversationsResponse as P, type ListLabelConversationsResponse as Q, type RequestFilterable as R, type UpdateConversationResponse as S, type TwilioSendgridChannelSyncResponse as T, type UpdateAccountResponse as U, type ListContactConversationsResponse as V, type WebhookResponse as W, type Label as X, type CreateLabelResponse as Y, type DeleteLabelResponse as Z, type GetLabelResponse as _, type Account as a, type UpdateLabelResponse as a0, type ListConversationLabelsResponse as a1, type ListContactLabelsResponse as a2, type Message as a3, type ListConversationMessagesResponse as a4, type ListMessagesResponse as a5, type ListChannelMessagesResponse as a6, type Model as a7, type GetModelResponse as a8, type ListModelsResponse as a9, type CreateCorrectionResponse as aa, type CreateResponseResponse as ab, type Note as ac, type CreateContactNoteResponse as ad, type CreateConversationNoteResponse as ae, type GetNoteResponse as af, type ListContactNotesResponse as ag, type ListConversationNotesResponse as ah, type UpdateNoteResponse as ai, type Source as aj, type GetSourceResponse as ak, type ListSourcesResponse as al, type NotificationSubscription as am, type CreateContactNotificationSubscriptionResponse as an, type Upload as ao, type CreateUploadResponse as ap, type GetUploadResponse as aq, type DeleteUploadResponse as ar, type GetNotificationWellKnownResponse as as, type Conversation as b, type Options$3 as c, type AccountConversationSettings as d, type GetAccountConversationSettingsResponse as e, type UpdateAccountConversationSettingsResponse as f, type Action as g, type CreateBoilerplateResponse as h, type ListBoilerplateCategoryBoilerplatesResponse as i, type GetBoilerplateResponse as j, type ListBoilerplatesResponse as k, type UpdateBoilerplateResponse as l, type BoilerplateCategory as m, type CreateBoilerplateCategoryResponse as n, type GetBoilerplateCategoryResponse as o, type ListBoilerplateCategoriesResponse as p, type UpdateBoilerplateCategoryResponse as q, type Channel as r, type ListChannelsResponse as s, type GetChannelResponse as t, type UpdateChannelResponse as u, type CreateChannelResponse as v, type CompositionSection as w, type GetCompositionSectionResponse as x, type ListCompositionSectionsResponse as y, type CreateCompositionSectionResponse as z };
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var se=Object.create;var kt=Object.defineProperty;var ie=Object.getOwnPropertyDescriptor;var pe=Object.getOwnPropertyNames;var ae=Object.getPrototypeOf,ce=Object.prototype.hasOwnProperty;var zt=(o,t)=>{for(var e in t)kt(o,e,{get:t[e],enumerable:!0})},Yt=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of pe(t))!ce.call(o,n)&&n!==e&&kt(o,n,{get:()=>t[n],enumerable:!(r=ie(t,n))||r.enumerable});return o};var $t=(o,t,e)=>(e=o!=null?se(ae(o)):{},Yt(t||!o||!o.__esModule?kt(e,"default",{value:o,enumerable:!0}):e,o)),le=o=>Yt(kt({},"__esModule",{value:!0}),o);var de={};zt(de,{Client:()=>f,DEFAULT_SUPPORT_BASE_URL:()=>Dt,Error:()=>Vt,KeyAuthentication:()=>Mt,PublicAuthentication:()=>Ht,TokenAuthentication:()=>jt,default:()=>f});module.exports=le(de);var Dt="https://api.support.greatdetail.com",Jt={"X-Powered-By":"GDSupport/JavaScript"},Xt="api-key";var Zt="SUPPORT_ACCESS_TOKEN",te="SUPPORT_API_KEY",ee="SUPPORT_KEY_NAME",oe="SUPPORT_BASE_URL";var C=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Jt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var re=$t(require("is-network-error"),1),Qt=$t(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 a=class extends i{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var m=class extends i{};var l=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var b=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Qt.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[r=>{for(let n of this.options.requestFilterables){let p=n.getHeaders();for(let[Wt,ne]of Object.entries(p))r.headers.has(Wt)||r.headers.set(Wt,ne)}}]}})}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 r of Object.keys(t))e.push(["include",r]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let r=this.client(t,e).catch(n=>{if((0,re.default)(n))throw new m("A network error occurred",{cause:n});if(n instanceof Qt.HTTPError){let p=n.response.status;switch(console.error(JSON.stringify(n.response)),p){case 400:throw l.badRequest();case 401:throw d.unauthenticated();case 403:throw u.forbidden();case 404:throw a.notFound(t);case 405:throw a.forbiddenMethod(t,e.method??"GET");case 415:throw l.unsupportedMediaType();case 418:throw a.teapot();case 429:throw a.rateLimited()}if(p>=500&&p<600)throw i.serverError(p)}throw n});return{response:()=>r,json:async()=>(await r).json()}}};var s=require("zod"),_=class o{constructor(t){this._client=t}static SCHEMA=s.z.object({data:s.z.object({event:s.z.intersection(s.z.object({id:s.z.string(),createdAt:s.z.string().datetime()}),s.z.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}=o.SCHEMA.parse(t.body);return{event:e.event}}};var g=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}};var x=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var R=class{constructor(t){this._transport=t}get api(){return{get:new g(this._transport),update:new x(this._transport)}}};var y=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 T=class{constructor(t){this._transport=t}get api(){return{list:new y(this._transport)}}};var O=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var L=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",json:t})}};var v=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var F=class{constructor(t){this._transport=t}send({limit:t,include:e,request:r={}}={}){return this._transport.send("v1/boilerplate-categories",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var U=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var w=class{constructor(t){this._transport=t}get api(){return{get:new v(this._transport),list:new F(this._transport),create:new L(this._transport),update:new U(this._transport),boilerplate:{list:new O(this._transport)}}}};var q=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",json:t})}};var S=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var I=class{constructor(t){this._transport=t}send({limit:t,query:e,request:r={}}={}){return this._transport.send("v1/boilerplates",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var E=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var A=class{constructor(t){this._transport=t}get api(){return{get:new S(this._transport),list:new I(this._transport),update:new E(this._transport),create:new q(this._transport)}}};var P=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}};var G=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var N=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 Kt=require("zod"),B=class o{constructor(t){this._transport=t}static SCHEMA=Kt.z.object({overwrite:Kt.z.boolean().optional()});send(t,{body:e,request:r={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...r,method:"POST",json:o.SCHEMA.parse(e)})}};var M=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var j=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var H=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var k=class{constructor(t){this._transport=t}get api(){return{get:new G(this._transport),list:new N(this._transport),update:new M(this._transport),create:new P(this._transport),compositionSection:{list:new j(this._transport)},message:{list:new H(this._transport)},twilioSendgrid:{sync:new B(this._transport)}}}};var D=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",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 K=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 V=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var W=class{constructor(t){this._transport=t}get api(){return{get:new Q(this._transport),list:new K(this._transport),create:new D(this._transport),update:new V(this._transport)}}};var z=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let r=e.variant??"vcard",n=e.format??(r==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var Y=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}};var $=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var J=class{constructor(t){this._transport=t}send({limit:t,query:e,request:r={}}={}){return this._transport.send("v1/contacts",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var X=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var Z=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var tt=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var et=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",json:e})}};var ot=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var rt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...r,method:"POST",json:e})}};var nt=class{constructor(t){this._transport=t}get api(){return{get:new $(this._transport),list:new J(this._transport),update:new X(this._transport),create:new Y(this._transport),conversation:{list:new Z(this._transport)},label:{list:new tt(this._transport)},note:{list:new ot(this._transport),create:new et(this._transport)},notificationSubscription:{create:new rt(this._transport)},vcf:{get:new z(this._transport)}}}};var st=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var it=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:r,request:n={}}={}){return this._transport.send("v1/conversations",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(r??{})]})}};var pt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var at=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var ct=class{constructor(t){this._transport=t}send(t,{limit:e,include:r,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(r??{})]})}};var h=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",json:e})}};var 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}get api(){return{get:new st(this._transport),list:new it(this._transport),update:new pt(this._transport),create:new h(this._transport),label:{list:new at(this._transport)},message:{list:new ct(this._transport)},note:{list:new lt(this._transport),create:new h(this._transport)}}}};var ut=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var mt=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var ht=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}};var ft=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Ct=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var bt=class{constructor(t){this._transport=t}send({limit:t,query:e,include:r,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(r??{})]})}};var _t=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var gt=class{constructor(t){this._transport=t}get api(){return{create:new ht(this._transport),get:new Ct(this._transport),list:new bt(this._transport),update:new _t(this._transport),delete:new ft(this._transport),contact:{list:new ut(this._transport)},conversation:{list:new mt(this._transport)}}}};var xt=class{constructor(t){this._transport=t}send({limit:t,include:e,request:r={}}={}){return this._transport.send("v1/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var Rt=class{constructor(t){this._transport=t}get api(){return{list:new xt(this._transport)}}};var yt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",json:e})}};var Tt=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 Lt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",timeout:12e4,json:e})}};var vt=class{constructor(t){this._transport=t}get api(){return{get:new Tt(this._transport),list:new Ot(this._transport),response:{create:new Lt(this._transport)},correction:{create:new yt(this._transport)}}}};var Ft=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var Ut=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var wt=class{constructor(t){this._transport=t}get api(){return{get:new Ft(this._transport),update:new Ut(this._transport)}}};var qt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var St=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let r=[];if(t){let n=Array.isArray(t)?t:[t];for(let p of n)r.push(["category",p])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:r})}};var It=class{constructor(t){this._transport=t}get api(){return{get:new qt(this._transport),list:new St(this._transport)}}};var Et=class{constructor(t){this._transport=t}send({account:t,files:e,request:r={}}){let n=new FormData;for(let p of e)n.append("file",p);return this._transport.send("v1/uploads",{...r,method:"POST",body:n,searchParams:{account:t}})}};var At=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Pt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var Gt=class{constructor(t){this._transport=t}get api(){return{get:new Pt(this._transport),create:new Et(this._transport),delete:new At(this._transport)}}};var Nt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var Bt=class{constructor(t){this._transport=t}get api(){return{notification:{get:new Nt(this._transport)}}}};var f=class o{static DEFAULT_BASE_URL=Dt;_transport;_account;_action;_boilerplate;_boilerplateCategory;_channel;_compositionSection;_contact;_conversation;_label;_message;_model;_note;_source;_upload;_webhook;_wellKnown;constructor(t,{baseURL:e,...r}={}){this._transport=new b({requestFilterables:[new C,t],...r,baseURL:e?.toString()??o.getBaseURL()}),this._account=new R(this._transport),this._action=new T(this._transport),this._boilerplate=new A(this._transport),this._boilerplateCategory=new w(this._transport),this._channel=new k(this._transport),this._compositionSection=new W(this._transport),this._contact=new nt(this._transport),this._conversation=new dt(this._transport),this._label=new gt(this._transport),this._message=new Rt(this._transport),this._model=new vt(this._transport),this._note=new wt(this._transport),this._source=new It(this._transport),this._upload=new Gt(this._transport),this._webhook=new _(this),this._wellKnown=new Bt(this._transport)}static getBaseURL(){return process.env[oe]??this.DEFAULT_BASE_URL}get account(){return this._account.api}get action(){return this._action.api}get boilerplate(){return this._boilerplate.api}get boilerplateCategory(){return this._boilerplateCategory.api}get channel(){return this._channel.api}get compositionSection(){return this._compositionSection.api}get contact(){return this._contact.api}get conversation(){return this._conversation.api}get label(){return this._label.api}get message(){return this._message.api}get model(){return this._model.api}get note(){return this._note.api}get source(){return this._source.api}get upload(){return this._upload.api}get webhook(){return this._webhook}get wellKnown(){return this._wellKnown.api}};var Vt={};zt(Vt,{AuthError:()=>c,AuthenticationError:()=>d,AuthorizationError:()=>u,LogicError:()=>a,NetworkError:()=>m,SupportError:()=>i,ValidationError:()=>l});var Mt=class o{static DEFAULT_NAME=Xt;name;#t;constructor({name:t=process.env[ee]??o.DEFAULT_NAME,key:e=process.env[te]}={}){if(!e)throw new Error("API Key option must be specified when using Key Authentication");this.name=t,this.#t=e}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var jt=class{#t;constructor({token:t=process.env[Zt]}={}){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 Ht=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 ae=Object.create;var Kt=Object.defineProperty;var ce=Object.getOwnPropertyDescriptor;var le=Object.getOwnPropertyNames;var de=Object.getPrototypeOf,ue=Object.prototype.hasOwnProperty;var Jt=(o,t)=>{for(var e in t)Kt(o,e,{get:t[e],enumerable:!0})},Xt=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of le(t))!ue.call(o,n)&&n!==e&&Kt(o,n,{get:()=>t[n],enumerable:!(r=ce(t,n))||r.enumerable});return o};var Zt=(o,t,e)=>(e=o!=null?ae(de(o)):{},Xt(t||!o||!o.__esModule?Kt(e,"default",{value:o,enumerable:!0}):e,o)),me=o=>Xt(Kt({},"__esModule",{value:!0}),o);var he={};Jt(he,{Client:()=>f,DEFAULT_SUPPORT_BASE_URL:()=>Vt,Error:()=>Yt,KeyAuthentication:()=>kt,PublicAuthentication:()=>Qt,TokenAuthentication:()=>Dt,default:()=>f});module.exports=me(he);var Vt="https://api.support.greatdetail.com",te={"X-Powered-By":"GDSupport/JavaScript"},ee="api-key";var oe="SUPPORT_ACCESS_TOKEN",re="SUPPORT_API_KEY",ne="SUPPORT_KEY_NAME",se="SUPPORT_BASE_URL";var C=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=te;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var ie=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 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 a=class extends i{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var m=class extends i{};var l=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var b=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Wt.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[r=>{for(let n of this.options.requestFilterables){let p=n.getHeaders();for(let[$t,pe]of Object.entries(p))r.headers.has($t)||r.headers.set($t,pe)}}]}})}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 r of Object.keys(t))e.push(["include",r]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let r=this.client(t,e).catch(n=>{if((0,ie.default)(n))throw new m("A network error occurred",{cause:n});if(n instanceof Wt.HTTPError){let p=n.response.status;switch(console.error(JSON.stringify(n.response)),p){case 400:throw l.badRequest();case 401:throw d.unauthenticated();case 403:throw u.forbidden();case 404:throw a.notFound(t);case 405:throw a.forbiddenMethod(t,e.method??"GET");case 415:throw l.unsupportedMediaType();case 418:throw a.teapot();case 429:throw a.rateLimited()}if(p>=500&&p<600)throw i.serverError(p)}throw n});return{response:()=>r,json:async()=>(await r).json()}}};var s=require("zod"),g=class o{constructor(t){this._client=t}static SCHEMA=s.z.object({data:s.z.object({event:s.z.intersection(s.z.object({id:s.z.string(),createdAt:s.z.string().datetime()}),s.z.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}=o.SCHEMA.parse(t.body);return{event:e.event}}};var _=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}};var x=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var R=class{constructor(t){this._transport=t}get api(){return{get:new _(this._transport),update:new x(this._transport)}}};var y=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}};var T=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...r,method:"PATCH",json:e})}};var v=class{constructor(t){this._transport=t}get api(){return{get:new y(this._transport),update:new T(this._transport)}}};var O=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 L=class{constructor(t){this._transport=t}get api(){return{list:new O(this._transport)}}};var F=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var U=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",json:t})}};var S=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var w=class{constructor(t){this._transport=t}send({limit:t,include:e,request:r={}}={}){return this._transport.send("v1/boilerplate-categories",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var q=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var I=class{constructor(t){this._transport=t}get api(){return{get:new S(this._transport),list:new w(this._transport),create:new U(this._transport),update:new q(this._transport),boilerplate:{list:new F(this._transport)}}}};var A=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",json:t})}};var E=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var P=class{constructor(t){this._transport=t}send({limit:t,query:e,request:r={}}={}){return this._transport.send("v1/boilerplates",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var G=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var N=class{constructor(t){this._transport=t}get api(){return{get:new E(this._transport),list:new P(this._transport),update:new G(this._transport),create:new A(this._transport)}}};var B=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}};var M=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var j=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 zt=require("zod"),H=class o{constructor(t){this._transport=t}static SCHEMA=zt.z.object({overwrite:zt.z.boolean().optional()});send(t,{body:e,request:r={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...r,method:"POST",json:o.SCHEMA.parse(e)})}};var k=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var D=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Q=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var K=class{constructor(t){this._transport=t}get api(){return{get:new M(this._transport),list:new j(this._transport),update:new k(this._transport),create:new B(this._transport),compositionSection:{list:new D(this._transport)},message:{list:new Q(this._transport)},twilioSendgrid:{sync:new H(this._transport)}}}};var V=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}};var W=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var z=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var Y=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var $=class{constructor(t){this._transport=t}get api(){return{get:new W(this._transport),list:new z(this._transport),create:new V(this._transport),update:new Y(this._transport)}}};var J=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let r=e.variant??"vcard",n=e.format??(r==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var X=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}};var Z=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var tt=class{constructor(t){this._transport=t}send({limit:t,query:e,request:r={}}={}){return this._transport.send("v1/contacts",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var et=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var ot=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var rt=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var nt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",json:e})}};var st=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var it=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...r,method:"POST",json:e})}};var pt=class{constructor(t){this._transport=t}get api(){return{get:new Z(this._transport),list:new tt(this._transport),update:new et(this._transport),create:new X(this._transport),conversation:{list:new ot(this._transport)},label:{list:new rt(this._transport)},note:{list:new st(this._transport),create:new nt(this._transport)},notificationSubscription:{create:new it(this._transport)},vcf:{get:new J(this._transport)}}}};var at=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var ct=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:r,request:n={}}={}){return this._transport.send("v1/conversations",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(r??{})]})}};var lt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var dt=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var ut=class{constructor(t){this._transport=t}send(t,{limit:e,include:r,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(r??{})]})}};var h=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",json:e})}};var mt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var ht=class{constructor(t){this._transport=t}get api(){return{get:new at(this._transport),list:new ct(this._transport),update:new lt(this._transport),create:new h(this._transport),label:{list:new dt(this._transport)},message:{list:new ut(this._transport)},note:{list:new mt(this._transport),create:new h(this._transport)}}}};var ft=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Ct=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var bt=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}};var gt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var _t=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var xt=class{constructor(t){this._transport=t}send({limit:t,query:e,include:r,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(r??{})]})}};var Rt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var yt=class{constructor(t){this._transport=t}get api(){return{create:new bt(this._transport),get:new _t(this._transport),list:new xt(this._transport),update:new Rt(this._transport),delete:new gt(this._transport),contact:{list:new ft(this._transport)},conversation:{list:new Ct(this._transport)}}}};var Tt=class{constructor(t){this._transport=t}send({limit:t,include:e,request:r={}}={}){return this._transport.send("v1/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var vt=class{constructor(t){this._transport=t}get api(){return{list:new Tt(this._transport)}}};var Ot=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",json:e})}};var Lt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var Ft=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var Ut=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",timeout:12e4,json:e})}};var St=class{constructor(t){this._transport=t}get api(){return{get:new Lt(this._transport),list:new Ft(this._transport),response:{create:new Ut(this._transport)},correction:{create:new Ot(this._transport)}}}};var wt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var qt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var It=class{constructor(t){this._transport=t}get api(){return{get:new wt(this._transport),update:new qt(this._transport)}}};var At=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var Et=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let r=[];if(t){let n=Array.isArray(t)?t:[t];for(let p of n)r.push(["category",p])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:r})}};var Pt=class{constructor(t){this._transport=t}get api(){return{get:new At(this._transport),list:new Et(this._transport)}}};var Gt=class{constructor(t){this._transport=t}send({account:t,files:e,request:r={}}){let n=new FormData;for(let p of e)n.append("file",p);return this._transport.send("v1/uploads",{...r,method:"POST",body:n,searchParams:{account:t}})}};var Nt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Bt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var Mt=class{constructor(t){this._transport=t}get api(){return{get:new Bt(this._transport),create:new Gt(this._transport),delete:new Nt(this._transport)}}};var jt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var Ht=class{constructor(t){this._transport=t}get api(){return{notification:{get:new jt(this._transport)}}}};var f=class o{static DEFAULT_BASE_URL=Vt;_transport;_account;_accountConversationSettings;_action;_boilerplate;_boilerplateCategory;_channel;_compositionSection;_contact;_conversation;_label;_message;_model;_note;_source;_upload;_webhook;_wellKnown;constructor(t,{baseURL:e,...r}={}){this._transport=new b({requestFilterables:[new C,t],...r,baseURL:e?.toString()??o.getBaseURL()}),this._account=new R(this._transport),this._accountConversationSettings=new v(this._transport),this._action=new L(this._transport),this._boilerplate=new N(this._transport),this._boilerplateCategory=new I(this._transport),this._channel=new K(this._transport),this._compositionSection=new $(this._transport),this._contact=new pt(this._transport),this._conversation=new ht(this._transport),this._label=new yt(this._transport),this._message=new vt(this._transport),this._model=new St(this._transport),this._note=new It(this._transport),this._source=new Pt(this._transport),this._upload=new Mt(this._transport),this._webhook=new g(this),this._wellKnown=new Ht(this._transport)}static getBaseURL(){return process.env[se]??this.DEFAULT_BASE_URL}get account(){return this._account.api}get accountConversationSettings(){return this._accountConversationSettings.api}get action(){return this._action.api}get boilerplate(){return this._boilerplate.api}get boilerplateCategory(){return this._boilerplateCategory.api}get channel(){return this._channel.api}get compositionSection(){return this._compositionSection.api}get contact(){return this._contact.api}get conversation(){return this._conversation.api}get label(){return this._label.api}get message(){return this._message.api}get model(){return this._model.api}get note(){return this._note.api}get source(){return this._source.api}get upload(){return this._upload.api}get webhook(){return this._webhook}get wellKnown(){return this._wellKnown.api}};var Yt={};Jt(Yt,{AuthError:()=>c,AuthenticationError:()=>d,AuthorizationError:()=>u,LogicError:()=>a,NetworkError:()=>m,SupportError:()=>i,ValidationError:()=>l});var kt=class o{static DEFAULT_NAME=ee;name;#t;constructor({name:t=process.env[ne]??o.DEFAULT_NAME,key:e=process.env[re]}={}){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 Dt=class{#t;constructor({token:t=process.env[oe]}={}){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 Qt=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-
|
|
2
|
-
export {
|
|
1
|
+
import { A as Authentication, a as Account, b as Conversation } from './index-Bz_QURtQ.cjs';
|
|
2
|
+
export { d as AccountConversationSettings, g as Action, B as Boilerplate, m as BoilerplateCategory, r as Channel, C as Client, w as CompositionSection, F as Contact, n as CreateBoilerplateCategoryResponse, h as CreateBoilerplateResponse, v as CreateChannelResponse, z as CreateCompositionSectionResponse, ad as CreateContactNoteResponse, an as CreateContactNotificationSubscriptionResponse, H as CreateContactResponse, ae as CreateConversationNoteResponse, aa as CreateCorrectionResponse, Y as CreateLabelResponse, ab as CreateResponseResponse, ap as CreateUploadResponse, Z as DeleteLabelResponse, ar as DeleteUploadResponse, e as GetAccountConversationSettingsResponse, G as GetAccountResponse, o as GetBoilerplateCategoryResponse, j as GetBoilerplateResponse, t as GetChannelResponse, x as GetCompositionSectionResponse, I as GetContactResponse, N as GetConversationResponse, _ as GetLabelResponse, a8 as GetModelResponse, af as GetNoteResponse, as as GetNotificationWellKnownResponse, ak as GetSourceResponse, aq as GetUploadResponse, X as Label, L as ListActionsResponse, p as ListBoilerplateCategoriesResponse, i as ListBoilerplateCategoryBoilerplatesResponse, k as ListBoilerplatesResponse, D as ListChannelCompositionSectionsResponse, a6 as ListChannelMessagesResponse, s as ListChannelsResponse, y as ListCompositionSectionsResponse, V as ListContactConversationsResponse, a2 as ListContactLabelsResponse, ag as ListContactNotesResponse, J as ListContactsResponse, a1 as ListConversationLabelsResponse, a4 as ListConversationMessagesResponse, ah as ListConversationNotesResponse, P as ListConversationsResponse, K as ListLabelContactsResponse, Q as ListLabelConversationsResponse, $ as ListLabelsResponse, a5 as ListMessagesResponse, a9 as ListModelsResponse, al as ListSourcesResponse, a3 as Message, a7 as Model, ac as Note, am as NotificationSubscription, O as Options, R as RequestFilterable, aj as Source, c as TransportOptions, T as TwilioSendgridChannelSyncResponse, f as UpdateAccountConversationSettingsResponse, U as UpdateAccountResponse, q as UpdateBoilerplateCategoryResponse, l as UpdateBoilerplateResponse, u as UpdateChannelResponse, E as UpdateCompositionSectionResponse, M as UpdateContactResponse, S as UpdateConversationResponse, a0 as UpdateLabelResponse, ai as UpdateNoteResponse, ao as Upload, W as WebhookResponse, C as default } from './index-Bz_QURtQ.cjs';
|
|
3
3
|
import 'ky';
|
|
4
4
|
import 'zod';
|
|
5
5
|
|
|
@@ -216,10 +216,16 @@ declare class PublicAuthentication implements Authentication {
|
|
|
216
216
|
getHeaders(): {};
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
+
type CreateAccountResponse = {
|
|
220
|
+
data: {
|
|
221
|
+
account: Account;
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
|
|
219
225
|
type CreateConversationResponse = {
|
|
220
226
|
data: {
|
|
221
227
|
conversation: Conversation;
|
|
222
228
|
};
|
|
223
229
|
};
|
|
224
230
|
|
|
225
|
-
export { Conversation, type CreateConversationResponse, DEFAULT_SUPPORT_BASE_URL, index as Error, KeyAuthentication, PublicAuthentication, TokenAuthentication };
|
|
231
|
+
export { Account, Conversation, type CreateAccountResponse, type CreateConversationResponse, DEFAULT_SUPPORT_BASE_URL, index as Error, KeyAuthentication, PublicAuthentication, TokenAuthentication };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as Authentication, a as Conversation } from './index-
|
|
2
|
-
export {
|
|
1
|
+
import { A as Authentication, a as Account, b as Conversation } from './index-Bz_QURtQ.js';
|
|
2
|
+
export { d as AccountConversationSettings, g as Action, B as Boilerplate, m as BoilerplateCategory, r as Channel, C as Client, w as CompositionSection, F as Contact, n as CreateBoilerplateCategoryResponse, h as CreateBoilerplateResponse, v as CreateChannelResponse, z as CreateCompositionSectionResponse, ad as CreateContactNoteResponse, an as CreateContactNotificationSubscriptionResponse, H as CreateContactResponse, ae as CreateConversationNoteResponse, aa as CreateCorrectionResponse, Y as CreateLabelResponse, ab as CreateResponseResponse, ap as CreateUploadResponse, Z as DeleteLabelResponse, ar as DeleteUploadResponse, e as GetAccountConversationSettingsResponse, G as GetAccountResponse, o as GetBoilerplateCategoryResponse, j as GetBoilerplateResponse, t as GetChannelResponse, x as GetCompositionSectionResponse, I as GetContactResponse, N as GetConversationResponse, _ as GetLabelResponse, a8 as GetModelResponse, af as GetNoteResponse, as as GetNotificationWellKnownResponse, ak as GetSourceResponse, aq as GetUploadResponse, X as Label, L as ListActionsResponse, p as ListBoilerplateCategoriesResponse, i as ListBoilerplateCategoryBoilerplatesResponse, k as ListBoilerplatesResponse, D as ListChannelCompositionSectionsResponse, a6 as ListChannelMessagesResponse, s as ListChannelsResponse, y as ListCompositionSectionsResponse, V as ListContactConversationsResponse, a2 as ListContactLabelsResponse, ag as ListContactNotesResponse, J as ListContactsResponse, a1 as ListConversationLabelsResponse, a4 as ListConversationMessagesResponse, ah as ListConversationNotesResponse, P as ListConversationsResponse, K as ListLabelContactsResponse, Q as ListLabelConversationsResponse, $ as ListLabelsResponse, a5 as ListMessagesResponse, a9 as ListModelsResponse, al as ListSourcesResponse, a3 as Message, a7 as Model, ac as Note, am as NotificationSubscription, O as Options, R as RequestFilterable, aj as Source, c as TransportOptions, T as TwilioSendgridChannelSyncResponse, f as UpdateAccountConversationSettingsResponse, U as UpdateAccountResponse, q as UpdateBoilerplateCategoryResponse, l as UpdateBoilerplateResponse, u as UpdateChannelResponse, E as UpdateCompositionSectionResponse, M as UpdateContactResponse, S as UpdateConversationResponse, a0 as UpdateLabelResponse, ai as UpdateNoteResponse, ao as Upload, W as WebhookResponse, C as default } from './index-Bz_QURtQ.js';
|
|
3
3
|
import 'ky';
|
|
4
4
|
import 'zod';
|
|
5
5
|
|
|
@@ -216,10 +216,16 @@ declare class PublicAuthentication implements Authentication {
|
|
|
216
216
|
getHeaders(): {};
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
+
type CreateAccountResponse = {
|
|
220
|
+
data: {
|
|
221
|
+
account: Account;
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
|
|
219
225
|
type CreateConversationResponse = {
|
|
220
226
|
data: {
|
|
221
227
|
conversation: Conversation;
|
|
222
228
|
};
|
|
223
229
|
};
|
|
224
230
|
|
|
225
|
-
export { Conversation, type CreateConversationResponse, DEFAULT_SUPPORT_BASE_URL, index as Error, KeyAuthentication, PublicAuthentication, TokenAuthentication };
|
|
231
|
+
export { Account, Conversation, type CreateAccountResponse, type CreateConversationResponse, DEFAULT_SUPPORT_BASE_URL, index as Error, KeyAuthentication, PublicAuthentication, TokenAuthentication };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as d,b as g,c as p,d as s,e as n,f as _,g as a,h as f,i as m,j as u,k as x,l as c,m as l,n as h,o as A}from"./chunk-
|
|
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-TMJDTCSK.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
package/dist/chunk-4NDRZLWQ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var Vt=Object.defineProperty;var $t=(o,t)=>{for(var e in t)Vt(o,e,{get:t[e],enumerable:!0})};var Bt=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var Ht="https://api.support.greatdetail.com",Qt={"X-Powered-By":"GDSupport/JavaScript"},Zt="api-key";import{z as s}from"zod";var u=class o{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}=o.SCHEMA.parse(t.body);return{event:e.event}}};var re="SUPPORT_ACCESS_TOKEN",ne="SUPPORT_API_KEY",se="SUPPORT_KEY_NAME",kt="SUPPORT_BASE_URL";var m=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Qt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};import Wt from"is-network-error";import zt,{HTTPError as Yt}from"ky";var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends i{};var h=class extends c{static unauthenticated(){return new this("An unauthenticated request occurred")}};var f=class extends c{static forbidden(){return new this("A forbidden request occurred")}};var a=class extends 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 C=class extends i{};var l=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var b=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=zt.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[r=>{for(let n of this.options.requestFilterables){let p=n.getHeaders();for(let[jt,Kt]of Object.entries(p))r.headers.has(jt)||r.headers.set(jt,Kt)}}]}})}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 r of Object.keys(t))e.push(["include",r]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let r=this.client(t,e).catch(n=>{if(Wt(n))throw new C("A network error occurred",{cause:n});if(n instanceof Yt){let p=n.response.status;switch(console.error(JSON.stringify(n.response)),p){case 400:throw l.badRequest();case 401:throw h.unauthenticated();case 403:throw f.forbidden();case 404:throw a.notFound(t);case 405:throw a.forbiddenMethod(t,e.method??"GET");case 415:throw l.unsupportedMediaType();case 418:throw a.teapot();case 429:throw a.rateLimited()}if(p>=500&&p<600)throw i.serverError(p)}throw n});return{response:()=>r,json:async()=>(await r).json()}}};var _=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}};var g=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var x=class{constructor(t){this._transport=t}get api(){return{get:new _(this._transport),update:new g(this._transport)}}};var R=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 y=class{constructor(t){this._transport=t}get api(){return{list:new R(this._transport)}}};var T=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var O=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",json:t})}};var v=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:r={}}={}){return this._transport.send("v1/boilerplate-categories",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var F=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var U=class{constructor(t){this._transport=t}get api(){return{get:new v(this._transport),list:new L(this._transport),create:new O(this._transport),update:new F(this._transport),boilerplate:{list:new T(this._transport)}}}};var w=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",json:t})}};var q=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var S=class{constructor(t){this._transport=t}send({limit:t,query:e,request:r={}}={}){return this._transport.send("v1/boilerplates",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var I=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var E=class{constructor(t){this._transport=t}get api(){return{get:new q(this._transport),list:new S(this._transport),update:new I(this._transport),create:new w(this._transport)}}};var P=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}};var A=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var G=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 Dt}from"zod";var N=class o{constructor(t){this._transport=t}static SCHEMA=Dt.object({overwrite:Dt.boolean().optional()});send(t,{body:e,request:r={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...r,method:"POST",json:o.SCHEMA.parse(e)})}};var B=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var M=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var j=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var H=class{constructor(t){this._transport=t}get api(){return{get:new A(this._transport),list:new G(this._transport),update:new B(this._transport),create:new P(this._transport),compositionSection:{list:new M(this._transport)},message:{list:new j(this._transport)},twilioSendgrid:{sync:new N(this._transport)}}}};var Q=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}};var k=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var D=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 K=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var V=class{constructor(t){this._transport=t}get api(){return{get:new k(this._transport),list:new D(this._transport),create:new Q(this._transport),update:new K(this._transport)}}};var W=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let r=e.variant??"vcard",n=e.format??(r==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var z=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}};var Y=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var $=class{constructor(t){this._transport=t}send({limit:t,query:e,request:r={}}={}){return this._transport.send("v1/contacts",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var J=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var X=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Z=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var tt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",json:e})}};var et=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var ot=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...r,method:"POST",json:e})}};var rt=class{constructor(t){this._transport=t}get api(){return{get:new Y(this._transport),list:new $(this._transport),update:new J(this._transport),create:new z(this._transport),conversation:{list:new X(this._transport)},label:{list:new Z(this._transport)},note:{list:new et(this._transport),create:new tt(this._transport)},notificationSubscription:{create:new ot(this._transport)},vcf:{get:new W(this._transport)}}}};var nt=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var st=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:r,request:n={}}={}){return this._transport.send("v1/conversations",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(r??{})]})}};var it=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var pt=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var at=class{constructor(t){this._transport=t}send(t,{limit:e,include:r,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(r??{})]})}};var d=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",json:e})}};var ct=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var lt=class{constructor(t){this._transport=t}get api(){return{get:new nt(this._transport),list:new st(this._transport),update:new it(this._transport),create:new d(this._transport),label:{list:new pt(this._transport)},message:{list:new at(this._transport)},note:{list:new ct(this._transport),create:new d(this._transport)}}}};var dt=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var ut=class{constructor(t){this._transport=t}send(t,{limit:e,request:r={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var mt=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}};var ht=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var ft=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var Ct=class{constructor(t){this._transport=t}send({limit:t,query:e,include:r,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(r??{})]})}};var bt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var _t=class{constructor(t){this._transport=t}get api(){return{create:new mt(this._transport),get:new ft(this._transport),list:new Ct(this._transport),update:new bt(this._transport),delete:new ht(this._transport),contact:{list:new dt(this._transport)},conversation:{list:new ut(this._transport)}}}};var gt=class{constructor(t){this._transport=t}send({limit:t,include:e,request:r={}}={}){return this._transport.send("v1/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var xt=class{constructor(t){this._transport=t}get api(){return{list:new gt(this._transport)}}};var Rt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",json:e})}};var yt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var Tt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var Ot=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",timeout:12e4,json:e})}};var vt=class{constructor(t){this._transport=t}get api(){return{get:new yt(this._transport),list:new Tt(this._transport),response:{create:new Ot(this._transport)},correction:{create:new Rt(this._transport)}}}};var Lt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var Ft=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",json:e})}};var Ut=class{constructor(t){this._transport=t}get api(){return{get:new Lt(this._transport),update:new Ft(this._transport)}}};var wt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var qt=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let r=[];if(t){let n=Array.isArray(t)?t:[t];for(let p of n)r.push(["category",p])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:r})}};var St=class{constructor(t){this._transport=t}get api(){return{get:new wt(this._transport),list:new qt(this._transport)}}};var It=class{constructor(t){this._transport=t}send({account:t,files:e,request:r={}}){let n=new FormData;for(let p of e)n.append("file",p);return this._transport.send("v1/uploads",{...r,method:"POST",body:n,searchParams:{account:t}})}};var Et=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Pt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var At=class{constructor(t){this._transport=t}get api(){return{get:new Pt(this._transport),create:new It(this._transport),delete:new Et(this._transport)}}};var Gt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var Nt=class{constructor(t){this._transport=t}get api(){return{notification:{get:new Gt(this._transport)}}}};var Mt=class o{static DEFAULT_BASE_URL=Ht;_transport;_account;_action;_boilerplate;_boilerplateCategory;_channel;_compositionSection;_contact;_conversation;_label;_message;_model;_note;_source;_upload;_webhook;_wellKnown;constructor(t,{baseURL:e,...r}={}){this._transport=new b({requestFilterables:[new m,t],...r,baseURL:e?.toString()??o.getBaseURL()}),this._account=new x(this._transport),this._action=new y(this._transport),this._boilerplate=new E(this._transport),this._boilerplateCategory=new U(this._transport),this._channel=new H(this._transport),this._compositionSection=new V(this._transport),this._contact=new rt(this._transport),this._conversation=new lt(this._transport),this._label=new _t(this._transport),this._message=new xt(this._transport),this._model=new vt(this._transport),this._note=new Ut(this._transport),this._source=new St(this._transport),this._upload=new At(this._transport),this._webhook=new u(this),this._wellKnown=new Nt(this._transport)}static getBaseURL(){return process.env[kt]??this.DEFAULT_BASE_URL}get account(){return this._account.api}get action(){return this._action.api}get boilerplate(){return this._boilerplate.api}get boilerplateCategory(){return this._boilerplateCategory.api}get channel(){return this._channel.api}get compositionSection(){return this._compositionSection.api}get contact(){return this._contact.api}get conversation(){return this._conversation.api}get label(){return this._label.api}get message(){return this._message.api}get model(){return this._model.api}get note(){return this._note.api}get source(){return this._source.api}get upload(){return this._upload.api}get webhook(){return this._webhook}get wellKnown(){return this._wellKnown.api}};export{$t as a,Bt as b,re as c,ne as d,se as e,Ht as f,Zt as g,i as h,c as i,h as j,f as k,a as l,C as m,l as n,Mt as o};
|