@great-detail/support-sdk 0.4.13 → 0.4.15
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-FQ6AQALK.js → chunk-K5Z4T3HT.js} +1 -1
- package/dist/chunk-L7CYM6XM.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-CqAYgTW0.d.cts → index-En9HWuig.d.cts} +80 -25
- package/dist/{index-CqAYgTW0.d.ts → index-En9HWuig.d.ts} +80 -25
- 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-HTPWK3JJ.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as y,o as j}from"./chunk-
|
|
1
|
+
import{b as y,o as j}from"./chunk-L7CYM6XM.js";import{Command as A}from"commander";import{Command as F}from"commander";import{oraPromise as I}from"ora";function m({client:t,ora:s}){let o=new F("actions").description("Actions");return o.addCommand(new F("list").description("List actions").action(async()=>{let n=await I(()=>t.action.list.send(),{...s,text:"Finding actions"});console.log(await n.json())})),o}import{Command as b}from"commander";import{oraPromise as S}from"ora";function r({client:t,ora:s}){let o=new b("channels").description("Channels");return o.addCommand(new b("list").description("List channels").action(async()=>{let n=await S(()=>t.channel.list.send(),{...s,text:"Finding channels"});console.log(await n.json())})),o}import{Command as d}from"commander";import{oraPromise as v}from"ora";function c({client:t,ora:s}){let o=new d("contacts").description("Contacts");return o.addCommand(new d("get").description("Find contact").argument("<contact>","Contact ID").action(async n=>{let i=await v(()=>t.contact.get.send({id:n}),{...s,text:"Finding contact"});console.log(await i.json())})),o.addCommand(new d("list").description("List contacts").action(async()=>{let n=await v(()=>t.contact.list.send(),{...s,text:"Finding contacts"});console.log(await n.json())})),o}import{Command as p}from"commander";import{oraPromise as L}from"ora";function l({client:t,ora:s}){let o=new p("conversations").description("Conversations");return o.addCommand(new p("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let i=await L(()=>t.conversation.get.send({id:n}),{...s,text:"Finding conversation"});console.log(await i.json())})),o.addCommand(new p("list").description("List conversations").action(async()=>{let n=await L(()=>t.conversation.list.send(),{...s,text:"Finding conversations"});console.log(await n.json())})),o}import{Command as a}from"commander";import{oraPromise as u}from"ora";function f({client:t,ora:s}){let o=new a("labels").description("Labels");return o.addCommand(new a("get").description("Find label").argument("<label>","Label ID").action(async n=>{let i=await u(()=>t.label.get.send({id:n}),{...s,text:"Finding label"});console.log(await i.json())})),o.addCommand(new a("list").description("List labels").action(async()=>{let n=await u(()=>t.label.list.send(),{...s,text:"Finding labels"});console.log(await n.json())})),o.addCommand(new a("conversations").description("Find label conversations").argument("<label>","Label ID").action(async n=>{let i=await u(()=>t.label.conversation.list.send({id:n}),{...s,text:"Finding conversations"});console.log(await i.json())})),o}import{Command as P}from"commander";import{oraPromise as M}from"ora";function C({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 M(()=>t.message.list.send(),{...s,text:"Finding messages"});console.log(await n.json())})),o}import{Command as g}from"commander";import{oraPromise as h}from"ora";function w({client:t,ora:s}){let o=new g("models").description("Models");return o.addCommand(new g("get").description("Find model").argument("<model>","Model ID").action(async n=>{let i=await h(()=>t.model.get.send({id:n}),{...s,text:"Finding model"});console.log(await i.json())})),o.addCommand(new g("list").description("List models").action(async()=>{let n=await h(()=>t.model.list.send(),{...s,text:"Finding models"});console.log(await n.json())})),o}import{Command as O}from"commander";import{oraPromise as D}from"ora";function x({client:t,ora:s}){let o=new O("sources").description("Sources");return o.addCommand(new O("get").description("Find source").argument("<source>","Source ID").action(async n=>{let i=await D(()=>t.source.get.send({id:n}),{...s,text:"Finding source"});console.log(await i.json())})),o.addCommand(new O("list").description("List sources").action(async()=>{let n=await D(()=>t.source.list.send(),{...s,text:"Finding sources"});console.log(await n.json())})),o}var e={ora:{spinner:"simpleDotsScrolling"},client:new j(new y)},G=new A("gds").description("Great Detail Support System").addCommand(m(e)).addCommand(r(e)).addCommand(c(e)).addCommand(l(e)).addCommand(f(e)).addCommand(C(e)).addCommand(w(e)).addCommand(x(e)),go=G;export{go as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var Ht=Object.defineProperty;var jt=(r,t)=>{for(var e in t)Ht(r,e,{get:t[e],enumerable:!0})};var yt=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var vt="https://api.support.greatdetail.com",Ot={"X-Powered-By":"GDSupport/JavaScript"},Bt="api-key";import{z as n}from"zod";var u=class r{constructor(t){this._client=t}static SCHEMA=n.object({event:n.intersection(n.object({id:n.string(),createdAt:n.string().datetime()}),n.discriminatedUnion("type",[n.object({type:n.literal("contact.created"),contact:n.string()}),n.object({type:n.literal("message.created"),message:n.string()})]))});async event({request:t}){let{event:e}=r.SCHEMA.parse(t.body);return{event:e}}};var g=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};import{z as gt}from"zod";var m=class r{constructor(t){this._transport=t}static SCHEMA=gt.object({title:gt.string(),content:gt.string(),account:gt.string()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var h=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var f=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var b=class{constructor(t){this._transport=t}async send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates"+(t?"?query="+encodeURIComponent(t):""),{...e,method:"GET"})}};import{z as Rt}from"zod";var C=class r{constructor(t){this._transport=t}static SCHEMA=Rt.object({title:Rt.string().optional(),content:Rt.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};import{z as mt}from"zod";var y=class r{constructor(t){this._transport=t}static SCHEMA=mt.object({title:mt.string(),description:mt.string().optional(),account:mt.string()});async send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(t))})}};var R=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var A=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/boilerplate-categories",{...t,method:"GET"})}};import{z as At}from"zod";var T=class r{constructor(t){this._transport=t}static SCHEMA=At.object({title:At.string().optional(),description:At.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};import{z as Tt}from"zod";var x=class r{constructor(t){this._transport=t}static SCHEMA=Tt.object({name:Tt.string().optional(),account:Tt.string()});async send({body:t,request:e={}}){return this._transport.send("v1/sources/meta-whatsapp/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(t))})}};import{z as i}from"zod";var _=class r{constructor(t){this._transport=t}static SCHEMA=i.object({name:i.string().optional(),account:i.string(),twilioSendgrid:i.object({displayName:i.string().optional(),outboundEmailAddress:i.string().email(),replyEmailAddress:i.string(),inboundHostname:i.string(),apiKey:i.string()})});async send({body:t,request:e={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(t))})}};var S=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var E=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var ue="SUPPORT_ACCESS_TOKEN",ge="SUPPORT_API_KEY",me="SUPPORT_KEY_NAME",Ft="SUPPORT_BASE_URL";var v=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let s=e.variant??"vcard",a=e.format??(e.variant==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(s)+"&format="+encodeURIComponent(a)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}};import{z as O}from"zod";var F=class r{constructor(t){this._transport=t}static SCHEMA=O.object({name:O.string(),account:O.string(),emailAddress:O.string().email().optional(),telephoneNumber:O.string().optional()});async send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(t))})}};var w=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"GET"})}};var I=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/contacts",{...t,method:"GET"})}};var U=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};import{z as ht}from"zod";var q=class r{constructor(t){this._transport=t}static SCHEMA=ht.object({name:ht.string().optional(),emailAddress:ht.string().email().optional(),telephoneNumber:ht.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var L=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var M=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/conversations",{...t,method:"GET"})}};var N=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};import{z as xt}from"zod";var G=class r{constructor(t){this._transport=t}static SCHEMA=xt.object({status:xt.enum(["AwaitingContactConversationStatus","AwaitingAgentConversationStatus","ResolvedConversationStatus","ClosedConversationStatus"]).optional(),hasEnded:xt.boolean().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};import{z as ft}from"zod";var j=class r{constructor(t){this._transport=t}static SCHEMA=ft.object({title:ft.string(),description:ft.string().optional(),account:ft.string()});async send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(t))})}};var P=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var z=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var B=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/labels",{...t,method:"GET"})}};import{z as _t}from"zod";var D=class r{constructor(t){this._transport=t}static SCHEMA=_t.object({title:_t.string().optional(),description:_t.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var J=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var k=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var K=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};import{z as bt}from"zod";var V=class r{constructor(t){this._transport=t}static SCHEMA=bt.object({input:bt.string().max(65536),original:bt.string().max(65536),correction:bt.string().max(65536)});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var W=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var Y=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};import{z as Ct}from"zod";var $=class r{constructor(t){this._transport=t}static SCHEMA=Ct.array(Ct.object({role:Ct.enum(["user","assistant"]),content:Ct.string().max(65536).nullable()})).min(1);async send({id:t,body:e,request:s={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};import{z as wt}from"zod";var X=class r{constructor(t){this._transport=t}static SCHEMA=wt.object({content:wt.string()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};import{z as It}from"zod";var d=class r{constructor(t){this._transport=t}static SCHEMA=It.object({content:It.string()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var Q=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var Z=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var tt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};import{z as Ut}from"zod";var et=class r{constructor(t){this._transport=t}static SCHEMA=Ut.object({content:Ut.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};import{z as p}from"zod";var rt=class r{constructor(t){this._transport=t}static SCHEMA=p.discriminatedUnion("type",[p.object({type:p.literal("vapid"),endpoint:p.string().url(),keys:p.object({p256dh:p.string(),auth:p.string()})})]);async send({id:t,body:e,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var st=class r{constructor(t=r.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Ot;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var nt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var ot=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/sources",{...t,method:"GET"})}};import Mt from"is-network-error";import Nt,{HTTPError as Gt}from"ky";var o=class extends Error{};var c=class extends o{};var it=class extends c{static unauthenticated(){return new this("An unauthenticated request occurred")}};var at=class extends c{static forbidden(){return new this("A forbidden request occurred")}};var l=class extends o{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}`)}};var pt=class extends o{};var ct=class extends o{static badRequest(){return new this("Bad request")}};var dt=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Nt.create({prefixUrl:this.options.baseURL,hooks:{beforeRequest:[s=>{for(let a of this.options.requestFilterables){let qt=a.getHeaders();for(let[Et,Lt]of Object.entries(qt))s.headers.has(Et)||s.headers.set(Et,Lt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}async send(t,e){return await this.client(t,e).catch(s=>{if(Mt(s))throw new pt("A network error occurred",{cause:s});if(s instanceof Gt){let a=s.response.status;switch(console.error(JSON.stringify(s.response)),a){case 400:throw ct.badRequest();case 401:throw it.unauthenticated();case 403:throw at.forbidden();case 404:throw l.notFound(t);case 405:throw l.forbiddenMethod(t,e.method??"GET")}}throw s})}};var lt=class{constructor(t){this._transport=t}async send({files:t,request:e={}}){let s=new FormData;for(let a of t)s.append("file",a);return this._transport.send("v1/uploads",{...e,method:"POST",body:s})}};var ut=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var St=class r{static DEFAULT_BASE_URL=vt;_transport;constructor(t,{baseURL:e,...s}={}){this._transport=new dt({requestFilterables:[new st,t],...s,baseURL:e?.toString()??r.getBaseURL()})}static getBaseURL(){return process.env[Ft]??this.DEFAULT_BASE_URL}get action(){return{list:new g(this._transport)}}get boilerplate(){return{get:new h(this._transport),list:new b(this._transport),update:new C(this._transport)}}get boilerplateCategory(){return{get:new R(this._transport),list:new A(this._transport),create:new y(this._transport),update:new T(this._transport),boilerplate:{list:new f(this._transport),create:new m(this._transport)}}}get channel(){return{get:new S(this._transport),list:new E(this._transport),message:{list:new J(this._transport)},twilioSendgrid:{create:new _(this._transport)},metaWhatsapp:{create:new x(this._transport)}}}get contact(){return{get:new w(this._transport),list:new I(this._transport),update:new q(this._transport),create:new F(this._transport),conversation:{list:new H(this._transport)},note:{list:new Z(this._transport),create:new X(this._transport)},notificationSubscription:{create:new rt(this._transport)},vcf:{get:new v(this._transport)}}}get conversation(){return{get:new L(this._transport),list:new M(this._transport),update:new G(this._transport),create:new d(this._transport),message:{list:new k(this._transport)},note:{list:new tt(this._transport),create:new d(this._transport)}}}get label(){return{create:new j(this._transport),get:new z(this._transport),list:new B(this._transport),update:new D(this._transport),delete:new P(this._transport),contact:{list:new U(this._transport)},conversation:{list:new N(this._transport)}}}get message(){return{list:new K(this._transport)}}get model(){return{get:new W(this._transport),list:new Y(this._transport),response:{create:new $(this._transport)},correction:{create:new V(this._transport)}}}get note(){return{get:new Q(this._transport),update:new et(this._transport)}}get source(){return{get:new nt(this._transport),list:new ot(this._transport)}}get upload(){return{get:new ut(this._transport),create:new lt(this._transport)}}get webhook(){return new u(this)}};export{jt as a,yt as b,ue as c,ge as d,me as e,vt as f,Bt as g,o as h,c as i,it as j,at as k,l,pt as m,ct as n,St as o};
|
package/dist/cli/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var de=Object.create;var xt=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var ue=Object.getPrototypeOf,ge=Object.prototype.hasOwnProperty;var fe=(n,t)=>{for(var e in t)xt(n,e,{get:t[e],enumerable:!0})},Qt=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of me(t))!ge.call(n,s)&&s!==e&&xt(n,s,{get:()=>t[s],enumerable:!(r=le(t,s))||r.enumerable});return n};var Zt=(n,t,e)=>(e=n!=null?de(ue(n)):{},Qt(t||!n||!n.__esModule?xt(e,"default",{value:n,enumerable:!0}):e,n)),he=n=>Qt(xt({},"__esModule",{value:!0}),n);var ye={};fe(ye,{default:()=>be});module.exports=he(ye);var ae=require("commander");var g=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var f=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var h=require("zod"),C=class n{constructor(t){this._transport=t}static SCHEMA=h.z.object({title:h.z.string(),content:h.z.string(),account:h.z.string()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var b=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var y=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var R=class{constructor(t){this._transport=t}async send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates"+(t?"?query="+encodeURIComponent(t):""),{...e,method:"GET"})}};var Tt=require("zod"),A=class n{constructor(t){this._transport=t}static SCHEMA=Tt.z.object({title:Tt.z.string().optional(),content:Tt.z.string().optional()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var x=require("zod"),T=class n{constructor(t){this._transport=t}static SCHEMA=x.z.object({title:x.z.string(),description:x.z.string().optional(),account:x.z.string()});async send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(t))})}};var O=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var _=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/boilerplate-categories",{...t,method:"GET"})}};var Ot=require("zod"),S=class n{constructor(t){this._transport=t}static SCHEMA=Ot.z.object({title:Ot.z.string().optional(),description:Ot.z.string().optional()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var a=require("zod"),v=class n{constructor(t){this._transport=t}static SCHEMA=a.z.object({name:a.z.string().optional(),account:a.z.string(),twilioSendgrid:a.z.object({displayName:a.z.string().optional(),outboundEmailAddress:a.z.string().email(),replyEmailAddress:a.z.string(),inboundHostname:a.z.string(),apiKey:a.z.string()})});async send({body:t,request:e={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(t))})}};var w=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var E=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var te="SUPPORT_BASE_URL";var ee="https://api.support.greatdetail.com",ne={"X-Powered-By":"GDSupport/JavaScript"};var F=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let r=e.variant??"vcard",s=e.format??(e.variant==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(s)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}};var l=require("zod"),I=class n{constructor(t){this._transport=t}static SCHEMA=l.z.object({name:l.z.string(),account:l.z.string(),emailAddress:l.z.string().email().optional(),telephoneNumber:l.z.string().optional()});async send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(t))})}};var U=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"GET"})}};var L=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/contacts",{...t,method:"GET"})}};var q=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var H=require("zod"),M=class n{constructor(t){this._transport=t}static SCHEMA=H.z.object({name:H.z.string().optional(),emailAddress:H.z.string().email().optional(),telephoneNumber:H.z.string().optional()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var N=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"GET"})}};var j=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var G=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/conversations",{...t,method:"GET"})}};var P=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var _t=require("zod"),B=class n{constructor(t){this._transport=t}static SCHEMA=_t.z.object({status:_t.z.enum(["AwaitingContactConversationStatus","AwaitingAgentConversationStatus","ResolvedConversationStatus","ClosedConversationStatus"]).optional(),hasEnded:_t.z.boolean().optional()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var D=require("zod"),z=class n{constructor(t){this._transport=t}static SCHEMA=D.z.object({title:D.z.string(),description:D.z.string().optional(),account:D.z.string()});async send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(t))})}};var J=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var k=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var K=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/labels",{...t,method:"GET"})}};var St=require("zod"),V=class n{constructor(t){this._transport=t}static SCHEMA=St.z.object({title:St.z.string().optional(),description:St.z.string().optional()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var W=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var Y=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var $=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var X=require("zod"),Q=class n{constructor(t){this._transport=t}static SCHEMA=X.z.object({input:X.z.string().max(65536),original:X.z.string().max(65536),correction:X.z.string().max(65536)});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var Z=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var tt=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var et=require("zod"),nt=class n{constructor(t){this._transport=t}static SCHEMA=et.z.array(et.z.object({role:et.z.enum(["user","assistant"]),content:et.z.string().max(65536).nullable()})).min(1);async send({id:t,body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var Lt=require("zod"),rt=class n{constructor(t){this._transport=t}static SCHEMA=Lt.z.object({content:Lt.z.string()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var qt=require("zod"),m=class n{constructor(t){this._transport=t}static SCHEMA=qt.z.object({content:qt.z.string()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var st=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var ot=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var it=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var Ht=require("zod"),at=class n{constructor(t){this._transport=t}static SCHEMA=Ht.z.object({content:Ht.z.string().optional()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var p=require("zod"),pt=class n{constructor(t){this._transport=t}static SCHEMA=p.z.discriminatedUnion("type",[p.z.object({type:p.z.literal("vapid"),endpoint:p.z.string().url(),keys:p.z.object({p256dh:p.z.string(),auth:p.z.string()})})]);async send({id: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"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var ct=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=ne;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var dt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var lt=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/sources",{...t,method:"GET"})}};var re=Zt(require("is-network-error"),1),vt=Zt(require("ky"),1);var i=class extends Error{};var d=class extends i{};var mt=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var ut=class extends d{static forbidden(){return new this("A forbidden request occurred")}};var u=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}`)}};var gt=class extends i{};var ft=class extends i{static badRequest(){return new this("Bad request")}};var ht=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=vt.default.create({prefixUrl:this.options.baseURL,hooks:{beforeRequest:[r=>{for(let s of this.options.requestFilterables){let pe=s.getHeaders();for(let[Xt,ce]of Object.entries(pe))r.headers.has(Xt)||r.headers.set(Xt,ce)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}async send(t,e){return await this.client(t,e).catch(r=>{if((0,re.default)(r))throw new gt("A network error occurred",{cause:r});if(r instanceof vt.HTTPError){let s=r.response.status;switch(console.error(JSON.stringify(r.response)),s){case 400:throw ft.badRequest();case 401:throw mt.unauthenticated();case 403:throw ut.forbidden();case 404:throw u.notFound(t);case 405:throw u.forbiddenMethod(t,e.method??"GET")}}throw r})}};var Ct=class{constructor(t){this._transport=t}async send({files:t,request:e={}}){let r=new FormData;for(let s of t)r.append("file",s);return this._transport.send("v1/uploads",{...e,method:"POST",body:r})}};var bt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var o=require("zod"),yt=class n{constructor(t){this._client=t}static SCHEMA=o.z.object({event:o.z.intersection(o.z.object({id:o.z.string(),createdAt:o.z.string().datetime()}),o.z.discriminatedUnion("type",[o.z.object({type:o.z.literal("contact.created"),contact:o.z.string()}),o.z.object({type:o.z.literal("message.created"),message:o.z.string()})]))});async event({request:t}){let{event:e}=n.SCHEMA.parse(t.body);return{event:e}}};var Rt=class n{static DEFAULT_BASE_URL=ee;_transport;constructor(t,{baseURL:e,...r}={}){this._transport=new ht({requestFilterables:[new ct,t],...r,baseURL:e?.toString()??n.getBaseURL()})}static getBaseURL(){return process.env[te]??this.DEFAULT_BASE_URL}get action(){return{list:new f(this._transport)}}get boilerplate(){return{get:new b(this._transport),list:new R(this._transport),update:new A(this._transport)}}get boilerplateCategory(){return{get:new O(this._transport),list:new _(this._transport),create:new T(this._transport),update:new S(this._transport),boilerplate:{list:new y(this._transport),create:new C(this._transport)}}}get channel(){return{get:new w(this._transport),list:new E(this._transport),message:{list:new W(this._transport)},twilioSendgrid:{create:new v(this._transport)}}}get contact(){return{get:new U(this._transport),list:new L(this._transport),update:new M(this._transport),create:new I(this._transport),conversation:{list:new j(this._transport)},note:{list:new ot(this._transport),create:new rt(this._transport)},notificationSubscription:{create:new pt(this._transport)},vcf:{get:new F(this._transport)}}}get conversation(){return{get:new N(this._transport),list:new G(this._transport),update:new B(this._transport),create:new m(this._transport),message:{list:new Y(this._transport)},note:{list:new it(this._transport),create:new m(this._transport)}}}get label(){return{create:new z(this._transport),get:new k(this._transport),list:new K(this._transport),update:new V(this._transport),delete:new J(this._transport),contact:{list:new q(this._transport)},conversation:{list:new P(this._transport)}}}get message(){return{list:new $(this._transport)}}get model(){return{get:new Z(this._transport),list:new tt(this._transport),response:{create:new nt(this._transport)},correction:{create:new Q(this._transport)}}}get note(){return{get:new st(this._transport),update:new at(this._transport)}}get source(){return{get:new dt(this._transport),list:new lt(this._transport)}}get upload(){return{get:new bt(this._transport),create:new Ct(this._transport)}}get webhook(){return new yt(this)}};var Mt=require("commander"),se=require("ora");function Nt({client:n,ora:t}){let e=new Mt.Command("actions").description("Actions");return e.addCommand(new Mt.Command("list").description("List actions").action(async()=>{let r=await(0,se.oraPromise)(()=>n.action.list.send(),{...t,text:"Finding actions"});console.log(await r.json())})),e}var jt=require("commander"),oe=require("ora");function Gt({client:n,ora:t}){let e=new jt.Command("channels").description("Channels");return e.addCommand(new jt.Command("list").description("List channels").action(async()=>{let r=await(0,oe.oraPromise)(()=>n.channel.list.send(),{...t,text:"Finding channels"});console.log(await r.json())})),e}var wt=require("commander"),Pt=require("ora");function Bt({client:n,ora:t}){let e=new wt.Command("contacts").description("Contacts");return e.addCommand(new wt.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async r=>{let s=await(0,Pt.oraPromise)(()=>n.contact.get.send({id:r}),{...t,text:"Finding contact"});console.log(await s.json())})),e.addCommand(new wt.Command("list").description("List contacts").action(async()=>{let r=await(0,Pt.oraPromise)(()=>n.contact.list.send(),{...t,text:"Finding contacts"});console.log(await r.json())})),e}var Et=require("commander"),Dt=require("ora");function zt({client:n,ora:t}){let e=new Et.Command("conversations").description("Conversations");return e.addCommand(new Et.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async r=>{let s=await(0,Dt.oraPromise)(()=>n.conversation.get.send({id:r}),{...t,text:"Finding conversation"});console.log(await s.json())})),e.addCommand(new Et.Command("list").description("List conversations").action(async()=>{let r=await(0,Dt.oraPromise)(()=>n.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await r.json())})),e}var At=require("commander"),Ft=require("ora");function Jt({client:n,ora:t}){let e=new At.Command("labels").description("Labels");return e.addCommand(new At.Command("get").description("Find label").argument("<label>","Label ID").action(async r=>{let s=await(0,Ft.oraPromise)(()=>n.label.get.send({id:r}),{...t,text:"Finding label"});console.log(await s.json())})),e.addCommand(new At.Command("list").description("List labels").action(async()=>{let r=await(0,Ft.oraPromise)(()=>n.label.list.send(),{...t,text:"Finding labels"});console.log(await r.json())})),e.addCommand(new At.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async r=>{let s=await(0,Ft.oraPromise)(()=>n.label.conversation.list.send({id:r}),{...t,text:"Finding conversations"});console.log(await s.json())})),e}var kt=require("commander"),ie=require("ora");function Kt({client:n,ora:t}){let e=new kt.Command("messages").description("Messages");return e.addCommand(new kt.Command("list").description("List messages").action(async()=>{let r=await(0,ie.oraPromise)(()=>n.message.list.send(),{...t,text:"Finding messages"});console.log(await r.json())})),e}var It=require("commander"),Vt=require("ora");function Wt({client:n,ora:t}){let e=new It.Command("models").description("Models");return e.addCommand(new It.Command("get").description("Find model").argument("<model>","Model ID").action(async r=>{let s=await(0,Vt.oraPromise)(()=>n.model.get.send({id:r}),{...t,text:"Finding model"});console.log(await s.json())})),e.addCommand(new It.Command("list").description("List models").action(async()=>{let r=await(0,Vt.oraPromise)(()=>n.model.list.send(),{...t,text:"Finding models"});console.log(await r.json())})),e}var Ut=require("commander"),Yt=require("ora");function $t({client:n,ora:t}){let e=new Ut.Command("sources").description("Sources");return e.addCommand(new Ut.Command("get").description("Find source").argument("<source>","Source ID").action(async r=>{let s=await(0,Yt.oraPromise)(()=>n.source.get.send({id:r}),{...t,text:"Finding source"});console.log(await s.json())})),e.addCommand(new Ut.Command("list").description("List sources").action(async()=>{let r=await(0,Yt.oraPromise)(()=>n.source.list.send(),{...t,text:"Finding sources"});console.log(await r.json())})),e}var c={ora:{spinner:"simpleDotsScrolling"},client:new Rt(new g)},Ce=new ae.Command("gds").description("Great Detail Support System").addCommand(Nt(c)).addCommand(Gt(c)).addCommand(Bt(c)).addCommand(zt(c)).addCommand(Jt(c)).addCommand(Kt(c)).addCommand(Wt(c)).addCommand($t(c)),be=Ce;
|
|
1
|
+
"use strict";var me=Object.create;var Tt=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var ge=Object.getOwnPropertyNames;var he=Object.getPrototypeOf,fe=Object.prototype.hasOwnProperty;var Ce=(n,t)=>{for(var e in t)Tt(n,e,{get:t[e],enumerable:!0})},te=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ge(t))!fe.call(n,s)&&s!==e&&Tt(n,s,{get:()=>t[s],enumerable:!(r=ue(t,s))||r.enumerable});return n};var ee=(n,t,e)=>(e=n!=null?me(he(n)):{},te(t||!n||!n.__esModule?Tt(e,"default",{value:n,enumerable:!0}):e,n)),be=n=>te(Tt({},"__esModule",{value:!0}),n);var Ae={};Ce(Ae,{default:()=>Re});module.exports=be(Ae);var ce=require("commander");var g=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var h=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var f=require("zod"),C=class n{constructor(t){this._transport=t}static SCHEMA=f.z.object({title:f.z.string(),content:f.z.string(),account:f.z.string()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var b=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var y=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var R=class{constructor(t){this._transport=t}async send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates"+(t?"?query="+encodeURIComponent(t):""),{...e,method:"GET"})}};var Ot=require("zod"),A=class n{constructor(t){this._transport=t}static SCHEMA=Ot.z.object({title:Ot.z.string().optional(),content:Ot.z.string().optional()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var x=require("zod"),T=class n{constructor(t){this._transport=t}static SCHEMA=x.z.object({title:x.z.string(),description:x.z.string().optional(),account:x.z.string()});async send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(t))})}};var O=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var _=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/boilerplate-categories",{...t,method:"GET"})}};var _t=require("zod"),S=class n{constructor(t){this._transport=t}static SCHEMA=_t.z.object({title:_t.z.string().optional(),description:_t.z.string().optional()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var St=require("zod"),v=class n{constructor(t){this._transport=t}static SCHEMA=St.z.object({name:St.z.string().optional(),account:St.z.string()});async send({body:t,request:e={}}){return this._transport.send("v1/sources/meta-whatsapp/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(t))})}};var a=require("zod"),w=class n{constructor(t){this._transport=t}static SCHEMA=a.z.object({name:a.z.string().optional(),account:a.z.string(),twilioSendgrid:a.z.object({displayName:a.z.string().optional(),outboundEmailAddress:a.z.string().email(),replyEmailAddress:a.z.string(),inboundHostname:a.z.string(),apiKey:a.z.string()})});async send({body:t,request:e={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(t))})}};var E=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var F=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var ne="SUPPORT_BASE_URL";var re="https://api.support.greatdetail.com",se={"X-Powered-By":"GDSupport/JavaScript"};var I=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let r=e.variant??"vcard",s=e.format??(e.variant==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(s)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}};var l=require("zod"),U=class n{constructor(t){this._transport=t}static SCHEMA=l.z.object({name:l.z.string(),account:l.z.string(),emailAddress:l.z.string().email().optional(),telephoneNumber:l.z.string().optional()});async send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(t))})}};var q=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"GET"})}};var L=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/contacts",{...t,method:"GET"})}};var H=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var M=require("zod"),N=class n{constructor(t){this._transport=t}static SCHEMA=M.z.object({name:M.z.string().optional(),emailAddress:M.z.string().email().optional(),telephoneNumber:M.z.string().optional()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var j=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"GET"})}};var G=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var P=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/conversations",{...t,method:"GET"})}};var D=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var vt=require("zod"),z=class n{constructor(t){this._transport=t}static SCHEMA=vt.z.object({status:vt.z.enum(["AwaitingContactConversationStatus","AwaitingAgentConversationStatus","ResolvedConversationStatus","ClosedConversationStatus"]).optional(),hasEnded:vt.z.boolean().optional()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var B=require("zod"),J=class n{constructor(t){this._transport=t}static SCHEMA=B.z.object({title:B.z.string(),description:B.z.string().optional(),account:B.z.string()});async send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(t))})}};var k=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var K=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var V=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/labels",{...t,method:"GET"})}};var wt=require("zod"),W=class n{constructor(t){this._transport=t}static SCHEMA=wt.z.object({title:wt.z.string().optional(),description:wt.z.string().optional()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var Y=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var $=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var X=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var Q=require("zod"),Z=class n{constructor(t){this._transport=t}static SCHEMA=Q.z.object({input:Q.z.string().max(65536),original:Q.z.string().max(65536),correction:Q.z.string().max(65536)});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var tt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var et=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var nt=require("zod"),rt=class n{constructor(t){this._transport=t}static SCHEMA=nt.z.array(nt.z.object({role:nt.z.enum(["user","assistant"]),content:nt.z.string().max(65536).nullable()})).min(1);async send({id:t,body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var Ht=require("zod"),st=class n{constructor(t){this._transport=t}static SCHEMA=Ht.z.object({content:Ht.z.string()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var Mt=require("zod"),m=class n{constructor(t){this._transport=t}static SCHEMA=Mt.z.object({content:Mt.z.string()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var ot=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var it=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var at=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var Nt=require("zod"),pt=class n{constructor(t){this._transport=t}static SCHEMA=Nt.z.object({content:Nt.z.string().optional()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var p=require("zod"),ct=class n{constructor(t){this._transport=t}static SCHEMA=p.z.discriminatedUnion("type",[p.z.object({type:p.z.literal("vapid"),endpoint:p.z.string().url(),keys:p.z.object({p256dh:p.z.string(),auth:p.z.string()})})]);async send({id: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"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var dt=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=se;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var lt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var mt=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/sources",{...t,method:"GET"})}};var oe=ee(require("is-network-error"),1),Et=ee(require("ky"),1);var i=class extends Error{};var d=class extends i{};var ut=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var gt=class extends d{static forbidden(){return new this("A forbidden request occurred")}};var u=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}`)}};var ht=class extends i{};var ft=class extends i{static badRequest(){return new this("Bad request")}};var Ct=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Et.default.create({prefixUrl:this.options.baseURL,hooks:{beforeRequest:[r=>{for(let s of this.options.requestFilterables){let de=s.getHeaders();for(let[Zt,le]of Object.entries(de))r.headers.has(Zt)||r.headers.set(Zt,le)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}async send(t,e){return await this.client(t,e).catch(r=>{if((0,oe.default)(r))throw new ht("A network error occurred",{cause:r});if(r instanceof Et.HTTPError){let s=r.response.status;switch(console.error(JSON.stringify(r.response)),s){case 400:throw ft.badRequest();case 401:throw ut.unauthenticated();case 403:throw gt.forbidden();case 404:throw u.notFound(t);case 405:throw u.forbiddenMethod(t,e.method??"GET")}}throw r})}};var bt=class{constructor(t){this._transport=t}async send({files:t,request:e={}}){let r=new FormData;for(let s of t)r.append("file",s);return this._transport.send("v1/uploads",{...e,method:"POST",body:r})}};var yt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var o=require("zod"),Rt=class n{constructor(t){this._client=t}static SCHEMA=o.z.object({event:o.z.intersection(o.z.object({id:o.z.string(),createdAt:o.z.string().datetime()}),o.z.discriminatedUnion("type",[o.z.object({type:o.z.literal("contact.created"),contact:o.z.string()}),o.z.object({type:o.z.literal("message.created"),message:o.z.string()})]))});async event({request:t}){let{event:e}=n.SCHEMA.parse(t.body);return{event:e}}};var At=class n{static DEFAULT_BASE_URL=re;_transport;constructor(t,{baseURL:e,...r}={}){this._transport=new Ct({requestFilterables:[new dt,t],...r,baseURL:e?.toString()??n.getBaseURL()})}static getBaseURL(){return process.env[ne]??this.DEFAULT_BASE_URL}get action(){return{list:new h(this._transport)}}get boilerplate(){return{get:new b(this._transport),list:new R(this._transport),update:new A(this._transport)}}get boilerplateCategory(){return{get:new O(this._transport),list:new _(this._transport),create:new T(this._transport),update:new S(this._transport),boilerplate:{list:new y(this._transport),create:new C(this._transport)}}}get channel(){return{get:new E(this._transport),list:new F(this._transport),message:{list:new Y(this._transport)},twilioSendgrid:{create:new w(this._transport)},metaWhatsapp:{create:new v(this._transport)}}}get contact(){return{get:new q(this._transport),list:new L(this._transport),update:new N(this._transport),create:new U(this._transport),conversation:{list:new G(this._transport)},note:{list:new it(this._transport),create:new st(this._transport)},notificationSubscription:{create:new ct(this._transport)},vcf:{get:new I(this._transport)}}}get conversation(){return{get:new j(this._transport),list:new P(this._transport),update:new z(this._transport),create:new m(this._transport),message:{list:new $(this._transport)},note:{list:new at(this._transport),create:new m(this._transport)}}}get label(){return{create:new J(this._transport),get:new K(this._transport),list:new V(this._transport),update:new W(this._transport),delete:new k(this._transport),contact:{list:new H(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 rt(this._transport)},correction:{create:new Z(this._transport)}}}get note(){return{get:new ot(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 yt(this._transport),create:new bt(this._transport)}}get webhook(){return new Rt(this)}};var jt=require("commander"),ie=require("ora");function Gt({client:n,ora:t}){let e=new jt.Command("actions").description("Actions");return e.addCommand(new jt.Command("list").description("List actions").action(async()=>{let r=await(0,ie.oraPromise)(()=>n.action.list.send(),{...t,text:"Finding actions"});console.log(await r.json())})),e}var Pt=require("commander"),ae=require("ora");function Dt({client:n,ora:t}){let e=new Pt.Command("channels").description("Channels");return e.addCommand(new Pt.Command("list").description("List channels").action(async()=>{let r=await(0,ae.oraPromise)(()=>n.channel.list.send(),{...t,text:"Finding channels"});console.log(await r.json())})),e}var Ft=require("commander"),zt=require("ora");function Bt({client:n,ora:t}){let e=new Ft.Command("contacts").description("Contacts");return e.addCommand(new Ft.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async r=>{let s=await(0,zt.oraPromise)(()=>n.contact.get.send({id:r}),{...t,text:"Finding contact"});console.log(await s.json())})),e.addCommand(new Ft.Command("list").description("List contacts").action(async()=>{let r=await(0,zt.oraPromise)(()=>n.contact.list.send(),{...t,text:"Finding contacts"});console.log(await r.json())})),e}var It=require("commander"),Jt=require("ora");function kt({client:n,ora:t}){let e=new It.Command("conversations").description("Conversations");return e.addCommand(new It.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async r=>{let s=await(0,Jt.oraPromise)(()=>n.conversation.get.send({id:r}),{...t,text:"Finding conversation"});console.log(await s.json())})),e.addCommand(new It.Command("list").description("List conversations").action(async()=>{let r=await(0,Jt.oraPromise)(()=>n.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await r.json())})),e}var xt=require("commander"),Ut=require("ora");function Kt({client:n,ora:t}){let e=new xt.Command("labels").description("Labels");return e.addCommand(new xt.Command("get").description("Find label").argument("<label>","Label ID").action(async r=>{let s=await(0,Ut.oraPromise)(()=>n.label.get.send({id:r}),{...t,text:"Finding label"});console.log(await s.json())})),e.addCommand(new xt.Command("list").description("List labels").action(async()=>{let r=await(0,Ut.oraPromise)(()=>n.label.list.send(),{...t,text:"Finding labels"});console.log(await r.json())})),e.addCommand(new xt.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async r=>{let s=await(0,Ut.oraPromise)(()=>n.label.conversation.list.send({id:r}),{...t,text:"Finding conversations"});console.log(await s.json())})),e}var Vt=require("commander"),pe=require("ora");function Wt({client:n,ora:t}){let e=new Vt.Command("messages").description("Messages");return e.addCommand(new Vt.Command("list").description("List messages").action(async()=>{let r=await(0,pe.oraPromise)(()=>n.message.list.send(),{...t,text:"Finding messages"});console.log(await r.json())})),e}var qt=require("commander"),Yt=require("ora");function $t({client:n,ora:t}){let e=new qt.Command("models").description("Models");return e.addCommand(new qt.Command("get").description("Find model").argument("<model>","Model ID").action(async r=>{let s=await(0,Yt.oraPromise)(()=>n.model.get.send({id:r}),{...t,text:"Finding model"});console.log(await s.json())})),e.addCommand(new qt.Command("list").description("List models").action(async()=>{let r=await(0,Yt.oraPromise)(()=>n.model.list.send(),{...t,text:"Finding models"});console.log(await r.json())})),e}var Lt=require("commander"),Xt=require("ora");function Qt({client:n,ora:t}){let e=new Lt.Command("sources").description("Sources");return e.addCommand(new Lt.Command("get").description("Find source").argument("<source>","Source ID").action(async r=>{let s=await(0,Xt.oraPromise)(()=>n.source.get.send({id:r}),{...t,text:"Finding source"});console.log(await s.json())})),e.addCommand(new Lt.Command("list").description("List sources").action(async()=>{let r=await(0,Xt.oraPromise)(()=>n.source.list.send(),{...t,text:"Finding sources"});console.log(await r.json())})),e}var c={ora:{spinner:"simpleDotsScrolling"},client:new At(new g)},ye=new ce.Command("gds").description("Great Detail Support System").addCommand(Gt(c)).addCommand(Dt(c)).addCommand(Bt(c)).addCommand(kt(c)).addCommand(Kt(c)).addCommand(Wt(c)).addCommand($t(c)).addCommand(Qt(c)),Re=ye;
|
package/dist/cli/index.d.cts
CHANGED
package/dist/cli/index.d.ts
CHANGED
package/dist/cli/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-K5Z4T3HT.js";import"../chunk-L7CYM6XM.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 Xt=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var ue=Object.getPrototypeOf,ge=Object.prototype.hasOwnProperty;var fe=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of me(t))!ge.call(n,s)&&s!==e&&Xt(n,s,{get:()=>t[s],enumerable:!(r=le(t,s))||r.enumerable});return n};var Qt=(n,t,e)=>(e=n!=null?de(ue(n)):{},fe(t||!n||!n.__esModule?Xt(e,"default",{value:n,enumerable:!0}):e,n));var ie=require("commander");var g=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var f=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var h=require("zod"),C=class n{constructor(t){this._transport=t}static SCHEMA=h.z.object({title:h.z.string(),content:h.z.string(),account:h.z.string()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var b=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var y=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var R=class{constructor(t){this._transport=t}async send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates"+(t?"?query="+encodeURIComponent(t):""),{...e,method:"GET"})}};var xt=require("zod"),A=class n{constructor(t){this._transport=t}static SCHEMA=xt.z.object({title:xt.z.string().optional(),content:xt.z.string().optional()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var x=require("zod"),T=class n{constructor(t){this._transport=t}static SCHEMA=x.z.object({title:x.z.string(),description:x.z.string().optional(),account:x.z.string()});async send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(t))})}};var O=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var _=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/boilerplate-categories",{...t,method:"GET"})}};var Tt=require("zod"),v=class n{constructor(t){this._transport=t}static SCHEMA=Tt.z.object({title:Tt.z.string().optional(),description:Tt.z.string().optional()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var a=require("zod"),S=class n{constructor(t){this._transport=t}static SCHEMA=a.z.object({name:a.z.string().optional(),account:a.z.string(),twilioSendgrid:a.z.object({displayName:a.z.string().optional(),outboundEmailAddress:a.z.string().email(),replyEmailAddress:a.z.string(),inboundHostname:a.z.string(),apiKey:a.z.string()})});async send({body:t,request:e={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(t))})}};var w=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var E=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var Zt="SUPPORT_BASE_URL";var te="https://api.support.greatdetail.com",ee={"X-Powered-By":"GDSupport/JavaScript"};var F=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let r=e.variant??"vcard",s=e.format??(e.variant==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(s)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}};var l=require("zod"),I=class n{constructor(t){this._transport=t}static SCHEMA=l.z.object({name:l.z.string(),account:l.z.string(),emailAddress:l.z.string().email().optional(),telephoneNumber:l.z.string().optional()});async send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(t))})}};var U=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"GET"})}};var L=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/contacts",{...t,method:"GET"})}};var q=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var H=require("zod"),M=class n{constructor(t){this._transport=t}static SCHEMA=H.z.object({name:H.z.string().optional(),emailAddress:H.z.string().email().optional(),telephoneNumber:H.z.string().optional()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var N=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"GET"})}};var j=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var G=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/conversations",{...t,method:"GET"})}};var P=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var Ot=require("zod"),B=class n{constructor(t){this._transport=t}static SCHEMA=Ot.z.object({status:Ot.z.enum(["AwaitingContactConversationStatus","AwaitingAgentConversationStatus","ResolvedConversationStatus","ClosedConversationStatus"]).optional(),hasEnded:Ot.z.boolean().optional()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var D=require("zod"),z=class n{constructor(t){this._transport=t}static SCHEMA=D.z.object({title:D.z.string(),description:D.z.string().optional(),account:D.z.string()});async send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(t))})}};var J=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var k=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var K=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/labels",{...t,method:"GET"})}};var _t=require("zod"),V=class n{constructor(t){this._transport=t}static SCHEMA=_t.z.object({title:_t.z.string().optional(),description:_t.z.string().optional()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var W=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var Y=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var $=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var X=require("zod"),Q=class n{constructor(t){this._transport=t}static SCHEMA=X.z.object({input:X.z.string().max(65536),original:X.z.string().max(65536),correction:X.z.string().max(65536)});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var Z=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var tt=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var et=require("zod"),nt=class n{constructor(t){this._transport=t}static SCHEMA=et.z.array(et.z.object({role:et.z.enum(["user","assistant"]),content:et.z.string().max(65536).nullable()})).min(1);async send({id:t,body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var Ut=require("zod"),rt=class n{constructor(t){this._transport=t}static SCHEMA=Ut.z.object({content:Ut.z.string()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var Lt=require("zod"),m=class n{constructor(t){this._transport=t}static SCHEMA=Lt.z.object({content:Lt.z.string()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var st=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var ot=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var it=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var qt=require("zod"),at=class n{constructor(t){this._transport=t}static SCHEMA=qt.z.object({content:qt.z.string().optional()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var p=require("zod"),pt=class n{constructor(t){this._transport=t}static SCHEMA=p.z.discriminatedUnion("type",[p.z.object({type:p.z.literal("vapid"),endpoint:p.z.string().url(),keys:p.z.object({p256dh:p.z.string(),auth:p.z.string()})})]);async send({id: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"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var ct=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=ee;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var dt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var lt=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/sources",{...t,method:"GET"})}};var ne=Qt(require("is-network-error"),1),vt=Qt(require("ky"),1);var i=class extends Error{};var d=class extends i{};var mt=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var ut=class extends d{static forbidden(){return new this("A forbidden request occurred")}};var u=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}`)}};var gt=class extends i{};var ft=class extends i{static badRequest(){return new this("Bad request")}};var ht=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=vt.default.create({prefixUrl:this.options.baseURL,hooks:{beforeRequest:[r=>{for(let s of this.options.requestFilterables){let pe=s.getHeaders();for(let[$t,ce]of Object.entries(pe))r.headers.has($t)||r.headers.set($t,ce)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}async send(t,e){return await this.client(t,e).catch(r=>{if((0,ne.default)(r))throw new gt("A network error occurred",{cause:r});if(r instanceof vt.HTTPError){let s=r.response.status;switch(console.error(JSON.stringify(r.response)),s){case 400:throw ft.badRequest();case 401:throw mt.unauthenticated();case 403:throw ut.forbidden();case 404:throw u.notFound(t);case 405:throw u.forbiddenMethod(t,e.method??"GET")}}throw r})}};var Ct=class{constructor(t){this._transport=t}async send({files:t,request:e={}}){let r=new FormData;for(let s of t)r.append("file",s);return this._transport.send("v1/uploads",{...e,method:"POST",body:r})}};var bt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var o=require("zod"),yt=class n{constructor(t){this._client=t}static SCHEMA=o.z.object({event:o.z.intersection(o.z.object({id:o.z.string(),createdAt:o.z.string().datetime()}),o.z.discriminatedUnion("type",[o.z.object({type:o.z.literal("contact.created"),contact:o.z.string()}),o.z.object({type:o.z.literal("message.created"),message:o.z.string()})]))});async event({request:t}){let{event:e}=n.SCHEMA.parse(t.body);return{event:e}}};var Rt=class n{static DEFAULT_BASE_URL=te;_transport;constructor(t,{baseURL:e,...r}={}){this._transport=new ht({requestFilterables:[new ct,t],...r,baseURL:e?.toString()??n.getBaseURL()})}static getBaseURL(){return process.env[Zt]??this.DEFAULT_BASE_URL}get action(){return{list:new f(this._transport)}}get boilerplate(){return{get:new b(this._transport),list:new R(this._transport),update:new A(this._transport)}}get boilerplateCategory(){return{get:new O(this._transport),list:new _(this._transport),create:new T(this._transport),update:new v(this._transport),boilerplate:{list:new y(this._transport),create:new C(this._transport)}}}get channel(){return{get:new w(this._transport),list:new E(this._transport),message:{list:new W(this._transport)},twilioSendgrid:{create:new S(this._transport)}}}get contact(){return{get:new U(this._transport),list:new L(this._transport),update:new M(this._transport),create:new I(this._transport),conversation:{list:new j(this._transport)},note:{list:new ot(this._transport),create:new rt(this._transport)},notificationSubscription:{create:new pt(this._transport)},vcf:{get:new F(this._transport)}}}get conversation(){return{get:new N(this._transport),list:new G(this._transport),update:new B(this._transport),create:new m(this._transport),message:{list:new Y(this._transport)},note:{list:new it(this._transport),create:new m(this._transport)}}}get label(){return{create:new z(this._transport),get:new k(this._transport),list:new K(this._transport),update:new V(this._transport),delete:new J(this._transport),contact:{list:new q(this._transport)},conversation:{list:new P(this._transport)}}}get message(){return{list:new $(this._transport)}}get model(){return{get:new Z(this._transport),list:new tt(this._transport),response:{create:new nt(this._transport)},correction:{create:new Q(this._transport)}}}get note(){return{get:new st(this._transport),update:new at(this._transport)}}get source(){return{get:new dt(this._transport),list:new lt(this._transport)}}get upload(){return{get:new bt(this._transport),create:new Ct(this._transport)}}get webhook(){return new yt(this)}};var Ht=require("commander"),re=require("ora");function Mt({client:n,ora:t}){let e=new Ht.Command("actions").description("Actions");return e.addCommand(new Ht.Command("list").description("List actions").action(async()=>{let r=await(0,re.oraPromise)(()=>n.action.list.send(),{...t,text:"Finding actions"});console.log(await r.json())})),e}var Nt=require("commander"),se=require("ora");function jt({client:n,ora:t}){let e=new Nt.Command("channels").description("Channels");return e.addCommand(new Nt.Command("list").description("List channels").action(async()=>{let r=await(0,se.oraPromise)(()=>n.channel.list.send(),{...t,text:"Finding channels"});console.log(await r.json())})),e}var St=require("commander"),Gt=require("ora");function Pt({client:n,ora:t}){let e=new St.Command("contacts").description("Contacts");return e.addCommand(new St.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async r=>{let s=await(0,Gt.oraPromise)(()=>n.contact.get.send({id:r}),{...t,text:"Finding contact"});console.log(await s.json())})),e.addCommand(new St.Command("list").description("List contacts").action(async()=>{let r=await(0,Gt.oraPromise)(()=>n.contact.list.send(),{...t,text:"Finding contacts"});console.log(await r.json())})),e}var wt=require("commander"),Bt=require("ora");function Dt({client:n,ora:t}){let e=new wt.Command("conversations").description("Conversations");return e.addCommand(new wt.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async r=>{let s=await(0,Bt.oraPromise)(()=>n.conversation.get.send({id:r}),{...t,text:"Finding conversation"});console.log(await s.json())})),e.addCommand(new wt.Command("list").description("List conversations").action(async()=>{let r=await(0,Bt.oraPromise)(()=>n.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await r.json())})),e}var At=require("commander"),Et=require("ora");function zt({client:n,ora:t}){let e=new At.Command("labels").description("Labels");return e.addCommand(new At.Command("get").description("Find label").argument("<label>","Label ID").action(async r=>{let s=await(0,Et.oraPromise)(()=>n.label.get.send({id:r}),{...t,text:"Finding label"});console.log(await s.json())})),e.addCommand(new At.Command("list").description("List labels").action(async()=>{let r=await(0,Et.oraPromise)(()=>n.label.list.send(),{...t,text:"Finding labels"});console.log(await r.json())})),e.addCommand(new At.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async r=>{let s=await(0,Et.oraPromise)(()=>n.label.conversation.list.send({id:r}),{...t,text:"Finding conversations"});console.log(await s.json())})),e}var Jt=require("commander"),oe=require("ora");function kt({client:n,ora:t}){let e=new Jt.Command("messages").description("Messages");return e.addCommand(new Jt.Command("list").description("List messages").action(async()=>{let r=await(0,oe.oraPromise)(()=>n.message.list.send(),{...t,text:"Finding messages"});console.log(await r.json())})),e}var Ft=require("commander"),Kt=require("ora");function Vt({client:n,ora:t}){let e=new Ft.Command("models").description("Models");return e.addCommand(new Ft.Command("get").description("Find model").argument("<model>","Model ID").action(async r=>{let s=await(0,Kt.oraPromise)(()=>n.model.get.send({id:r}),{...t,text:"Finding model"});console.log(await s.json())})),e.addCommand(new Ft.Command("list").description("List models").action(async()=>{let r=await(0,Kt.oraPromise)(()=>n.model.list.send(),{...t,text:"Finding models"});console.log(await r.json())})),e}var It=require("commander"),Wt=require("ora");function Yt({client:n,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 r=>{let s=await(0,Wt.oraPromise)(()=>n.source.get.send({id:r}),{...t,text:"Finding source"});console.log(await s.json())})),e.addCommand(new It.Command("list").description("List sources").action(async()=>{let r=await(0,Wt.oraPromise)(()=>n.source.list.send(),{...t,text:"Finding sources"});console.log(await r.json())})),e}var c={ora:{spinner:"simpleDotsScrolling"},client:new Rt(new g)},he=new ie.Command("gds").description("Great Detail Support System").addCommand(Mt(c)).addCommand(jt(c)).addCommand(Pt(c)).addCommand(Dt(c)).addCommand(zt(c)).addCommand(kt(c)).addCommand(Vt(c)).addCommand(Yt(c)),ae=he;ae.parseAsync(process.argv);
|
|
2
|
+
"use strict";var me=Object.create;var Zt=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var ge=Object.getOwnPropertyNames;var he=Object.getPrototypeOf,fe=Object.prototype.hasOwnProperty;var Ce=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ge(t))!fe.call(n,s)&&s!==e&&Zt(n,s,{get:()=>t[s],enumerable:!(r=ue(t,s))||r.enumerable});return n};var te=(n,t,e)=>(e=n!=null?me(he(n)):{},Ce(t||!n||!n.__esModule?Zt(e,"default",{value:n,enumerable:!0}):e,n));var pe=require("commander");var g=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var h=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var f=require("zod"),C=class n{constructor(t){this._transport=t}static SCHEMA=f.z.object({title:f.z.string(),content:f.z.string(),account:f.z.string()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var b=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var y=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var R=class{constructor(t){this._transport=t}async send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates"+(t?"?query="+encodeURIComponent(t):""),{...e,method:"GET"})}};var Tt=require("zod"),A=class n{constructor(t){this._transport=t}static SCHEMA=Tt.z.object({title:Tt.z.string().optional(),content:Tt.z.string().optional()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var x=require("zod"),T=class n{constructor(t){this._transport=t}static SCHEMA=x.z.object({title:x.z.string(),description:x.z.string().optional(),account:x.z.string()});async send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(t))})}};var O=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var _=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/boilerplate-categories",{...t,method:"GET"})}};var Ot=require("zod"),S=class n{constructor(t){this._transport=t}static SCHEMA=Ot.z.object({title:Ot.z.string().optional(),description:Ot.z.string().optional()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var _t=require("zod"),v=class n{constructor(t){this._transport=t}static SCHEMA=_t.z.object({name:_t.z.string().optional(),account:_t.z.string()});async send({body:t,request:e={}}){return this._transport.send("v1/sources/meta-whatsapp/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(t))})}};var a=require("zod"),w=class n{constructor(t){this._transport=t}static SCHEMA=a.z.object({name:a.z.string().optional(),account:a.z.string(),twilioSendgrid:a.z.object({displayName:a.z.string().optional(),outboundEmailAddress:a.z.string().email(),replyEmailAddress:a.z.string(),inboundHostname:a.z.string(),apiKey:a.z.string()})});async send({body:t,request:e={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(t))})}};var E=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var F=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var ee="SUPPORT_BASE_URL";var ne="https://api.support.greatdetail.com",re={"X-Powered-By":"GDSupport/JavaScript"};var I=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let r=e.variant??"vcard",s=e.format??(e.variant==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(s)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}};var l=require("zod"),U=class n{constructor(t){this._transport=t}static SCHEMA=l.z.object({name:l.z.string(),account:l.z.string(),emailAddress:l.z.string().email().optional(),telephoneNumber:l.z.string().optional()});async send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(t))})}};var q=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"GET"})}};var L=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/contacts",{...t,method:"GET"})}};var H=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var M=require("zod"),N=class n{constructor(t){this._transport=t}static SCHEMA=M.z.object({name:M.z.string().optional(),emailAddress:M.z.string().email().optional(),telephoneNumber:M.z.string().optional()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var j=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"GET"})}};var G=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var P=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/conversations",{...t,method:"GET"})}};var D=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var St=require("zod"),z=class n{constructor(t){this._transport=t}static SCHEMA=St.z.object({status:St.z.enum(["AwaitingContactConversationStatus","AwaitingAgentConversationStatus","ResolvedConversationStatus","ClosedConversationStatus"]).optional(),hasEnded:St.z.boolean().optional()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var B=require("zod"),J=class n{constructor(t){this._transport=t}static SCHEMA=B.z.object({title:B.z.string(),description:B.z.string().optional(),account:B.z.string()});async send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(t))})}};var k=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var K=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var V=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/labels",{...t,method:"GET"})}};var vt=require("zod"),W=class n{constructor(t){this._transport=t}static SCHEMA=vt.z.object({title:vt.z.string().optional(),description:vt.z.string().optional()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var Y=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var $=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var X=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var Q=require("zod"),Z=class n{constructor(t){this._transport=t}static SCHEMA=Q.z.object({input:Q.z.string().max(65536),original:Q.z.string().max(65536),correction:Q.z.string().max(65536)});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var tt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var et=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var nt=require("zod"),rt=class n{constructor(t){this._transport=t}static SCHEMA=nt.z.array(nt.z.object({role:nt.z.enum(["user","assistant"]),content:nt.z.string().max(65536).nullable()})).min(1);async send({id:t,body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var Lt=require("zod"),st=class n{constructor(t){this._transport=t}static SCHEMA=Lt.z.object({content:Lt.z.string()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var Ht=require("zod"),m=class n{constructor(t){this._transport=t}static SCHEMA=Ht.z.object({content:Ht.z.string()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var ot=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var it=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var at=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var Mt=require("zod"),pt=class n{constructor(t){this._transport=t}static SCHEMA=Mt.z.object({content:Mt.z.string().optional()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var p=require("zod"),ct=class n{constructor(t){this._transport=t}static SCHEMA=p.z.discriminatedUnion("type",[p.z.object({type:p.z.literal("vapid"),endpoint:p.z.string().url(),keys:p.z.object({p256dh:p.z.string(),auth:p.z.string()})})]);async send({id: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"},body:JSON.stringify(n.SCHEMA.parse(e))})}};var dt=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=re;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var lt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var mt=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/sources",{...t,method:"GET"})}};var se=te(require("is-network-error"),1),wt=te(require("ky"),1);var i=class extends Error{};var d=class extends i{};var ut=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var gt=class extends d{static forbidden(){return new this("A forbidden request occurred")}};var u=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}`)}};var ht=class extends i{};var ft=class extends i{static badRequest(){return new this("Bad request")}};var Ct=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=wt.default.create({prefixUrl:this.options.baseURL,hooks:{beforeRequest:[r=>{for(let s of this.options.requestFilterables){let de=s.getHeaders();for(let[Qt,le]of Object.entries(de))r.headers.has(Qt)||r.headers.set(Qt,le)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}async send(t,e){return await this.client(t,e).catch(r=>{if((0,se.default)(r))throw new ht("A network error occurred",{cause:r});if(r instanceof wt.HTTPError){let s=r.response.status;switch(console.error(JSON.stringify(r.response)),s){case 400:throw ft.badRequest();case 401:throw ut.unauthenticated();case 403:throw gt.forbidden();case 404:throw u.notFound(t);case 405:throw u.forbiddenMethod(t,e.method??"GET")}}throw r})}};var bt=class{constructor(t){this._transport=t}async send({files:t,request:e={}}){let r=new FormData;for(let s of t)r.append("file",s);return this._transport.send("v1/uploads",{...e,method:"POST",body:r})}};var yt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var o=require("zod"),Rt=class n{constructor(t){this._client=t}static SCHEMA=o.z.object({event:o.z.intersection(o.z.object({id:o.z.string(),createdAt:o.z.string().datetime()}),o.z.discriminatedUnion("type",[o.z.object({type:o.z.literal("contact.created"),contact:o.z.string()}),o.z.object({type:o.z.literal("message.created"),message:o.z.string()})]))});async event({request:t}){let{event:e}=n.SCHEMA.parse(t.body);return{event:e}}};var At=class n{static DEFAULT_BASE_URL=ne;_transport;constructor(t,{baseURL:e,...r}={}){this._transport=new Ct({requestFilterables:[new dt,t],...r,baseURL:e?.toString()??n.getBaseURL()})}static getBaseURL(){return process.env[ee]??this.DEFAULT_BASE_URL}get action(){return{list:new h(this._transport)}}get boilerplate(){return{get:new b(this._transport),list:new R(this._transport),update:new A(this._transport)}}get boilerplateCategory(){return{get:new O(this._transport),list:new _(this._transport),create:new T(this._transport),update:new S(this._transport),boilerplate:{list:new y(this._transport),create:new C(this._transport)}}}get channel(){return{get:new E(this._transport),list:new F(this._transport),message:{list:new Y(this._transport)},twilioSendgrid:{create:new w(this._transport)},metaWhatsapp:{create:new v(this._transport)}}}get contact(){return{get:new q(this._transport),list:new L(this._transport),update:new N(this._transport),create:new U(this._transport),conversation:{list:new G(this._transport)},note:{list:new it(this._transport),create:new st(this._transport)},notificationSubscription:{create:new ct(this._transport)},vcf:{get:new I(this._transport)}}}get conversation(){return{get:new j(this._transport),list:new P(this._transport),update:new z(this._transport),create:new m(this._transport),message:{list:new $(this._transport)},note:{list:new at(this._transport),create:new m(this._transport)}}}get label(){return{create:new J(this._transport),get:new K(this._transport),list:new V(this._transport),update:new W(this._transport),delete:new k(this._transport),contact:{list:new H(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 rt(this._transport)},correction:{create:new Z(this._transport)}}}get note(){return{get:new ot(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 yt(this._transport),create:new bt(this._transport)}}get webhook(){return new Rt(this)}};var Nt=require("commander"),oe=require("ora");function jt({client:n,ora:t}){let e=new Nt.Command("actions").description("Actions");return e.addCommand(new Nt.Command("list").description("List actions").action(async()=>{let r=await(0,oe.oraPromise)(()=>n.action.list.send(),{...t,text:"Finding actions"});console.log(await r.json())})),e}var Gt=require("commander"),ie=require("ora");function Pt({client:n,ora:t}){let e=new Gt.Command("channels").description("Channels");return e.addCommand(new Gt.Command("list").description("List channels").action(async()=>{let r=await(0,ie.oraPromise)(()=>n.channel.list.send(),{...t,text:"Finding channels"});console.log(await r.json())})),e}var Et=require("commander"),Dt=require("ora");function zt({client:n,ora:t}){let e=new Et.Command("contacts").description("Contacts");return e.addCommand(new Et.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async r=>{let s=await(0,Dt.oraPromise)(()=>n.contact.get.send({id:r}),{...t,text:"Finding contact"});console.log(await s.json())})),e.addCommand(new Et.Command("list").description("List contacts").action(async()=>{let r=await(0,Dt.oraPromise)(()=>n.contact.list.send(),{...t,text:"Finding contacts"});console.log(await r.json())})),e}var Ft=require("commander"),Bt=require("ora");function Jt({client:n,ora:t}){let e=new Ft.Command("conversations").description("Conversations");return e.addCommand(new Ft.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async r=>{let s=await(0,Bt.oraPromise)(()=>n.conversation.get.send({id:r}),{...t,text:"Finding conversation"});console.log(await s.json())})),e.addCommand(new Ft.Command("list").description("List conversations").action(async()=>{let r=await(0,Bt.oraPromise)(()=>n.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await r.json())})),e}var xt=require("commander"),It=require("ora");function kt({client:n,ora:t}){let e=new xt.Command("labels").description("Labels");return e.addCommand(new xt.Command("get").description("Find label").argument("<label>","Label ID").action(async r=>{let s=await(0,It.oraPromise)(()=>n.label.get.send({id:r}),{...t,text:"Finding label"});console.log(await s.json())})),e.addCommand(new xt.Command("list").description("List labels").action(async()=>{let r=await(0,It.oraPromise)(()=>n.label.list.send(),{...t,text:"Finding labels"});console.log(await r.json())})),e.addCommand(new xt.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async r=>{let s=await(0,It.oraPromise)(()=>n.label.conversation.list.send({id:r}),{...t,text:"Finding conversations"});console.log(await s.json())})),e}var Kt=require("commander"),ae=require("ora");function Vt({client:n,ora:t}){let e=new Kt.Command("messages").description("Messages");return e.addCommand(new Kt.Command("list").description("List messages").action(async()=>{let r=await(0,ae.oraPromise)(()=>n.message.list.send(),{...t,text:"Finding messages"});console.log(await r.json())})),e}var Ut=require("commander"),Wt=require("ora");function Yt({client:n,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 r=>{let s=await(0,Wt.oraPromise)(()=>n.model.get.send({id:r}),{...t,text:"Finding model"});console.log(await s.json())})),e.addCommand(new Ut.Command("list").description("List models").action(async()=>{let r=await(0,Wt.oraPromise)(()=>n.model.list.send(),{...t,text:"Finding models"});console.log(await r.json())})),e}var qt=require("commander"),$t=require("ora");function Xt({client:n,ora:t}){let e=new qt.Command("sources").description("Sources");return e.addCommand(new qt.Command("get").description("Find source").argument("<source>","Source ID").action(async r=>{let s=await(0,$t.oraPromise)(()=>n.source.get.send({id:r}),{...t,text:"Finding source"});console.log(await s.json())})),e.addCommand(new qt.Command("list").description("List sources").action(async()=>{let r=await(0,$t.oraPromise)(()=>n.source.list.send(),{...t,text:"Finding sources"});console.log(await r.json())})),e}var c={ora:{spinner:"simpleDotsScrolling"},client:new At(new g)},be=new pe.Command("gds").description("Great Detail Support System").addCommand(jt(c)).addCommand(Pt(c)).addCommand(zt(c)).addCommand(Jt(c)).addCommand(kt(c)).addCommand(Vt(c)).addCommand(Yt(c)).addCommand(Xt(c)),ce=be;ce.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-K5Z4T3HT.js";import"./chunk-L7CYM6XM.js";r.parseAsync(process.argv);
|
|
@@ -29,28 +29,28 @@ interface RequestFilterable {
|
|
|
29
29
|
* @see https://greatdetail.com
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
|
-
interface Options$
|
|
32
|
+
interface Options$P {
|
|
33
33
|
requestFilterables: RequestFilterable[];
|
|
34
34
|
}
|
|
35
35
|
interface Transport {
|
|
36
36
|
getURL(url: string): string;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
interface InputOptions extends Options$
|
|
39
|
+
interface InputOptions extends Options$P {
|
|
40
40
|
baseURL: string;
|
|
41
41
|
}
|
|
42
|
-
interface Options$
|
|
42
|
+
interface Options$O extends Options$P {
|
|
43
43
|
baseURL: string;
|
|
44
44
|
}
|
|
45
45
|
declare class FetchTransport implements Transport {
|
|
46
46
|
client: KyInstance;
|
|
47
|
-
options: Options$
|
|
47
|
+
options: Options$O;
|
|
48
48
|
constructor({ baseURL, ...options }: InputOptions);
|
|
49
49
|
getURL(url: string): string;
|
|
50
50
|
send<T = unknown>(url: string, request: RequestInit): Promise<ky.KyResponse<T>>;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
interface Options$
|
|
53
|
+
interface Options$N {
|
|
54
54
|
request?: RequestInit;
|
|
55
55
|
}
|
|
56
56
|
type ListActionsResponse = {
|
|
@@ -70,7 +70,7 @@ type ListActionsResponse = {
|
|
|
70
70
|
declare class ListActions {
|
|
71
71
|
protected _transport: FetchTransport;
|
|
72
72
|
constructor(_transport: FetchTransport);
|
|
73
|
-
send({ request }?: Options$
|
|
73
|
+
send({ request }?: Options$N): Promise<ky.KyResponse<ListActionsResponse>>;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
/**
|
|
@@ -84,7 +84,7 @@ declare class ListActions {
|
|
|
84
84
|
|
|
85
85
|
type Authentication = RequestFilterable;
|
|
86
86
|
|
|
87
|
-
interface Options$
|
|
87
|
+
interface Options$M {
|
|
88
88
|
id: string;
|
|
89
89
|
body: z.infer<typeof CreateBoilerplateCategoryBoilerplate.SCHEMA>;
|
|
90
90
|
request?: RequestInit;
|
|
@@ -115,10 +115,10 @@ declare class CreateBoilerplateCategoryBoilerplate {
|
|
|
115
115
|
account: string;
|
|
116
116
|
}>;
|
|
117
117
|
constructor(_transport: FetchTransport);
|
|
118
|
-
send({ id, body, request }: Options$
|
|
118
|
+
send({ id, body, request }: Options$M): Promise<ky.KyResponse<CreateBoilerplateCategoryBoilerplateResponse>>;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
interface Options$
|
|
121
|
+
interface Options$L {
|
|
122
122
|
id: string;
|
|
123
123
|
request?: RequestInit;
|
|
124
124
|
}
|
|
@@ -136,17 +136,17 @@ type GetBoilerplateResponse = {
|
|
|
136
136
|
declare class GetBoilerplate {
|
|
137
137
|
protected _transport: FetchTransport;
|
|
138
138
|
constructor(_transport: FetchTransport);
|
|
139
|
-
send({ id, request }: Options$
|
|
139
|
+
send({ id, request }: Options$L): Promise<ky.KyResponse<GetBoilerplateResponse>>;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
interface Options$
|
|
142
|
+
interface Options$K {
|
|
143
143
|
id: string;
|
|
144
144
|
request?: RequestInit;
|
|
145
145
|
}
|
|
146
146
|
declare class ListBoilerplateCategoryBoilerplates {
|
|
147
147
|
protected _transport: FetchTransport;
|
|
148
148
|
constructor(_transport: FetchTransport);
|
|
149
|
-
send({ id, request }: Options$
|
|
149
|
+
send({ id, request }: Options$K): Promise<ky.KyResponse<ListBoilerplateCategoryBoilerplatesResponse>>;
|
|
150
150
|
}
|
|
151
151
|
type ListBoilerplateCategoryBoilerplatesResponse = {
|
|
152
152
|
boilerplates: {
|
|
@@ -160,7 +160,7 @@ type ListBoilerplateCategoryBoilerplatesResponse = {
|
|
|
160
160
|
}[];
|
|
161
161
|
};
|
|
162
162
|
|
|
163
|
-
interface Options$
|
|
163
|
+
interface Options$J {
|
|
164
164
|
query?: string;
|
|
165
165
|
request?: RequestInit;
|
|
166
166
|
}
|
|
@@ -178,10 +178,10 @@ type ListBoilerplatesResponse = {
|
|
|
178
178
|
declare class ListBoilerplates {
|
|
179
179
|
protected _transport: FetchTransport;
|
|
180
180
|
constructor(_transport: FetchTransport);
|
|
181
|
-
send({ query, request }?: Options$
|
|
181
|
+
send({ query, request }?: Options$J): Promise<ky.KyResponse<ListBoilerplatesResponse>>;
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
interface Options$
|
|
184
|
+
interface Options$I {
|
|
185
185
|
id: string;
|
|
186
186
|
body: z.infer<typeof UpdateBoilerplate.SCHEMA>;
|
|
187
187
|
request?: RequestInit;
|
|
@@ -210,10 +210,10 @@ declare class UpdateBoilerplate {
|
|
|
210
210
|
content?: string | undefined;
|
|
211
211
|
}>;
|
|
212
212
|
constructor(_transport: FetchTransport);
|
|
213
|
-
send({ id, body, request }: Options$
|
|
213
|
+
send({ id, body, request }: Options$I): Promise<ky.KyResponse<UpdateBoilerplateResponse>>;
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
-
interface Options$
|
|
216
|
+
interface Options$H {
|
|
217
217
|
body: z.infer<typeof CreateBoilerplateCategory.SCHEMA>;
|
|
218
218
|
request?: RequestInit;
|
|
219
219
|
}
|
|
@@ -243,10 +243,10 @@ declare class CreateBoilerplateCategory {
|
|
|
243
243
|
description?: string | undefined;
|
|
244
244
|
}>;
|
|
245
245
|
constructor(_transport: FetchTransport);
|
|
246
|
-
send({ body, request }: Options$
|
|
246
|
+
send({ body, request }: Options$H): Promise<ky.KyResponse<CreateBoilerplateCategoryResponse>>;
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
-
interface Options$
|
|
249
|
+
interface Options$G {
|
|
250
250
|
id: string;
|
|
251
251
|
request?: RequestInit;
|
|
252
252
|
}
|
|
@@ -263,10 +263,10 @@ type GetBoilerplateCategoryResponse = {
|
|
|
263
263
|
declare class GetBoilerplateCategory {
|
|
264
264
|
protected _transport: FetchTransport;
|
|
265
265
|
constructor(_transport: FetchTransport);
|
|
266
|
-
send({ id, request }: Options$
|
|
266
|
+
send({ id, request }: Options$G): Promise<ky.KyResponse<GetBoilerplateCategoryResponse>>;
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
-
interface Options$
|
|
269
|
+
interface Options$F {
|
|
270
270
|
request?: RequestInit;
|
|
271
271
|
}
|
|
272
272
|
type ListBoilerplateCategoriesResponse = {
|
|
@@ -282,10 +282,10 @@ type ListBoilerplateCategoriesResponse = {
|
|
|
282
282
|
declare class ListBoilerplateCategories {
|
|
283
283
|
protected _transport: FetchTransport;
|
|
284
284
|
constructor(_transport: FetchTransport);
|
|
285
|
-
send({ request }?: Options$
|
|
285
|
+
send({ request }?: Options$F): Promise<ky.KyResponse<ListBoilerplateCategoriesResponse>>;
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
-
interface Options$
|
|
288
|
+
interface Options$E {
|
|
289
289
|
id: string;
|
|
290
290
|
body: z.infer<typeof UpdateBoilerplateCategory.SCHEMA>;
|
|
291
291
|
request?: RequestInit;
|
|
@@ -313,7 +313,44 @@ declare class UpdateBoilerplateCategory {
|
|
|
313
313
|
description?: string | undefined;
|
|
314
314
|
}>;
|
|
315
315
|
constructor(_transport: FetchTransport);
|
|
316
|
-
send({ id, body, request }: Options$
|
|
316
|
+
send({ id, body, request }: Options$E): Promise<ky.KyResponse<UpdateBoilerplateCategoryResponse>>;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
interface Options$D {
|
|
320
|
+
body: z.infer<typeof CreateMetaWhatsappChannel.SCHEMA>;
|
|
321
|
+
request?: RequestInit;
|
|
322
|
+
}
|
|
323
|
+
type CreateMetaWhatsappChannelResponse = {
|
|
324
|
+
channel: {
|
|
325
|
+
id: string;
|
|
326
|
+
name?: string;
|
|
327
|
+
source: "meta-whatsapp";
|
|
328
|
+
status: "ActiveChannelStatus" | "PotentialChannelStatus";
|
|
329
|
+
account: string;
|
|
330
|
+
createdAt: string;
|
|
331
|
+
updatedAt: string;
|
|
332
|
+
metaWhatsapp: {
|
|
333
|
+
id: string;
|
|
334
|
+
whatsappAccountID: string;
|
|
335
|
+
whatsappPhoneNumberID: string;
|
|
336
|
+
accessToken: string;
|
|
337
|
+
};
|
|
338
|
+
};
|
|
339
|
+
};
|
|
340
|
+
declare class CreateMetaWhatsappChannel {
|
|
341
|
+
protected _transport: FetchTransport;
|
|
342
|
+
static SCHEMA: z.ZodObject<{
|
|
343
|
+
name: z.ZodOptional<z.ZodString>;
|
|
344
|
+
account: z.ZodString;
|
|
345
|
+
}, "strip", z.ZodTypeAny, {
|
|
346
|
+
account: string;
|
|
347
|
+
name?: string | undefined;
|
|
348
|
+
}, {
|
|
349
|
+
account: string;
|
|
350
|
+
name?: string | undefined;
|
|
351
|
+
}>;
|
|
352
|
+
constructor(_transport: FetchTransport);
|
|
353
|
+
send({ body, request }: Options$D): Promise<ky.KyResponse<CreateMetaWhatsappChannelResponse>>;
|
|
317
354
|
}
|
|
318
355
|
|
|
319
356
|
interface Options$C {
|
|
@@ -334,6 +371,11 @@ type CreateTwilioSendgridChannelResponse = {
|
|
|
334
371
|
replyEmailAddress?: string;
|
|
335
372
|
inboundHostname: string;
|
|
336
373
|
apiKey: string;
|
|
374
|
+
secrets: {
|
|
375
|
+
id: string;
|
|
376
|
+
isActive: boolean;
|
|
377
|
+
secretExcerpt: string;
|
|
378
|
+
}[];
|
|
337
379
|
};
|
|
338
380
|
createdAt: string;
|
|
339
381
|
updatedAt: string;
|
|
@@ -417,6 +459,11 @@ type GetChannelResponse = {
|
|
|
417
459
|
replyEmailAddress?: string;
|
|
418
460
|
inboundHostname: string;
|
|
419
461
|
apiKey: string;
|
|
462
|
+
secrets: {
|
|
463
|
+
id: string;
|
|
464
|
+
isActive: boolean;
|
|
465
|
+
secretExcerpt: string;
|
|
466
|
+
}[];
|
|
420
467
|
};
|
|
421
468
|
});
|
|
422
469
|
};
|
|
@@ -454,6 +501,11 @@ type ListChannelsResponse = {
|
|
|
454
501
|
replyEmailAddress?: string;
|
|
455
502
|
inboundHostname: string;
|
|
456
503
|
apiKey: string;
|
|
504
|
+
secrets: {
|
|
505
|
+
id: string;
|
|
506
|
+
isActive: boolean;
|
|
507
|
+
secretExcerpt: string;
|
|
508
|
+
}[];
|
|
457
509
|
};
|
|
458
510
|
}))[];
|
|
459
511
|
};
|
|
@@ -1420,6 +1472,9 @@ declare class Client {
|
|
|
1420
1472
|
twilioSendgrid: {
|
|
1421
1473
|
create: CreateTwilioSendgridChannel;
|
|
1422
1474
|
};
|
|
1475
|
+
metaWhatsapp: {
|
|
1476
|
+
create: CreateMetaWhatsappChannel;
|
|
1477
|
+
};
|
|
1423
1478
|
};
|
|
1424
1479
|
get contact(): {
|
|
1425
1480
|
get: GetContact;
|
|
@@ -1494,4 +1549,4 @@ declare class Client {
|
|
|
1494
1549
|
get webhook(): Webhook;
|
|
1495
1550
|
}
|
|
1496
1551
|
|
|
1497
|
-
export { type Authentication as A, type
|
|
1552
|
+
export { type Authentication as A, type ListConversationMessagesResponse as B, Client as C, type DeleteLabelResponse as D, type ListMessagesResponse as E, type ListChannelMessagesResponse as F, type GetBoilerplateResponse as G, type GetModelResponse as H, type ListModelsResponse as I, type CreateCorrectionResponse as J, type CreateResponseResponse as K, type ListActionsResponse as L, type CreateContactNoteResponse as M, type CreateConversationNoteResponse as N, type Options as O, type GetNoteResponse as P, type ListContactNotesResponse as Q, type RequestFilterable as R, type ListConversationNotesResponse as S, type UpdateNoteResponse as T, type UpdateBoilerplateResponse as U, type GetSourceResponse as V, type WebhookResponse as W, type ListSourcesResponse as X, type CreateContactNotificationSubscriptionResponse as Y, type CreateUploadResponse as Z, type GetUploadResponse as _, type Options$P as a, type CreateBoilerplateCategoryBoilerplateResponse as b, type ListBoilerplateCategoryBoilerplatesResponse as c, type ListBoilerplatesResponse as d, type CreateBoilerplateCategoryResponse as e, type GetBoilerplateCategoryResponse as f, type ListBoilerplateCategoriesResponse as g, type UpdateBoilerplateCategoryResponse as h, type ListChannelsResponse as i, type CreateTwilioSendgridChannelResponse as j, type CreateMetaWhatsappChannelResponse as k, type GetChannelResponse as l, type CreateContactResponse as m, type GetContactResponse as n, type ListContactsResponse as o, type ListLabelContactsResponse as p, type UpdateContactResponse as q, type GetConversationResponse as r, type ListConversationsResponse as s, type ListLabelConversationsResponse as t, type UpdateConversationResponse as u, type ListContactConversationsResponse as v, type CreateLabelResponse as w, type GetLabelResponse as x, type ListLabelsResponse as y, type UpdateLabelResponse as z };
|
|
@@ -29,28 +29,28 @@ interface RequestFilterable {
|
|
|
29
29
|
* @see https://greatdetail.com
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
|
-
interface Options$
|
|
32
|
+
interface Options$P {
|
|
33
33
|
requestFilterables: RequestFilterable[];
|
|
34
34
|
}
|
|
35
35
|
interface Transport {
|
|
36
36
|
getURL(url: string): string;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
interface InputOptions extends Options$
|
|
39
|
+
interface InputOptions extends Options$P {
|
|
40
40
|
baseURL: string;
|
|
41
41
|
}
|
|
42
|
-
interface Options$
|
|
42
|
+
interface Options$O extends Options$P {
|
|
43
43
|
baseURL: string;
|
|
44
44
|
}
|
|
45
45
|
declare class FetchTransport implements Transport {
|
|
46
46
|
client: KyInstance;
|
|
47
|
-
options: Options$
|
|
47
|
+
options: Options$O;
|
|
48
48
|
constructor({ baseURL, ...options }: InputOptions);
|
|
49
49
|
getURL(url: string): string;
|
|
50
50
|
send<T = unknown>(url: string, request: RequestInit): Promise<ky.KyResponse<T>>;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
interface Options$
|
|
53
|
+
interface Options$N {
|
|
54
54
|
request?: RequestInit;
|
|
55
55
|
}
|
|
56
56
|
type ListActionsResponse = {
|
|
@@ -70,7 +70,7 @@ type ListActionsResponse = {
|
|
|
70
70
|
declare class ListActions {
|
|
71
71
|
protected _transport: FetchTransport;
|
|
72
72
|
constructor(_transport: FetchTransport);
|
|
73
|
-
send({ request }?: Options$
|
|
73
|
+
send({ request }?: Options$N): Promise<ky.KyResponse<ListActionsResponse>>;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
/**
|
|
@@ -84,7 +84,7 @@ declare class ListActions {
|
|
|
84
84
|
|
|
85
85
|
type Authentication = RequestFilterable;
|
|
86
86
|
|
|
87
|
-
interface Options$
|
|
87
|
+
interface Options$M {
|
|
88
88
|
id: string;
|
|
89
89
|
body: z.infer<typeof CreateBoilerplateCategoryBoilerplate.SCHEMA>;
|
|
90
90
|
request?: RequestInit;
|
|
@@ -115,10 +115,10 @@ declare class CreateBoilerplateCategoryBoilerplate {
|
|
|
115
115
|
account: string;
|
|
116
116
|
}>;
|
|
117
117
|
constructor(_transport: FetchTransport);
|
|
118
|
-
send({ id, body, request }: Options$
|
|
118
|
+
send({ id, body, request }: Options$M): Promise<ky.KyResponse<CreateBoilerplateCategoryBoilerplateResponse>>;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
interface Options$
|
|
121
|
+
interface Options$L {
|
|
122
122
|
id: string;
|
|
123
123
|
request?: RequestInit;
|
|
124
124
|
}
|
|
@@ -136,17 +136,17 @@ type GetBoilerplateResponse = {
|
|
|
136
136
|
declare class GetBoilerplate {
|
|
137
137
|
protected _transport: FetchTransport;
|
|
138
138
|
constructor(_transport: FetchTransport);
|
|
139
|
-
send({ id, request }: Options$
|
|
139
|
+
send({ id, request }: Options$L): Promise<ky.KyResponse<GetBoilerplateResponse>>;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
interface Options$
|
|
142
|
+
interface Options$K {
|
|
143
143
|
id: string;
|
|
144
144
|
request?: RequestInit;
|
|
145
145
|
}
|
|
146
146
|
declare class ListBoilerplateCategoryBoilerplates {
|
|
147
147
|
protected _transport: FetchTransport;
|
|
148
148
|
constructor(_transport: FetchTransport);
|
|
149
|
-
send({ id, request }: Options$
|
|
149
|
+
send({ id, request }: Options$K): Promise<ky.KyResponse<ListBoilerplateCategoryBoilerplatesResponse>>;
|
|
150
150
|
}
|
|
151
151
|
type ListBoilerplateCategoryBoilerplatesResponse = {
|
|
152
152
|
boilerplates: {
|
|
@@ -160,7 +160,7 @@ type ListBoilerplateCategoryBoilerplatesResponse = {
|
|
|
160
160
|
}[];
|
|
161
161
|
};
|
|
162
162
|
|
|
163
|
-
interface Options$
|
|
163
|
+
interface Options$J {
|
|
164
164
|
query?: string;
|
|
165
165
|
request?: RequestInit;
|
|
166
166
|
}
|
|
@@ -178,10 +178,10 @@ type ListBoilerplatesResponse = {
|
|
|
178
178
|
declare class ListBoilerplates {
|
|
179
179
|
protected _transport: FetchTransport;
|
|
180
180
|
constructor(_transport: FetchTransport);
|
|
181
|
-
send({ query, request }?: Options$
|
|
181
|
+
send({ query, request }?: Options$J): Promise<ky.KyResponse<ListBoilerplatesResponse>>;
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
interface Options$
|
|
184
|
+
interface Options$I {
|
|
185
185
|
id: string;
|
|
186
186
|
body: z.infer<typeof UpdateBoilerplate.SCHEMA>;
|
|
187
187
|
request?: RequestInit;
|
|
@@ -210,10 +210,10 @@ declare class UpdateBoilerplate {
|
|
|
210
210
|
content?: string | undefined;
|
|
211
211
|
}>;
|
|
212
212
|
constructor(_transport: FetchTransport);
|
|
213
|
-
send({ id, body, request }: Options$
|
|
213
|
+
send({ id, body, request }: Options$I): Promise<ky.KyResponse<UpdateBoilerplateResponse>>;
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
-
interface Options$
|
|
216
|
+
interface Options$H {
|
|
217
217
|
body: z.infer<typeof CreateBoilerplateCategory.SCHEMA>;
|
|
218
218
|
request?: RequestInit;
|
|
219
219
|
}
|
|
@@ -243,10 +243,10 @@ declare class CreateBoilerplateCategory {
|
|
|
243
243
|
description?: string | undefined;
|
|
244
244
|
}>;
|
|
245
245
|
constructor(_transport: FetchTransport);
|
|
246
|
-
send({ body, request }: Options$
|
|
246
|
+
send({ body, request }: Options$H): Promise<ky.KyResponse<CreateBoilerplateCategoryResponse>>;
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
-
interface Options$
|
|
249
|
+
interface Options$G {
|
|
250
250
|
id: string;
|
|
251
251
|
request?: RequestInit;
|
|
252
252
|
}
|
|
@@ -263,10 +263,10 @@ type GetBoilerplateCategoryResponse = {
|
|
|
263
263
|
declare class GetBoilerplateCategory {
|
|
264
264
|
protected _transport: FetchTransport;
|
|
265
265
|
constructor(_transport: FetchTransport);
|
|
266
|
-
send({ id, request }: Options$
|
|
266
|
+
send({ id, request }: Options$G): Promise<ky.KyResponse<GetBoilerplateCategoryResponse>>;
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
-
interface Options$
|
|
269
|
+
interface Options$F {
|
|
270
270
|
request?: RequestInit;
|
|
271
271
|
}
|
|
272
272
|
type ListBoilerplateCategoriesResponse = {
|
|
@@ -282,10 +282,10 @@ type ListBoilerplateCategoriesResponse = {
|
|
|
282
282
|
declare class ListBoilerplateCategories {
|
|
283
283
|
protected _transport: FetchTransport;
|
|
284
284
|
constructor(_transport: FetchTransport);
|
|
285
|
-
send({ request }?: Options$
|
|
285
|
+
send({ request }?: Options$F): Promise<ky.KyResponse<ListBoilerplateCategoriesResponse>>;
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
-
interface Options$
|
|
288
|
+
interface Options$E {
|
|
289
289
|
id: string;
|
|
290
290
|
body: z.infer<typeof UpdateBoilerplateCategory.SCHEMA>;
|
|
291
291
|
request?: RequestInit;
|
|
@@ -313,7 +313,44 @@ declare class UpdateBoilerplateCategory {
|
|
|
313
313
|
description?: string | undefined;
|
|
314
314
|
}>;
|
|
315
315
|
constructor(_transport: FetchTransport);
|
|
316
|
-
send({ id, body, request }: Options$
|
|
316
|
+
send({ id, body, request }: Options$E): Promise<ky.KyResponse<UpdateBoilerplateCategoryResponse>>;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
interface Options$D {
|
|
320
|
+
body: z.infer<typeof CreateMetaWhatsappChannel.SCHEMA>;
|
|
321
|
+
request?: RequestInit;
|
|
322
|
+
}
|
|
323
|
+
type CreateMetaWhatsappChannelResponse = {
|
|
324
|
+
channel: {
|
|
325
|
+
id: string;
|
|
326
|
+
name?: string;
|
|
327
|
+
source: "meta-whatsapp";
|
|
328
|
+
status: "ActiveChannelStatus" | "PotentialChannelStatus";
|
|
329
|
+
account: string;
|
|
330
|
+
createdAt: string;
|
|
331
|
+
updatedAt: string;
|
|
332
|
+
metaWhatsapp: {
|
|
333
|
+
id: string;
|
|
334
|
+
whatsappAccountID: string;
|
|
335
|
+
whatsappPhoneNumberID: string;
|
|
336
|
+
accessToken: string;
|
|
337
|
+
};
|
|
338
|
+
};
|
|
339
|
+
};
|
|
340
|
+
declare class CreateMetaWhatsappChannel {
|
|
341
|
+
protected _transport: FetchTransport;
|
|
342
|
+
static SCHEMA: z.ZodObject<{
|
|
343
|
+
name: z.ZodOptional<z.ZodString>;
|
|
344
|
+
account: z.ZodString;
|
|
345
|
+
}, "strip", z.ZodTypeAny, {
|
|
346
|
+
account: string;
|
|
347
|
+
name?: string | undefined;
|
|
348
|
+
}, {
|
|
349
|
+
account: string;
|
|
350
|
+
name?: string | undefined;
|
|
351
|
+
}>;
|
|
352
|
+
constructor(_transport: FetchTransport);
|
|
353
|
+
send({ body, request }: Options$D): Promise<ky.KyResponse<CreateMetaWhatsappChannelResponse>>;
|
|
317
354
|
}
|
|
318
355
|
|
|
319
356
|
interface Options$C {
|
|
@@ -334,6 +371,11 @@ type CreateTwilioSendgridChannelResponse = {
|
|
|
334
371
|
replyEmailAddress?: string;
|
|
335
372
|
inboundHostname: string;
|
|
336
373
|
apiKey: string;
|
|
374
|
+
secrets: {
|
|
375
|
+
id: string;
|
|
376
|
+
isActive: boolean;
|
|
377
|
+
secretExcerpt: string;
|
|
378
|
+
}[];
|
|
337
379
|
};
|
|
338
380
|
createdAt: string;
|
|
339
381
|
updatedAt: string;
|
|
@@ -417,6 +459,11 @@ type GetChannelResponse = {
|
|
|
417
459
|
replyEmailAddress?: string;
|
|
418
460
|
inboundHostname: string;
|
|
419
461
|
apiKey: string;
|
|
462
|
+
secrets: {
|
|
463
|
+
id: string;
|
|
464
|
+
isActive: boolean;
|
|
465
|
+
secretExcerpt: string;
|
|
466
|
+
}[];
|
|
420
467
|
};
|
|
421
468
|
});
|
|
422
469
|
};
|
|
@@ -454,6 +501,11 @@ type ListChannelsResponse = {
|
|
|
454
501
|
replyEmailAddress?: string;
|
|
455
502
|
inboundHostname: string;
|
|
456
503
|
apiKey: string;
|
|
504
|
+
secrets: {
|
|
505
|
+
id: string;
|
|
506
|
+
isActive: boolean;
|
|
507
|
+
secretExcerpt: string;
|
|
508
|
+
}[];
|
|
457
509
|
};
|
|
458
510
|
}))[];
|
|
459
511
|
};
|
|
@@ -1420,6 +1472,9 @@ declare class Client {
|
|
|
1420
1472
|
twilioSendgrid: {
|
|
1421
1473
|
create: CreateTwilioSendgridChannel;
|
|
1422
1474
|
};
|
|
1475
|
+
metaWhatsapp: {
|
|
1476
|
+
create: CreateMetaWhatsappChannel;
|
|
1477
|
+
};
|
|
1423
1478
|
};
|
|
1424
1479
|
get contact(): {
|
|
1425
1480
|
get: GetContact;
|
|
@@ -1494,4 +1549,4 @@ declare class Client {
|
|
|
1494
1549
|
get webhook(): Webhook;
|
|
1495
1550
|
}
|
|
1496
1551
|
|
|
1497
|
-
export { type Authentication as A, type
|
|
1552
|
+
export { type Authentication as A, type ListConversationMessagesResponse as B, Client as C, type DeleteLabelResponse as D, type ListMessagesResponse as E, type ListChannelMessagesResponse as F, type GetBoilerplateResponse as G, type GetModelResponse as H, type ListModelsResponse as I, type CreateCorrectionResponse as J, type CreateResponseResponse as K, type ListActionsResponse as L, type CreateContactNoteResponse as M, type CreateConversationNoteResponse as N, type Options as O, type GetNoteResponse as P, type ListContactNotesResponse as Q, type RequestFilterable as R, type ListConversationNotesResponse as S, type UpdateNoteResponse as T, type UpdateBoilerplateResponse as U, type GetSourceResponse as V, type WebhookResponse as W, type ListSourcesResponse as X, type CreateContactNotificationSubscriptionResponse as Y, type CreateUploadResponse as Z, type GetUploadResponse as _, type Options$P as a, type CreateBoilerplateCategoryBoilerplateResponse as b, type ListBoilerplateCategoryBoilerplatesResponse as c, type ListBoilerplatesResponse as d, type CreateBoilerplateCategoryResponse as e, type GetBoilerplateCategoryResponse as f, type ListBoilerplateCategoriesResponse as g, type UpdateBoilerplateCategoryResponse as h, type ListChannelsResponse as i, type CreateTwilioSendgridChannelResponse as j, type CreateMetaWhatsappChannelResponse as k, type GetChannelResponse as l, type CreateContactResponse as m, type GetContactResponse as n, type ListContactsResponse as o, type ListLabelContactsResponse as p, type UpdateContactResponse as q, type GetConversationResponse as r, type ListConversationsResponse as s, type ListLabelConversationsResponse as t, type UpdateConversationResponse as u, type ListContactConversationsResponse as v, type CreateLabelResponse as w, type GetLabelResponse as x, type ListLabelsResponse as y, type UpdateLabelResponse as z };
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Vt=Object.create;var xt=Object.defineProperty;var Kt=Object.getOwnPropertyDescriptor;var Yt=Object.getOwnPropertyNames;var Wt=Object.getPrototypeOf,$t=Object.prototype.hasOwnProperty;var Lt=(r,t)=>{for(var e in t)xt(r,e,{get:t[e],enumerable:!0})},Ht=(r,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Yt(t))!$t.call(r,n)&&n!==e&&xt(r,n,{get:()=>t[n],enumerable:!(s=Kt(t,n))||s.enumerable});return r};var Nt=(r,t,e)=>(e=r!=null?Vt(Wt(r)):{},Ht(t||!r||!r.__esModule?xt(e,"default",{value:r,enumerable:!0}):e,r)),Xt=r=>Ht(xt({},"__esModule",{value:!0}),r);var Qt={};Lt(Qt,{Client:()=>b,DEFAULT_SUPPORT_BASE_URL:()=>Tt,Error:()=>It,KeyAuthentication:()=>At,PublicAuthentication:()=>yt,TokenAuthentication:()=>Rt,default:()=>b});module.exports=Xt(Qt);var Tt="https://api.support.greatdetail.com",Mt={"X-Powered-By":"GDSupport/JavaScript"},Gt="api-key";var C=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var A=require("zod"),R=class r{constructor(t){this._transport=t}static SCHEMA=A.z.object({title:A.z.string(),content:A.z.string(),account:A.z.string()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var y=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var x=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var T=class{constructor(t){this._transport=t}async send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates"+(t?"?query="+encodeURIComponent(t):""),{...e,method:"GET"})}};var _t=require("zod"),_=class r{constructor(t){this._transport=t}static SCHEMA=_t.z.object({title:_t.z.string().optional(),content:_t.z.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var E=require("zod"),S=class r{constructor(t){this._transport=t}static SCHEMA=E.z.object({title:E.z.string(),description:E.z.string().optional(),account:E.z.string()});async send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(t))})}};var O=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var v=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/boilerplate-categories",{...t,method:"GET"})}};var Et=require("zod"),F=class r{constructor(t){this._transport=t}static SCHEMA=Et.z.object({title:Et.z.string().optional(),description:Et.z.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var a=require("zod"),w=class r{constructor(t){this._transport=t}static SCHEMA=a.z.object({name:a.z.string().optional(),account:a.z.string(),twilioSendgrid:a.z.object({displayName:a.z.string().optional(),outboundEmailAddress:a.z.string().email(),replyEmailAddress:a.z.string(),inboundHostname:a.z.string(),apiKey:a.z.string()})});async send({body:t,request:e={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(t))})}};var U=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var I=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var jt="SUPPORT_ACCESS_TOKEN",Bt="SUPPORT_API_KEY",Pt="SUPPORT_KEY_NAME",zt="SUPPORT_BASE_URL";var q=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let s=e.variant??"vcard",n=e.format??(e.variant==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(s)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}};var h=require("zod"),L=class r{constructor(t){this._transport=t}static SCHEMA=h.z.object({name:h.z.string(),account:h.z.string(),emailAddress:h.z.string().email().optional(),telephoneNumber:h.z.string().optional()});async send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(t))})}};var H=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"GET"})}};var N=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/contacts",{...t,method:"GET"})}};var M=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var G=require("zod"),j=class r{constructor(t){this._transport=t}static SCHEMA=G.z.object({name:G.z.string().optional(),emailAddress:G.z.string().email().optional(),telephoneNumber:G.z.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var B=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"GET"})}};var P=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var z=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/conversations",{...t,method:"GET"})}};var D=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var St=require("zod"),k=class r{constructor(t){this._transport=t}static SCHEMA=St.z.object({status:St.z.enum(["AwaitingContactConversationStatus","AwaitingAgentConversationStatus","ResolvedConversationStatus","ClosedConversationStatus"]).optional(),hasEnded:St.z.boolean().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var J=require("zod"),V=class r{constructor(t){this._transport=t}static SCHEMA=J.z.object({title:J.z.string(),description:J.z.string().optional(),account:J.z.string()});async send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(t))})}};var K=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Y=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var W=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/labels",{...t,method:"GET"})}};var Ot=require("zod"),$=class r{constructor(t){this._transport=t}static SCHEMA=Ot.z.object({title:Ot.z.string().optional(),description:Ot.z.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var X=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var Q=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var Z=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var tt=require("zod"),et=class r{constructor(t){this._transport=t}static SCHEMA=tt.z.object({input:tt.z.string().max(65536),original:tt.z.string().max(65536),correction:tt.z.string().max(65536)});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var rt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var st=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var nt=require("zod"),ot=class r{constructor(t){this._transport=t}static SCHEMA=nt.z.array(nt.z.object({role:nt.z.enum(["user","assistant"]),content:nt.z.string().max(65536).nullable()})).min(1);async send({id:t,body:e,request:s={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var Ft=require("zod"),it=class r{constructor(t){this._transport=t}static SCHEMA=Ft.z.object({content:Ft.z.string()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var wt=require("zod"),f=class r{constructor(t){this._transport=t}static SCHEMA=wt.z.object({content:wt.z.string()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var at=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var pt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var ct=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var Ut=require("zod"),dt=class r{constructor(t){this._transport=t}static SCHEMA=Ut.z.object({content:Ut.z.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var c=require("zod"),lt=class r{constructor(t){this._transport=t}static SCHEMA=c.z.discriminatedUnion("type",[c.z.object({type:c.z.literal("vapid"),endpoint:c.z.string().url(),keys:c.z.object({p256dh:c.z.string(),auth:c.z.string()})})]);async send({id:t,body:e,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var ut=class r{constructor(t=r.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Mt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var gt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var mt=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/sources",{...t,method:"GET"})}};var Dt=Nt(require("is-network-error"),1),vt=Nt(require("ky"),1);var o=class extends Error{};var p=class extends o{};var l=class extends p{static unauthenticated(){return new this("An unauthenticated request occurred")}};var u=class extends p{static forbidden(){return new this("A forbidden request occurred")}};var d=class extends o{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}`)}};var g=class extends o{};var m=class extends o{static badRequest(){return new this("Bad request")}};var ht=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=vt.default.create({prefixUrl:this.options.baseURL,hooks:{beforeRequest:[s=>{for(let n of this.options.requestFilterables){let kt=n.getHeaders();for(let[qt,Jt]of Object.entries(kt))s.headers.has(qt)||s.headers.set(qt,Jt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}async send(t,e){return await this.client(t,e).catch(s=>{if((0,Dt.default)(s))throw new g("A network error occurred",{cause:s});if(s instanceof vt.HTTPError){let n=s.response.status;switch(console.error(JSON.stringify(s.response)),n){case 400:throw m.badRequest();case 401:throw l.unauthenticated();case 403:throw u.forbidden();case 404:throw d.notFound(t);case 405:throw d.forbiddenMethod(t,e.method??"GET")}}throw s})}};var ft=class{constructor(t){this._transport=t}async send({files:t,request:e={}}){let s=new FormData;for(let n of t)s.append("file",n);return this._transport.send("v1/uploads",{...e,method:"POST",body:s})}};var bt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var i=require("zod"),Ct=class r{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}=r.SCHEMA.parse(t.body);return{event:e}}};var b=class r{static DEFAULT_BASE_URL=Tt;_transport;constructor(t,{baseURL:e,...s}={}){this._transport=new ht({requestFilterables:[new ut,t],...s,baseURL:e?.toString()??r.getBaseURL()})}static getBaseURL(){return process.env[zt]??this.DEFAULT_BASE_URL}get action(){return{list:new C(this._transport)}}get boilerplate(){return{get:new y(this._transport),list:new T(this._transport),update:new _(this._transport)}}get boilerplateCategory(){return{get:new O(this._transport),list:new v(this._transport),create:new S(this._transport),update:new F(this._transport),boilerplate:{list:new x(this._transport),create:new R(this._transport)}}}get channel(){return{get:new U(this._transport),list:new I(this._transport),message:{list:new X(this._transport)},twilioSendgrid:{create:new w(this._transport)}}}get contact(){return{get:new H(this._transport),list:new N(this._transport),update:new j(this._transport),create:new L(this._transport),conversation:{list:new P(this._transport)},note:{list:new pt(this._transport),create:new it(this._transport)},notificationSubscription:{create:new lt(this._transport)},vcf:{get:new q(this._transport)}}}get conversation(){return{get:new B(this._transport),list:new z(this._transport),update:new k(this._transport),create:new f(this._transport),message:{list:new Q(this._transport)},note:{list:new ct(this._transport),create:new f(this._transport)}}}get label(){return{create:new V(this._transport),get:new Y(this._transport),list:new W(this._transport),update:new $(this._transport),delete:new K(this._transport),contact:{list:new M(this._transport)},conversation:{list:new D(this._transport)}}}get message(){return{list:new Z(this._transport)}}get model(){return{get:new rt(this._transport),list:new st(this._transport),response:{create:new ot(this._transport)},correction:{create:new et(this._transport)}}}get note(){return{get:new at(this._transport),update:new dt(this._transport)}}get source(){return{get:new gt(this._transport),list:new mt(this._transport)}}get upload(){return{get:new bt(this._transport),create:new ft(this._transport)}}get webhook(){return new Ct(this)}};var It={};Lt(It,{AuthError:()=>p,AuthenticationError:()=>l,AuthorizationError:()=>u,LogicError:()=>d,NetworkError:()=>g,SupportError:()=>o,ValidationError:()=>m});var At=class r{static DEFAULT_NAME=Gt;name;#t;constructor({name:t=process.env[Pt]??r.DEFAULT_NAME,key:e=process.env[Bt]}={}){if(!e)throw new Error("API Key option must be specified when using Key Authentication");this.name=t,this.#t=e}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var Rt=class{#t;constructor({token:t=process.env[jt]}={}){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 yt=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 Wt=Object.create;var Tt=Object.defineProperty;var Yt=Object.getOwnPropertyDescriptor;var $t=Object.getOwnPropertyNames;var Xt=Object.getPrototypeOf,Qt=Object.prototype.hasOwnProperty;var Nt=(r,t)=>{for(var e in t)Tt(r,e,{get:t[e],enumerable:!0})},Mt=(r,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of $t(t))!Qt.call(r,n)&&n!==e&&Tt(r,n,{get:()=>t[n],enumerable:!(s=Yt(t,n))||s.enumerable});return r};var Gt=(r,t,e)=>(e=r!=null?Wt(Xt(r)):{},Mt(t||!r||!r.__esModule?Tt(e,"default",{value:r,enumerable:!0}):e,r)),Zt=r=>Mt(Tt({},"__esModule",{value:!0}),r);var te={};Nt(te,{Client:()=>b,DEFAULT_SUPPORT_BASE_URL:()=>_t,Error:()=>Lt,KeyAuthentication:()=>yt,PublicAuthentication:()=>xt,TokenAuthentication:()=>Rt,default:()=>b});module.exports=Zt(te);var _t="https://api.support.greatdetail.com",jt={"X-Powered-By":"GDSupport/JavaScript"},Pt="api-key";var C=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var A=require("zod"),y=class r{constructor(t){this._transport=t}static SCHEMA=A.z.object({title:A.z.string(),content:A.z.string(),account:A.z.string()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var R=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var x=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var T=class{constructor(t){this._transport=t}async send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates"+(t?"?query="+encodeURIComponent(t):""),{...e,method:"GET"})}};var Et=require("zod"),_=class r{constructor(t){this._transport=t}static SCHEMA=Et.z.object({title:Et.z.string().optional(),content:Et.z.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var E=require("zod"),S=class r{constructor(t){this._transport=t}static SCHEMA=E.z.object({title:E.z.string(),description:E.z.string().optional(),account:E.z.string()});async send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(t))})}};var O=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var v=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/boilerplate-categories",{...t,method:"GET"})}};var St=require("zod"),w=class r{constructor(t){this._transport=t}static SCHEMA=St.z.object({title:St.z.string().optional(),description:St.z.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var Ot=require("zod"),F=class r{constructor(t){this._transport=t}static SCHEMA=Ot.z.object({name:Ot.z.string().optional(),account:Ot.z.string()});async send({body:t,request:e={}}){return this._transport.send("v1/sources/meta-whatsapp/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(t))})}};var a=require("zod"),U=class r{constructor(t){this._transport=t}static SCHEMA=a.z.object({name:a.z.string().optional(),account:a.z.string(),twilioSendgrid:a.z.object({displayName:a.z.string().optional(),outboundEmailAddress:a.z.string().email(),replyEmailAddress:a.z.string(),inboundHostname:a.z.string(),apiKey:a.z.string()})});async send({body:t,request:e={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(t))})}};var I=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var q=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var zt="SUPPORT_ACCESS_TOKEN",Bt="SUPPORT_API_KEY",Dt="SUPPORT_KEY_NAME",kt="SUPPORT_BASE_URL";var L=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let s=e.variant??"vcard",n=e.format??(e.variant==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(s)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}};var h=require("zod"),H=class r{constructor(t){this._transport=t}static SCHEMA=h.z.object({name:h.z.string(),account:h.z.string(),emailAddress:h.z.string().email().optional(),telephoneNumber:h.z.string().optional()});async send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(t))})}};var N=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"GET"})}};var M=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/contacts",{...t,method:"GET"})}};var G=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var j=require("zod"),P=class r{constructor(t){this._transport=t}static SCHEMA=j.z.object({name:j.z.string().optional(),emailAddress:j.z.string().email().optional(),telephoneNumber:j.z.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var z=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"GET"})}};var B=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var D=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/conversations",{...t,method:"GET"})}};var k=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var vt=require("zod"),J=class r{constructor(t){this._transport=t}static SCHEMA=vt.z.object({status:vt.z.enum(["AwaitingContactConversationStatus","AwaitingAgentConversationStatus","ResolvedConversationStatus","ClosedConversationStatus"]).optional(),hasEnded:vt.z.boolean().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var V=require("zod"),K=class r{constructor(t){this._transport=t}static SCHEMA=V.z.object({title:V.z.string(),description:V.z.string().optional(),account:V.z.string()});async send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(t))})}};var W=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Y=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var $=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/labels",{...t,method:"GET"})}};var wt=require("zod"),X=class r{constructor(t){this._transport=t}static SCHEMA=wt.z.object({title:wt.z.string().optional(),description:wt.z.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var Q=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var Z=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var tt=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var et=require("zod"),rt=class r{constructor(t){this._transport=t}static SCHEMA=et.z.object({input:et.z.string().max(65536),original:et.z.string().max(65536),correction:et.z.string().max(65536)});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var st=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var nt=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var ot=require("zod"),it=class r{constructor(t){this._transport=t}static SCHEMA=ot.z.array(ot.z.object({role:ot.z.enum(["user","assistant"]),content:ot.z.string().max(65536).nullable()})).min(1);async send({id:t,body:e,request:s={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var Ut=require("zod"),at=class r{constructor(t){this._transport=t}static SCHEMA=Ut.z.object({content:Ut.z.string()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var It=require("zod"),f=class r{constructor(t){this._transport=t}static SCHEMA=It.z.object({content:It.z.string()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var pt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var ct=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var dt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var qt=require("zod"),lt=class r{constructor(t){this._transport=t}static SCHEMA=qt.z.object({content:qt.z.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var c=require("zod"),ut=class r{constructor(t){this._transport=t}static SCHEMA=c.z.discriminatedUnion("type",[c.z.object({type:c.z.literal("vapid"),endpoint:c.z.string().url(),keys:c.z.object({p256dh:c.z.string(),auth:c.z.string()})})]);async send({id:t,body:e,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var gt=class r{constructor(t=r.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=jt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var mt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var ht=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/sources",{...t,method:"GET"})}};var Jt=Gt(require("is-network-error"),1),Ft=Gt(require("ky"),1);var o=class extends Error{};var p=class extends o{};var l=class extends p{static unauthenticated(){return new this("An unauthenticated request occurred")}};var u=class extends p{static forbidden(){return new this("A forbidden request occurred")}};var d=class extends o{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}`)}};var g=class extends o{};var m=class extends o{static badRequest(){return new this("Bad request")}};var ft=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Ft.default.create({prefixUrl:this.options.baseURL,hooks:{beforeRequest:[s=>{for(let n of this.options.requestFilterables){let Vt=n.getHeaders();for(let[Ht,Kt]of Object.entries(Vt))s.headers.has(Ht)||s.headers.set(Ht,Kt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}async send(t,e){return await this.client(t,e).catch(s=>{if((0,Jt.default)(s))throw new g("A network error occurred",{cause:s});if(s instanceof Ft.HTTPError){let n=s.response.status;switch(console.error(JSON.stringify(s.response)),n){case 400:throw m.badRequest();case 401:throw l.unauthenticated();case 403:throw u.forbidden();case 404:throw d.notFound(t);case 405:throw d.forbiddenMethod(t,e.method??"GET")}}throw s})}};var bt=class{constructor(t){this._transport=t}async send({files:t,request:e={}}){let s=new FormData;for(let n of t)s.append("file",n);return this._transport.send("v1/uploads",{...e,method:"POST",body:s})}};var Ct=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var i=require("zod"),At=class r{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}=r.SCHEMA.parse(t.body);return{event:e}}};var b=class r{static DEFAULT_BASE_URL=_t;_transport;constructor(t,{baseURL:e,...s}={}){this._transport=new ft({requestFilterables:[new gt,t],...s,baseURL:e?.toString()??r.getBaseURL()})}static getBaseURL(){return process.env[kt]??this.DEFAULT_BASE_URL}get action(){return{list:new C(this._transport)}}get boilerplate(){return{get:new R(this._transport),list:new T(this._transport),update:new _(this._transport)}}get boilerplateCategory(){return{get:new O(this._transport),list:new v(this._transport),create:new S(this._transport),update:new w(this._transport),boilerplate:{list:new x(this._transport),create:new y(this._transport)}}}get channel(){return{get:new I(this._transport),list:new q(this._transport),message:{list:new Q(this._transport)},twilioSendgrid:{create:new U(this._transport)},metaWhatsapp:{create:new F(this._transport)}}}get contact(){return{get:new N(this._transport),list:new M(this._transport),update:new P(this._transport),create:new H(this._transport),conversation:{list:new B(this._transport)},note:{list:new ct(this._transport),create:new at(this._transport)},notificationSubscription:{create:new ut(this._transport)},vcf:{get:new L(this._transport)}}}get conversation(){return{get:new z(this._transport),list:new D(this._transport),update:new J(this._transport),create:new f(this._transport),message:{list:new Z(this._transport)},note:{list:new dt(this._transport),create:new f(this._transport)}}}get label(){return{create:new K(this._transport),get:new Y(this._transport),list:new $(this._transport),update:new X(this._transport),delete:new W(this._transport),contact:{list:new G(this._transport)},conversation:{list:new k(this._transport)}}}get message(){return{list:new tt(this._transport)}}get model(){return{get:new st(this._transport),list:new nt(this._transport),response:{create:new it(this._transport)},correction:{create:new rt(this._transport)}}}get note(){return{get:new pt(this._transport),update:new lt(this._transport)}}get source(){return{get:new mt(this._transport),list:new ht(this._transport)}}get upload(){return{get:new Ct(this._transport),create:new bt(this._transport)}}get webhook(){return new At(this)}};var Lt={};Nt(Lt,{AuthError:()=>p,AuthenticationError:()=>l,AuthorizationError:()=>u,LogicError:()=>d,NetworkError:()=>g,SupportError:()=>o,ValidationError:()=>m});var yt=class r{static DEFAULT_NAME=Pt;name;#t;constructor({name:t=process.env[Dt]??r.DEFAULT_NAME,key:e=process.env[Bt]}={}){if(!e)throw new Error("API Key option must be specified when using Key Authentication");this.name=t,this.#t=e}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var Rt=class{#t;constructor({token:t=process.env[zt]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var xt=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 } from './index-
|
|
2
|
-
export { C as Client, b as CreateBoilerplateCategoryBoilerplateResponse, e as CreateBoilerplateCategoryResponse,
|
|
1
|
+
import { A as Authentication } from './index-En9HWuig.cjs';
|
|
2
|
+
export { C as Client, b as CreateBoilerplateCategoryBoilerplateResponse, e as CreateBoilerplateCategoryResponse, M as CreateContactNoteResponse, Y as CreateContactNotificationSubscriptionResponse, m as CreateContactResponse, N as CreateConversationNoteResponse, J as CreateCorrectionResponse, w as CreateLabelResponse, k as CreateMetaWhatsappChannelResponse, K as CreateResponseResponse, j as CreateTwilioSendgridChannelResponse, Z as CreateUploadResponse, D as DeleteLabelResponse, f as GetBoilerplateCategoryResponse, G as GetBoilerplateResponse, l as GetChannelResponse, n as GetContactResponse, r as GetConversationResponse, x as GetLabelResponse, H as GetModelResponse, P as GetNoteResponse, V as GetSourceResponse, _ as GetUploadResponse, L as ListActionsResponse, g as ListBoilerplateCategoriesResponse, c as ListBoilerplateCategoryBoilerplatesResponse, d as ListBoilerplatesResponse, F as ListChannelMessagesResponse, i as ListChannelsResponse, v as ListContactConversationsResponse, Q as ListContactNotesResponse, o as ListContactsResponse, B as ListConversationMessagesResponse, S as ListConversationNotesResponse, s as ListConversationsResponse, p as ListLabelContactsResponse, t as ListLabelConversationsResponse, y as ListLabelsResponse, E as ListMessagesResponse, I as ListModelsResponse, X as ListSourcesResponse, O as Options, R as RequestFilterable, a as TransportOptions, h as UpdateBoilerplateCategoryResponse, U as UpdateBoilerplateResponse, q as UpdateContactResponse, u as UpdateConversationResponse, z as UpdateLabelResponse, T as UpdateNoteResponse, W as WebhookResponse, C as default } from './index-En9HWuig.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 } from './index-
|
|
2
|
-
export { C as Client, b as CreateBoilerplateCategoryBoilerplateResponse, e as CreateBoilerplateCategoryResponse,
|
|
1
|
+
import { A as Authentication } from './index-En9HWuig.js';
|
|
2
|
+
export { C as Client, b as CreateBoilerplateCategoryBoilerplateResponse, e as CreateBoilerplateCategoryResponse, M as CreateContactNoteResponse, Y as CreateContactNotificationSubscriptionResponse, m as CreateContactResponse, N as CreateConversationNoteResponse, J as CreateCorrectionResponse, w as CreateLabelResponse, k as CreateMetaWhatsappChannelResponse, K as CreateResponseResponse, j as CreateTwilioSendgridChannelResponse, Z as CreateUploadResponse, D as DeleteLabelResponse, f as GetBoilerplateCategoryResponse, G as GetBoilerplateResponse, l as GetChannelResponse, n as GetContactResponse, r as GetConversationResponse, x as GetLabelResponse, H as GetModelResponse, P as GetNoteResponse, V as GetSourceResponse, _ as GetUploadResponse, L as ListActionsResponse, g as ListBoilerplateCategoriesResponse, c as ListBoilerplateCategoryBoilerplatesResponse, d as ListBoilerplatesResponse, F as ListChannelMessagesResponse, i as ListChannelsResponse, v as ListContactConversationsResponse, Q as ListContactNotesResponse, o as ListContactsResponse, B as ListConversationMessagesResponse, S as ListConversationNotesResponse, s as ListConversationsResponse, p as ListLabelContactsResponse, t as ListLabelConversationsResponse, y as ListLabelsResponse, E as ListMessagesResponse, I as ListModelsResponse, X as ListSourcesResponse, O as Options, R as RequestFilterable, a as TransportOptions, h as UpdateBoilerplateCategoryResponse, U as UpdateBoilerplateResponse, q as UpdateContactResponse, u as UpdateConversationResponse, z as UpdateLabelResponse, T as UpdateNoteResponse, W as WebhookResponse, C as default } from './index-En9HWuig.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-L7CYM6XM.js";var E={};d(E,{AuthError:()=>m,AuthenticationError:()=>u,AuthorizationError:()=>c,LogicError:()=>x,NetworkError:()=>l,SupportError:()=>f,ValidationError:()=>h});var t=class o{static DEFAULT_NAME=a;name;#r;constructor({name:r=process.env[n]??o.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 e=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,e as TokenAuthentication,A as default};
|
package/package.json
CHANGED
package/dist/chunk-HTPWK3JJ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var qt=Object.defineProperty;var Nt=(r,t)=>{for(var e in t)qt(r,e,{get:t[e],enumerable:!0})};var Ct=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var St="https://api.support.greatdetail.com",vt={"X-Powered-By":"GDSupport/JavaScript"},Bt="api-key";import{z as n}from"zod";var u=class r{constructor(t){this._client=t}static SCHEMA=n.object({event:n.intersection(n.object({id:n.string(),createdAt:n.string().datetime()}),n.discriminatedUnion("type",[n.object({type:n.literal("contact.created"),contact:n.string()}),n.object({type:n.literal("message.created"),message:n.string()})]))});async event({request:t}){let{event:e}=r.SCHEMA.parse(t.body);return{event:e}}};var g=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};import{z as ut}from"zod";var m=class r{constructor(t){this._transport=t}static SCHEMA=ut.object({title:ut.string(),content:ut.string(),account:ut.string()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var h=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var f=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var b=class{constructor(t){this._transport=t}async send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates"+(t?"?query="+encodeURIComponent(t):""),{...e,method:"GET"})}};import{z as Rt}from"zod";var C=class r{constructor(t){this._transport=t}static SCHEMA=Rt.object({title:Rt.string().optional(),content:Rt.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};import{z as gt}from"zod";var R=class r{constructor(t){this._transport=t}static SCHEMA=gt.object({title:gt.string(),description:gt.string().optional(),account:gt.string()});async send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(t))})}};var y=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var A=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/boilerplate-categories",{...t,method:"GET"})}};import{z as yt}from"zod";var T=class r{constructor(t){this._transport=t}static SCHEMA=yt.object({title:yt.string().optional(),description:yt.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};import{z as i}from"zod";var x=class r{constructor(t){this._transport=t}static SCHEMA=i.object({name:i.string().optional(),account:i.string(),twilioSendgrid:i.object({displayName:i.string().optional(),outboundEmailAddress:i.string().email(),replyEmailAddress:i.string(),inboundHostname:i.string(),apiKey:i.string()})});async send({body:t,request:e={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(t))})}};var _=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var S=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var pe="SUPPORT_ACCESS_TOKEN",ce="SUPPORT_API_KEY",de="SUPPORT_KEY_NAME",Et="SUPPORT_BASE_URL";var v=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let s=e.variant??"vcard",a=e.format??(e.variant==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(s)+"&format="+encodeURIComponent(a)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}};import{z as E}from"zod";var O=class r{constructor(t){this._transport=t}static SCHEMA=E.object({name:E.string(),account:E.string(),emailAddress:E.string().email().optional(),telephoneNumber:E.string().optional()});async send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(t))})}};var F=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"GET"})}};var w=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/contacts",{...t,method:"GET"})}};var I=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};import{z as mt}from"zod";var U=class r{constructor(t){this._transport=t}static SCHEMA=mt.object({name:mt.string().optional(),emailAddress:mt.string().email().optional(),telephoneNumber:mt.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var q=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"GET"})}};var L=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/conversations",{...t,method:"GET"})}};var M=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};import{z as At}from"zod";var N=class r{constructor(t){this._transport=t}static SCHEMA=At.object({status:At.enum(["AwaitingContactConversationStatus","AwaitingAgentConversationStatus","ResolvedConversationStatus","ClosedConversationStatus"]).optional(),hasEnded:At.boolean().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};import{z as ht}from"zod";var G=class r{constructor(t){this._transport=t}static SCHEMA=ht.object({title:ht.string(),description:ht.string().optional(),account:ht.string()});async send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(t))})}};var j=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var B=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var z=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/labels",{...t,method:"GET"})}};import{z as Tt}from"zod";var P=class r{constructor(t){this._transport=t}static SCHEMA=Tt.object({title:Tt.string().optional(),description:Tt.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var D=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var J=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var k=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};import{z as ft}from"zod";var K=class r{constructor(t){this._transport=t}static SCHEMA=ft.object({input:ft.string().max(65536),original:ft.string().max(65536),correction:ft.string().max(65536)});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var V=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var W=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};import{z as bt}from"zod";var Y=class r{constructor(t){this._transport=t}static SCHEMA=bt.array(bt.object({role:bt.enum(["user","assistant"]),content:bt.string().max(65536).nullable()})).min(1);async send({id:t,body:e,request:s={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};import{z as Ot}from"zod";var $=class r{constructor(t){this._transport=t}static SCHEMA=Ot.object({content:Ot.string()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};import{z as Ft}from"zod";var d=class r{constructor(t){this._transport=t}static SCHEMA=Ft.object({content:Ft.string()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var X=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var Q=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var Z=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};import{z as wt}from"zod";var tt=class r{constructor(t){this._transport=t}static SCHEMA=wt.object({content:wt.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};import{z as p}from"zod";var et=class r{constructor(t){this._transport=t}static SCHEMA=p.discriminatedUnion("type",[p.object({type:p.literal("vapid"),endpoint:p.string().url(),keys:p.object({p256dh:p.string(),auth:p.string()})})]);async send({id:t,body:e,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var rt=class r{constructor(t=r.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=vt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var st=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var nt=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/sources",{...t,method:"GET"})}};import Lt from"is-network-error";import Ht,{HTTPError as Mt}from"ky";var o=class extends Error{};var c=class extends o{};var ot=class extends c{static unauthenticated(){return new this("An unauthenticated request occurred")}};var it=class extends c{static forbidden(){return new this("A forbidden request occurred")}};var l=class extends o{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}`)}};var at=class extends o{};var pt=class extends o{static badRequest(){return new this("Bad request")}};var ct=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Ht.create({prefixUrl:this.options.baseURL,hooks:{beforeRequest:[s=>{for(let a of this.options.requestFilterables){let It=a.getHeaders();for(let[_t,Ut]of Object.entries(It))s.headers.has(_t)||s.headers.set(_t,Ut)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}async send(t,e){return await this.client(t,e).catch(s=>{if(Lt(s))throw new at("A network error occurred",{cause:s});if(s instanceof Mt){let a=s.response.status;switch(console.error(JSON.stringify(s.response)),a){case 400:throw pt.badRequest();case 401:throw ot.unauthenticated();case 403:throw it.forbidden();case 404:throw l.notFound(t);case 405:throw l.forbiddenMethod(t,e.method??"GET")}}throw s})}};var dt=class{constructor(t){this._transport=t}async send({files:t,request:e={}}){let s=new FormData;for(let a of t)s.append("file",a);return this._transport.send("v1/uploads",{...e,method:"POST",body:s})}};var lt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var xt=class r{static DEFAULT_BASE_URL=St;_transport;constructor(t,{baseURL:e,...s}={}){this._transport=new ct({requestFilterables:[new rt,t],...s,baseURL:e?.toString()??r.getBaseURL()})}static getBaseURL(){return process.env[Et]??this.DEFAULT_BASE_URL}get action(){return{list:new g(this._transport)}}get boilerplate(){return{get:new h(this._transport),list:new b(this._transport),update:new C(this._transport)}}get boilerplateCategory(){return{get:new y(this._transport),list:new A(this._transport),create:new R(this._transport),update:new T(this._transport),boilerplate:{list:new f(this._transport),create:new m(this._transport)}}}get channel(){return{get:new _(this._transport),list:new S(this._transport),message:{list:new D(this._transport)},twilioSendgrid:{create:new x(this._transport)}}}get contact(){return{get:new F(this._transport),list:new w(this._transport),update:new U(this._transport),create:new O(this._transport),conversation:{list:new L(this._transport)},note:{list:new Q(this._transport),create:new $(this._transport)},notificationSubscription:{create:new et(this._transport)},vcf:{get:new v(this._transport)}}}get conversation(){return{get:new q(this._transport),list:new H(this._transport),update:new N(this._transport),create:new d(this._transport),message:{list:new J(this._transport)},note:{list:new Z(this._transport),create:new d(this._transport)}}}get label(){return{create:new G(this._transport),get:new B(this._transport),list:new z(this._transport),update:new P(this._transport),delete:new j(this._transport),contact:{list:new I(this._transport)},conversation:{list:new M(this._transport)}}}get message(){return{list:new k(this._transport)}}get model(){return{get:new V(this._transport),list:new W(this._transport),response:{create:new Y(this._transport)},correction:{create:new K(this._transport)}}}get note(){return{get:new X(this._transport),update:new tt(this._transport)}}get source(){return{get:new st(this._transport),list:new nt(this._transport)}}get upload(){return{get:new lt(this._transport),create:new dt(this._transport)}}get webhook(){return new u(this)}};export{Nt as a,Ct as b,pe as c,ce as d,de as e,St as f,Bt as g,o as h,c as i,ot as j,it as k,l,at as m,pt as n,xt as o};
|