@great-detail/support-sdk 0.4.8 → 0.4.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-EGNL6HZZ.js +1 -0
- package/dist/{chunk-XDIXHCJB.js → chunk-UODL67G5.js} +1 -1
- 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-Br3bu497.d.cts → index-CWk6sQzL.d.cts} +175 -72
- package/dist/{index-Br3bu497.d.ts → index-CWk6sQzL.d.ts} +175 -72
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-LM2GWKIZ.js +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Pt=Object.create;var Ct=Object.defineProperty;var Dt=Object.getOwnPropertyDescriptor;var kt=Object.getOwnPropertyNames;var Vt=Object.getPrototypeOf,Jt=Object.prototype.hasOwnProperty;var Ut=(r,t)=>{for(var e in t)Ct(r,e,{get:t[e],enumerable:!0})},wt=(r,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of kt(t))!Jt.call(r,o)&&o!==e&&Ct(r,o,{get:()=>t[o],enumerable:!(s=Dt(t,o))||s.enumerable});return r};var It=(r,t,e)=>(e=r!=null?Pt(Vt(r)):{},wt(t||!r||!r.__esModule?Ct(e,"default",{value:r,enumerable:!0}):e,r)),Kt=r=>wt(Ct({},"__esModule",{value:!0}),r);var Yt={};Ut(Yt,{Client:()=>h,DEFAULT_SUPPORT_BASE_URL:()=>Rt,Error:()=>Ot,KeyAuthentication:()=>ft,PublicAuthentication:()=>bt,TokenAuthentication:()=>ht,default:()=>h});module.exports=Kt(Yt);var Rt="https://api.support.greatdetail.com",qt={"X-Powered-By":"GDSupport/JavaScript"},Lt="api-key";var b=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var C=require("zod"),R=class r{constructor(t){this._transport=t}static SCHEMA=C.z.object({title:C.z.string(),content:C.z.string(),account:C.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 A=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 x=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 At=require("zod"),T=class r{constructor(t){this._transport=t}static SCHEMA=At.z.object({title:At.z.string().optional(),content:At.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 _=require("zod"),E=class r{constructor(t){this._transport=t}static SCHEMA=_.z.object({title:_.z.string(),description:_.z.string().optional(),account:_.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 S=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 yt=require("zod"),O=class r{constructor(t){this._transport=t}static SCHEMA=yt.z.object({title:yt.z.string().optional(),description:yt.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 F=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var Ht="SUPPORT_ACCESS_TOKEN",Nt="SUPPORT_API_KEY",Mt="SUPPORT_KEY_NAME",Gt="SUPPORT_BASE_URL";var U=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let s=e.variant??"vcard",o=e.format??(e.variant==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(s)+"&format="+encodeURIComponent(o)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}};var m=require("zod"),w=class r{constructor(t){this._transport=t}static SCHEMA=m.z.object({name:m.z.string(),account:m.z.string(),emailAddress:m.z.string().email().optional(),telephoneNumber:m.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 I=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"GET"})}};var q=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/contacts",{...t,method:"GET"})}};var L=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"),N=class r{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: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 M=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 B=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/conversations",{...t,method:"GET"})}};var j=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 xt=require("zod"),z=class r{constructor(t){this._transport=t}static SCHEMA=xt.z.object({conversationStatus:xt.z.enum(["AwaitingContactConversationStatus","AwaitingAgentConversationStatus","ResolvedConversationStatus","ClosedConversationStatus"]).optional(),hasEnded:xt.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 P=require("zod"),D=class r{constructor(t){this._transport=t}static SCHEMA=P.z.object({title:P.z.string(),description:P.z.string().optional(),account:P.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 V=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var J=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/labels",{...t,method:"GET"})}};var Tt=require("zod"),K=class r{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: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 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 W=require("zod"),X=class r{constructor(t){this._transport=t}static SCHEMA=W.z.object({input:W.z.string().max(65536),original:W.z.string().max(65536),correction:W.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 Q=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var Z=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var tt=require("zod"),et=class r{constructor(t){this._transport=t}static SCHEMA=tt.z.array(tt.z.object({role:tt.z.enum(["user","assistant"]),content:tt.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 Et=require("zod"),rt=class r{constructor(t){this._transport=t}static SCHEMA=Et.z.object({content:Et.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 St=require("zod"),f=class r{constructor(t){this._transport=t}static SCHEMA=St.z.object({content:St.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 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 nt=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 vt=require("zod"),it=class r{constructor(t){this._transport=t}static SCHEMA=vt.z.object({content:vt.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 p=require("zod"),at=class r{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: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 pt=class r{constructor(t=r.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=qt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var ct=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var dt=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/sources",{...t,method:"GET"})}};var Bt=It(require("is-network-error"),1),_t=It(require("ky"),1);var n=class extends Error{};var a=class extends n{};var d=class extends a{static unauthenticated(){return new this("An unauthenticated request occurred")}};var u=class extends a{static forbidden(){return new this("A forbidden request occurred")}};var c=class extends n{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 l=class extends n{};var g=class extends n{static badRequest(){return new this("Bad request")}};var ut=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=_t.default.create({prefixUrl:this.options.baseURL,hooks:{beforeRequest:[s=>{for(let o of this.options.requestFilterables){let jt=o.getHeaders();for(let[Ft,zt]of Object.entries(jt))s.headers.has(Ft)||s.headers.set(Ft,zt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}async send(t,e){return await this.client(t,e).catch(s=>{if((0,Bt.default)(s))throw new l("A network error occurred",{cause:s});if(s instanceof _t.HTTPError){let o=s.response.status;switch(console.error(JSON.stringify(s.response)),o){case 400:throw g.badRequest();case 401:throw d.unauthenticated();case 403:throw u.forbidden();case 404:throw c.notFound(t);case 405:throw c.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 o of t)s.append("file",o);return this._transport.send("v1/uploads",{...e,method:"POST",body:s})}};var gt=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"),mt=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 h=class r{static DEFAULT_BASE_URL=Rt;_transport;constructor(t,{baseURL:e,...s}={}){this._transport=new ut({requestFilterables:[new pt,t],...s,baseURL:e?.toString()??r.getBaseURL()})}static getBaseURL(){return process.env[Gt]??this.DEFAULT_BASE_URL}get action(){return{list:new b(this._transport)}}get boilerplate(){return{get:new A(this._transport),list:new x(this._transport),update:new T(this._transport)}}get boilerplateCategory(){return{get:new S(this._transport),list:new v(this._transport),create:new E(this._transport),update:new O(this._transport),boilerplate:{list:new y(this._transport),create:new R(this._transport)}}}get channel(){return{list:new F(this._transport)}}get contact(){return{get:new I(this._transport),list:new q(this._transport),update:new N(this._transport),create:new w(this._transport),conversation:{list:new G(this._transport)},note:{list:new ot(this._transport),create:new rt(this._transport)},notificationSubscription:{create:new at(this._transport)},vcf:{get:new U(this._transport)}}}get conversation(){return{get:new M(this._transport),list:new B(this._transport),update:new z(this._transport),create:new f(this._transport),message:{list:new Y(this._transport)},note:{list:new nt(this._transport),create:new f(this._transport)}}}get label(){return{create:new D(this._transport),get:new V(this._transport),list:new J(this._transport),update:new K(this._transport),delete:new k(this._transport),contact:{list:new L(this._transport)},conversation:{list:new j(this._transport)}}}get message(){return{list:new $(this._transport)}}get model(){return{get:new Q(this._transport),list:new Z(this._transport),response:{create:new et(this._transport)},correction:{create:new X(this._transport)}}}get note(){return{get:new st(this._transport),update:new it(this._transport)}}get source(){return{get:new ct(this._transport),list:new dt(this._transport)}}get upload(){return{get:new gt(this._transport),create:new lt(this._transport)}}get webhook(){return new mt(this)}};var Ot={};Ut(Ot,{AuthError:()=>a,AuthenticationError:()=>d,AuthorizationError:()=>u,LogicError:()=>c,NetworkError:()=>l,SupportError:()=>n,ValidationError:()=>g});var ft=class r{static DEFAULT_NAME=Lt;name;#t;constructor({name:t=process.env[Mt]??r.DEFAULT_NAME,key:e=process.env[Nt]}={}){if(!e)throw new Error("API Key option must be specified when using Key Authentication");this.name=t,this.#t=e}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var ht=class{#t;constructor({token:t=process.env[Ht]}={}){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 bt=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 Jt=Object.create;var yt=Object.defineProperty;var Vt=Object.getOwnPropertyDescriptor;var Kt=Object.getOwnPropertyNames;var Yt=Object.getPrototypeOf,$t=Object.prototype.hasOwnProperty;var qt=(r,t)=>{for(var e in t)yt(r,e,{get:t[e],enumerable:!0})},Lt=(r,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Kt(t))!$t.call(r,n)&&n!==e&&yt(r,n,{get:()=>t[n],enumerable:!(s=Vt(t,n))||s.enumerable});return r};var Ht=(r,t,e)=>(e=r!=null?Jt(Yt(r)):{},Lt(t||!r||!r.__esModule?yt(e,"default",{value:r,enumerable:!0}):e,r)),Wt=r=>Lt(yt({},"__esModule",{value:!0}),r);var Xt={};qt(Xt,{Client:()=>b,DEFAULT_SUPPORT_BASE_URL:()=>xt,Error:()=>Ut,KeyAuthentication:()=>Ct,PublicAuthentication:()=>Rt,TokenAuthentication:()=>At,default:()=>b});module.exports=Wt(Xt);var xt="https://api.support.greatdetail.com",Nt={"X-Powered-By":"GDSupport/JavaScript"},Mt="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 Tt=require("zod"),_=class r{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: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 _t=require("zod"),F=class r{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: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({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var Gt="SUPPORT_ACCESS_TOKEN",jt="SUPPORT_API_KEY",Bt="SUPPORT_KEY_NAME",zt="SUPPORT_BASE_URL";var I=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 f=require("zod"),q=class r{constructor(t){this._transport=t}static SCHEMA=f.z.object({name:f.z.string(),account:f.z.string(),emailAddress:f.z.string().email().optional(),telephoneNumber:f.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 L=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/contacts",{...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)+"/contacts",{...e,method:"GET"})}};var M=require("zod"),G=class r{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: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 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 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 z=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 Et=require("zod"),D=class r{constructor(t){this._transport=t}static SCHEMA=Et.z.object({status:Et.z.enum(["AwaitingContactConversationStatus","AwaitingAgentConversationStatus","ResolvedConversationStatus","ClosedConversationStatus"]).optional(),hasEnded:Et.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 k=require("zod"),J=class r{constructor(t){this._transport=t}static SCHEMA=k.z.object({title:k.z.string(),description:k.z.string().optional(),account:k.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 V=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 Y=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/labels",{...t,method:"GET"})}};var St=require("zod"),$=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/labels/"+encodeURIComponent(t),{...s,method:"PATCH",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/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var X=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 Q=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var Z=require("zod"),tt=class r{constructor(t){this._transport=t}static SCHEMA=Z.z.object({input:Z.z.string().max(65536),original:Z.z.string().max(65536),correction:Z.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 et=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var rt=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var st=require("zod"),nt=class r{constructor(t){this._transport=t}static SCHEMA=st.z.array(st.z.object({role:st.z.enum(["user","assistant"]),content:st.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 vt=require("zod"),ot=class r{constructor(t){this._transport=t}static SCHEMA=vt.z.object({content:vt.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 Ft=require("zod"),h=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/conversations/"+encodeURIComponent(t)+"/notes",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var it=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var at=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 pt=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 wt=require("zod"),ct=class r{constructor(t){this._transport=t}static SCHEMA=wt.z.object({content:wt.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"),dt=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 lt=class r{constructor(t=r.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Nt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var ut=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var gt=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/sources",{...t,method:"GET"})}};var Pt=Ht(require("is-network-error"),1),Ot=Ht(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 mt=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Ot.default.create({prefixUrl:this.options.baseURL,hooks:{beforeRequest:[s=>{for(let n of this.options.requestFilterables){let Dt=n.getHeaders();for(let[It,kt]of Object.entries(Dt))s.headers.has(It)||s.headers.set(It,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,Pt.default)(s))throw new g("A network error occurred",{cause:s});if(s instanceof Ot.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 ht=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"),bt=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=xt;_transport;constructor(t,{baseURL:e,...s}={}){this._transport=new mt({requestFilterables:[new lt,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{list:new U(this._transport),message:{list:new W(this._transport)},twilioSendgrid:{create:new w(this._transport)}}}get contact(){return{get:new L(this._transport),list:new H(this._transport),update:new G(this._transport),create:new q(this._transport),conversation:{list:new B(this._transport)},note:{list:new at(this._transport),create:new ot(this._transport)},notificationSubscription:{create:new dt(this._transport)},vcf:{get:new I(this._transport)}}}get conversation(){return{get:new j(this._transport),list:new z(this._transport),update:new D(this._transport),create:new h(this._transport),message:{list:new X(this._transport)},note:{list:new pt(this._transport),create:new h(this._transport)}}}get label(){return{create:new J(this._transport),get:new K(this._transport),list:new Y(this._transport),update:new $(this._transport),delete:new V(this._transport),contact:{list:new N(this._transport)},conversation:{list:new P(this._transport)}}}get message(){return{list:new Q(this._transport)}}get model(){return{get:new et(this._transport),list:new rt(this._transport),response:{create:new nt(this._transport)},correction:{create:new tt(this._transport)}}}get note(){return{get:new it(this._transport),update:new ct(this._transport)}}get source(){return{get:new ut(this._transport),list:new gt(this._transport)}}get upload(){return{get:new ht(this._transport),create:new ft(this._transport)}}get webhook(){return new bt(this)}};var Ut={};qt(Ut,{AuthError:()=>p,AuthenticationError:()=>l,AuthorizationError:()=>u,LogicError:()=>d,NetworkError:()=>g,SupportError:()=>o,ValidationError:()=>m});var Ct=class r{static DEFAULT_NAME=Mt;name;#t;constructor({name:t=process.env[Bt]??r.DEFAULT_NAME,key:e=process.env[jt]}={}){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 At=class{#t;constructor({token:t=process.env[Gt]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var Rt=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-CWk6sQzL.cjs';
|
|
2
|
+
export { C as Client, b as CreateBoilerplateCategoryBoilerplateResponse, e as CreateBoilerplateCategoryResponse, J as CreateContactNoteResponse, V as CreateContactNotificationSubscriptionResponse, k as CreateContactResponse, K as CreateConversationNoteResponse, H as CreateCorrectionResponse, u as CreateLabelResponse, I as CreateResponseResponse, j as CreateTwilioSendgridChannelResponse, X as CreateUploadResponse, D as DeleteLabelResponse, f as GetBoilerplateCategoryResponse, G as GetBoilerplateResponse, l as GetContactResponse, p as GetConversationResponse, v as GetLabelResponse, E as GetModelResponse, M as GetNoteResponse, S as GetSourceResponse, Y as GetUploadResponse, L as ListActionsResponse, g as ListBoilerplateCategoriesResponse, c as ListBoilerplateCategoryBoilerplatesResponse, d as ListBoilerplatesResponse, B as ListChannelMessagesResponse, i as ListChannelsResponse, t as ListContactConversationsResponse, N as ListContactNotesResponse, m as ListContactsResponse, y as ListConversationMessagesResponse, P as ListConversationNotesResponse, q as ListConversationsResponse, n as ListLabelContactsResponse, r as ListLabelConversationsResponse, w as ListLabelsResponse, z as ListMessagesResponse, F as ListModelsResponse, T as ListSourcesResponse, O as Options, R as RequestFilterable, a as TransportOptions, h as UpdateBoilerplateCategoryResponse, U as UpdateBoilerplateResponse, o as UpdateContactResponse, s as UpdateConversationResponse, x as UpdateLabelResponse, Q as UpdateNoteResponse, W as WebhookResponse, C as default } from './index-CWk6sQzL.cjs';
|
|
3
3
|
import 'ky';
|
|
4
4
|
import 'zod';
|
|
5
5
|
|
|
@@ -217,7 +217,7 @@ type CreateConversationResponse = {
|
|
|
217
217
|
id: string;
|
|
218
218
|
name?: string;
|
|
219
219
|
hasEnded: boolean;
|
|
220
|
-
|
|
220
|
+
status: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
|
|
221
221
|
accountChannel: string;
|
|
222
222
|
createdAt: string;
|
|
223
223
|
updatedAt: string;
|
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-CWk6sQzL.js';
|
|
2
|
+
export { C as Client, b as CreateBoilerplateCategoryBoilerplateResponse, e as CreateBoilerplateCategoryResponse, J as CreateContactNoteResponse, V as CreateContactNotificationSubscriptionResponse, k as CreateContactResponse, K as CreateConversationNoteResponse, H as CreateCorrectionResponse, u as CreateLabelResponse, I as CreateResponseResponse, j as CreateTwilioSendgridChannelResponse, X as CreateUploadResponse, D as DeleteLabelResponse, f as GetBoilerplateCategoryResponse, G as GetBoilerplateResponse, l as GetContactResponse, p as GetConversationResponse, v as GetLabelResponse, E as GetModelResponse, M as GetNoteResponse, S as GetSourceResponse, Y as GetUploadResponse, L as ListActionsResponse, g as ListBoilerplateCategoriesResponse, c as ListBoilerplateCategoryBoilerplatesResponse, d as ListBoilerplatesResponse, B as ListChannelMessagesResponse, i as ListChannelsResponse, t as ListContactConversationsResponse, N as ListContactNotesResponse, m as ListContactsResponse, y as ListConversationMessagesResponse, P as ListConversationNotesResponse, q as ListConversationsResponse, n as ListLabelContactsResponse, r as ListLabelConversationsResponse, w as ListLabelsResponse, z as ListMessagesResponse, F as ListModelsResponse, T as ListSourcesResponse, O as Options, R as RequestFilterable, a as TransportOptions, h as UpdateBoilerplateCategoryResponse, U as UpdateBoilerplateResponse, o as UpdateContactResponse, s as UpdateConversationResponse, x as UpdateLabelResponse, Q as UpdateNoteResponse, W as WebhookResponse, C as default } from './index-CWk6sQzL.js';
|
|
3
3
|
import 'ky';
|
|
4
4
|
import 'zod';
|
|
5
5
|
|
|
@@ -217,7 +217,7 @@ type CreateConversationResponse = {
|
|
|
217
217
|
id: string;
|
|
218
218
|
name?: string;
|
|
219
219
|
hasEnded: boolean;
|
|
220
|
-
|
|
220
|
+
status: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
|
|
221
221
|
accountChannel: string;
|
|
222
222
|
createdAt: string;
|
|
223
223
|
updatedAt: string;
|
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
|
|
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-EGNL6HZZ.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-LM2GWKIZ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var Ft=Object.defineProperty;var qt=(r,t)=>{for(var e in t)Ft(r,e,{get:t[e],enumerable:!0})};var At="https://api.support.greatdetail.com",Tt={"X-Powered-By":"GDSupport/JavaScript"},Ht="api-key";import{z as n}from"zod";var l=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 u=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};import{z as pt}from"zod";var g=class r{constructor(t){this._transport=t}static SCHEMA=pt.object({title:pt.string(),content:pt.string(),account:pt.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 m=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var h=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 f=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 mt}from"zod";var b=class r{constructor(t){this._transport=t}static SCHEMA=mt.object({title:mt.string().optional(),content:mt.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 ct}from"zod";var C=class r{constructor(t){this._transport=t}static SCHEMA=ct.object({title:ct.string(),description:ct.string().optional(),account:ct.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 y=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/boilerplate-categories",{...t,method:"GET"})}};import{z as ht}from"zod";var A=class r{constructor(t){this._transport=t}static SCHEMA=ht.object({title:ht.string().optional(),description:ht.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 T=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var te="SUPPORT_ACCESS_TOKEN",ee="SUPPORT_API_KEY",re="SUPPORT_KEY_NAME",xt="SUPPORT_BASE_URL";var x=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let s=e.variant??"vcard",i=e.format??(e.variant==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(s)+"&format="+encodeURIComponent(i)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}};import{z as _}from"zod";var S=class r{constructor(t){this._transport=t}static SCHEMA=_.object({name:_.string(),account:_.string(),emailAddress:_.string().email().optional(),telephoneNumber:_.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 v=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"GET"})}};var O=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/contacts",{...t,method:"GET"})}};var E=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 dt}from"zod";var F=class r{constructor(t){this._transport=t}static SCHEMA=dt.object({name:dt.string().optional(),emailAddress:dt.string().email().optional(),telephoneNumber:dt.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 U=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"GET"})}};var w=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 I=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/conversations",{...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)+"/conversations",{...e,method:"GET"})}};import{z as ft}from"zod";var L=class r{constructor(t){this._transport=t}static SCHEMA=ft.object({conversationStatus:ft.enum(["AwaitingContactConversationStatus","AwaitingAgentConversationStatus","ResolvedConversationStatus","ClosedConversationStatus"]).optional(),hasEnded:ft.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 lt}from"zod";var H=class r{constructor(t){this._transport=t}static SCHEMA=lt.object({title:lt.string(),description:lt.string().optional(),account:lt.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 M=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var N=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var G=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/labels",{...t,method:"GET"})}};import{z as bt}from"zod";var j=class r{constructor(t){this._transport=t}static SCHEMA=bt.object({title:bt.string().optional(),description:bt.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 B=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"})}};import{z as ut}from"zod";var P=class r{constructor(t){this._transport=t}static SCHEMA=ut.object({input:ut.string().max(65536),original:ut.string().max(65536),correction:ut.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 D=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var J=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};import{z as gt}from"zod";var k=class r{constructor(t){this._transport=t}static SCHEMA=gt.array(gt.object({role:gt.enum(["user","assistant"]),content:gt.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 _t}from"zod";var V=class r{constructor(t){this._transport=t}static SCHEMA=_t.object({content:_t.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 St}from"zod";var c=class r{constructor(t){this._transport=t}static SCHEMA=St.object({content:St.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 K=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var Y=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 W=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 vt}from"zod";var $=class r{constructor(t){this._transport=t}static SCHEMA=vt.object({content:vt.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 a}from"zod";var X=class r{constructor(t){this._transport=t}static SCHEMA=a.discriminatedUnion("type",[a.object({type:a.literal("vapid"),endpoint:a.string().url(),keys:a.object({p256dh:a.string(),auth:a.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 Q=class r{constructor(t=r.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Tt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var Z=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var tt=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/sources",{...t,method:"GET"})}};import Ut from"is-network-error";import wt,{HTTPError as It}from"ky";var o=class extends Error{};var p=class extends o{};var et=class extends p{static unauthenticated(){return new this("An unauthenticated request occurred")}};var rt=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 st=class extends o{};var nt=class extends o{static badRequest(){return new this("Bad request")}};var ot=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=wt.create({prefixUrl:this.options.baseURL,hooks:{beforeRequest:[s=>{for(let i of this.options.requestFilterables){let Ot=i.getHeaders();for(let[yt,Et]of Object.entries(Ot))s.headers.has(yt)||s.headers.set(yt,Et)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}async send(t,e){return await this.client(t,e).catch(s=>{if(Ut(s))throw new st("A network error occurred",{cause:s});if(s instanceof It){let i=s.response.status;switch(console.error(JSON.stringify(s.response)),i){case 400:throw nt.badRequest();case 401:throw et.unauthenticated();case 403:throw rt.forbidden();case 404:throw d.notFound(t);case 405:throw d.forbiddenMethod(t,e.method??"GET")}}throw s})}};var it=class{constructor(t){this._transport=t}async send({files:t,request:e={}}){let s=new FormData;for(let i of t)s.append("file",i);return this._transport.send("v1/uploads",{...e,method:"POST",body:s})}};var at=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var Ct=class r{static DEFAULT_BASE_URL=At;_transport;constructor(t,{baseURL:e,...s}={}){this._transport=new ot({requestFilterables:[new Q,t],...s,baseURL:e?.toString()??r.getBaseURL()})}static getBaseURL(){return process.env[xt]??this.DEFAULT_BASE_URL}get action(){return{list:new u(this._transport)}}get boilerplate(){return{get:new m(this._transport),list:new f(this._transport),update:new b(this._transport)}}get boilerplateCategory(){return{get:new R(this._transport),list:new y(this._transport),create:new C(this._transport),update:new A(this._transport),boilerplate:{list:new h(this._transport),create:new g(this._transport)}}}get channel(){return{list:new T(this._transport)}}get contact(){return{get:new v(this._transport),list:new O(this._transport),update:new F(this._transport),create:new S(this._transport),conversation:{list:new w(this._transport)},note:{list:new Y(this._transport),create:new V(this._transport)},notificationSubscription:{create:new X(this._transport)},vcf:{get:new x(this._transport)}}}get conversation(){return{get:new U(this._transport),list:new I(this._transport),update:new L(this._transport),create:new c(this._transport),message:{list:new B(this._transport)},note:{list:new W(this._transport),create:new c(this._transport)}}}get label(){return{create:new H(this._transport),get:new N(this._transport),list:new G(this._transport),update:new j(this._transport),delete:new M(this._transport),contact:{list:new E(this._transport)},conversation:{list:new q(this._transport)}}}get message(){return{list:new z(this._transport)}}get model(){return{get:new D(this._transport),list:new J(this._transport),response:{create:new k(this._transport)},correction:{create:new P(this._transport)}}}get note(){return{get:new K(this._transport),update:new $(this._transport)}}get source(){return{get:new Z(this._transport),list:new tt(this._transport)}}get upload(){return{get:new at(this._transport),create:new it(this._transport)}}get webhook(){return new l(this)}};var Rt=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};export{qt as a,At as b,Ht as c,te as d,ee as e,re as f,o as g,p as h,et as i,rt as j,d as k,st as l,nt as m,Ct as n,Rt as o};
|