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