@great-detail/support-sdk 0.4.4 → 0.4.6
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-F67NJYPP.js → chunk-HN3EOCB3.js} +1 -1
- package/dist/{chunk-23BXD6T5.js → chunk-OXJTX6H4.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-CV2Xq9A0.d.cts → index-BLy-LH3e.d.cts} +115 -90
- package/dist/{index-CV2Xq9A0.d.ts → index-BLy-LH3e.d.ts} +115 -90
- 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 +2 -3
- package/src/Action/ListActions.ts +0 -40
- package/src/Action/index.ts +0 -10
- package/src/Authentication/KeyAuthentication.ts +0 -50
- package/src/Authentication/PublicAuthentication.ts +0 -32
- package/src/Authentication/TokenAuthentication.ts +0 -41
- package/src/Authentication/index.ts +0 -13
- package/src/Boilerplate/CreateBoilerplateCategoryBoilerplate.ts +0 -55
- package/src/Boilerplate/GetBoilerplate.ts +0 -41
- package/src/Boilerplate/ListBoilerplateCategoryBoilerplates.ts +0 -41
- package/src/Boilerplate/ListBoilerplates.ts +0 -37
- package/src/Boilerplate/UpdateBoilerplate.ts +0 -53
- package/src/Boilerplate/index.ts +0 -14
- package/src/BoilerplateCategory/CreateBoilerplateCategory.ts +0 -52
- package/src/BoilerplateCategory/GetBoilerplateCategory.ts +0 -40
- package/src/BoilerplateCategory/ListBoilerplateCategories.ts +0 -39
- package/src/BoilerplateCategory/UpdateBoilerplateCategory.ts +0 -52
- package/src/BoilerplateCategory/index.ts +0 -13
- package/src/Channel/ListChannels.ts +0 -53
- package/src/Channel/index.ts +0 -10
- package/src/Client/index.ts +0 -206
- package/src/Contact/ContactVCF/GetContactVCF.ts +0 -45
- package/src/Contact/CreateContact.ts +0 -51
- package/src/Contact/GetContact.ts +0 -41
- package/src/Contact/ListContacts.ts +0 -37
- package/src/Contact/ListLabelContacts.ts +0 -41
- package/src/Contact/UpdateContact.ts +0 -54
- package/src/Contact/index.ts +0 -14
- package/src/Conversation/CreateConversation.ts +0 -58
- package/src/Conversation/GetConversation.ts +0 -45
- package/src/Conversation/ListContactConversations.ts +0 -45
- package/src/Conversation/ListConversations.ts +0 -41
- package/src/Conversation/ListLabelConversations.ts +0 -45
- package/src/Conversation/UpdateConversation.ts +0 -64
- package/src/Conversation/index.ts +0 -15
- package/src/Error/AuthError.ts +0 -12
- package/src/Error/AuthenticationError.ts +0 -16
- package/src/Error/AuthorizationError.ts +0 -16
- package/src/Error/LogicError.ts +0 -20
- package/src/Error/NetworkError.ts +0 -12
- package/src/Error/SupportError.ts +0 -10
- package/src/Error/ValidationError.ts +0 -16
- package/src/Error/index.ts +0 -20
- package/src/Label/CreateLabel.ts +0 -49
- package/src/Label/DeleteLabel.ts +0 -31
- package/src/Label/GetLabel.ts +0 -40
- package/src/Label/ListLabels.ts +0 -36
- package/src/Label/UpdateLabel.ts +0 -52
- package/src/Label/index.ts +0 -14
- package/src/Message/ListConversationMessages.ts +0 -49
- package/src/Message/ListMessages.ts +0 -45
- package/src/Message/index.ts +0 -11
- package/src/Model/Correction/CreateCorrectionModel.ts +0 -44
- package/src/Model/GetModel.ts +0 -39
- package/src/Model/ListModels.ts +0 -35
- package/src/Model/Response/CreateResponseModel.ts +0 -53
- package/src/Model/index.ts +0 -15
- package/src/Note/CreateContactNote.ts +0 -49
- package/src/Note/CreateConversationNote.ts +0 -49
- package/src/Note/GetNote.ts +0 -38
- package/src/Note/ListContactNotes.ts +0 -38
- package/src/Note/ListConversationNotes.ts +0 -38
- package/src/Note/UpdateNote.ts +0 -49
- package/src/Note/index.ts +0 -15
- package/src/NotificationSubscription/CreateContactNotificationSubscription.ts +0 -57
- package/src/NotificationSubscription/index.ts +0 -10
- package/src/Request/RequestFilterable.ts +0 -16
- package/src/Request/RequestStandardHeaders.ts +0 -32
- package/src/Source/GetSource.ts +0 -40
- package/src/Source/ListSources.ts +0 -36
- package/src/Source/index.ts +0 -11
- package/src/Transport/FetchTransport.ts +0 -100
- package/src/Transport/index.ts +0 -18
- package/src/Webhook/index.ts +0 -55
- package/src/__tests__/Client/Client.test.ts +0 -38
- package/src/cli/actions.ts +0 -31
- package/src/cli/channels.ts +0 -31
- package/src/cli/contacts.ts +0 -45
- package/src/cli/conversations.ts +0 -48
- package/src/cli/index.ts +0 -46
- package/src/cli/labels.ts +0 -62
- package/src/cli/messages.ts +0 -31
- package/src/cli/models.ts +0 -45
- package/src/cli/sources.ts +0 -45
- package/src/cli.ts +0 -13
- package/src/constants/environment.ts +0 -36
- package/src/constants/index.ts +0 -31
- package/src/index.ts +0 -39
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var jt=Object.create;var ht=Object.defineProperty;var zt=Object.getOwnPropertyDescriptor;var Pt=Object.getOwnPropertyNames;var Dt=Object.getPrototypeOf,kt=Object.prototype.hasOwnProperty;var Ot=(r,t)=>{for(var e in t)ht(r,e,{get:t[e],enumerable:!0})},Ft=(r,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Pt(t))!kt.call(r,i)&&i!==e&&ht(r,i,{get:()=>t[i],enumerable:!(s=zt(t,i))||s.enumerable});return r};var Ut=(r,t,e)=>(e=r!=null?jt(Dt(r)):{},Ft(t||!r||!r.__esModule?ht(e,"default",{value:r,enumerable:!0}):e,r)),Vt=r=>Ft(ht({},"__esModule",{value:!0}),r);var Jt={};Ot(Jt,{Client:()=>h,DEFAULT_SUPPORT_BASE_URL:()=>bt,Error:()=>St,KeyAuthentication:()=>gt,PublicAuthentication:()=>ft,TokenAuthentication:()=>mt,default:()=>h});module.exports=Vt(Jt);var bt="https://api.support.greatdetail.com",wt={"X-Powered-By":"GDSupport/JavaScript"},It="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"),A=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 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 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({request:t={}}={}){return this._transport.send("v1/boilerplates",{...t,method:"GET"})}};var Ct=require("zod"),T=class r{constructor(t){this._transport=t}static SCHEMA=Ct.z.object({title:Ct.z.string().optional(),content:Ct.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 At=require("zod"),O=class r{constructor(t){this._transport=t}static SCHEMA=At.z.object({title:At.z.string().optional(),description:At.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 Lt="SUPPORT_ACCESS_TOKEN",qt="SUPPORT_API_KEY",Ht="SUPPORT_KEY_NAME",Nt="SUPPORT_BASE_URL";var U=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))}};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 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"),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 Rt=require("zod"),z=class r{constructor(t){this._transport=t}static SCHEMA=Rt.z.object({conversationStatus:Rt.z.enum(["AwaitingContactConversationStatus","AwaitingAgentConversationStatus","ResolvedConversationStatus","ClosedConversationStatus"]).optional(),hasEnded:Rt.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 yt=require("zod"),K=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/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 Tt=require("zod"),rt=class r{constructor(t){this._transport=t}static SCHEMA=Tt.z.object({content:Tt.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 _t=require("zod"),f=class r{constructor(t){this._transport=t}static SCHEMA=_t.z.object({content:_t.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 Et=require("zod"),it=class r{constructor(t){this._transport=t}static SCHEMA=Et.z.object({content:Et.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=wt;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 Mt=Ut(require("is-network-error"),1),xt=Ut(require("ky"),1);var o=class extends Error{};var a=class extends o{};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 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 l=class extends o{};var g=class extends o{static badRequest(){return new this("Bad request")}};var ut=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=xt.default.create({prefixUrl:this.options.baseURL,hooks:{beforeRequest:[s=>{for(let i of this.options.requestFilterables){let Gt=i.getHeaders();for(let[vt,Bt]of Object.entries(Gt))s.headers.has(vt)||s.headers.set(vt,Bt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}async send(t,e){return await this.client(t,e).catch(s=>{if((0,Mt.default)(s))throw new l("A network error occurred",{cause:s});if(s instanceof xt.HTTPError){let i=s.response.status;switch(console.error(JSON.stringify(s.response)),i){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 n=require("zod"),lt=class r{constructor(t){this._client=t}static SCHEMA=n.z.object({event:n.z.intersection(n.z.object({id:n.z.string(),createdAt:n.z.string().datetime()}),n.z.discriminatedUnion("type",[n.z.object({type:n.z.literal("contact.created"),contact:n.z.string()}),n.z.object({type:n.z.literal("message.created"),message:n.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=bt;_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[Nt]??this.DEFAULT_BASE_URL}get action(){return{list:new b(this._transport)}}get boilerplate(){return{get:new R(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 A(this._transport)}}}get channel(){return{list:new F(this._transport)}}get contact(){return{get:new I(this._transport),list:new L(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 q(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 webhook(){return new lt(this)}};var St={};Ot(St,{AuthError:()=>a,AuthenticationError:()=>d,AuthorizationError:()=>u,LogicError:()=>c,NetworkError:()=>l,SupportError:()=>o,ValidationError:()=>g});var gt=class r{static DEFAULT_NAME=It;name;#t;constructor({name:t=process.env[Ht]??r.DEFAULT_NAME,key:e=process.env[qt]}={}){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 mt=class{#t;constructor({token:t=process.env[Lt]}={}){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 ft=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 zt=Object.create;var bt=Object.defineProperty;var Pt=Object.getOwnPropertyDescriptor;var Dt=Object.getOwnPropertyNames;var kt=Object.getPrototypeOf,Vt=Object.prototype.hasOwnProperty;var Ft=(r,t)=>{for(var e in t)bt(r,e,{get:t[e],enumerable:!0})},Ut=(r,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Dt(t))!Vt.call(r,i)&&i!==e&&bt(r,i,{get:()=>t[i],enumerable:!(s=Pt(t,i))||s.enumerable});return r};var wt=(r,t,e)=>(e=r!=null?zt(kt(r)):{},Ut(t||!r||!r.__esModule?bt(e,"default",{value:r,enumerable:!0}):e,r)),Jt=r=>Ut(bt({},"__esModule",{value:!0}),r);var Kt={};Ft(Kt,{Client:()=>h,DEFAULT_SUPPORT_BASE_URL:()=>Ct,Error:()=>vt,KeyAuthentication:()=>mt,PublicAuthentication:()=>ht,TokenAuthentication:()=>ft,default:()=>h});module.exports=Jt(Kt);var Ct="https://api.support.greatdetail.com",It={"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"),A=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 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 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({request:t={}}={}){return this._transport.send("v1/boilerplates",{...t,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 Rt=require("zod"),O=class r{constructor(t){this._transport=t}static SCHEMA=Rt.z.object({title:Rt.z.string().optional(),description:Rt.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 qt="SUPPORT_ACCESS_TOKEN",Ht="SUPPORT_API_KEY",Nt="SUPPORT_KEY_NAME",Mt="SUPPORT_BASE_URL";var U=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))}};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 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"),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 yt=require("zod"),z=class r{constructor(t){this._transport=t}static SCHEMA=yt.z.object({conversationStatus:yt.z.enum(["AwaitingContactConversationStatus","AwaitingAgentConversationStatus","ResolvedConversationStatus","ClosedConversationStatus"]).optional(),hasEnded:yt.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 xt=require("zod"),K=class r{constructor(t){this._transport=t}static SCHEMA=xt.z.object({title:xt.z.string().optional(),description:xt.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 _t=require("zod"),rt=class r{constructor(t){this._transport=t}static SCHEMA=_t.z.object({content:_t.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 Et=require("zod"),f=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/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 St=require("zod"),it=class r{constructor(t){this._transport=t}static SCHEMA=St.z.object({content:St.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=It;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 Gt=wt(require("is-network-error"),1),Tt=wt(require("ky"),1);var o=class extends Error{};var a=class extends o{};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 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 l=class extends o{};var g=class extends o{static badRequest(){return new this("Bad request")}};var ut=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Tt.default.create({prefixUrl:this.options.baseURL,hooks:{beforeRequest:[s=>{for(let i of this.options.requestFilterables){let Bt=i.getHeaders();for(let[Ot,jt]of Object.entries(Bt))s.headers.has(Ot)||s.headers.set(Ot,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,Gt.default)(s))throw new l("A network error occurred",{cause:s});if(s instanceof Tt.HTTPError){let i=s.response.status;switch(console.error(JSON.stringify(s.response)),i){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({id:t,request:e={}}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var n=require("zod"),gt=class r{constructor(t){this._client=t}static SCHEMA=n.z.object({event:n.z.intersection(n.z.object({id:n.z.string(),createdAt:n.z.string().datetime()}),n.z.discriminatedUnion("type",[n.z.object({type:n.z.literal("contact.created"),contact:n.z.string()}),n.z.object({type:n.z.literal("message.created"),message:n.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=Ct;_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[Mt]??this.DEFAULT_BASE_URL}get action(){return{list:new b(this._transport)}}get boilerplate(){return{get:new R(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 A(this._transport)}}}get channel(){return{list:new F(this._transport)}}get contact(){return{get:new I(this._transport),list:new L(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 q(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 lt(this._transport)}}get webhook(){return new gt(this)}};var vt={};Ft(vt,{AuthError:()=>a,AuthenticationError:()=>d,AuthorizationError:()=>u,LogicError:()=>c,NetworkError:()=>l,SupportError:()=>o,ValidationError:()=>g});var mt=class r{static DEFAULT_NAME=Lt;name;#t;constructor({name:t=process.env[Nt]??r.DEFAULT_NAME,key:e=process.env[Ht]}={}){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 ft=class{#t;constructor({token:t=process.env[qt]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var ht=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,Error,KeyAuthentication,PublicAuthentication,TokenAuthentication});
|
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, H as CreateContactNoteResponse, S as CreateContactNotificationSubscriptionResponse, j as CreateContactResponse, I as CreateConversationNoteResponse, E as CreateCorrectionResponse, t as CreateLabelResponse, F as CreateResponseResponse, D as DeleteLabelResponse, f as GetBoilerplateCategoryResponse, G as GetBoilerplateResponse, k as GetContactResponse, o as GetConversationResponse, u as GetLabelResponse, z as GetModelResponse, J as GetNoteResponse, P as GetSourceResponse, L as ListActionsResponse, g as ListBoilerplateCategoriesResponse, c as ListBoilerplateCategoryBoilerplatesResponse, d as ListBoilerplatesResponse, i as ListChannelsResponse, s as ListContactConversationsResponse, K as ListContactNotesResponse, l as ListContactsResponse, x as ListConversationMessagesResponse, M as ListConversationNotesResponse, p as ListConversationsResponse, m as ListLabelContactsResponse, q as ListLabelConversationsResponse, v as ListLabelsResponse, y as ListMessagesResponse, B as ListModelsResponse, Q as ListSourcesResponse, O as Options, R as RequestFilterable, a as TransportOptions, h as UpdateBoilerplateCategoryResponse, U as UpdateBoilerplateResponse, n as UpdateContactResponse, r as UpdateConversationResponse, w as UpdateLabelResponse, N as UpdateNoteResponse, W as WebhookResponse, C as default } from './index-
|
|
1
|
+
import { A as Authentication } from './index-BLy-LH3e.cjs';
|
|
2
|
+
export { C as Client, b as CreateBoilerplateCategoryBoilerplateResponse, e as CreateBoilerplateCategoryResponse, H as CreateContactNoteResponse, S as CreateContactNotificationSubscriptionResponse, j as CreateContactResponse, I as CreateConversationNoteResponse, E as CreateCorrectionResponse, t as CreateLabelResponse, F as CreateResponseResponse, D as DeleteLabelResponse, f as GetBoilerplateCategoryResponse, G as GetBoilerplateResponse, k as GetContactResponse, o as GetConversationResponse, u as GetLabelResponse, z as GetModelResponse, J as GetNoteResponse, P as GetSourceResponse, T as GetUploadResponse, L as ListActionsResponse, g as ListBoilerplateCategoriesResponse, c as ListBoilerplateCategoryBoilerplatesResponse, d as ListBoilerplatesResponse, i as ListChannelsResponse, s as ListContactConversationsResponse, K as ListContactNotesResponse, l as ListContactsResponse, x as ListConversationMessagesResponse, M as ListConversationNotesResponse, p as ListConversationsResponse, m as ListLabelContactsResponse, q as ListLabelConversationsResponse, v as ListLabelsResponse, y as ListMessagesResponse, B as ListModelsResponse, Q as ListSourcesResponse, O as Options, R as RequestFilterable, a as TransportOptions, h as UpdateBoilerplateCategoryResponse, U as UpdateBoilerplateResponse, n as UpdateContactResponse, r as UpdateConversationResponse, w as UpdateLabelResponse, N as UpdateNoteResponse, W as WebhookResponse, C as default } from './index-BLy-LH3e.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, H as CreateContactNoteResponse, S as CreateContactNotificationSubscriptionResponse, j as CreateContactResponse, I as CreateConversationNoteResponse, E as CreateCorrectionResponse, t as CreateLabelResponse, F as CreateResponseResponse, D as DeleteLabelResponse, f as GetBoilerplateCategoryResponse, G as GetBoilerplateResponse, k as GetContactResponse, o as GetConversationResponse, u as GetLabelResponse, z as GetModelResponse, J as GetNoteResponse, P as GetSourceResponse, L as ListActionsResponse, g as ListBoilerplateCategoriesResponse, c as ListBoilerplateCategoryBoilerplatesResponse, d as ListBoilerplatesResponse, i as ListChannelsResponse, s as ListContactConversationsResponse, K as ListContactNotesResponse, l as ListContactsResponse, x as ListConversationMessagesResponse, M as ListConversationNotesResponse, p as ListConversationsResponse, m as ListLabelContactsResponse, q as ListLabelConversationsResponse, v as ListLabelsResponse, y as ListMessagesResponse, B as ListModelsResponse, Q as ListSourcesResponse, O as Options, R as RequestFilterable, a as TransportOptions, h as UpdateBoilerplateCategoryResponse, U as UpdateBoilerplateResponse, n as UpdateContactResponse, r as UpdateConversationResponse, w as UpdateLabelResponse, N as UpdateNoteResponse, W as WebhookResponse, C as default } from './index-
|
|
1
|
+
import { A as Authentication } from './index-BLy-LH3e.js';
|
|
2
|
+
export { C as Client, b as CreateBoilerplateCategoryBoilerplateResponse, e as CreateBoilerplateCategoryResponse, H as CreateContactNoteResponse, S as CreateContactNotificationSubscriptionResponse, j as CreateContactResponse, I as CreateConversationNoteResponse, E as CreateCorrectionResponse, t as CreateLabelResponse, F as CreateResponseResponse, D as DeleteLabelResponse, f as GetBoilerplateCategoryResponse, G as GetBoilerplateResponse, k as GetContactResponse, o as GetConversationResponse, u as GetLabelResponse, z as GetModelResponse, J as GetNoteResponse, P as GetSourceResponse, T as GetUploadResponse, L as ListActionsResponse, g as ListBoilerplateCategoriesResponse, c as ListBoilerplateCategoryBoilerplatesResponse, d as ListBoilerplatesResponse, i as ListChannelsResponse, s as ListContactConversationsResponse, K as ListContactNotesResponse, l as ListContactsResponse, x as ListConversationMessagesResponse, M as ListConversationNotesResponse, p as ListConversationsResponse, m as ListLabelContactsResponse, q as ListLabelConversationsResponse, v as ListLabelsResponse, y as ListMessagesResponse, B as ListModelsResponse, Q as ListSourcesResponse, O as Options, R as RequestFilterable, a as TransportOptions, h as UpdateBoilerplateCategoryResponse, U as UpdateBoilerplateResponse, n as UpdateContactResponse, r as UpdateConversationResponse, w as UpdateLabelResponse, N as UpdateNoteResponse, W as WebhookResponse, C as default } from './index-BLy-LH3e.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 a,g as f,h as m,i as u,j as c,k as
|
|
1
|
+
import{a as d,b as g,c as s,d as p,e as n,f as a,g as f,h as m,i as u,j as c,k as x,l,m as h,n as A,o as _}from"./chunk-OXJTX6H4.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=s;name;#r;constructor({name:r=process.env[a]??o.DEFAULT_NAME,key:i=process.env[n]}={}){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[p]}={}){if(!r)throw new Error("Access Token option must be specified when using Token Authentication");this.#r=r}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Bearer ${this.#r}`}}};export{A as Client,g as DEFAULT_SUPPORT_BASE_URL,E as Error,t as KeyAuthentication,_ as PublicAuthentication,e as TokenAuthentication,A as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@great-detail/support-sdk",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "JavaScript SDK for the Great Detail Support System",
|
|
6
6
|
"author": "Great Detail Ltd <info@greatdetail.com>",
|
|
@@ -36,8 +36,7 @@
|
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
"files": [
|
|
39
|
-
"dist"
|
|
40
|
-
"src"
|
|
39
|
+
"dist"
|
|
41
40
|
],
|
|
42
41
|
"keywords": [
|
|
43
42
|
"SDK"
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Great Detail Support System.
|
|
3
|
-
*
|
|
4
|
-
* @copyright 2024 Great Detail Ltd
|
|
5
|
-
* @author Great Detail Ltd <info@greatdetail.com>
|
|
6
|
-
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
7
|
-
* @see https://greatdetail.com
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import FetchTransport from "../Transport/FetchTransport.js";
|
|
11
|
-
|
|
12
|
-
export interface Options {
|
|
13
|
-
request?: RequestInit;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export type ListActionsResponse = {
|
|
17
|
-
actions: {
|
|
18
|
-
id: string;
|
|
19
|
-
actionStatus: string;
|
|
20
|
-
message: string;
|
|
21
|
-
name: string;
|
|
22
|
-
object?: string;
|
|
23
|
-
result?: string;
|
|
24
|
-
startedAt?: string;
|
|
25
|
-
endedAt?: string;
|
|
26
|
-
createdAt: string;
|
|
27
|
-
updatedAt?: string;
|
|
28
|
-
}[];
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export default class ListActions {
|
|
32
|
-
constructor(protected _transport: FetchTransport) {}
|
|
33
|
-
|
|
34
|
-
public async send({ request = {} }: Options = {}) {
|
|
35
|
-
return this._transport.send<ListActionsResponse>("v1/actions", {
|
|
36
|
-
...request,
|
|
37
|
-
method: "GET",
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
}
|
package/src/Action/index.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Great Detail Support System.
|
|
3
|
-
*
|
|
4
|
-
* @copyright 2024 Great Detail Ltd
|
|
5
|
-
* @author Great Detail Ltd <info@greatdetail.com>
|
|
6
|
-
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
7
|
-
* @see https://greatdetail.com
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
export { type ListActionsResponse } from "./ListActions.js";
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Great Detail Support System.
|
|
3
|
-
*
|
|
4
|
-
* @copyright 2024 Great Detail Ltd
|
|
5
|
-
* @author Great Detail Ltd <info@greatdetail.com>
|
|
6
|
-
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
7
|
-
* @see https://greatdetail.com
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { KEY_ENV_VAR, USER_ENV_VAR } from "../constants/environment.js";
|
|
11
|
-
import { DEFAULT_KEY_AUTHENTICATION_NAME } from "../constants/index.js";
|
|
12
|
-
import Authentication from "./index.js";
|
|
13
|
-
|
|
14
|
-
export interface Options {
|
|
15
|
-
name?: string;
|
|
16
|
-
key?: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export default class KeyAuthentication implements Authentication {
|
|
20
|
-
public static DEFAULT_NAME = DEFAULT_KEY_AUTHENTICATION_NAME;
|
|
21
|
-
|
|
22
|
-
public name: string;
|
|
23
|
-
#key: string;
|
|
24
|
-
|
|
25
|
-
constructor({
|
|
26
|
-
name = process.env[USER_ENV_VAR] ?? KeyAuthentication.DEFAULT_NAME,
|
|
27
|
-
key = process.env[KEY_ENV_VAR],
|
|
28
|
-
}: Options = {}) {
|
|
29
|
-
if (!key) {
|
|
30
|
-
throw new Error(
|
|
31
|
-
"API Key option must be specified when using Key Authentication",
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
this.name = name;
|
|
36
|
-
this.#key = key;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
public async filter() {
|
|
40
|
-
return {
|
|
41
|
-
headers: this.getHeaders(),
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
public getHeaders() {
|
|
46
|
-
return {
|
|
47
|
-
Authorization: `Basic ${btoa(this.name + ":" + this.#key)}`,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Great Detail Support System.
|
|
3
|
-
*
|
|
4
|
-
* @copyright 2024 Great Detail Ltd
|
|
5
|
-
* @author Great Detail Ltd <info@greatdetail.com>
|
|
6
|
-
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
7
|
-
* @see https://greatdetail.com
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import Authentication from "./index.js";
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Public Authentication Configuration.
|
|
14
|
-
* This type of authentication doesn't define any authentication for outgoing
|
|
15
|
-
* HTTP requests. This functionality may work well when using a proxying method
|
|
16
|
-
* to add credentials to a request after-the-fact.
|
|
17
|
-
*
|
|
18
|
-
* Note: Not all APIs and endpoints will work with this authentication type.
|
|
19
|
-
*
|
|
20
|
-
* @since 1.0.l0
|
|
21
|
-
*/
|
|
22
|
-
export default class PublicAuthentication implements Authentication {
|
|
23
|
-
public async filter() {
|
|
24
|
-
return {
|
|
25
|
-
headers: this.getHeaders(),
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
public getHeaders() {
|
|
30
|
-
return {};
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Great Detail Support System.
|
|
3
|
-
*
|
|
4
|
-
* @copyright 2024 Great Detail Ltd
|
|
5
|
-
* @author Great Detail Ltd <info@greatdetail.com>
|
|
6
|
-
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
7
|
-
* @see https://greatdetail.com
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { TOKEN_ENV_VAR } from "../constants/environment.js";
|
|
11
|
-
import Authentication from "./index.js";
|
|
12
|
-
|
|
13
|
-
export interface Options {
|
|
14
|
-
token?: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export default class TokenAuthentication implements Authentication {
|
|
18
|
-
#token: string;
|
|
19
|
-
|
|
20
|
-
constructor({ token = process.env[TOKEN_ENV_VAR] }: Options = {}) {
|
|
21
|
-
if (!token) {
|
|
22
|
-
throw new Error(
|
|
23
|
-
"Access Token option must be specified when using Token Authentication",
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
this.#token = token;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
public async filter() {
|
|
31
|
-
return {
|
|
32
|
-
headers: this.getHeaders(),
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
public getHeaders() {
|
|
37
|
-
return {
|
|
38
|
-
Authorization: `Bearer ${this.#token}`,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Great Detail Support System.
|
|
3
|
-
*
|
|
4
|
-
* @copyright 2024 Great Detail Ltd
|
|
5
|
-
* @author Great Detail Ltd <info@greatdetail.com>
|
|
6
|
-
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
7
|
-
* @see https://greatdetail.com
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import RequestFilterable from "../Request/RequestFilterable.js";
|
|
11
|
-
|
|
12
|
-
type Authentication = RequestFilterable;
|
|
13
|
-
export default Authentication;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Great Detail Support System.
|
|
3
|
-
*
|
|
4
|
-
* @copyright 2024 Great Detail Ltd
|
|
5
|
-
* @author Great Detail Ltd <info@greatdetail.com>
|
|
6
|
-
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
7
|
-
* @see https://greatdetail.com
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { z } from "zod";
|
|
11
|
-
import FetchTransport from "../Transport/FetchTransport.js";
|
|
12
|
-
|
|
13
|
-
export interface Options {
|
|
14
|
-
id: string;
|
|
15
|
-
body: z.infer<typeof CreateBoilerplateCategoryBoilerplate.SCHEMA>;
|
|
16
|
-
request?: RequestInit;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export type CreateBoilerplateCategoryBoilerplateResponse = {
|
|
20
|
-
boilerplate: {
|
|
21
|
-
id: string;
|
|
22
|
-
title: string;
|
|
23
|
-
content: string;
|
|
24
|
-
account: string;
|
|
25
|
-
createdAt: string;
|
|
26
|
-
updatedAt: string;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export default class CreateBoilerplateCategoryBoilerplate {
|
|
31
|
-
public static SCHEMA = z.object({
|
|
32
|
-
title: z.string(),
|
|
33
|
-
content: z.string(),
|
|
34
|
-
account: z.string(),
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
constructor(protected _transport: FetchTransport) {}
|
|
38
|
-
|
|
39
|
-
public async send({ id, body, request = {} }: Options) {
|
|
40
|
-
return this._transport.send<CreateBoilerplateCategoryBoilerplateResponse>(
|
|
41
|
-
"v1/boilerplate-categories/" + encodeURIComponent(id) + "/boilerplates",
|
|
42
|
-
{
|
|
43
|
-
...request,
|
|
44
|
-
method: "POST",
|
|
45
|
-
headers: {
|
|
46
|
-
...request.headers,
|
|
47
|
-
"Content-Type": "application/json",
|
|
48
|
-
},
|
|
49
|
-
body: JSON.stringify(
|
|
50
|
-
CreateBoilerplateCategoryBoilerplate.SCHEMA.parse(body),
|
|
51
|
-
),
|
|
52
|
-
},
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Great Detail Support System.
|
|
3
|
-
*
|
|
4
|
-
* @copyright 2024 Great Detail Ltd
|
|
5
|
-
* @author Great Detail Ltd <info@greatdetail.com>
|
|
6
|
-
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
7
|
-
* @see https://greatdetail.com
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import FetchTransport from "../Transport/FetchTransport.js";
|
|
11
|
-
|
|
12
|
-
export interface Options {
|
|
13
|
-
id: string;
|
|
14
|
-
request?: RequestInit;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export type GetBoilerplateResponse = {
|
|
18
|
-
boilerplate: {
|
|
19
|
-
id: string;
|
|
20
|
-
title: string;
|
|
21
|
-
content: string;
|
|
22
|
-
account: string;
|
|
23
|
-
boilerplateCategory: string;
|
|
24
|
-
createdAt: string;
|
|
25
|
-
updatedAt: string;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export default class GetBoilerplate {
|
|
30
|
-
constructor(protected _transport: FetchTransport) {}
|
|
31
|
-
|
|
32
|
-
public async send({ id, request = {} }: Options) {
|
|
33
|
-
return this._transport.send<GetBoilerplateResponse>(
|
|
34
|
-
"v1/boilerplates/" + encodeURIComponent(id),
|
|
35
|
-
{
|
|
36
|
-
...request,
|
|
37
|
-
method: "GET",
|
|
38
|
-
},
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Great Detail Support System.
|
|
3
|
-
*
|
|
4
|
-
* @copyright 2024 Great Detail Ltd
|
|
5
|
-
* @author Great Detail Ltd <info@greatdetail.com>
|
|
6
|
-
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
7
|
-
* @see https://greatdetail.com
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import FetchTransport from "../Transport/FetchTransport.js";
|
|
11
|
-
|
|
12
|
-
export interface Options {
|
|
13
|
-
id: string;
|
|
14
|
-
request?: RequestInit;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export default class ListBoilerplateCategoryBoilerplates {
|
|
18
|
-
constructor(protected _transport: FetchTransport) {}
|
|
19
|
-
|
|
20
|
-
public async send({ id, request = {} }: Options) {
|
|
21
|
-
return this._transport.send<ListBoilerplateCategoryBoilerplatesResponse>(
|
|
22
|
-
"v1/boilerplate-categories/" + encodeURIComponent(id) + "/boilerplates",
|
|
23
|
-
{
|
|
24
|
-
...request,
|
|
25
|
-
method: "GET",
|
|
26
|
-
},
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export type ListBoilerplateCategoryBoilerplatesResponse = {
|
|
32
|
-
boilerplates: {
|
|
33
|
-
id: string;
|
|
34
|
-
title: string;
|
|
35
|
-
content: string;
|
|
36
|
-
account: string;
|
|
37
|
-
boilerplateCategory: string;
|
|
38
|
-
createdAt: string;
|
|
39
|
-
updatedAt: string;
|
|
40
|
-
}[];
|
|
41
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Great Detail Support System.
|
|
3
|
-
*
|
|
4
|
-
* @copyright 2024 Great Detail Ltd
|
|
5
|
-
* @author Great Detail Ltd <info@greatdetail.com>
|
|
6
|
-
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
7
|
-
* @see https://greatdetail.com
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import FetchTransport from "../Transport/FetchTransport.js";
|
|
11
|
-
|
|
12
|
-
export interface Options {
|
|
13
|
-
request?: RequestInit;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export type ListBoilerplatesResponse = {
|
|
17
|
-
boilerplates: {
|
|
18
|
-
id: string;
|
|
19
|
-
title: string;
|
|
20
|
-
content: string;
|
|
21
|
-
account: string;
|
|
22
|
-
boilerplateCategory: string;
|
|
23
|
-
createdAt: string;
|
|
24
|
-
updatedAt: string;
|
|
25
|
-
}[];
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export default class ListBoilerplates {
|
|
29
|
-
constructor(protected _transport: FetchTransport) {}
|
|
30
|
-
|
|
31
|
-
public async send({ request = {} }: Options = {}) {
|
|
32
|
-
return this._transport.send<ListBoilerplatesResponse>("v1/boilerplates", {
|
|
33
|
-
...request,
|
|
34
|
-
method: "GET",
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Great Detail Support System.
|
|
3
|
-
*
|
|
4
|
-
* @copyright 2024 Great Detail Ltd
|
|
5
|
-
* @author Great Detail Ltd <info@greatdetail.com>
|
|
6
|
-
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
7
|
-
* @see https://greatdetail.com
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { z } from "zod";
|
|
11
|
-
import FetchTransport from "../Transport/FetchTransport.js";
|
|
12
|
-
|
|
13
|
-
export interface Options {
|
|
14
|
-
id: string;
|
|
15
|
-
body: z.infer<typeof UpdateBoilerplate.SCHEMA>;
|
|
16
|
-
request?: RequestInit;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export type UpdateBoilerplateResponse = {
|
|
20
|
-
boilerplate: {
|
|
21
|
-
id: string;
|
|
22
|
-
title: string;
|
|
23
|
-
content: string;
|
|
24
|
-
account: string;
|
|
25
|
-
boilerplateCategory: string;
|
|
26
|
-
createdAt: string;
|
|
27
|
-
updatedAt: string;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export default class UpdateBoilerplate {
|
|
32
|
-
public static SCHEMA = z.object({
|
|
33
|
-
title: z.string().optional(),
|
|
34
|
-
content: z.string().optional(),
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
constructor(protected _transport: FetchTransport) {}
|
|
38
|
-
|
|
39
|
-
public async send({ id, body, request = {} }: Options) {
|
|
40
|
-
return this._transport.send<UpdateBoilerplateResponse>(
|
|
41
|
-
"v1/boilerplates/" + encodeURIComponent(id),
|
|
42
|
-
{
|
|
43
|
-
...request,
|
|
44
|
-
method: "PATCH",
|
|
45
|
-
headers: {
|
|
46
|
-
...request.headers,
|
|
47
|
-
"Content-Type": "application/json",
|
|
48
|
-
},
|
|
49
|
-
body: JSON.stringify(UpdateBoilerplate.SCHEMA.parse(body)),
|
|
50
|
-
},
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
}
|
package/src/Boilerplate/index.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Great Detail Support System.
|
|
3
|
-
*
|
|
4
|
-
* @copyright 2024 Great Detail Ltd
|
|
5
|
-
* @author Great Detail Ltd <info@greatdetail.com>
|
|
6
|
-
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
7
|
-
* @see https://greatdetail.com
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
export { type CreateBoilerplateCategoryBoilerplateResponse } from "./CreateBoilerplateCategoryBoilerplate.js";
|
|
11
|
-
export { type ListBoilerplateCategoryBoilerplatesResponse } from "./ListBoilerplateCategoryBoilerplates.js";
|
|
12
|
-
export { type GetBoilerplateResponse } from "./GetBoilerplate.js";
|
|
13
|
-
export { type ListBoilerplatesResponse } from "./ListBoilerplates.js";
|
|
14
|
-
export { type UpdateBoilerplateResponse } from "./UpdateBoilerplate.js";
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Great Detail Support System.
|
|
3
|
-
*
|
|
4
|
-
* @copyright 2024 Great Detail Ltd
|
|
5
|
-
* @author Great Detail Ltd <info@greatdetail.com>
|
|
6
|
-
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
7
|
-
* @see https://greatdetail.com
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { z } from "zod";
|
|
11
|
-
import FetchTransport from "../Transport/FetchTransport.js";
|
|
12
|
-
|
|
13
|
-
export interface Options {
|
|
14
|
-
body: z.infer<typeof CreateBoilerplateCategory.SCHEMA>;
|
|
15
|
-
request?: RequestInit;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export type CreateBoilerplateCategoryResponse = {
|
|
19
|
-
boilerplateCategory: {
|
|
20
|
-
id: string;
|
|
21
|
-
title: string;
|
|
22
|
-
description?: string;
|
|
23
|
-
account: string;
|
|
24
|
-
createdAt: string;
|
|
25
|
-
updatedAt: string;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export default class CreateBoilerplateCategory {
|
|
30
|
-
public static SCHEMA = z.object({
|
|
31
|
-
title: z.string(),
|
|
32
|
-
description: z.string().optional(),
|
|
33
|
-
account: z.string(),
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
constructor(protected _transport: FetchTransport) {}
|
|
37
|
-
|
|
38
|
-
public async send({ body, request = {} }: Options) {
|
|
39
|
-
return this._transport.send<CreateBoilerplateCategoryResponse>(
|
|
40
|
-
"v1/boilerplate-categories",
|
|
41
|
-
{
|
|
42
|
-
...request,
|
|
43
|
-
method: "POST",
|
|
44
|
-
headers: {
|
|
45
|
-
...request.headers,
|
|
46
|
-
"Content-Type": "application/json",
|
|
47
|
-
},
|
|
48
|
-
body: JSON.stringify(CreateBoilerplateCategory.SCHEMA.parse(body)),
|
|
49
|
-
},
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
}
|