@great-detail/support-sdk 0.10.3 → 0.10.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-NIDUSXK5.js → chunk-6ZAGISJI.js} +1 -1
- package/dist/chunk-FBUVV5WK.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-CHwV9Mrz.d.cts → index-BciOGkft.d.cts} +81 -41
- package/dist/{index-CHwV9Mrz.d.ts → index-BciOGkft.d.ts} +81 -41
- 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-X7766EUY.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-FBUVV5WK.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 Ft=Object.defineProperty;var qt=(o,t)=>{for(var e in t)Ft(o,e,{get:t[e],enumerable:!0})};var yt=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var _t="https://api.support.greatdetail.com",Ot={"X-Powered-By":"GDSupport/JavaScript"},Pt="api-key";import{z as s}from"zod";var u=class o{constructor(t){this._client=t}static SCHEMA=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{event:e}=o.SCHEMA.parse(t.body);return{event:e}}};var m=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var h=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var C=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var f=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var b=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var g=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.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 y=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var x=class{constructor(t){this._transport=t}send({include:t,request:e={}}={}){return this._transport.send("v1/boilerplate-categories",{...e,method:"GET",searchParams:[...this._transport.includeQuery(t??{})]})}};var T=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var _=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var O=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var v=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};import{z as vt}from"zod";var L=class o{constructor(t){this._transport=t}static SCHEMA=vt.object({overwrite:vt.boolean().optional()});send(t,{body:e,request:r={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:o.SCHEMA.parse(e)})}};var U=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var F=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var S=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var I=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...e,method:"GET"})}};var w=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/composition-sections",{...t,method:"GET"})}};var q=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var ae="SUPPORT_ACCESS_TOKEN",pe="SUPPORT_API_KEY",ie="SUPPORT_KEY_NAME",Lt="SUPPORT_BASE_URL";var E=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 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 P=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 N=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/contacts",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var B=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var A=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var M=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 j=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}send({filter:t,include:e,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...t?[["filter",t]]:[],...this._transport.includeQuery(e??{})]})}};var D=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var k=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.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 Q=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var W=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...e,method:"GET"})}};var z=class{constructor(t){this._transport=t}send({query:t,include:e,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.includeQuery(e??{})]})}};var Y=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var $=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var J=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var X=class{constructor(t){this._transport=t}send({include:t,request:e={}}={}){return this._transport.send("v1/messages",{...e,method:"GET",searchParams:[...this._transport.includeQuery(t??{})]})}};var Z=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var tt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var et=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var ot=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",timeout:12e4,headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var rt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},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",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var nt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var st=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var at=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var pt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var it=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var ct=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Ot;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var lt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var dt=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let r=[];if(t){let n=Array.isArray(t)?t:[t];for(let p of n)r.push(["category",p])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:r})}};import St from"is-network-error";import It,{HTTPError as wt}from"ky";var a=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends a{};var ut=class extends c{static unauthenticated(){return new this("An unauthenticated request occurred")}};var mt=class extends c{static forbidden(){return new this("A forbidden request occurred")}};var i=class extends a{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var ht=class extends a{};var d=class extends a{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var Ct=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=It.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[r=>{for(let n of this.options.requestFilterables){let p=n.getHeaders();for(let[Tt,Ut]of Object.entries(p))r.headers.has(Tt)||r.headers.set(Tt,Ut)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}includeQuery(t){let 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(St(n))throw new ht("A network error occurred",{cause:n});if(n instanceof wt){let p=n.response.status;switch(console.error(JSON.stringify(n.response)),p){case 400:throw d.badRequest();case 401:throw ut.unauthenticated();case 403:throw mt.forbidden();case 404:throw i.notFound(t);case 405:throw i.forbiddenMethod(t,e.method??"GET");case 415:throw d.unsupportedMediaType();case 418:throw i.teapot();case 429:throw i.rateLimited()}if(p>=500&&p<600)throw a.serverError(p)}throw n});return{response:()=>r,json:async()=>(await r).json()}}};var ft=class{constructor(t){this._transport=t}send({account:t,files:e,request:r={}}){let n=new FormData;for(let p of e)n.append("file",p);return this._transport.send("v1/uploads",{...r,method:"POST",body:n,searchParams:{account:t}})}};var bt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var gt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var Rt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var xt=class o{static DEFAULT_BASE_URL=_t;_transport;constructor(t,{baseURL:e,...r}={}){this._transport=new Ct({requestFilterables:[new ct,t],...r,baseURL:e?.toString()??o.getBaseURL()})}static getBaseURL(){return process.env[Lt]??this.DEFAULT_BASE_URL}get action(){return{list:new m(this._transport)}}get boilerplate(){return{get:new C(this._transport),list:new b(this._transport),update:new g(this._transport),create:new h(this._transport)}}get boilerplateCategory(){return{get:new y(this._transport),list:new x(this._transport),create:new R(this._transport),update:new T(this._transport),boilerplate:{list:new f(this._transport)}}}get channel(){return{get:new O(this._transport),list:new v(this._transport),update:new U(this._transport),create:new _(this._transport),compositionSection:{list:new I(this._transport)},message:{list:new $(this._transport)},twilioSendgrid:{sync:new L(this._transport)}}}get compositionSection(){return{get:new S(this._transport),list:new w(this._transport),create:new F(this._transport),update:new q(this._transport)}}get contact(){return{get:new P(this._transport),list:new N(this._transport),update:new A(this._transport),create:new G(this._transport),conversation:{list:new j(this._transport)},note:{list:new st(this._transport),create:new rt(this._transport)},notificationSubscription:{create:new it(this._transport)},vcf:{get:new E(this._transport)}}}get conversation(){return{get:new M(this._transport),list:new H(this._transport),update:new k(this._transport),create:new l(this._transport),label:{list:new W(this._transport)},message:{list:new J(this._transport)},note:{list:new at(this._transport),create:new l(this._transport)}}}get label(){return{create:new K(this._transport),get:new Q(this._transport),list:new z(this._transport),update:new Y(this._transport),delete:new V(this._transport),contact:{list:new B(this._transport)},conversation:{list:new D(this._transport)}}}get message(){return{list:new X(this._transport)}}get model(){return{get:new tt(this._transport),list:new et(this._transport),response:{create:new ot(this._transport)},correction:{create:new Z(this._transport)}}}get note(){return{get:new nt(this._transport),update:new pt(this._transport)}}get source(){return{get:new lt(this._transport),list:new dt(this._transport)}}get upload(){return{get:new gt(this._transport),create:new ft(this._transport),delete:new bt(this._transport)}}get webhook(){return new u(this)}get wellKnown(){return{notification:{get:new Rt(this._transport)}}}};export{qt as a,yt as b,ae as c,pe as d,ie as e,_t as f,Pt as g,a as h,c as i,ut as j,mt as k,i as l,ht as m,d as n,xt as o};
|
package/dist/cli/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var de=Object.create;var vt=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var ue=Object.getPrototypeOf,Ce=Object.prototype.hasOwnProperty;var he=(o,t)=>{for(var e in t)vt(o,e,{get:t[e],enumerable:!0})},Jt=(o,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of me(t))!Ce.call(o,r)&&r!==e&&vt(o,r,{get:()=>t[r],enumerable:!(n=le(t,r))||n.enumerable});return o};var Xt=(o,t,e)=>(e=o!=null?de(ue(o)):{},Jt(t||!o||!o.__esModule?vt(e,"default",{value:o,enumerable:!0}):e,o)),fe=o=>Jt(vt({},"__esModule",{value:!0}),o);var be={};he(be,{default:()=>xe});module.exports=fe(be);var pe=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var C=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var h=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var f=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var g=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var x=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var b=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var y=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var R=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var O=class{constructor(t){this._transport=t}send({include:t,request:e={}}={}){return this._transport.send("v1/boilerplate-categories",{...e,method:"GET",searchParams:[...this._transport.includeQuery(t??{})]})}};var T=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var _=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var v=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var w=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var qt=require("zod"),L=class o{constructor(t){this._transport=t}static SCHEMA=qt.z.object({overwrite:qt.z.boolean().optional()});send(t,{body:e,request:n={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:o.SCHEMA.parse(e)})}};var F=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var U=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var S=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var I=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...e,method:"GET"})}};var q=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/composition-sections",{...t,method:"GET"})}};var E=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var Zt="SUPPORT_BASE_URL";var te="https://api.support.greatdetail.com",ee={"X-Powered-By":"GDSupport/JavaScript"};var P=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let n=e.variant??"vcard",r=e.format??(n==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(n)+"&format="+encodeURIComponent(r)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var G=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var N=class{constructor(t){this._transport=t}send(t,{include:e,request:n={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var A=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/contacts",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var j=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var B=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var M=class{constructor(t){this._transport=t}send(t,{include:e,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var D=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}send({filter:t,include:e,request:n={}}={}){return this._transport.send("v1/conversations",{...n,method:"GET",searchParams:[...t?[["filter",t]]:[],...this._transport.includeQuery(e??{})]})}};var K=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var k=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.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 Q=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,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...e,method:"GET"})}};var Y=class{constructor(t){this._transport=t}send({query:t,include:e,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.includeQuery(e??{})]})}};var $=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var J=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var X=class{constructor(t){this._transport=t}send(t,{include:e,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var Z=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var tt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var et=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var ot=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var nt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var rt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var l=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var st=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var it=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var at=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var pt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var ct=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var dt=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=ee;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var lt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var mt=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let n=[];if(t){let r=Array.isArray(t)?t:[t];for(let a of r)n.push(["category",a])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:n})}};var oe=Xt(require("is-network-error"),1),wt=Xt(require("ky"),1);var s=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var d=class extends s{};var ut=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var Ct=class extends d{static forbidden(){return new this("A forbidden request occurred")}};var c=class extends s{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 ht=class extends s{};var m=class extends s{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var ft=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=wt.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[n=>{for(let r of this.options.requestFilterables){let a=r.getHeaders();for(let[$t,ce]of Object.entries(a))n.headers.has($t)||n.headers.set($t,ce)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}includeQuery(t){let e=[];for(let n of Object.keys(t))e.push(["include",n]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let n=this.client(t,e).catch(r=>{if((0,oe.default)(r))throw new ht("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 ut.unauthenticated();case 403:throw Ct.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 s.serverError(a)}throw r});return{response:()=>n,json:async()=>(await n).json()}}};var gt=class{constructor(t){this._transport=t}send({account:t,files:e,request:n={}}){let r=new FormData;for(let a of e)r.append("file",a);return this._transport.send("v1/uploads",{...n,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 bt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var i=require("zod"),yt=class o{constructor(t){this._client=t}static SCHEMA=i.z.object({event:i.z.intersection(i.z.object({id:i.z.string(),createdAt:i.z.string().datetime()}),i.z.discriminatedUnion("type",[i.z.object({type:i.z.literal("contact.created"),contact:i.z.string()}),i.z.object({type:i.z.literal("message.created"),message:i.z.string()})]))});async event({request:t}){let{event:e}=o.SCHEMA.parse(t.body);return{event:e}}};var Rt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var Ot=class o{static DEFAULT_BASE_URL=te;_transport;constructor(t,{baseURL:e,...n}={}){this._transport=new ft({requestFilterables:[new dt,t],...n,baseURL:e?.toString()??o.getBaseURL()})}static getBaseURL(){return process.env[Zt]??this.DEFAULT_BASE_URL}get action(){return{list:new C(this._transport)}}get boilerplate(){return{get:new f(this._transport),list:new x(this._transport),update:new b(this._transport),create:new h(this._transport)}}get boilerplateCategory(){return{get:new R(this._transport),list:new O(this._transport),create:new y(this._transport),update:new T(this._transport),boilerplate:{list:new g(this._transport)}}}get channel(){return{get:new v(this._transport),list:new w(this._transport),update:new F(this._transport),create:new _(this._transport),compositionSection:{list:new I(this._transport)},message:{list:new J(this._transport)},twilioSendgrid:{sync:new L(this._transport)}}}get compositionSection(){return{get:new S(this._transport),list:new q(this._transport),create:new U(this._transport),update:new E(this._transport)}}get contact(){return{get:new N(this._transport),list:new A(this._transport),update:new B(this._transport),create:new G(this._transport),conversation:{list:new D(this._transport)},note:{list:new it(this._transport),create:new rt(this._transport)},notificationSubscription:{create:new ct(this._transport)},vcf:{get:new P(this._transport)}}}get conversation(){return{get:new M(this._transport),list:new H(this._transport),update:new k(this._transport),create:new l(this._transport),label:{list:new z(this._transport)},message:{list:new X(this._transport)},note:{list:new at(this._transport),create:new l(this._transport)}}}get label(){return{create:new V(this._transport),get:new W(this._transport),list:new Y(this._transport),update:new $(this._transport),delete:new Q(this._transport),contact:{list:new j(this._transport)},conversation:{list:new K(this._transport)}}}get message(){return{list:new Z(this._transport)}}get model(){return{get:new et(this._transport),list:new ot(this._transport),response:{create:new nt(this._transport)},correction:{create:new tt(this._transport)}}}get note(){return{get:new st(this._transport),update:new pt(this._transport)}}get source(){return{get:new lt(this._transport),list:new mt(this._transport)}}get upload(){return{get:new bt(this._transport),create:new gt(this._transport),delete:new xt(this._transport)}}get webhook(){return new yt(this)}get wellKnown(){return{notification:{get:new Rt(this._transport)}}}};var Et=require("commander"),ne=require("ora");function Pt({client:o,ora:t}){let e=new Et.Command("actions").description("Actions");return e.addCommand(new Et.Command("list").description("List actions").action(async()=>{let n=await(0,ne.oraPromise)(()=>o.action.list.send().json(),{...t,text:"Finding actions"});console.log(n)})),e}var Gt=require("commander"),re=require("ora");function Nt({client:o,ora:t}){let e=new Gt.Command("channels").description("Channels");return e.addCommand(new Gt.Command("list").description("List channels").action(async()=>{let n=await(0,re.oraPromise)(()=>o.channel.list.send().json(),{...t,text:"Finding channels"});console.log(n)})),e}var Tt=require("commander"),Lt=require("ora");function At({client:o,ora:t}){let e=new Tt.Command("contacts").description("Contacts");return e.addCommand(new Tt.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async n=>{let r=await(0,Lt.oraPromise)(()=>o.contact.get.send(n).json(),{...t,text:"Finding contact"});console.log(r)})),e.addCommand(new Tt.Command("list").description("List contacts").action(async()=>{let n=await(0,Lt.oraPromise)(()=>o.contact.list.send().json(),{...t,text:"Finding contacts"});console.log(n)})),e.addCommand(new Tt.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async n=>{let r=await(0,Lt.oraPromise)(()=>o.contact.vcf.get.send({id:n}).response(),{...t,text:"Exporting contact"});console.log(r)})),e}var Ft=require("commander"),jt=require("ora");function Bt({client:o,ora:t}){let e=new Ft.Command("conversations").description("Conversations");return e.addCommand(new Ft.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let r=await(0,jt.oraPromise)(()=>o.conversation.get.send(n).json(),{...t,text:"Finding conversation"});console.log(r)})),e.addCommand(new Ft.Command("list").description("List conversations").action(async()=>{let n=await(0,jt.oraPromise)(()=>o.conversation.list.send().json(),{...t,text:"Finding conversations"});console.log(n)})),e}var _t=require("commander"),Ut=require("ora");function Mt({client:o,ora:t}){let e=new _t.Command("labels").description("Labels");return e.addCommand(new _t.Command("get").description("Find label").argument("<label>","Label ID").action(async n=>{let r=await(0,Ut.oraPromise)(()=>o.label.get.send(n).json(),{...t,text:"Finding label"});console.log(r)})),e.addCommand(new _t.Command("list").description("List labels").action(async()=>{let n=await(0,Ut.oraPromise)(()=>o.label.list.send().json(),{...t,text:"Finding labels"});console.log(n)})),e.addCommand(new _t.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async n=>{let r=await(0,Ut.oraPromise)(()=>o.label.conversation.list.send(n).json(),{...t,text:"Finding conversations"});console.log(r)})),e}var Dt=require("commander"),se=require("ora");function Ht({client:o,ora:t}){let e=new Dt.Command("messages").description("Messages");return e.addCommand(new Dt.Command("list").description("List messages").action(async()=>{let n=await(0,se.oraPromise)(()=>o.message.list.send().json(),{...t,text:"Finding messages"});console.log(n)})),e}var St=require("commander"),Kt=require("ora");function kt({client:o,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 n=>{let r=await(0,Kt.oraPromise)(()=>o.model.get.send(n).json(),{...t,text:"Finding model"});console.log(r)})),e.addCommand(new St.Command("list").description("List models").action(async()=>{let n=await(0,Kt.oraPromise)(()=>o.model.list.send().json(),{...t,text:"Finding models"});console.log(n)})),e}var It=require("commander"),Vt=require("ora");function Qt({client:o,ora:t}){let e=new It.Command("sources").description("Sources");return e.addCommand(new It.Command("get").description("Find source").argument("<source>","Source ID").action(async n=>{let r=await(0,Vt.oraPromise)(()=>o.source.get.send(n).json(),{...t,text:"Finding source"});console.log(r)})),e.addCommand(new It.Command("list").description("List sources").action(async()=>{let n=await(0,Vt.oraPromise)(()=>o.source.list.send().json(),{...t,text:"Finding sources"});console.log(n)})),e}var ae=require("commander");var Wt=require("commander"),ie=require("ora");function zt({client:o,ora:t}){let e=new Wt.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new Wt.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let n=await(0,ie.oraPromise)(()=>o.wellKnown.notification.get.send().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(n)})),e}function Yt({client:o,ora:t}){let e=new ae.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(zt({client:o,ora:t})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new Ot(new u)},ge=new pe.Command("gds").description("Great Detail Support System").addCommand(Pt(p)).addCommand(Nt(p)).addCommand(At(p)).addCommand(Bt(p)).addCommand(Mt(p)).addCommand(Ht(p)).addCommand(kt(p)).addCommand(Qt(p)).addCommand(Yt(p)),xe=ge;
|
|
1
|
+
"use strict";var de=Object.create;var vt=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var ue=Object.getPrototypeOf,Ce=Object.prototype.hasOwnProperty;var he=(o,t)=>{for(var e in t)vt(o,e,{get:t[e],enumerable:!0})},Jt=(o,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of me(t))!Ce.call(o,r)&&r!==e&&vt(o,r,{get:()=>t[r],enumerable:!(n=le(t,r))||n.enumerable});return o};var Xt=(o,t,e)=>(e=o!=null?de(ue(o)):{},Jt(t||!o||!o.__esModule?vt(e,"default",{value:o,enumerable:!0}):e,o)),fe=o=>Jt(vt({},"__esModule",{value:!0}),o);var be={};he(be,{default:()=>xe});module.exports=fe(be);var pe=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var C=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var h=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var f=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var g=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var x=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var b=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var y=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var R=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var O=class{constructor(t){this._transport=t}send({include:t,request:e={}}={}){return this._transport.send("v1/boilerplate-categories",{...e,method:"GET",searchParams:[...this._transport.includeQuery(t??{})]})}};var T=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var _=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var v=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var w=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var qt=require("zod"),L=class o{constructor(t){this._transport=t}static SCHEMA=qt.z.object({overwrite:qt.z.boolean().optional()});send(t,{body:e,request:n={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:o.SCHEMA.parse(e)})}};var F=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var U=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var I=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var S=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...e,method:"GET"})}};var q=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/composition-sections",{...t,method:"GET"})}};var E=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var Zt="SUPPORT_BASE_URL";var te="https://api.support.greatdetail.com",ee={"X-Powered-By":"GDSupport/JavaScript"};var P=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let n=e.variant??"vcard",r=e.format??(n==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(n)+"&format="+encodeURIComponent(r)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var G=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var N=class{constructor(t){this._transport=t}send(t,{include:e,request:n={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var j=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/contacts",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var A=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var B=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var M=class{constructor(t){this._transport=t}send(t,{include:e,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var D=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}send({filter:t,include:e,request:n={}}={}){return this._transport.send("v1/conversations",{...n,method:"GET",searchParams:[...t?[["filter",t]]:[],...this._transport.includeQuery(e??{})]})}};var K=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var k=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.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 Q=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,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...e,method:"GET"})}};var Y=class{constructor(t){this._transport=t}send({query:t,include:e,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.includeQuery(e??{})]})}};var $=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var J=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var X=class{constructor(t){this._transport=t}send(t,{include:e,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var Z=class{constructor(t){this._transport=t}send({include:t,request:e={}}={}){return this._transport.send("v1/messages",{...e,method:"GET",searchParams:[...this._transport.includeQuery(t??{})]})}};var tt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var et=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var ot=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var nt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...n,method:"POST",timeout:12e4,headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var rt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var l=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var st=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var it=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var at=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var pt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var ct=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var dt=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=ee;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var lt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var mt=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let n=[];if(t){let r=Array.isArray(t)?t:[t];for(let a of r)n.push(["category",a])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:n})}};var oe=Xt(require("is-network-error"),1),wt=Xt(require("ky"),1);var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var d=class extends i{};var ut=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var Ct=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 ht=class extends i{};var m=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var ft=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=wt.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[n=>{for(let r of this.options.requestFilterables){let a=r.getHeaders();for(let[$t,ce]of Object.entries(a))n.headers.has($t)||n.headers.set($t,ce)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}includeQuery(t){let e=[];for(let n of Object.keys(t))e.push(["include",n]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let n=this.client(t,e).catch(r=>{if((0,oe.default)(r))throw new ht("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 ut.unauthenticated();case 403:throw Ct.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:()=>n,json:async()=>(await n).json()}}};var gt=class{constructor(t){this._transport=t}send({account:t,files:e,request:n={}}){let r=new FormData;for(let a of e)r.append("file",a);return this._transport.send("v1/uploads",{...n,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 bt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var s=require("zod"),yt=class o{constructor(t){this._client=t}static SCHEMA=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{event:e}=o.SCHEMA.parse(t.body);return{event:e}}};var Rt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var Ot=class o{static DEFAULT_BASE_URL=te;_transport;constructor(t,{baseURL:e,...n}={}){this._transport=new ft({requestFilterables:[new dt,t],...n,baseURL:e?.toString()??o.getBaseURL()})}static getBaseURL(){return process.env[Zt]??this.DEFAULT_BASE_URL}get action(){return{list:new C(this._transport)}}get boilerplate(){return{get:new f(this._transport),list:new x(this._transport),update:new b(this._transport),create:new h(this._transport)}}get boilerplateCategory(){return{get:new R(this._transport),list:new O(this._transport),create:new y(this._transport),update:new T(this._transport),boilerplate:{list:new g(this._transport)}}}get channel(){return{get:new v(this._transport),list:new w(this._transport),update:new F(this._transport),create:new _(this._transport),compositionSection:{list:new S(this._transport)},message:{list:new J(this._transport)},twilioSendgrid:{sync:new L(this._transport)}}}get compositionSection(){return{get:new I(this._transport),list:new q(this._transport),create:new U(this._transport),update:new E(this._transport)}}get contact(){return{get:new N(this._transport),list:new j(this._transport),update:new B(this._transport),create:new G(this._transport),conversation:{list:new D(this._transport)},note:{list:new it(this._transport),create:new rt(this._transport)},notificationSubscription:{create:new ct(this._transport)},vcf:{get:new P(this._transport)}}}get conversation(){return{get:new M(this._transport),list:new H(this._transport),update:new k(this._transport),create:new l(this._transport),label:{list:new z(this._transport)},message:{list:new X(this._transport)},note:{list:new at(this._transport),create:new l(this._transport)}}}get label(){return{create:new V(this._transport),get:new W(this._transport),list:new Y(this._transport),update:new $(this._transport),delete:new Q(this._transport),contact:{list:new A(this._transport)},conversation:{list:new K(this._transport)}}}get message(){return{list:new Z(this._transport)}}get model(){return{get:new et(this._transport),list:new ot(this._transport),response:{create:new nt(this._transport)},correction:{create:new tt(this._transport)}}}get note(){return{get:new st(this._transport),update:new pt(this._transport)}}get source(){return{get:new lt(this._transport),list:new mt(this._transport)}}get upload(){return{get:new bt(this._transport),create:new gt(this._transport),delete:new xt(this._transport)}}get webhook(){return new yt(this)}get wellKnown(){return{notification:{get:new Rt(this._transport)}}}};var Et=require("commander"),ne=require("ora");function Pt({client:o,ora:t}){let e=new Et.Command("actions").description("Actions");return e.addCommand(new Et.Command("list").description("List actions").action(async()=>{let n=await(0,ne.oraPromise)(()=>o.action.list.send().json(),{...t,text:"Finding actions"});console.log(n)})),e}var Gt=require("commander"),re=require("ora");function Nt({client:o,ora:t}){let e=new Gt.Command("channels").description("Channels");return e.addCommand(new Gt.Command("list").description("List channels").action(async()=>{let n=await(0,re.oraPromise)(()=>o.channel.list.send().json(),{...t,text:"Finding channels"});console.log(n)})),e}var Tt=require("commander"),Lt=require("ora");function jt({client:o,ora:t}){let e=new Tt.Command("contacts").description("Contacts");return e.addCommand(new Tt.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async n=>{let r=await(0,Lt.oraPromise)(()=>o.contact.get.send(n).json(),{...t,text:"Finding contact"});console.log(r)})),e.addCommand(new Tt.Command("list").description("List contacts").action(async()=>{let n=await(0,Lt.oraPromise)(()=>o.contact.list.send().json(),{...t,text:"Finding contacts"});console.log(n)})),e.addCommand(new Tt.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async n=>{let r=await(0,Lt.oraPromise)(()=>o.contact.vcf.get.send({id:n}).response(),{...t,text:"Exporting contact"});console.log(r)})),e}var Ft=require("commander"),At=require("ora");function Bt({client:o,ora:t}){let e=new Ft.Command("conversations").description("Conversations");return e.addCommand(new Ft.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let r=await(0,At.oraPromise)(()=>o.conversation.get.send(n).json(),{...t,text:"Finding conversation"});console.log(r)})),e.addCommand(new Ft.Command("list").description("List conversations").action(async()=>{let n=await(0,At.oraPromise)(()=>o.conversation.list.send().json(),{...t,text:"Finding conversations"});console.log(n)})),e}var _t=require("commander"),Ut=require("ora");function Mt({client:o,ora:t}){let e=new _t.Command("labels").description("Labels");return e.addCommand(new _t.Command("get").description("Find label").argument("<label>","Label ID").action(async n=>{let r=await(0,Ut.oraPromise)(()=>o.label.get.send(n).json(),{...t,text:"Finding label"});console.log(r)})),e.addCommand(new _t.Command("list").description("List labels").action(async()=>{let n=await(0,Ut.oraPromise)(()=>o.label.list.send().json(),{...t,text:"Finding labels"});console.log(n)})),e.addCommand(new _t.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async n=>{let r=await(0,Ut.oraPromise)(()=>o.label.conversation.list.send(n).json(),{...t,text:"Finding conversations"});console.log(r)})),e}var Dt=require("commander"),se=require("ora");function Ht({client:o,ora:t}){let e=new Dt.Command("messages").description("Messages");return e.addCommand(new Dt.Command("list").description("List messages").action(async()=>{let n=await(0,se.oraPromise)(()=>o.message.list.send().json(),{...t,text:"Finding messages"});console.log(n)})),e}var It=require("commander"),Kt=require("ora");function kt({client:o,ora:t}){let e=new It.Command("models").description("Models");return e.addCommand(new It.Command("get").description("Find model").argument("<model>","Model ID").action(async n=>{let r=await(0,Kt.oraPromise)(()=>o.model.get.send(n).json(),{...t,text:"Finding model"});console.log(r)})),e.addCommand(new It.Command("list").description("List models").action(async()=>{let n=await(0,Kt.oraPromise)(()=>o.model.list.send().json(),{...t,text:"Finding models"});console.log(n)})),e}var St=require("commander"),Vt=require("ora");function Qt({client:o,ora:t}){let e=new St.Command("sources").description("Sources");return e.addCommand(new St.Command("get").description("Find source").argument("<source>","Source ID").action(async n=>{let r=await(0,Vt.oraPromise)(()=>o.source.get.send(n).json(),{...t,text:"Finding source"});console.log(r)})),e.addCommand(new St.Command("list").description("List sources").action(async()=>{let n=await(0,Vt.oraPromise)(()=>o.source.list.send().json(),{...t,text:"Finding sources"});console.log(n)})),e}var ae=require("commander");var Wt=require("commander"),ie=require("ora");function zt({client:o,ora:t}){let e=new Wt.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new Wt.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let n=await(0,ie.oraPromise)(()=>o.wellKnown.notification.get.send().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(n)})),e}function Yt({client:o,ora:t}){let e=new ae.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(zt({client:o,ora:t})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new Ot(new u)},ge=new pe.Command("gds").description("Great Detail Support System").addCommand(Pt(p)).addCommand(Nt(p)).addCommand(jt(p)).addCommand(Bt(p)).addCommand(Mt(p)).addCommand(Ht(p)).addCommand(kt(p)).addCommand(Qt(p)).addCommand(Yt(p)),xe=ge;
|
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-6ZAGISJI.js";import"../chunk-FBUVV5WK.js";export{a as default};
|
package/dist/cli.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var de=Object.create;var $t=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var ue=Object.getPrototypeOf,Ce=Object.prototype.hasOwnProperty;var he=(o,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of me(t))!Ce.call(o,r)&&r!==e&&$t(o,r,{get:()=>t[r],enumerable:!(n=le(t,r))||n.enumerable});return o};var Jt=(o,t,e)=>(e=o!=null?de(ue(o)):{},he(t||!o||!o.__esModule?$t(e,"default",{value:o,enumerable:!0}):e,o));var ae=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var C=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var h=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var f=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var g=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var x=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var b=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var y=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var R=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var O=class{constructor(t){this._transport=t}send({include:t,request:e={}}={}){return this._transport.send("v1/boilerplate-categories",{...e,method:"GET",searchParams:[...this._transport.includeQuery(t??{})]})}};var T=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var _=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var v=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var w=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var It=require("zod"),L=class o{constructor(t){this._transport=t}static SCHEMA=It.z.object({overwrite:It.z.boolean().optional()});send(t,{body:e,request:n={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:o.SCHEMA.parse(e)})}};var F=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var U=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var S=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var I=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...e,method:"GET"})}};var q=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/composition-sections",{...t,method:"GET"})}};var E=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var Xt="SUPPORT_BASE_URL";var Zt="https://api.support.greatdetail.com",te={"X-Powered-By":"GDSupport/JavaScript"};var P=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let n=e.variant??"vcard",r=e.format??(n==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(n)+"&format="+encodeURIComponent(r)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var G=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var N=class{constructor(t){this._transport=t}send(t,{include:e,request:n={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var A=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/contacts",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var j=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var B=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var M=class{constructor(t){this._transport=t}send(t,{include:e,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var D=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}send({filter:t,include:e,request:n={}}={}){return this._transport.send("v1/conversations",{...n,method:"GET",searchParams:[...t?[["filter",t]]:[],...this._transport.includeQuery(e??{})]})}};var K=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var k=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.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 Q=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,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...e,method:"GET"})}};var Y=class{constructor(t){this._transport=t}send({query:t,include:e,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.includeQuery(e??{})]})}};var $=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var J=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var X=class{constructor(t){this._transport=t}send(t,{include:e,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var Z=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var tt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var et=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var ot=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var nt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var rt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var l=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var st=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var it=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var at=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var pt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var ct=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var dt=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=te;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var lt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var mt=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let n=[];if(t){let r=Array.isArray(t)?t:[t];for(let a of r)n.push(["category",a])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:n})}};var ee=Jt(require("is-network-error"),1),vt=Jt(require("ky"),1);var s=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var d=class extends s{};var ut=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var Ct=class extends d{static forbidden(){return new this("A forbidden request occurred")}};var c=class extends s{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 ht=class extends s{};var m=class extends s{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var ft=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=vt.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[n=>{for(let r of this.options.requestFilterables){let a=r.getHeaders();for(let[Yt,ce]of Object.entries(a))n.headers.has(Yt)||n.headers.set(Yt,ce)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}includeQuery(t){let e=[];for(let n of Object.keys(t))e.push(["include",n]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let n=this.client(t,e).catch(r=>{if((0,ee.default)(r))throw new ht("A network error occurred",{cause:r});if(r instanceof vt.HTTPError){let a=r.response.status;switch(console.error(JSON.stringify(r.response)),a){case 400:throw m.badRequest();case 401:throw ut.unauthenticated();case 403:throw Ct.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 s.serverError(a)}throw r});return{response:()=>n,json:async()=>(await n).json()}}};var gt=class{constructor(t){this._transport=t}send({account:t,files:e,request:n={}}){let r=new FormData;for(let a of e)r.append("file",a);return this._transport.send("v1/uploads",{...n,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 bt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var i=require("zod"),yt=class o{constructor(t){this._client=t}static SCHEMA=i.z.object({event:i.z.intersection(i.z.object({id:i.z.string(),createdAt:i.z.string().datetime()}),i.z.discriminatedUnion("type",[i.z.object({type:i.z.literal("contact.created"),contact:i.z.string()}),i.z.object({type:i.z.literal("message.created"),message:i.z.string()})]))});async event({request:t}){let{event:e}=o.SCHEMA.parse(t.body);return{event:e}}};var Rt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var Ot=class o{static DEFAULT_BASE_URL=Zt;_transport;constructor(t,{baseURL:e,...n}={}){this._transport=new ft({requestFilterables:[new dt,t],...n,baseURL:e?.toString()??o.getBaseURL()})}static getBaseURL(){return process.env[Xt]??this.DEFAULT_BASE_URL}get action(){return{list:new C(this._transport)}}get boilerplate(){return{get:new f(this._transport),list:new x(this._transport),update:new b(this._transport),create:new h(this._transport)}}get boilerplateCategory(){return{get:new R(this._transport),list:new O(this._transport),create:new y(this._transport),update:new T(this._transport),boilerplate:{list:new g(this._transport)}}}get channel(){return{get:new v(this._transport),list:new w(this._transport),update:new F(this._transport),create:new _(this._transport),compositionSection:{list:new I(this._transport)},message:{list:new J(this._transport)},twilioSendgrid:{sync:new L(this._transport)}}}get compositionSection(){return{get:new S(this._transport),list:new q(this._transport),create:new U(this._transport),update:new E(this._transport)}}get contact(){return{get:new N(this._transport),list:new A(this._transport),update:new B(this._transport),create:new G(this._transport),conversation:{list:new D(this._transport)},note:{list:new it(this._transport),create:new rt(this._transport)},notificationSubscription:{create:new ct(this._transport)},vcf:{get:new P(this._transport)}}}get conversation(){return{get:new M(this._transport),list:new H(this._transport),update:new k(this._transport),create:new l(this._transport),label:{list:new z(this._transport)},message:{list:new X(this._transport)},note:{list:new at(this._transport),create:new l(this._transport)}}}get label(){return{create:new V(this._transport),get:new W(this._transport),list:new Y(this._transport),update:new $(this._transport),delete:new Q(this._transport),contact:{list:new j(this._transport)},conversation:{list:new K(this._transport)}}}get message(){return{list:new Z(this._transport)}}get model(){return{get:new et(this._transport),list:new ot(this._transport),response:{create:new nt(this._transport)},correction:{create:new tt(this._transport)}}}get note(){return{get:new st(this._transport),update:new pt(this._transport)}}get source(){return{get:new lt(this._transport),list:new mt(this._transport)}}get upload(){return{get:new bt(this._transport),create:new gt(this._transport),delete:new xt(this._transport)}}get webhook(){return new yt(this)}get wellKnown(){return{notification:{get:new Rt(this._transport)}}}};var qt=require("commander"),oe=require("ora");function Et({client:o,ora:t}){let e=new qt.Command("actions").description("Actions");return e.addCommand(new qt.Command("list").description("List actions").action(async()=>{let n=await(0,oe.oraPromise)(()=>o.action.list.send().json(),{...t,text:"Finding actions"});console.log(n)})),e}var Pt=require("commander"),ne=require("ora");function Gt({client:o,ora:t}){let e=new Pt.Command("channels").description("Channels");return e.addCommand(new Pt.Command("list").description("List channels").action(async()=>{let n=await(0,ne.oraPromise)(()=>o.channel.list.send().json(),{...t,text:"Finding channels"});console.log(n)})),e}var Tt=require("commander"),wt=require("ora");function Nt({client:o,ora:t}){let e=new Tt.Command("contacts").description("Contacts");return e.addCommand(new Tt.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async n=>{let r=await(0,wt.oraPromise)(()=>o.contact.get.send(n).json(),{...t,text:"Finding contact"});console.log(r)})),e.addCommand(new Tt.Command("list").description("List contacts").action(async()=>{let n=await(0,wt.oraPromise)(()=>o.contact.list.send().json(),{...t,text:"Finding contacts"});console.log(n)})),e.addCommand(new Tt.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async n=>{let r=await(0,wt.oraPromise)(()=>o.contact.vcf.get.send({id:n}).response(),{...t,text:"Exporting contact"});console.log(r)})),e}var Lt=require("commander"),At=require("ora");function jt({client:o,ora:t}){let e=new Lt.Command("conversations").description("Conversations");return e.addCommand(new Lt.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let r=await(0,At.oraPromise)(()=>o.conversation.get.send(n).json(),{...t,text:"Finding conversation"});console.log(r)})),e.addCommand(new Lt.Command("list").description("List conversations").action(async()=>{let n=await(0,At.oraPromise)(()=>o.conversation.list.send().json(),{...t,text:"Finding conversations"});console.log(n)})),e}var _t=require("commander"),Ft=require("ora");function Bt({client:o,ora:t}){let e=new _t.Command("labels").description("Labels");return e.addCommand(new _t.Command("get").description("Find label").argument("<label>","Label ID").action(async n=>{let r=await(0,Ft.oraPromise)(()=>o.label.get.send(n).json(),{...t,text:"Finding label"});console.log(r)})),e.addCommand(new _t.Command("list").description("List labels").action(async()=>{let n=await(0,Ft.oraPromise)(()=>o.label.list.send().json(),{...t,text:"Finding labels"});console.log(n)})),e.addCommand(new _t.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async n=>{let r=await(0,Ft.oraPromise)(()=>o.label.conversation.list.send(n).json(),{...t,text:"Finding conversations"});console.log(r)})),e}var Mt=require("commander"),re=require("ora");function Dt({client:o,ora:t}){let e=new Mt.Command("messages").description("Messages");return e.addCommand(new Mt.Command("list").description("List messages").action(async()=>{let n=await(0,re.oraPromise)(()=>o.message.list.send().json(),{...t,text:"Finding messages"});console.log(n)})),e}var Ut=require("commander"),Ht=require("ora");function Kt({client:o,ora:t}){let e=new Ut.Command("models").description("Models");return e.addCommand(new Ut.Command("get").description("Find model").argument("<model>","Model ID").action(async n=>{let r=await(0,Ht.oraPromise)(()=>o.model.get.send(n).json(),{...t,text:"Finding model"});console.log(r)})),e.addCommand(new Ut.Command("list").description("List models").action(async()=>{let n=await(0,Ht.oraPromise)(()=>o.model.list.send().json(),{...t,text:"Finding models"});console.log(n)})),e}var St=require("commander"),kt=require("ora");function Vt({client:o,ora:t}){let e=new St.Command("sources").description("Sources");return e.addCommand(new St.Command("get").description("Find source").argument("<source>","Source ID").action(async n=>{let r=await(0,kt.oraPromise)(()=>o.source.get.send(n).json(),{...t,text:"Finding source"});console.log(r)})),e.addCommand(new St.Command("list").description("List sources").action(async()=>{let n=await(0,kt.oraPromise)(()=>o.source.list.send().json(),{...t,text:"Finding sources"});console.log(n)})),e}var ie=require("commander");var Qt=require("commander"),se=require("ora");function Wt({client:o,ora:t}){let e=new Qt.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new Qt.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let n=await(0,se.oraPromise)(()=>o.wellKnown.notification.get.send().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(n)})),e}function zt({client:o,ora:t}){let e=new ie.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(Wt({client:o,ora:t})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new Ot(new u)},fe=new ae.Command("gds").description("Great Detail Support System").addCommand(Et(p)).addCommand(Gt(p)).addCommand(Nt(p)).addCommand(jt(p)).addCommand(Bt(p)).addCommand(Dt(p)).addCommand(Kt(p)).addCommand(Vt(p)).addCommand(zt(p)),pe=fe;pe.parseAsync(process.argv);
|
|
2
|
+
"use strict";var de=Object.create;var $t=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var ue=Object.getPrototypeOf,Ce=Object.prototype.hasOwnProperty;var he=(o,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of me(t))!Ce.call(o,r)&&r!==e&&$t(o,r,{get:()=>t[r],enumerable:!(n=le(t,r))||n.enumerable});return o};var Jt=(o,t,e)=>(e=o!=null?de(ue(o)):{},he(t||!o||!o.__esModule?$t(e,"default",{value:o,enumerable:!0}):e,o));var ae=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var C=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var h=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var f=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var g=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var x=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var b=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var y=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var R=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var O=class{constructor(t){this._transport=t}send({include:t,request:e={}}={}){return this._transport.send("v1/boilerplate-categories",{...e,method:"GET",searchParams:[...this._transport.includeQuery(t??{})]})}};var T=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var _=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var v=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var w=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var St=require("zod"),L=class o{constructor(t){this._transport=t}static SCHEMA=St.z.object({overwrite:St.z.boolean().optional()});send(t,{body:e,request:n={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:o.SCHEMA.parse(e)})}};var F=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var U=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var I=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var S=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...e,method:"GET"})}};var q=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/composition-sections",{...t,method:"GET"})}};var E=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var Xt="SUPPORT_BASE_URL";var Zt="https://api.support.greatdetail.com",te={"X-Powered-By":"GDSupport/JavaScript"};var P=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let n=e.variant??"vcard",r=e.format??(n==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(n)+"&format="+encodeURIComponent(r)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var G=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var N=class{constructor(t){this._transport=t}send(t,{include:e,request:n={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var j=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/contacts",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var A=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var B=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var M=class{constructor(t){this._transport=t}send(t,{include:e,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var D=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}send({filter:t,include:e,request:n={}}={}){return this._transport.send("v1/conversations",{...n,method:"GET",searchParams:[...t?[["filter",t]]:[],...this._transport.includeQuery(e??{})]})}};var K=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var k=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.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 Q=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,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...e,method:"GET"})}};var Y=class{constructor(t){this._transport=t}send({query:t,include:e,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.includeQuery(e??{})]})}};var $=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var J=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var X=class{constructor(t){this._transport=t}send(t,{include:e,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var Z=class{constructor(t){this._transport=t}send({include:t,request:e={}}={}){return this._transport.send("v1/messages",{...e,method:"GET",searchParams:[...this._transport.includeQuery(t??{})]})}};var tt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var et=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var ot=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var nt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...n,method:"POST",timeout:12e4,headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var rt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var l=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var st=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var it=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var at=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var pt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var ct=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var dt=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=te;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var lt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var mt=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let n=[];if(t){let r=Array.isArray(t)?t:[t];for(let a of r)n.push(["category",a])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:n})}};var ee=Jt(require("is-network-error"),1),vt=Jt(require("ky"),1);var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var d=class extends i{};var ut=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var Ct=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 ht=class extends i{};var m=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var ft=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=vt.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[n=>{for(let r of this.options.requestFilterables){let a=r.getHeaders();for(let[Yt,ce]of Object.entries(a))n.headers.has(Yt)||n.headers.set(Yt,ce)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}includeQuery(t){let e=[];for(let n of Object.keys(t))e.push(["include",n]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let n=this.client(t,e).catch(r=>{if((0,ee.default)(r))throw new ht("A network error occurred",{cause:r});if(r instanceof vt.HTTPError){let a=r.response.status;switch(console.error(JSON.stringify(r.response)),a){case 400:throw m.badRequest();case 401:throw ut.unauthenticated();case 403:throw Ct.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:()=>n,json:async()=>(await n).json()}}};var gt=class{constructor(t){this._transport=t}send({account:t,files:e,request:n={}}){let r=new FormData;for(let a of e)r.append("file",a);return this._transport.send("v1/uploads",{...n,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 bt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var s=require("zod"),yt=class o{constructor(t){this._client=t}static SCHEMA=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{event:e}=o.SCHEMA.parse(t.body);return{event:e}}};var Rt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var Ot=class o{static DEFAULT_BASE_URL=Zt;_transport;constructor(t,{baseURL:e,...n}={}){this._transport=new ft({requestFilterables:[new dt,t],...n,baseURL:e?.toString()??o.getBaseURL()})}static getBaseURL(){return process.env[Xt]??this.DEFAULT_BASE_URL}get action(){return{list:new C(this._transport)}}get boilerplate(){return{get:new f(this._transport),list:new x(this._transport),update:new b(this._transport),create:new h(this._transport)}}get boilerplateCategory(){return{get:new R(this._transport),list:new O(this._transport),create:new y(this._transport),update:new T(this._transport),boilerplate:{list:new g(this._transport)}}}get channel(){return{get:new v(this._transport),list:new w(this._transport),update:new F(this._transport),create:new _(this._transport),compositionSection:{list:new S(this._transport)},message:{list:new J(this._transport)},twilioSendgrid:{sync:new L(this._transport)}}}get compositionSection(){return{get:new I(this._transport),list:new q(this._transport),create:new U(this._transport),update:new E(this._transport)}}get contact(){return{get:new N(this._transport),list:new j(this._transport),update:new B(this._transport),create:new G(this._transport),conversation:{list:new D(this._transport)},note:{list:new it(this._transport),create:new rt(this._transport)},notificationSubscription:{create:new ct(this._transport)},vcf:{get:new P(this._transport)}}}get conversation(){return{get:new M(this._transport),list:new H(this._transport),update:new k(this._transport),create:new l(this._transport),label:{list:new z(this._transport)},message:{list:new X(this._transport)},note:{list:new at(this._transport),create:new l(this._transport)}}}get label(){return{create:new V(this._transport),get:new W(this._transport),list:new Y(this._transport),update:new $(this._transport),delete:new Q(this._transport),contact:{list:new A(this._transport)},conversation:{list:new K(this._transport)}}}get message(){return{list:new Z(this._transport)}}get model(){return{get:new et(this._transport),list:new ot(this._transport),response:{create:new nt(this._transport)},correction:{create:new tt(this._transport)}}}get note(){return{get:new st(this._transport),update:new pt(this._transport)}}get source(){return{get:new lt(this._transport),list:new mt(this._transport)}}get upload(){return{get:new bt(this._transport),create:new gt(this._transport),delete:new xt(this._transport)}}get webhook(){return new yt(this)}get wellKnown(){return{notification:{get:new Rt(this._transport)}}}};var qt=require("commander"),oe=require("ora");function Et({client:o,ora:t}){let e=new qt.Command("actions").description("Actions");return e.addCommand(new qt.Command("list").description("List actions").action(async()=>{let n=await(0,oe.oraPromise)(()=>o.action.list.send().json(),{...t,text:"Finding actions"});console.log(n)})),e}var Pt=require("commander"),ne=require("ora");function Gt({client:o,ora:t}){let e=new Pt.Command("channels").description("Channels");return e.addCommand(new Pt.Command("list").description("List channels").action(async()=>{let n=await(0,ne.oraPromise)(()=>o.channel.list.send().json(),{...t,text:"Finding channels"});console.log(n)})),e}var Tt=require("commander"),wt=require("ora");function Nt({client:o,ora:t}){let e=new Tt.Command("contacts").description("Contacts");return e.addCommand(new Tt.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async n=>{let r=await(0,wt.oraPromise)(()=>o.contact.get.send(n).json(),{...t,text:"Finding contact"});console.log(r)})),e.addCommand(new Tt.Command("list").description("List contacts").action(async()=>{let n=await(0,wt.oraPromise)(()=>o.contact.list.send().json(),{...t,text:"Finding contacts"});console.log(n)})),e.addCommand(new Tt.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async n=>{let r=await(0,wt.oraPromise)(()=>o.contact.vcf.get.send({id:n}).response(),{...t,text:"Exporting contact"});console.log(r)})),e}var Lt=require("commander"),jt=require("ora");function At({client:o,ora:t}){let e=new Lt.Command("conversations").description("Conversations");return e.addCommand(new Lt.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let r=await(0,jt.oraPromise)(()=>o.conversation.get.send(n).json(),{...t,text:"Finding conversation"});console.log(r)})),e.addCommand(new Lt.Command("list").description("List conversations").action(async()=>{let n=await(0,jt.oraPromise)(()=>o.conversation.list.send().json(),{...t,text:"Finding conversations"});console.log(n)})),e}var _t=require("commander"),Ft=require("ora");function Bt({client:o,ora:t}){let e=new _t.Command("labels").description("Labels");return e.addCommand(new _t.Command("get").description("Find label").argument("<label>","Label ID").action(async n=>{let r=await(0,Ft.oraPromise)(()=>o.label.get.send(n).json(),{...t,text:"Finding label"});console.log(r)})),e.addCommand(new _t.Command("list").description("List labels").action(async()=>{let n=await(0,Ft.oraPromise)(()=>o.label.list.send().json(),{...t,text:"Finding labels"});console.log(n)})),e.addCommand(new _t.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async n=>{let r=await(0,Ft.oraPromise)(()=>o.label.conversation.list.send(n).json(),{...t,text:"Finding conversations"});console.log(r)})),e}var Mt=require("commander"),re=require("ora");function Dt({client:o,ora:t}){let e=new Mt.Command("messages").description("Messages");return e.addCommand(new Mt.Command("list").description("List messages").action(async()=>{let n=await(0,re.oraPromise)(()=>o.message.list.send().json(),{...t,text:"Finding messages"});console.log(n)})),e}var Ut=require("commander"),Ht=require("ora");function Kt({client:o,ora:t}){let e=new Ut.Command("models").description("Models");return e.addCommand(new Ut.Command("get").description("Find model").argument("<model>","Model ID").action(async n=>{let r=await(0,Ht.oraPromise)(()=>o.model.get.send(n).json(),{...t,text:"Finding model"});console.log(r)})),e.addCommand(new Ut.Command("list").description("List models").action(async()=>{let n=await(0,Ht.oraPromise)(()=>o.model.list.send().json(),{...t,text:"Finding models"});console.log(n)})),e}var It=require("commander"),kt=require("ora");function Vt({client:o,ora:t}){let e=new It.Command("sources").description("Sources");return e.addCommand(new It.Command("get").description("Find source").argument("<source>","Source ID").action(async n=>{let r=await(0,kt.oraPromise)(()=>o.source.get.send(n).json(),{...t,text:"Finding source"});console.log(r)})),e.addCommand(new It.Command("list").description("List sources").action(async()=>{let n=await(0,kt.oraPromise)(()=>o.source.list.send().json(),{...t,text:"Finding sources"});console.log(n)})),e}var ie=require("commander");var Qt=require("commander"),se=require("ora");function Wt({client:o,ora:t}){let e=new Qt.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new Qt.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let n=await(0,se.oraPromise)(()=>o.wellKnown.notification.get.send().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(n)})),e}function zt({client:o,ora:t}){let e=new ie.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(Wt({client:o,ora:t})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new Ot(new u)},fe=new ae.Command("gds").description("Great Detail Support System").addCommand(Et(p)).addCommand(Gt(p)).addCommand(Nt(p)).addCommand(At(p)).addCommand(Bt(p)).addCommand(Dt(p)).addCommand(Kt(p)).addCommand(Vt(p)).addCommand(zt(p)),pe=fe;pe.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-6ZAGISJI.js";import"./chunk-FBUVV5WK.js";r.parseAsync(process.argv);
|
|
@@ -292,15 +292,15 @@ declare class GetBoilerplateCategory {
|
|
|
292
292
|
};
|
|
293
293
|
}
|
|
294
294
|
|
|
295
|
-
interface IncludeOptions$
|
|
295
|
+
interface IncludeOptions$6 {
|
|
296
296
|
boilerplateCount?: boolean;
|
|
297
297
|
[key: string]: boolean | undefined;
|
|
298
298
|
}
|
|
299
|
-
interface ListBoilerplateCategoriesOptions<C extends IncludeOptions$
|
|
299
|
+
interface ListBoilerplateCategoriesOptions<C extends IncludeOptions$6> {
|
|
300
300
|
include?: C;
|
|
301
301
|
request?: RequestInit;
|
|
302
302
|
}
|
|
303
|
-
type ListBoilerplateCategoriesResponse<C extends IncludeOptions$
|
|
303
|
+
type ListBoilerplateCategoriesResponse<C extends IncludeOptions$6> = {
|
|
304
304
|
data: {
|
|
305
305
|
boilerplateCategory: BoilerplateCategory;
|
|
306
306
|
boilerplateCount?: C extends {
|
|
@@ -311,7 +311,7 @@ type ListBoilerplateCategoriesResponse<C extends IncludeOptions$5> = {
|
|
|
311
311
|
declare class ListBoilerplateCategories {
|
|
312
312
|
protected _transport: FetchTransport;
|
|
313
313
|
constructor(_transport: FetchTransport);
|
|
314
|
-
send<C extends IncludeOptions$
|
|
314
|
+
send<C extends IncludeOptions$6>({ include, request, }?: ListBoilerplateCategoriesOptions<C>): {
|
|
315
315
|
response: () => Promise<ky.KyResponse<ListBoilerplateCategoriesResponse<C>>>;
|
|
316
316
|
json: () => Promise<ListBoilerplateCategoriesResponse<C>>;
|
|
317
317
|
};
|
|
@@ -680,16 +680,16 @@ declare class CreateContact {
|
|
|
680
680
|
};
|
|
681
681
|
}
|
|
682
682
|
|
|
683
|
-
interface IncludeOptions$
|
|
683
|
+
interface IncludeOptions$5 {
|
|
684
684
|
messageCount?: boolean;
|
|
685
685
|
conversationCount?: boolean;
|
|
686
686
|
[key: string]: boolean | undefined;
|
|
687
687
|
}
|
|
688
|
-
interface GetContactOptions<C extends IncludeOptions$
|
|
688
|
+
interface GetContactOptions<C extends IncludeOptions$5> {
|
|
689
689
|
include?: C;
|
|
690
690
|
request?: RequestInit;
|
|
691
691
|
}
|
|
692
|
-
type GetContactResponse<C extends IncludeOptions$
|
|
692
|
+
type GetContactResponse<C extends IncludeOptions$5> = {
|
|
693
693
|
data: {
|
|
694
694
|
contact: Contact;
|
|
695
695
|
messageCount?: C extends {
|
|
@@ -703,7 +703,7 @@ type GetContactResponse<C extends IncludeOptions$4> = {
|
|
|
703
703
|
declare class GetContact {
|
|
704
704
|
protected _transport: FetchTransport;
|
|
705
705
|
constructor(_transport: FetchTransport);
|
|
706
|
-
send<C extends IncludeOptions$
|
|
706
|
+
send<C extends IncludeOptions$5>(id: string, { include, request }?: GetContactOptions<C>): {
|
|
707
707
|
response: () => Promise<ky.KyResponse<GetContactResponse<C>>>;
|
|
708
708
|
json: () => Promise<GetContactResponse<C>>;
|
|
709
709
|
};
|
|
@@ -785,15 +785,15 @@ type Conversation = {
|
|
|
785
785
|
channel: string;
|
|
786
786
|
} & ResponseTimestamp;
|
|
787
787
|
|
|
788
|
-
interface IncludeOptions$
|
|
788
|
+
interface IncludeOptions$4 {
|
|
789
789
|
channel?: boolean;
|
|
790
790
|
[key: string]: boolean | undefined;
|
|
791
791
|
}
|
|
792
|
-
interface GetConversationOptions<C extends IncludeOptions$
|
|
792
|
+
interface GetConversationOptions<C extends IncludeOptions$4> {
|
|
793
793
|
include?: C;
|
|
794
794
|
request?: RequestInit;
|
|
795
795
|
}
|
|
796
|
-
type GetConversationResponse<C extends IncludeOptions$
|
|
796
|
+
type GetConversationResponse<C extends IncludeOptions$4> = {
|
|
797
797
|
data: {
|
|
798
798
|
conversation: Conversation;
|
|
799
799
|
channel: C extends {
|
|
@@ -804,7 +804,7 @@ type GetConversationResponse<C extends IncludeOptions$3> = {
|
|
|
804
804
|
declare class GetConversation {
|
|
805
805
|
protected _transport: FetchTransport;
|
|
806
806
|
constructor(_transport: FetchTransport);
|
|
807
|
-
send<C extends IncludeOptions$
|
|
807
|
+
send<C extends IncludeOptions$4>(id: string, { include, request }?: GetConversationOptions<C>): {
|
|
808
808
|
response: () => Promise<ky.KyResponse<GetConversationResponse<C>>>;
|
|
809
809
|
json: () => Promise<GetConversationResponse<C>>;
|
|
810
810
|
};
|
|
@@ -864,17 +864,17 @@ type Message = {
|
|
|
864
864
|
type: "richtext";
|
|
865
865
|
}) & ResponseTimestamp;
|
|
866
866
|
|
|
867
|
-
interface IncludeOptions$
|
|
867
|
+
interface IncludeOptions$3 {
|
|
868
868
|
latestMessage?: boolean;
|
|
869
869
|
[key: string]: boolean | undefined;
|
|
870
870
|
}
|
|
871
871
|
type FilterOptions = "unresolved" | "awaitingContact" | "awaitingAgent" | (string & NonNullable<unknown>);
|
|
872
|
-
interface ListConversationOptions<C extends IncludeOptions$
|
|
872
|
+
interface ListConversationOptions<C extends IncludeOptions$3> {
|
|
873
873
|
filter?: FilterOptions;
|
|
874
874
|
include?: C;
|
|
875
875
|
request?: RequestInit;
|
|
876
876
|
}
|
|
877
|
-
type ListConversationsResponse<C extends IncludeOptions$
|
|
877
|
+
type ListConversationsResponse<C extends IncludeOptions$3> = {
|
|
878
878
|
data: {
|
|
879
879
|
conversation: Conversation;
|
|
880
880
|
latestMessage?: C extends {
|
|
@@ -885,7 +885,7 @@ type ListConversationsResponse<C extends IncludeOptions$2> = {
|
|
|
885
885
|
declare class ListConversations {
|
|
886
886
|
protected _transport: FetchTransport;
|
|
887
887
|
constructor(_transport: FetchTransport);
|
|
888
|
-
send<C extends IncludeOptions$
|
|
888
|
+
send<C extends IncludeOptions$3>({ filter, include, request, }?: ListConversationOptions<C>): {
|
|
889
889
|
response: () => Promise<ky.KyResponse<ListConversationsResponse<C>>>;
|
|
890
890
|
json: () => Promise<ListConversationsResponse<C>>;
|
|
891
891
|
};
|
|
@@ -1016,17 +1016,17 @@ declare class ListConversationLabels {
|
|
|
1016
1016
|
};
|
|
1017
1017
|
}
|
|
1018
1018
|
|
|
1019
|
-
interface IncludeOptions$
|
|
1019
|
+
interface IncludeOptions$2 {
|
|
1020
1020
|
contactCount?: boolean;
|
|
1021
1021
|
conversationCount?: boolean;
|
|
1022
1022
|
[key: string]: boolean | undefined;
|
|
1023
1023
|
}
|
|
1024
|
-
interface ListLabelsOptions<C extends IncludeOptions$
|
|
1024
|
+
interface ListLabelsOptions<C extends IncludeOptions$2> {
|
|
1025
1025
|
query?: string;
|
|
1026
1026
|
include?: C;
|
|
1027
1027
|
request?: RequestInit;
|
|
1028
1028
|
}
|
|
1029
|
-
type ListLabelsResponse<C extends IncludeOptions$
|
|
1029
|
+
type ListLabelsResponse<C extends IncludeOptions$2> = {
|
|
1030
1030
|
data: {
|
|
1031
1031
|
label: Label;
|
|
1032
1032
|
contactCount?: C extends {
|
|
@@ -1040,7 +1040,7 @@ type ListLabelsResponse<C extends IncludeOptions$1> = {
|
|
|
1040
1040
|
declare class ListLabels {
|
|
1041
1041
|
protected _transport: FetchTransport;
|
|
1042
1042
|
constructor(_transport: FetchTransport);
|
|
1043
|
-
send<C extends IncludeOptions$
|
|
1043
|
+
send<C extends IncludeOptions$2>({ query, include, request, }?: ListLabelsOptions<C>): {
|
|
1044
1044
|
response: () => Promise<ky.KyResponse<ListLabelsResponse<C>>>;
|
|
1045
1045
|
json: () => Promise<ListLabelsResponse<C>>;
|
|
1046
1046
|
};
|
|
@@ -1085,15 +1085,15 @@ declare class ListChannelMessages {
|
|
|
1085
1085
|
};
|
|
1086
1086
|
}
|
|
1087
1087
|
|
|
1088
|
-
interface IncludeOptions {
|
|
1088
|
+
interface IncludeOptions$1 {
|
|
1089
1089
|
contact?: boolean;
|
|
1090
1090
|
[key: string]: boolean | undefined;
|
|
1091
1091
|
}
|
|
1092
|
-
interface ListConversationMessagesOptions<C extends IncludeOptions> {
|
|
1092
|
+
interface ListConversationMessagesOptions<C extends IncludeOptions$1> {
|
|
1093
1093
|
include?: C;
|
|
1094
1094
|
request?: RequestInit;
|
|
1095
1095
|
}
|
|
1096
|
-
type ListConversationMessagesResponse<C extends IncludeOptions> = {
|
|
1096
|
+
type ListConversationMessagesResponse<C extends IncludeOptions$1> = {
|
|
1097
1097
|
data: {
|
|
1098
1098
|
message: Message;
|
|
1099
1099
|
contact?: C extends {
|
|
@@ -1104,26 +1104,34 @@ type ListConversationMessagesResponse<C extends IncludeOptions> = {
|
|
|
1104
1104
|
declare class ListConversationMessages {
|
|
1105
1105
|
protected _transport: FetchTransport;
|
|
1106
1106
|
constructor(_transport: FetchTransport);
|
|
1107
|
-
send<C extends IncludeOptions>(id: string, { include, request }?: ListConversationMessagesOptions<C>): {
|
|
1107
|
+
send<C extends IncludeOptions$1>(id: string, { include, request }?: ListConversationMessagesOptions<C>): {
|
|
1108
1108
|
response: () => Promise<ky.KyResponse<ListConversationMessagesResponse<C>>>;
|
|
1109
1109
|
json: () => Promise<ListConversationMessagesResponse<C>>;
|
|
1110
1110
|
};
|
|
1111
1111
|
}
|
|
1112
1112
|
|
|
1113
|
-
interface
|
|
1113
|
+
interface IncludeOptions {
|
|
1114
|
+
contact?: boolean;
|
|
1115
|
+
[key: string]: boolean | undefined;
|
|
1116
|
+
}
|
|
1117
|
+
interface ListMessagesOptions<C extends IncludeOptions> {
|
|
1118
|
+
include?: C;
|
|
1114
1119
|
request?: RequestInit;
|
|
1115
1120
|
}
|
|
1116
|
-
type ListMessagesResponse = {
|
|
1121
|
+
type ListMessagesResponse<C extends IncludeOptions> = {
|
|
1117
1122
|
data: {
|
|
1118
1123
|
message: Message;
|
|
1124
|
+
contact?: C extends {
|
|
1125
|
+
contact: true;
|
|
1126
|
+
} ? Contact : never;
|
|
1119
1127
|
}[];
|
|
1120
1128
|
};
|
|
1121
1129
|
declare class ListMessages {
|
|
1122
1130
|
protected _transport: FetchTransport;
|
|
1123
1131
|
constructor(_transport: FetchTransport);
|
|
1124
|
-
send({ request }?: ListMessagesOptions): {
|
|
1125
|
-
response: () => Promise<ky.KyResponse<ListMessagesResponse
|
|
1126
|
-
json: () => Promise<ListMessagesResponse
|
|
1132
|
+
send<C extends IncludeOptions>({ include, request, }?: ListMessagesOptions<C>): {
|
|
1133
|
+
response: () => Promise<ky.KyResponse<ListMessagesResponse<C>>>;
|
|
1134
|
+
json: () => Promise<ListMessagesResponse<C>>;
|
|
1127
1135
|
};
|
|
1128
1136
|
}
|
|
1129
1137
|
|
|
@@ -1539,22 +1547,42 @@ declare class Webhook {
|
|
|
1539
1547
|
createdAt: string;
|
|
1540
1548
|
}>, z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
1541
1549
|
type: z.ZodLiteral<"contact.created">;
|
|
1542
|
-
|
|
1550
|
+
payload: z.ZodObject<{
|
|
1551
|
+
contact: z.ZodString;
|
|
1552
|
+
}, "strip", z.ZodTypeAny, {
|
|
1553
|
+
contact: string;
|
|
1554
|
+
}, {
|
|
1555
|
+
contact: string;
|
|
1556
|
+
}>;
|
|
1543
1557
|
}, "strip", z.ZodTypeAny, {
|
|
1544
1558
|
type: "contact.created";
|
|
1545
|
-
|
|
1559
|
+
payload: {
|
|
1560
|
+
contact: string;
|
|
1561
|
+
};
|
|
1546
1562
|
}, {
|
|
1547
1563
|
type: "contact.created";
|
|
1548
|
-
|
|
1564
|
+
payload: {
|
|
1565
|
+
contact: string;
|
|
1566
|
+
};
|
|
1549
1567
|
}>, z.ZodObject<{
|
|
1550
1568
|
type: z.ZodLiteral<"message.created">;
|
|
1551
|
-
|
|
1569
|
+
payload: z.ZodObject<{
|
|
1570
|
+
message: z.ZodString;
|
|
1571
|
+
}, "strip", z.ZodTypeAny, {
|
|
1572
|
+
message: string;
|
|
1573
|
+
}, {
|
|
1574
|
+
message: string;
|
|
1575
|
+
}>;
|
|
1552
1576
|
}, "strip", z.ZodTypeAny, {
|
|
1553
|
-
message: string;
|
|
1554
1577
|
type: "message.created";
|
|
1578
|
+
payload: {
|
|
1579
|
+
message: string;
|
|
1580
|
+
};
|
|
1555
1581
|
}, {
|
|
1556
|
-
message: string;
|
|
1557
1582
|
type: "message.created";
|
|
1583
|
+
payload: {
|
|
1584
|
+
message: string;
|
|
1585
|
+
};
|
|
1558
1586
|
}>]>>;
|
|
1559
1587
|
}, "strip", z.ZodTypeAny, {
|
|
1560
1588
|
event: {
|
|
@@ -1562,10 +1590,14 @@ declare class Webhook {
|
|
|
1562
1590
|
createdAt: string;
|
|
1563
1591
|
} & ({
|
|
1564
1592
|
type: "contact.created";
|
|
1565
|
-
|
|
1593
|
+
payload: {
|
|
1594
|
+
contact: string;
|
|
1595
|
+
};
|
|
1566
1596
|
} | {
|
|
1567
|
-
message: string;
|
|
1568
1597
|
type: "message.created";
|
|
1598
|
+
payload: {
|
|
1599
|
+
message: string;
|
|
1600
|
+
};
|
|
1569
1601
|
});
|
|
1570
1602
|
}, {
|
|
1571
1603
|
event: {
|
|
@@ -1573,10 +1605,14 @@ declare class Webhook {
|
|
|
1573
1605
|
createdAt: string;
|
|
1574
1606
|
} & ({
|
|
1575
1607
|
type: "contact.created";
|
|
1576
|
-
|
|
1608
|
+
payload: {
|
|
1609
|
+
contact: string;
|
|
1610
|
+
};
|
|
1577
1611
|
} | {
|
|
1578
|
-
message: string;
|
|
1579
1612
|
type: "message.created";
|
|
1613
|
+
payload: {
|
|
1614
|
+
message: string;
|
|
1615
|
+
};
|
|
1580
1616
|
});
|
|
1581
1617
|
}>;
|
|
1582
1618
|
constructor(_client: Client);
|
|
@@ -1589,10 +1625,14 @@ declare class Webhook {
|
|
|
1589
1625
|
createdAt: string;
|
|
1590
1626
|
} & ({
|
|
1591
1627
|
type: "contact.created";
|
|
1592
|
-
|
|
1628
|
+
payload: {
|
|
1629
|
+
contact: string;
|
|
1630
|
+
};
|
|
1593
1631
|
} | {
|
|
1594
|
-
message: string;
|
|
1595
1632
|
type: "message.created";
|
|
1633
|
+
payload: {
|
|
1634
|
+
message: string;
|
|
1635
|
+
};
|
|
1596
1636
|
});
|
|
1597
1637
|
}>;
|
|
1598
1638
|
}
|
|
@@ -292,15 +292,15 @@ declare class GetBoilerplateCategory {
|
|
|
292
292
|
};
|
|
293
293
|
}
|
|
294
294
|
|
|
295
|
-
interface IncludeOptions$
|
|
295
|
+
interface IncludeOptions$6 {
|
|
296
296
|
boilerplateCount?: boolean;
|
|
297
297
|
[key: string]: boolean | undefined;
|
|
298
298
|
}
|
|
299
|
-
interface ListBoilerplateCategoriesOptions<C extends IncludeOptions$
|
|
299
|
+
interface ListBoilerplateCategoriesOptions<C extends IncludeOptions$6> {
|
|
300
300
|
include?: C;
|
|
301
301
|
request?: RequestInit;
|
|
302
302
|
}
|
|
303
|
-
type ListBoilerplateCategoriesResponse<C extends IncludeOptions$
|
|
303
|
+
type ListBoilerplateCategoriesResponse<C extends IncludeOptions$6> = {
|
|
304
304
|
data: {
|
|
305
305
|
boilerplateCategory: BoilerplateCategory;
|
|
306
306
|
boilerplateCount?: C extends {
|
|
@@ -311,7 +311,7 @@ type ListBoilerplateCategoriesResponse<C extends IncludeOptions$5> = {
|
|
|
311
311
|
declare class ListBoilerplateCategories {
|
|
312
312
|
protected _transport: FetchTransport;
|
|
313
313
|
constructor(_transport: FetchTransport);
|
|
314
|
-
send<C extends IncludeOptions$
|
|
314
|
+
send<C extends IncludeOptions$6>({ include, request, }?: ListBoilerplateCategoriesOptions<C>): {
|
|
315
315
|
response: () => Promise<ky.KyResponse<ListBoilerplateCategoriesResponse<C>>>;
|
|
316
316
|
json: () => Promise<ListBoilerplateCategoriesResponse<C>>;
|
|
317
317
|
};
|
|
@@ -680,16 +680,16 @@ declare class CreateContact {
|
|
|
680
680
|
};
|
|
681
681
|
}
|
|
682
682
|
|
|
683
|
-
interface IncludeOptions$
|
|
683
|
+
interface IncludeOptions$5 {
|
|
684
684
|
messageCount?: boolean;
|
|
685
685
|
conversationCount?: boolean;
|
|
686
686
|
[key: string]: boolean | undefined;
|
|
687
687
|
}
|
|
688
|
-
interface GetContactOptions<C extends IncludeOptions$
|
|
688
|
+
interface GetContactOptions<C extends IncludeOptions$5> {
|
|
689
689
|
include?: C;
|
|
690
690
|
request?: RequestInit;
|
|
691
691
|
}
|
|
692
|
-
type GetContactResponse<C extends IncludeOptions$
|
|
692
|
+
type GetContactResponse<C extends IncludeOptions$5> = {
|
|
693
693
|
data: {
|
|
694
694
|
contact: Contact;
|
|
695
695
|
messageCount?: C extends {
|
|
@@ -703,7 +703,7 @@ type GetContactResponse<C extends IncludeOptions$4> = {
|
|
|
703
703
|
declare class GetContact {
|
|
704
704
|
protected _transport: FetchTransport;
|
|
705
705
|
constructor(_transport: FetchTransport);
|
|
706
|
-
send<C extends IncludeOptions$
|
|
706
|
+
send<C extends IncludeOptions$5>(id: string, { include, request }?: GetContactOptions<C>): {
|
|
707
707
|
response: () => Promise<ky.KyResponse<GetContactResponse<C>>>;
|
|
708
708
|
json: () => Promise<GetContactResponse<C>>;
|
|
709
709
|
};
|
|
@@ -785,15 +785,15 @@ type Conversation = {
|
|
|
785
785
|
channel: string;
|
|
786
786
|
} & ResponseTimestamp;
|
|
787
787
|
|
|
788
|
-
interface IncludeOptions$
|
|
788
|
+
interface IncludeOptions$4 {
|
|
789
789
|
channel?: boolean;
|
|
790
790
|
[key: string]: boolean | undefined;
|
|
791
791
|
}
|
|
792
|
-
interface GetConversationOptions<C extends IncludeOptions$
|
|
792
|
+
interface GetConversationOptions<C extends IncludeOptions$4> {
|
|
793
793
|
include?: C;
|
|
794
794
|
request?: RequestInit;
|
|
795
795
|
}
|
|
796
|
-
type GetConversationResponse<C extends IncludeOptions$
|
|
796
|
+
type GetConversationResponse<C extends IncludeOptions$4> = {
|
|
797
797
|
data: {
|
|
798
798
|
conversation: Conversation;
|
|
799
799
|
channel: C extends {
|
|
@@ -804,7 +804,7 @@ type GetConversationResponse<C extends IncludeOptions$3> = {
|
|
|
804
804
|
declare class GetConversation {
|
|
805
805
|
protected _transport: FetchTransport;
|
|
806
806
|
constructor(_transport: FetchTransport);
|
|
807
|
-
send<C extends IncludeOptions$
|
|
807
|
+
send<C extends IncludeOptions$4>(id: string, { include, request }?: GetConversationOptions<C>): {
|
|
808
808
|
response: () => Promise<ky.KyResponse<GetConversationResponse<C>>>;
|
|
809
809
|
json: () => Promise<GetConversationResponse<C>>;
|
|
810
810
|
};
|
|
@@ -864,17 +864,17 @@ type Message = {
|
|
|
864
864
|
type: "richtext";
|
|
865
865
|
}) & ResponseTimestamp;
|
|
866
866
|
|
|
867
|
-
interface IncludeOptions$
|
|
867
|
+
interface IncludeOptions$3 {
|
|
868
868
|
latestMessage?: boolean;
|
|
869
869
|
[key: string]: boolean | undefined;
|
|
870
870
|
}
|
|
871
871
|
type FilterOptions = "unresolved" | "awaitingContact" | "awaitingAgent" | (string & NonNullable<unknown>);
|
|
872
|
-
interface ListConversationOptions<C extends IncludeOptions$
|
|
872
|
+
interface ListConversationOptions<C extends IncludeOptions$3> {
|
|
873
873
|
filter?: FilterOptions;
|
|
874
874
|
include?: C;
|
|
875
875
|
request?: RequestInit;
|
|
876
876
|
}
|
|
877
|
-
type ListConversationsResponse<C extends IncludeOptions$
|
|
877
|
+
type ListConversationsResponse<C extends IncludeOptions$3> = {
|
|
878
878
|
data: {
|
|
879
879
|
conversation: Conversation;
|
|
880
880
|
latestMessage?: C extends {
|
|
@@ -885,7 +885,7 @@ type ListConversationsResponse<C extends IncludeOptions$2> = {
|
|
|
885
885
|
declare class ListConversations {
|
|
886
886
|
protected _transport: FetchTransport;
|
|
887
887
|
constructor(_transport: FetchTransport);
|
|
888
|
-
send<C extends IncludeOptions$
|
|
888
|
+
send<C extends IncludeOptions$3>({ filter, include, request, }?: ListConversationOptions<C>): {
|
|
889
889
|
response: () => Promise<ky.KyResponse<ListConversationsResponse<C>>>;
|
|
890
890
|
json: () => Promise<ListConversationsResponse<C>>;
|
|
891
891
|
};
|
|
@@ -1016,17 +1016,17 @@ declare class ListConversationLabels {
|
|
|
1016
1016
|
};
|
|
1017
1017
|
}
|
|
1018
1018
|
|
|
1019
|
-
interface IncludeOptions$
|
|
1019
|
+
interface IncludeOptions$2 {
|
|
1020
1020
|
contactCount?: boolean;
|
|
1021
1021
|
conversationCount?: boolean;
|
|
1022
1022
|
[key: string]: boolean | undefined;
|
|
1023
1023
|
}
|
|
1024
|
-
interface ListLabelsOptions<C extends IncludeOptions$
|
|
1024
|
+
interface ListLabelsOptions<C extends IncludeOptions$2> {
|
|
1025
1025
|
query?: string;
|
|
1026
1026
|
include?: C;
|
|
1027
1027
|
request?: RequestInit;
|
|
1028
1028
|
}
|
|
1029
|
-
type ListLabelsResponse<C extends IncludeOptions$
|
|
1029
|
+
type ListLabelsResponse<C extends IncludeOptions$2> = {
|
|
1030
1030
|
data: {
|
|
1031
1031
|
label: Label;
|
|
1032
1032
|
contactCount?: C extends {
|
|
@@ -1040,7 +1040,7 @@ type ListLabelsResponse<C extends IncludeOptions$1> = {
|
|
|
1040
1040
|
declare class ListLabels {
|
|
1041
1041
|
protected _transport: FetchTransport;
|
|
1042
1042
|
constructor(_transport: FetchTransport);
|
|
1043
|
-
send<C extends IncludeOptions$
|
|
1043
|
+
send<C extends IncludeOptions$2>({ query, include, request, }?: ListLabelsOptions<C>): {
|
|
1044
1044
|
response: () => Promise<ky.KyResponse<ListLabelsResponse<C>>>;
|
|
1045
1045
|
json: () => Promise<ListLabelsResponse<C>>;
|
|
1046
1046
|
};
|
|
@@ -1085,15 +1085,15 @@ declare class ListChannelMessages {
|
|
|
1085
1085
|
};
|
|
1086
1086
|
}
|
|
1087
1087
|
|
|
1088
|
-
interface IncludeOptions {
|
|
1088
|
+
interface IncludeOptions$1 {
|
|
1089
1089
|
contact?: boolean;
|
|
1090
1090
|
[key: string]: boolean | undefined;
|
|
1091
1091
|
}
|
|
1092
|
-
interface ListConversationMessagesOptions<C extends IncludeOptions> {
|
|
1092
|
+
interface ListConversationMessagesOptions<C extends IncludeOptions$1> {
|
|
1093
1093
|
include?: C;
|
|
1094
1094
|
request?: RequestInit;
|
|
1095
1095
|
}
|
|
1096
|
-
type ListConversationMessagesResponse<C extends IncludeOptions> = {
|
|
1096
|
+
type ListConversationMessagesResponse<C extends IncludeOptions$1> = {
|
|
1097
1097
|
data: {
|
|
1098
1098
|
message: Message;
|
|
1099
1099
|
contact?: C extends {
|
|
@@ -1104,26 +1104,34 @@ type ListConversationMessagesResponse<C extends IncludeOptions> = {
|
|
|
1104
1104
|
declare class ListConversationMessages {
|
|
1105
1105
|
protected _transport: FetchTransport;
|
|
1106
1106
|
constructor(_transport: FetchTransport);
|
|
1107
|
-
send<C extends IncludeOptions>(id: string, { include, request }?: ListConversationMessagesOptions<C>): {
|
|
1107
|
+
send<C extends IncludeOptions$1>(id: string, { include, request }?: ListConversationMessagesOptions<C>): {
|
|
1108
1108
|
response: () => Promise<ky.KyResponse<ListConversationMessagesResponse<C>>>;
|
|
1109
1109
|
json: () => Promise<ListConversationMessagesResponse<C>>;
|
|
1110
1110
|
};
|
|
1111
1111
|
}
|
|
1112
1112
|
|
|
1113
|
-
interface
|
|
1113
|
+
interface IncludeOptions {
|
|
1114
|
+
contact?: boolean;
|
|
1115
|
+
[key: string]: boolean | undefined;
|
|
1116
|
+
}
|
|
1117
|
+
interface ListMessagesOptions<C extends IncludeOptions> {
|
|
1118
|
+
include?: C;
|
|
1114
1119
|
request?: RequestInit;
|
|
1115
1120
|
}
|
|
1116
|
-
type ListMessagesResponse = {
|
|
1121
|
+
type ListMessagesResponse<C extends IncludeOptions> = {
|
|
1117
1122
|
data: {
|
|
1118
1123
|
message: Message;
|
|
1124
|
+
contact?: C extends {
|
|
1125
|
+
contact: true;
|
|
1126
|
+
} ? Contact : never;
|
|
1119
1127
|
}[];
|
|
1120
1128
|
};
|
|
1121
1129
|
declare class ListMessages {
|
|
1122
1130
|
protected _transport: FetchTransport;
|
|
1123
1131
|
constructor(_transport: FetchTransport);
|
|
1124
|
-
send({ request }?: ListMessagesOptions): {
|
|
1125
|
-
response: () => Promise<ky.KyResponse<ListMessagesResponse
|
|
1126
|
-
json: () => Promise<ListMessagesResponse
|
|
1132
|
+
send<C extends IncludeOptions>({ include, request, }?: ListMessagesOptions<C>): {
|
|
1133
|
+
response: () => Promise<ky.KyResponse<ListMessagesResponse<C>>>;
|
|
1134
|
+
json: () => Promise<ListMessagesResponse<C>>;
|
|
1127
1135
|
};
|
|
1128
1136
|
}
|
|
1129
1137
|
|
|
@@ -1539,22 +1547,42 @@ declare class Webhook {
|
|
|
1539
1547
|
createdAt: string;
|
|
1540
1548
|
}>, z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
1541
1549
|
type: z.ZodLiteral<"contact.created">;
|
|
1542
|
-
|
|
1550
|
+
payload: z.ZodObject<{
|
|
1551
|
+
contact: z.ZodString;
|
|
1552
|
+
}, "strip", z.ZodTypeAny, {
|
|
1553
|
+
contact: string;
|
|
1554
|
+
}, {
|
|
1555
|
+
contact: string;
|
|
1556
|
+
}>;
|
|
1543
1557
|
}, "strip", z.ZodTypeAny, {
|
|
1544
1558
|
type: "contact.created";
|
|
1545
|
-
|
|
1559
|
+
payload: {
|
|
1560
|
+
contact: string;
|
|
1561
|
+
};
|
|
1546
1562
|
}, {
|
|
1547
1563
|
type: "contact.created";
|
|
1548
|
-
|
|
1564
|
+
payload: {
|
|
1565
|
+
contact: string;
|
|
1566
|
+
};
|
|
1549
1567
|
}>, z.ZodObject<{
|
|
1550
1568
|
type: z.ZodLiteral<"message.created">;
|
|
1551
|
-
|
|
1569
|
+
payload: z.ZodObject<{
|
|
1570
|
+
message: z.ZodString;
|
|
1571
|
+
}, "strip", z.ZodTypeAny, {
|
|
1572
|
+
message: string;
|
|
1573
|
+
}, {
|
|
1574
|
+
message: string;
|
|
1575
|
+
}>;
|
|
1552
1576
|
}, "strip", z.ZodTypeAny, {
|
|
1553
|
-
message: string;
|
|
1554
1577
|
type: "message.created";
|
|
1578
|
+
payload: {
|
|
1579
|
+
message: string;
|
|
1580
|
+
};
|
|
1555
1581
|
}, {
|
|
1556
|
-
message: string;
|
|
1557
1582
|
type: "message.created";
|
|
1583
|
+
payload: {
|
|
1584
|
+
message: string;
|
|
1585
|
+
};
|
|
1558
1586
|
}>]>>;
|
|
1559
1587
|
}, "strip", z.ZodTypeAny, {
|
|
1560
1588
|
event: {
|
|
@@ -1562,10 +1590,14 @@ declare class Webhook {
|
|
|
1562
1590
|
createdAt: string;
|
|
1563
1591
|
} & ({
|
|
1564
1592
|
type: "contact.created";
|
|
1565
|
-
|
|
1593
|
+
payload: {
|
|
1594
|
+
contact: string;
|
|
1595
|
+
};
|
|
1566
1596
|
} | {
|
|
1567
|
-
message: string;
|
|
1568
1597
|
type: "message.created";
|
|
1598
|
+
payload: {
|
|
1599
|
+
message: string;
|
|
1600
|
+
};
|
|
1569
1601
|
});
|
|
1570
1602
|
}, {
|
|
1571
1603
|
event: {
|
|
@@ -1573,10 +1605,14 @@ declare class Webhook {
|
|
|
1573
1605
|
createdAt: string;
|
|
1574
1606
|
} & ({
|
|
1575
1607
|
type: "contact.created";
|
|
1576
|
-
|
|
1608
|
+
payload: {
|
|
1609
|
+
contact: string;
|
|
1610
|
+
};
|
|
1577
1611
|
} | {
|
|
1578
|
-
message: string;
|
|
1579
1612
|
type: "message.created";
|
|
1613
|
+
payload: {
|
|
1614
|
+
message: string;
|
|
1615
|
+
};
|
|
1580
1616
|
});
|
|
1581
1617
|
}>;
|
|
1582
1618
|
constructor(_client: Client);
|
|
@@ -1589,10 +1625,14 @@ declare class Webhook {
|
|
|
1589
1625
|
createdAt: string;
|
|
1590
1626
|
} & ({
|
|
1591
1627
|
type: "contact.created";
|
|
1592
|
-
|
|
1628
|
+
payload: {
|
|
1629
|
+
contact: string;
|
|
1630
|
+
};
|
|
1593
1631
|
} | {
|
|
1594
|
-
message: string;
|
|
1595
1632
|
type: "message.created";
|
|
1633
|
+
payload: {
|
|
1634
|
+
message: string;
|
|
1635
|
+
};
|
|
1596
1636
|
});
|
|
1597
1637
|
}>;
|
|
1598
1638
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Ht=Object.create;var Ot=Object.defineProperty;var Dt=Object.getOwnPropertyDescriptor;var kt=Object.getOwnPropertyNames;var Kt=Object.getPrototypeOf,Vt=Object.prototype.hasOwnProperty;var It=(o,t)=>{for(var e in t)Ot(o,e,{get:t[e],enumerable:!0})},wt=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of kt(t))!Vt.call(o,n)&&n!==e&&Ot(o,n,{get:()=>t[n],enumerable:!(r=Dt(t,n))||r.enumerable});return o};var Et=(o,t,e)=>(e=o!=null?Ht(Kt(o)):{},wt(t||!o||!o.__esModule?Ot(e,"default",{value:o,enumerable:!0}):e,o)),Qt=o=>wt(Ot({},"__esModule",{value:!0}),o);var zt={};It(zt,{Client:()=>f,DEFAULT_SUPPORT_BASE_URL:()=>vt,Error:()=>Ft,KeyAuthentication:()=>yt,PublicAuthentication:()=>_t,TokenAuthentication:()=>Tt,default:()=>f});module.exports=Qt(zt);var vt="https://api.support.greatdetail.com",qt={"X-Powered-By":"GDSupport/JavaScript"},At="api-key";var C=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};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 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,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var R=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var y=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.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 _=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var O=class{constructor(t){this._transport=t}send({include:t,request:e={}}={}){return this._transport.send("v1/boilerplate-categories",{...e,method:"GET",searchParams:[...this._transport.includeQuery(t??{})]})}};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",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var L=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var U=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var F=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var Ut=require("zod"),S=class o{constructor(t){this._transport=t}static SCHEMA=Ut.z.object({overwrite:Ut.z.boolean().optional()});send(t,{body:e,request:r={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},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",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var w=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var E=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var q=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...e,method:"GET"})}};var A=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/composition-sections",{...t,method:"GET"})}};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",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var Gt="SUPPORT_ACCESS_TOKEN",Nt="SUPPORT_API_KEY",Pt="SUPPORT_KEY_NAME",Bt="SUPPORT_BASE_URL";var N=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 P=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var 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 M=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/contacts",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var j=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var D=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,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var K=class{constructor(t){this._transport=t}send({filter:t,include:e,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...t?[["filter",t]]:[],...this._transport.includeQuery(e??{})]})}};var V=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var Q=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var z=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var W=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Y=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var $=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...e,method:"GET"})}};var J=class{constructor(t){this._transport=t}send({query:t,include:e,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.includeQuery(e??{})]})}};var X=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var Z=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var tt=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var et=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var ot=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},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:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},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",headers:{...r.headers,"Content-Type":"application/json"},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",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var pt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var it=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:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var dt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var ut=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=qt;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 r=[];if(t){let n=Array.isArray(t)?t:[t];for(let p of n)r.push(["category",p])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:r})}};var Mt=Et(require("is-network-error"),1),Lt=Et(require("ky"),1);var s=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends s{};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 i=class extends s{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 s{};var l=class extends s{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var ft=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Lt.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[r=>{for(let n of this.options.requestFilterables){let p=n.getHeaders();for(let[St,jt]of Object.entries(p))r.headers.has(St)||r.headers.set(St,jt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}includeQuery(t){let 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,Mt.default)(n))throw new m("A network error occurred",{cause:n});if(n instanceof Lt.HTTPError){let p=n.response.status;switch(console.error(JSON.stringify(n.response)),p){case 400:throw l.badRequest();case 401:throw d.unauthenticated();case 403:throw u.forbidden();case 404:throw i.notFound(t);case 405:throw i.forbiddenMethod(t,e.method??"GET");case 415:throw l.unsupportedMediaType();case 418:throw i.teapot();case 429:throw i.rateLimited()}if(p>=500&&p<600)throw s.serverError(p)}throw n});return{response:()=>r,json:async()=>(await r).json()}}};var Ct=class{constructor(t){this._transport=t}send({account:t,files:e,request:r={}}){let n=new FormData;for(let p of e)n.append("file",p);return this._transport.send("v1/uploads",{...r,method:"POST",body:n,searchParams:{account:t}})}};var gt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var bt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var a=require("zod"),xt=class o{constructor(t){this._client=t}static SCHEMA=a.z.object({event:a.z.intersection(a.z.object({id:a.z.string(),createdAt:a.z.string().datetime()}),a.z.discriminatedUnion("type",[a.z.object({type:a.z.literal("contact.created"),contact:a.z.string()}),a.z.object({type:a.z.literal("message.created"),message:a.z.string()})]))});async event({request:t}){let{event:e}=o.SCHEMA.parse(t.body);return{event:e}}};var Rt=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=vt;_transport;constructor(t,{baseURL:e,...r}={}){this._transport=new ft({requestFilterables:[new ut,t],...r,baseURL:e?.toString()??o.getBaseURL()})}static getBaseURL(){return process.env[Bt]??this.DEFAULT_BASE_URL}get action(){return{list:new C(this._transport)}}get boilerplate(){return{get:new b(this._transport),list:new R(this._transport),update:new y(this._transport),create:new g(this._transport)}}get boilerplateCategory(){return{get:new _(this._transport),list:new O(this._transport),create:new T(this._transport),update:new v(this._transport),boilerplate:{list:new x(this._transport)}}}get channel(){return{get:new U(this._transport),list:new F(this._transport),update:new I(this._transport),create:new L(this._transport),compositionSection:{list:new q(this._transport)},message:{list:new Z(this._transport)},twilioSendgrid:{sync:new S(this._transport)}}}get compositionSection(){return{get:new E(this._transport),list:new A(this._transport),create:new w(this._transport),update:new G(this._transport)}}get contact(){return{get:new B(this._transport),list:new M(this._transport),update:new H(this._transport),create:new P(this._transport),conversation:{list:new k(this._transport)},note:{list:new it(this._transport),create:new at(this._transport)},notificationSubscription:{create:new dt(this._transport)},vcf:{get:new N(this._transport)}}}get conversation(){return{get:new D(this._transport),list:new K(this._transport),update:new Q(this._transport),create:new h(this._transport),label:{list:new $(this._transport)},message:{list:new tt(this._transport)},note:{list:new ct(this._transport),create:new h(this._transport)}}}get label(){return{create:new z(this._transport),get:new Y(this._transport),list:new J(this._transport),update:new X(this._transport),delete:new W(this._transport),contact:{list:new j(this._transport)},conversation:{list:new V(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 pt(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 bt(this._transport),create:new Ct(this._transport),delete:new gt(this._transport)}}get webhook(){return new xt(this)}get wellKnown(){return{notification:{get:new Rt(this._transport)}}}};var Ft={};It(Ft,{AuthError:()=>c,AuthenticationError:()=>d,AuthorizationError:()=>u,LogicError:()=>i,NetworkError:()=>m,SupportError:()=>s,ValidationError:()=>l});var yt=class o{static DEFAULT_NAME=At;name;#t;constructor({name:t=process.env[Pt]??o.DEFAULT_NAME,key:e=process.env[Nt]}={}){if(!e)throw new Error("API Key option must be specified when using Key Authentication");this.name=t,this.#t=e}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var Tt=class{#t;constructor({token:t=process.env[Gt]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var _t=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 Ht=Object.create;var Ot=Object.defineProperty;var Dt=Object.getOwnPropertyDescriptor;var kt=Object.getOwnPropertyNames;var Kt=Object.getPrototypeOf,Vt=Object.prototype.hasOwnProperty;var It=(o,t)=>{for(var e in t)Ot(o,e,{get:t[e],enumerable:!0})},wt=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of kt(t))!Vt.call(o,n)&&n!==e&&Ot(o,n,{get:()=>t[n],enumerable:!(r=Dt(t,n))||r.enumerable});return o};var Et=(o,t,e)=>(e=o!=null?Ht(Kt(o)):{},wt(t||!o||!o.__esModule?Ot(e,"default",{value:o,enumerable:!0}):e,o)),Qt=o=>wt(Ot({},"__esModule",{value:!0}),o);var zt={};It(zt,{Client:()=>f,DEFAULT_SUPPORT_BASE_URL:()=>vt,Error:()=>Ft,KeyAuthentication:()=>yt,PublicAuthentication:()=>_t,TokenAuthentication:()=>Tt,default:()=>f});module.exports=Qt(zt);var vt="https://api.support.greatdetail.com",qt={"X-Powered-By":"GDSupport/JavaScript"},At="api-key";var C=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};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 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,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var R=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var y=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.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 _=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var O=class{constructor(t){this._transport=t}send({include:t,request:e={}}={}){return this._transport.send("v1/boilerplate-categories",{...e,method:"GET",searchParams:[...this._transport.includeQuery(t??{})]})}};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",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var L=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var U=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var F=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var Ut=require("zod"),S=class o{constructor(t){this._transport=t}static SCHEMA=Ut.z.object({overwrite:Ut.z.boolean().optional()});send(t,{body:e,request:r={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},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",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var w=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var E=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var q=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...e,method:"GET"})}};var A=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/composition-sections",{...t,method:"GET"})}};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",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var Gt="SUPPORT_ACCESS_TOKEN",Nt="SUPPORT_API_KEY",Pt="SUPPORT_KEY_NAME",Bt="SUPPORT_BASE_URL";var N=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 P=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var 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 M=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/contacts",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var j=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var D=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,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var K=class{constructor(t){this._transport=t}send({filter:t,include:e,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...t?[["filter",t]]:[],...this._transport.includeQuery(e??{})]})}};var V=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var Q=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var z=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var W=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Y=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var $=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...e,method:"GET"})}};var J=class{constructor(t){this._transport=t}send({query:t,include:e,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.includeQuery(e??{})]})}};var X=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var Z=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var tt=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var et=class{constructor(t){this._transport=t}send({include:t,request:e={}}={}){return this._transport.send("v1/messages",{...e,method:"GET",searchParams:[...this._transport.includeQuery(t??{})]})}};var ot=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},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:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",timeout:12e4,headers:{...r.headers,"Content-Type":"application/json"},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",headers:{...r.headers,"Content-Type":"application/json"},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",headers:{...r.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 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:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var dt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var ut=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=qt;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 r=[];if(t){let n=Array.isArray(t)?t:[t];for(let i of n)r.push(["category",i])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:r})}};var Mt=Et(require("is-network-error"),1),Lt=Et(require("ky"),1);var s=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends s{};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 s{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 s{};var l=class extends s{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var ft=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Lt.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[r=>{for(let n of this.options.requestFilterables){let i=n.getHeaders();for(let[St,jt]of Object.entries(i))r.headers.has(St)||r.headers.set(St,jt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}includeQuery(t){let 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,Mt.default)(n))throw new m("A network error occurred",{cause:n});if(n instanceof Lt.HTTPError){let i=n.response.status;switch(console.error(JSON.stringify(n.response)),i){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(i>=500&&i<600)throw s.serverError(i)}throw n});return{response:()=>r,json:async()=>(await r).json()}}};var Ct=class{constructor(t){this._transport=t}send({account:t,files:e,request:r={}}){let n=new FormData;for(let i of e)n.append("file",i);return this._transport.send("v1/uploads",{...r,method:"POST",body:n,searchParams:{account:t}})}};var gt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var bt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var a=require("zod"),xt=class o{constructor(t){this._client=t}static SCHEMA=a.z.object({event:a.z.intersection(a.z.object({id:a.z.string(),createdAt:a.z.string().datetime()}),a.z.discriminatedUnion("type",[a.z.object({type:a.z.literal("contact.created"),payload:a.z.object({contact:a.z.string()})}),a.z.object({type:a.z.literal("message.created"),payload:a.z.object({message:a.z.string()})})]))});async event({request:t}){let{event:e}=o.SCHEMA.parse(t.body);return{event:e}}};var Rt=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=vt;_transport;constructor(t,{baseURL:e,...r}={}){this._transport=new ft({requestFilterables:[new ut,t],...r,baseURL:e?.toString()??o.getBaseURL()})}static getBaseURL(){return process.env[Bt]??this.DEFAULT_BASE_URL}get action(){return{list:new C(this._transport)}}get boilerplate(){return{get:new b(this._transport),list:new R(this._transport),update:new y(this._transport),create:new g(this._transport)}}get boilerplateCategory(){return{get:new _(this._transport),list:new O(this._transport),create:new T(this._transport),update:new v(this._transport),boilerplate:{list:new x(this._transport)}}}get channel(){return{get:new U(this._transport),list:new F(this._transport),update:new I(this._transport),create:new L(this._transport),compositionSection:{list:new q(this._transport)},message:{list:new Z(this._transport)},twilioSendgrid:{sync:new S(this._transport)}}}get compositionSection(){return{get:new E(this._transport),list:new A(this._transport),create:new w(this._transport),update:new G(this._transport)}}get contact(){return{get:new B(this._transport),list:new M(this._transport),update:new H(this._transport),create:new P(this._transport),conversation:{list:new k(this._transport)},note:{list:new pt(this._transport),create:new at(this._transport)},notificationSubscription:{create:new dt(this._transport)},vcf:{get:new N(this._transport)}}}get conversation(){return{get:new D(this._transport),list:new K(this._transport),update:new Q(this._transport),create:new h(this._transport),label:{list:new $(this._transport)},message:{list:new tt(this._transport)},note:{list:new ct(this._transport),create:new h(this._transport)}}}get label(){return{create:new z(this._transport),get:new Y(this._transport),list:new J(this._transport),update:new X(this._transport),delete:new W(this._transport),contact:{list:new j(this._transport)},conversation:{list:new V(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 it(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 bt(this._transport),create:new Ct(this._transport),delete:new gt(this._transport)}}get webhook(){return new xt(this)}get wellKnown(){return{notification:{get:new Rt(this._transport)}}}};var Ft={};It(Ft,{AuthError:()=>c,AuthenticationError:()=>d,AuthorizationError:()=>u,LogicError:()=>p,NetworkError:()=>m,SupportError:()=>s,ValidationError:()=>l});var yt=class o{static DEFAULT_NAME=At;name;#t;constructor({name:t=process.env[Pt]??o.DEFAULT_NAME,key:e=process.env[Nt]}={}){if(!e)throw new Error("API Key option must be specified when using Key Authentication");this.name=t,this.#t=e}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var Tt=class{#t;constructor({token:t=process.env[Gt]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var _t=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 Action, B as Boilerplate, g as BoilerplateCategory, l as Channel, C as Client, q as CompositionSection, w as Contact, h as CreateBoilerplateCategoryResponse, d as CreateBoilerplateResponse, p as CreateChannelResponse, t as CreateCompositionSectionResponse, a6 as CreateContactNoteResponse, ag as CreateContactNotificationSubscriptionResponse, x as CreateContactResponse, a7 as CreateConversationNoteResponse, a3 as CreateCorrectionResponse, N as CreateLabelResponse, a4 as CreateResponseResponse, ai as CreateUploadResponse, P as DeleteLabelResponse, ak as DeleteUploadResponse, i as GetBoilerplateCategoryResponse, G as GetBoilerplateResponse, n as GetChannelResponse, r as GetCompositionSectionResponse, y as GetContactResponse, F as GetConversationResponse, Q as GetLabelResponse, a1 as GetModelResponse, a8 as GetNoteResponse, al as GetNotificationWellKnownResponse, ad as GetSourceResponse, aj as GetUploadResponse, M as Label, L as ListActionsResponse, j as ListBoilerplateCategoriesResponse, e as ListBoilerplateCategoryBoilerplatesResponse, f as ListBoilerplatesResponse, u as ListChannelCompositionSectionsResponse, $ as ListChannelMessagesResponse, m as ListChannelsResponse, s as ListCompositionSectionsResponse, K as ListContactConversationsResponse, a9 as ListContactNotesResponse, z as ListContactsResponse, X as ListConversationLabelsResponse, Z as ListConversationMessagesResponse, aa as ListConversationNotesResponse, H as ListConversationsResponse, D as ListLabelContactsResponse, I as ListLabelConversationsResponse, S as ListLabelsResponse, _ as ListMessagesResponse, a2 as ListModelsResponse, ae as ListSourcesResponse, Y as Message, a0 as Model, a5 as Note, af as NotificationSubscription, O as Options, R as RequestFilterable, ac as Source, b as TransportOptions, T as TwilioSendgridChannelSyncResponse, k as UpdateBoilerplateCategoryResponse, U as UpdateBoilerplateResponse, o as UpdateChannelResponse, v as UpdateCompositionSectionResponse, E as UpdateContactResponse, J as UpdateConversationResponse, V as UpdateLabelResponse, ab as UpdateNoteResponse, ah as Upload, W as WebhookResponse, C as default } from './index-
|
|
1
|
+
import { A as Authentication, a as Conversation } from './index-BciOGkft.cjs';
|
|
2
|
+
export { c as Action, B as Boilerplate, g as BoilerplateCategory, l as Channel, C as Client, q as CompositionSection, w as Contact, h as CreateBoilerplateCategoryResponse, d as CreateBoilerplateResponse, p as CreateChannelResponse, t as CreateCompositionSectionResponse, a6 as CreateContactNoteResponse, ag as CreateContactNotificationSubscriptionResponse, x as CreateContactResponse, a7 as CreateConversationNoteResponse, a3 as CreateCorrectionResponse, N as CreateLabelResponse, a4 as CreateResponseResponse, ai as CreateUploadResponse, P as DeleteLabelResponse, ak as DeleteUploadResponse, i as GetBoilerplateCategoryResponse, G as GetBoilerplateResponse, n as GetChannelResponse, r as GetCompositionSectionResponse, y as GetContactResponse, F as GetConversationResponse, Q as GetLabelResponse, a1 as GetModelResponse, a8 as GetNoteResponse, al as GetNotificationWellKnownResponse, ad as GetSourceResponse, aj as GetUploadResponse, M as Label, L as ListActionsResponse, j as ListBoilerplateCategoriesResponse, e as ListBoilerplateCategoryBoilerplatesResponse, f as ListBoilerplatesResponse, u as ListChannelCompositionSectionsResponse, $ as ListChannelMessagesResponse, m as ListChannelsResponse, s as ListCompositionSectionsResponse, K as ListContactConversationsResponse, a9 as ListContactNotesResponse, z as ListContactsResponse, X as ListConversationLabelsResponse, Z as ListConversationMessagesResponse, aa as ListConversationNotesResponse, H as ListConversationsResponse, D as ListLabelContactsResponse, I as ListLabelConversationsResponse, S as ListLabelsResponse, _ as ListMessagesResponse, a2 as ListModelsResponse, ae as ListSourcesResponse, Y as Message, a0 as Model, a5 as Note, af as NotificationSubscription, O as Options, R as RequestFilterable, ac as Source, b as TransportOptions, T as TwilioSendgridChannelSyncResponse, k as UpdateBoilerplateCategoryResponse, U as UpdateBoilerplateResponse, o as UpdateChannelResponse, v as UpdateCompositionSectionResponse, E as UpdateContactResponse, J as UpdateConversationResponse, V as UpdateLabelResponse, ab as UpdateNoteResponse, ah as Upload, W as WebhookResponse, C as default } from './index-BciOGkft.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 Action, B as Boilerplate, g as BoilerplateCategory, l as Channel, C as Client, q as CompositionSection, w as Contact, h as CreateBoilerplateCategoryResponse, d as CreateBoilerplateResponse, p as CreateChannelResponse, t as CreateCompositionSectionResponse, a6 as CreateContactNoteResponse, ag as CreateContactNotificationSubscriptionResponse, x as CreateContactResponse, a7 as CreateConversationNoteResponse, a3 as CreateCorrectionResponse, N as CreateLabelResponse, a4 as CreateResponseResponse, ai as CreateUploadResponse, P as DeleteLabelResponse, ak as DeleteUploadResponse, i as GetBoilerplateCategoryResponse, G as GetBoilerplateResponse, n as GetChannelResponse, r as GetCompositionSectionResponse, y as GetContactResponse, F as GetConversationResponse, Q as GetLabelResponse, a1 as GetModelResponse, a8 as GetNoteResponse, al as GetNotificationWellKnownResponse, ad as GetSourceResponse, aj as GetUploadResponse, M as Label, L as ListActionsResponse, j as ListBoilerplateCategoriesResponse, e as ListBoilerplateCategoryBoilerplatesResponse, f as ListBoilerplatesResponse, u as ListChannelCompositionSectionsResponse, $ as ListChannelMessagesResponse, m as ListChannelsResponse, s as ListCompositionSectionsResponse, K as ListContactConversationsResponse, a9 as ListContactNotesResponse, z as ListContactsResponse, X as ListConversationLabelsResponse, Z as ListConversationMessagesResponse, aa as ListConversationNotesResponse, H as ListConversationsResponse, D as ListLabelContactsResponse, I as ListLabelConversationsResponse, S as ListLabelsResponse, _ as ListMessagesResponse, a2 as ListModelsResponse, ae as ListSourcesResponse, Y as Message, a0 as Model, a5 as Note, af as NotificationSubscription, O as Options, R as RequestFilterable, ac as Source, b as TransportOptions, T as TwilioSendgridChannelSyncResponse, k as UpdateBoilerplateCategoryResponse, U as UpdateBoilerplateResponse, o as UpdateChannelResponse, v as UpdateCompositionSectionResponse, E as UpdateContactResponse, J as UpdateConversationResponse, V as UpdateLabelResponse, ab as UpdateNoteResponse, ah as Upload, W as WebhookResponse, C as default } from './index-
|
|
1
|
+
import { A as Authentication, a as Conversation } from './index-BciOGkft.js';
|
|
2
|
+
export { c as Action, B as Boilerplate, g as BoilerplateCategory, l as Channel, C as Client, q as CompositionSection, w as Contact, h as CreateBoilerplateCategoryResponse, d as CreateBoilerplateResponse, p as CreateChannelResponse, t as CreateCompositionSectionResponse, a6 as CreateContactNoteResponse, ag as CreateContactNotificationSubscriptionResponse, x as CreateContactResponse, a7 as CreateConversationNoteResponse, a3 as CreateCorrectionResponse, N as CreateLabelResponse, a4 as CreateResponseResponse, ai as CreateUploadResponse, P as DeleteLabelResponse, ak as DeleteUploadResponse, i as GetBoilerplateCategoryResponse, G as GetBoilerplateResponse, n as GetChannelResponse, r as GetCompositionSectionResponse, y as GetContactResponse, F as GetConversationResponse, Q as GetLabelResponse, a1 as GetModelResponse, a8 as GetNoteResponse, al as GetNotificationWellKnownResponse, ad as GetSourceResponse, aj as GetUploadResponse, M as Label, L as ListActionsResponse, j as ListBoilerplateCategoriesResponse, e as ListBoilerplateCategoryBoilerplatesResponse, f as ListBoilerplatesResponse, u as ListChannelCompositionSectionsResponse, $ as ListChannelMessagesResponse, m as ListChannelsResponse, s as ListCompositionSectionsResponse, K as ListContactConversationsResponse, a9 as ListContactNotesResponse, z as ListContactsResponse, X as ListConversationLabelsResponse, Z as ListConversationMessagesResponse, aa as ListConversationNotesResponse, H as ListConversationsResponse, D as ListLabelContactsResponse, I as ListLabelConversationsResponse, S as ListLabelsResponse, _ as ListMessagesResponse, a2 as ListModelsResponse, ae as ListSourcesResponse, Y as Message, a0 as Model, a5 as Note, af as NotificationSubscription, O as Options, R as RequestFilterable, ac as Source, b as TransportOptions, T as TwilioSendgridChannelSyncResponse, k as UpdateBoilerplateCategoryResponse, U as UpdateBoilerplateResponse, o as UpdateChannelResponse, v as UpdateCompositionSectionResponse, E as UpdateContactResponse, J as UpdateConversationResponse, V as UpdateLabelResponse, ab as UpdateNoteResponse, ah as Upload, W as WebhookResponse, C as default } from './index-BciOGkft.js';
|
|
3
3
|
import 'ky';
|
|
4
4
|
import 'zod';
|
|
5
5
|
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as d,b as g,c as s,d as p,e as n,f as _,g as a,h as f,i as m,j as u,k as c,l as x,m as l,n as h,o as A}from"./chunk-
|
|
1
|
+
import{a as d,b as g,c as s,d as p,e as n,f as _,g as a,h as f,i as m,j as u,k as c,l as x,m as l,n as h,o as A}from"./chunk-FBUVV5WK.js";var E={};d(E,{AuthError:()=>m,AuthenticationError:()=>u,AuthorizationError:()=>c,LogicError:()=>x,NetworkError:()=>l,SupportError:()=>f,ValidationError:()=>h});var t=class e{static DEFAULT_NAME=a;name;#r;constructor({name:r=process.env[n]??e.DEFAULT_NAME,key:i=process.env[p]}={}){if(!i)throw new Error("API Key option must be specified when using Key Authentication");this.name=r,this.#r=i}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#r)}`}}};var o=class{#r;constructor({token:r=process.env[s]}={}){if(!r)throw new Error("Access Token option must be specified when using Token Authentication");this.#r=r}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Bearer ${this.#r}`}}};export{A as Client,_ as DEFAULT_SUPPORT_BASE_URL,E as Error,t as KeyAuthentication,g as PublicAuthentication,o as TokenAuthentication,A as default};
|
package/package.json
CHANGED
package/dist/chunk-X7766EUY.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var Ft=Object.defineProperty;var qt=(o,t)=>{for(var e in t)Ft(o,e,{get:t[e],enumerable:!0})};var yt=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var _t="https://api.support.greatdetail.com",Ot={"X-Powered-By":"GDSupport/JavaScript"},Pt="api-key";import{z as a}from"zod";var u=class o{constructor(t){this._client=t}static SCHEMA=a.object({event:a.intersection(a.object({id:a.string(),createdAt:a.string().datetime()}),a.discriminatedUnion("type",[a.object({type:a.literal("contact.created"),contact:a.string()}),a.object({type:a.literal("message.created"),message:a.string()})]))});async event({request:t}){let{event:e}=o.SCHEMA.parse(t.body);return{event:e}}};var m=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var h=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var C=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var f=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var g=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var b=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.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 y=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var x=class{constructor(t){this._transport=t}send({include:t,request:e={}}={}){return this._transport.send("v1/boilerplate-categories",{...e,method:"GET",searchParams:[...this._transport.includeQuery(t??{})]})}};var T=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var _=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var O=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var v=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};import{z as vt}from"zod";var L=class o{constructor(t){this._transport=t}static SCHEMA=vt.object({overwrite:vt.boolean().optional()});send(t,{body:e,request:r={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:o.SCHEMA.parse(e)})}};var U=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var F=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var S=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var I=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...e,method:"GET"})}};var w=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/composition-sections",{...t,method:"GET"})}};var q=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var ae="SUPPORT_ACCESS_TOKEN",pe="SUPPORT_API_KEY",ie="SUPPORT_KEY_NAME",Lt="SUPPORT_BASE_URL";var E=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 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 P=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 N=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/contacts",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var B=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var A=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var M=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 j=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}send({filter:t,include:e,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...t?[["filter",t]]:[],...this._transport.includeQuery(e??{})]})}};var D=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var k=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.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 Q=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var W=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...e,method:"GET"})}};var z=class{constructor(t){this._transport=t}send({query:t,include:e,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.includeQuery(e??{})]})}};var Y=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var $=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var J=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var X=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var Z=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var tt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var et=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var ot=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var rt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},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",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var nt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var st=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var at=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var pt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var it=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var ct=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Ot;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var lt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var dt=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let r=[];if(t){let n=Array.isArray(t)?t:[t];for(let p of n)r.push(["category",p])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:r})}};import St from"is-network-error";import It,{HTTPError as wt}from"ky";var s=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends s{};var ut=class extends c{static unauthenticated(){return new this("An unauthenticated request occurred")}};var mt=class extends c{static forbidden(){return new this("A forbidden request occurred")}};var i=class extends s{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 ht=class extends s{};var d=class extends s{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var Ct=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=It.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[r=>{for(let n of this.options.requestFilterables){let p=n.getHeaders();for(let[Tt,Ut]of Object.entries(p))r.headers.has(Tt)||r.headers.set(Tt,Ut)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}includeQuery(t){let 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(St(n))throw new ht("A network error occurred",{cause:n});if(n instanceof wt){let p=n.response.status;switch(console.error(JSON.stringify(n.response)),p){case 400:throw d.badRequest();case 401:throw ut.unauthenticated();case 403:throw mt.forbidden();case 404:throw i.notFound(t);case 405:throw i.forbiddenMethod(t,e.method??"GET");case 415:throw d.unsupportedMediaType();case 418:throw i.teapot();case 429:throw i.rateLimited()}if(p>=500&&p<600)throw s.serverError(p)}throw n});return{response:()=>r,json:async()=>(await r).json()}}};var ft=class{constructor(t){this._transport=t}send({account:t,files:e,request:r={}}){let n=new FormData;for(let p of e)n.append("file",p);return this._transport.send("v1/uploads",{...r,method:"POST",body:n,searchParams:{account:t}})}};var gt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var bt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var Rt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var xt=class o{static DEFAULT_BASE_URL=_t;_transport;constructor(t,{baseURL:e,...r}={}){this._transport=new Ct({requestFilterables:[new ct,t],...r,baseURL:e?.toString()??o.getBaseURL()})}static getBaseURL(){return process.env[Lt]??this.DEFAULT_BASE_URL}get action(){return{list:new m(this._transport)}}get boilerplate(){return{get:new C(this._transport),list:new g(this._transport),update:new b(this._transport),create:new h(this._transport)}}get boilerplateCategory(){return{get:new y(this._transport),list:new x(this._transport),create:new R(this._transport),update:new T(this._transport),boilerplate:{list:new f(this._transport)}}}get channel(){return{get:new O(this._transport),list:new v(this._transport),update:new U(this._transport),create:new _(this._transport),compositionSection:{list:new I(this._transport)},message:{list:new $(this._transport)},twilioSendgrid:{sync:new L(this._transport)}}}get compositionSection(){return{get:new S(this._transport),list:new w(this._transport),create:new F(this._transport),update:new q(this._transport)}}get contact(){return{get:new P(this._transport),list:new N(this._transport),update:new A(this._transport),create:new G(this._transport),conversation:{list:new j(this._transport)},note:{list:new st(this._transport),create:new rt(this._transport)},notificationSubscription:{create:new it(this._transport)},vcf:{get:new E(this._transport)}}}get conversation(){return{get:new M(this._transport),list:new H(this._transport),update:new k(this._transport),create:new l(this._transport),label:{list:new W(this._transport)},message:{list:new J(this._transport)},note:{list:new at(this._transport),create:new l(this._transport)}}}get label(){return{create:new K(this._transport),get:new Q(this._transport),list:new z(this._transport),update:new Y(this._transport),delete:new V(this._transport),contact:{list:new B(this._transport)},conversation:{list:new D(this._transport)}}}get message(){return{list:new X(this._transport)}}get model(){return{get:new tt(this._transport),list:new et(this._transport),response:{create:new ot(this._transport)},correction:{create:new Z(this._transport)}}}get note(){return{get:new nt(this._transport),update:new pt(this._transport)}}get source(){return{get:new lt(this._transport),list:new dt(this._transport)}}get upload(){return{get:new bt(this._transport),create:new ft(this._transport),delete:new gt(this._transport)}}get webhook(){return new u(this)}get wellKnown(){return{notification:{get:new Rt(this._transport)}}}};export{qt as a,yt as b,ae as c,pe as d,ie as e,_t as f,Pt as g,s as h,c as i,ut as j,mt as k,i as l,ht as m,d as n,xt as o};
|