@great-detail/support-sdk 0.0.8 → 0.0.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.
Files changed (36) hide show
  1. package/dist/{chunk-ABALSK3N.js → chunk-565FNIKF.js} +1 -1
  2. package/dist/chunk-K2S74QO7.js +1 -0
  3. package/dist/cli/index.cjs +1 -1
  4. package/dist/cli/index.d.cts +1 -1
  5. package/dist/cli/index.d.ts +1 -1
  6. package/dist/cli/index.js +1 -1
  7. package/dist/cli.cjs +1 -1
  8. package/dist/cli.js +1 -1
  9. package/dist/{index-CNLZqmjo.d.cts → index-CAMI8mLN.d.cts} +6 -2
  10. package/dist/{index-CNLZqmjo.d.ts → index-CAMI8mLN.d.ts} +6 -2
  11. package/dist/index.cjs +1 -1
  12. package/dist/index.d.cts +6 -2
  13. package/dist/index.d.ts +6 -2
  14. package/dist/index.js +1 -1
  15. package/package.json +1 -1
  16. package/src/Action/ListActions.ts +1 -1
  17. package/src/Authentication/PublicAuthentication.ts +4 -0
  18. package/src/Channel/ListChannels.ts +1 -1
  19. package/src/Client/index.ts +7 -3
  20. package/src/Contact/GetContact.ts +1 -1
  21. package/src/Contact/ListContacts.ts +1 -1
  22. package/src/Conversation/GetConversation.ts +6 -1
  23. package/src/Conversation/ListConversations.ts +6 -1
  24. package/src/Conversation/UpdateConversation.ts +6 -1
  25. package/src/Label/CreateLabel.ts +1 -1
  26. package/src/Label/GetLabel.ts +1 -1
  27. package/src/Label/ListLabels.ts +1 -1
  28. package/src/Message/ListConversationMessages.ts +1 -1
  29. package/src/Message/ListMessages.ts +1 -1
  30. package/src/Model/Correction/CreateCorrectionModel.ts +1 -1
  31. package/src/Model/GetModel.ts +1 -1
  32. package/src/Model/ListModels.ts +1 -1
  33. package/src/Model/Response/CreateResponseModel.ts +1 -1
  34. package/src/Source/GetSource.ts +1 -1
  35. package/src/Source/ListSources.ts +1 -1
  36. package/dist/chunk-3N2R6UO2.js +0 -1
@@ -1 +1 @@
1
- import{f as x,g as y}from"./chunk-3N2R6UO2.js";import{Command as A}from"commander";import{Command as F}from"commander";import{oraPromise as I}from"ora";function a({client:n,ora:s}){let o=new F("actions").description("Actions");return o.addCommand(new F("list").description("List actions").action(async()=>{let t=await I(()=>n.action.list.send(),{...s,text:"Finding actions"});console.log(await t.result())})),o}import{Command as b}from"commander";import{oraPromise as S}from"ora";function m({client:n,ora:s}){let o=new b("channels").description("Channels");return o.addCommand(new b("list").description("List channels").action(async()=>{let t=await S(()=>n.channel.list.send(),{...s,text:"Finding channels"});console.log(await t.result())})),o}import{Command as r}from"commander";import{oraPromise as v}from"ora";function d({client:n,ora:s}){let o=new r("contacts").description("Contacts");return o.addCommand(new r("get").description("Find contact").argument("<contact>","Contact ID").action(async t=>{let i=await v(()=>n.contact.get.send({id:t}),{...s,text:"Finding contact"});console.log(await i.result())})),o.addCommand(new r("list").description("List contacts").action(async()=>{let t=await v(()=>n.contact.list.send(),{...s,text:"Finding contacts"});console.log(await t.result())})),o}import{Command as c}from"commander";import{oraPromise as L}from"ora";function p({client:n,ora:s}){let o=new c("conversations").description("Conversations");return o.addCommand(new c("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async t=>{let i=await L(()=>n.conversation.get.send({id:t}),{...s,text:"Finding conversation"});console.log(await i.result())})),o.addCommand(new c("list").description("List conversations").action(async()=>{let t=await L(()=>n.conversation.list.send(),{...s,text:"Finding conversations"});console.log(await t.result())})),o}import{Command as l}from"commander";import{oraPromise as P}from"ora";function u({client:n,ora:s}){let o=new l("labels").description("Labels");return o.addCommand(new l("get").description("Find label").argument("<label>","Label ID").action(async t=>{let i=await P(()=>n.label.get.send({id:t}),{...s,text:"Finding label"});console.log(await i.result())})),o.addCommand(new l("list").description("List labels").action(async()=>{let t=await P(()=>n.label.list.send(),{...s,text:"Finding labels"});console.log(await t.result())})),o}import{Command as h}from"commander";import{oraPromise as M}from"ora";function f({client:n,ora:s}){let o=new h("messages").description("Messages");return o.addCommand(new h("list").description("List messages").action(async()=>{let t=await M(()=>n.message.list.send(),{...s,text:"Finding messages"});console.log(await t.result())})),o}import{Command as C}from"commander";import{oraPromise as j}from"ora";function g({client:n,ora:s}){let o=new C("models").description("Models");return o.addCommand(new C("get").description("Find model").argument("<model>","Model ID").action(async t=>{let i=await j(()=>n.model.get.send({id:t}),{...s,text:"Finding model"});console.log(await i.result())})),o.addCommand(new C("list").description("List models").action(async()=>{let t=await j(()=>n.model.list.send(),{...s,text:"Finding models"});console.log(await t.result())})),o}import{Command as w}from"commander";import{oraPromise as D}from"ora";function O({client:n,ora:s}){let o=new w("sources").description("Sources");return o.addCommand(new w("get").description("Find source").argument("<source>","Source ID").action(async t=>{let i=await D(()=>n.source.get.send({id:t}),{...s,text:"Finding source"});console.log(await i.result())})),o.addCommand(new w("list").description("List sources").action(async()=>{let t=await D(()=>n.source.list.send(),{...s,text:"Finding sources"});console.log(await t.result())})),o}var e={ora:{spinner:"simpleDotsScrolling"},client:new y(new x)},G=new A("gds").description("Great Detail Support System").addCommand(a(e)).addCommand(m(e)).addCommand(d(e)).addCommand(p(e)).addCommand(u(e)).addCommand(f(e)).addCommand(g(e)).addCommand(O(e)),go=G;export{go as a};
1
+ import{f as x,g as y}from"./chunk-K2S74QO7.js";import{Command as A}from"commander";import{Command as F}from"commander";import{oraPromise as I}from"ora";function a({client:n,ora:s}){let o=new F("actions").description("Actions");return o.addCommand(new F("list").description("List actions").action(async()=>{let t=await I(()=>n.action.list.send(),{...s,text:"Finding actions"});console.log(await t.result())})),o}import{Command as b}from"commander";import{oraPromise as S}from"ora";function m({client:n,ora:s}){let o=new b("channels").description("Channels");return o.addCommand(new b("list").description("List channels").action(async()=>{let t=await S(()=>n.channel.list.send(),{...s,text:"Finding channels"});console.log(await t.result())})),o}import{Command as r}from"commander";import{oraPromise as v}from"ora";function d({client:n,ora:s}){let o=new r("contacts").description("Contacts");return o.addCommand(new r("get").description("Find contact").argument("<contact>","Contact ID").action(async t=>{let i=await v(()=>n.contact.get.send({id:t}),{...s,text:"Finding contact"});console.log(await i.result())})),o.addCommand(new r("list").description("List contacts").action(async()=>{let t=await v(()=>n.contact.list.send(),{...s,text:"Finding contacts"});console.log(await t.result())})),o}import{Command as c}from"commander";import{oraPromise as L}from"ora";function p({client:n,ora:s}){let o=new c("conversations").description("Conversations");return o.addCommand(new c("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async t=>{let i=await L(()=>n.conversation.get.send({id:t}),{...s,text:"Finding conversation"});console.log(await i.result())})),o.addCommand(new c("list").description("List conversations").action(async()=>{let t=await L(()=>n.conversation.list.send(),{...s,text:"Finding conversations"});console.log(await t.result())})),o}import{Command as l}from"commander";import{oraPromise as P}from"ora";function u({client:n,ora:s}){let o=new l("labels").description("Labels");return o.addCommand(new l("get").description("Find label").argument("<label>","Label ID").action(async t=>{let i=await P(()=>n.label.get.send({id:t}),{...s,text:"Finding label"});console.log(await i.result())})),o.addCommand(new l("list").description("List labels").action(async()=>{let t=await P(()=>n.label.list.send(),{...s,text:"Finding labels"});console.log(await t.result())})),o}import{Command as h}from"commander";import{oraPromise as M}from"ora";function f({client:n,ora:s}){let o=new h("messages").description("Messages");return o.addCommand(new h("list").description("List messages").action(async()=>{let t=await M(()=>n.message.list.send(),{...s,text:"Finding messages"});console.log(await t.result())})),o}import{Command as C}from"commander";import{oraPromise as j}from"ora";function g({client:n,ora:s}){let o=new C("models").description("Models");return o.addCommand(new C("get").description("Find model").argument("<model>","Model ID").action(async t=>{let i=await j(()=>n.model.get.send({id:t}),{...s,text:"Finding model"});console.log(await i.result())})),o.addCommand(new C("list").description("List models").action(async()=>{let t=await j(()=>n.model.list.send(),{...s,text:"Finding models"});console.log(await t.result())})),o}import{Command as w}from"commander";import{oraPromise as D}from"ora";function O({client:n,ora:s}){let o=new w("sources").description("Sources");return o.addCommand(new w("get").description("Find source").argument("<source>","Source ID").action(async t=>{let i=await D(()=>n.source.get.send({id:t}),{...s,text:"Finding source"});console.log(await i.result())})),o.addCommand(new w("list").description("List sources").action(async()=>{let t=await D(()=>n.source.list.send(),{...s,text:"Finding sources"});console.log(await t.result())})),o}var e={ora:{spinner:"simpleDotsScrolling"},client:new y(new x)},G=new A("gds").description("Great Detail Support System").addCommand(a(e)).addCommand(m(e)).addCommand(d(e)).addCommand(p(e)).addCommand(u(e)).addCommand(f(e)).addCommand(g(e)).addCommand(O(e)),go=G;export{go as a};
@@ -0,0 +1 @@
1
+ var k="https://api.support.greatdetail.com",W={"X-Powered-By":"GDSupport/JavaScript"},Q="api-key",Z="SUPPORT_ACCESS_TOKEN",$="SUPPORT_API_KEY",tt="SUPPORT_KEY_NAME";var v=class{async filter(t){return t}};var i=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("v1/actions",{...t,method:"GET"},s).then(n=>new w(n))}},w=class{constructor(t){this.response=t}async result(){return this.response.json()}};var p=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("v1/channels",{...t,method:"GET"},s).then(n=>new q(n))}},q=class{constructor(t){this.response=t}async result(){return this.response.json()}};var a=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("v1/contacts",{...t,method:"GET"},s).then(n=>new T(n))}},T=class{constructor(t){this.response=t}async result(){return this.response.json()}};var c=class{constructor(t){this._client=t}async send({id:t,request:s={},...n}){return this._client.send("v1/conversations/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new I(r))}},I=class{constructor(t){this.response=t}async result(){return this.response.json()}};var l=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("v1/conversations",{...t,method:"GET"},s).then(n=>new U(n))}},U=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as d}from"zod";var u=class e{constructor(t){this._client=t}static SCHEMA=d.object({title:d.string(),description:d.optional(d.string()),account:d.string()});async send({body:t,request:s={},...n}){return this._client.send("v1/labels",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))},n).then(r=>new L(r))}},L=class{constructor(t){this.response=t}async result(){return this.response.json()}};var g=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("v1/labels",{...t,method:"GET"},s).then(n=>new j(n))}},j=class{constructor(t){this.response=t}async result(){return this.response.json()}};var m=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("v1/messages",{...t,method:"GET"},s).then(n=>new D(n))}},D=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as _}from"zod";var h=class e{constructor(t){this._client=t}static SCHEMA=_.object({input:_.string().max(65536),original:_.string().max(65536),correction:_.string().max(65536)});async send({id:t,body:s,request:n={},...r}){return this._client.send("v1/models/"+encodeURIComponent(t)+"/correction",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))},r).then(o=>new G(o))}},G=class{constructor(t){this.response=t}async result(){return this.response.json()}};var y=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("v1/models",{...t,method:"GET"},s).then(n=>new N(n))}},N=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as E}from"zod";var b=class e{constructor(t){this._client=t}static SCHEMA=E.array(E.object({role:E.enum(["user","assistant"]),content:E.string().max(65536).nullable()})).min(1);async send({id:t,body:s,request:n={},...r}){return this._client.send("v1/models/"+encodeURIComponent(t)+"/response",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))},r).then(o=>new H(o))}},H=class{constructor(t){this.response=t}async result(){return this.response.json()}};var f=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("v1/sources",{...t,method:"GET"},s).then(n=>new M(n))}},M=class{constructor(t){this.response=t}async result(){return this.response.json()}};var R=class{constructor(t){this._client=t}async send({id:t,request:s={},...n}){return this._client.send("v1/contacts/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new F(r))}},F=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as X}from"zod";var x=class e{constructor(t){this._client=t}static SCHEMA=X.object({hasEnded:X.boolean()});async send({id:t,body:s,request:n={},...r}){return this._client.send("v1/conversations/"+encodeURIComponent(t),{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))},r).then(o=>new z(o))}},z=class{constructor(t){this.response=t}async result(){return this.response.json()}};var S=class{constructor(t){this._client=t}async send({id:t,request:s={},...n}){return this._client.send("v1/labels/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new B(r))}},B=class{constructor(t){this.response=t}async result(){return this.response.json()}};var C=class{constructor(t){this._client=t}async send({id:t,request:s={},...n}){return this._client.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...s,method:"GET"},n).then(r=>new K(r))}},K=class{constructor(t){this.response=t}async result(){return this.response.json()}};var O=class{constructor(t){this._client=t}async send({id:t,request:s={},...n}){return this._client.send("v1/models/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new V(r))}},V=class{constructor(t){this.response=t}async result(){return this.response.json()}};var A=class e{constructor(t=e.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=W;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var P=class{constructor(t){this._client=t}async send({id:t,request:s={},...n}){return this._client.send("v1/sources/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new J(r))}},J=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Y=class e{static DEFAULT_BASE_URL=k;options;constructor(t,{baseURL:s,...n}={}){this.options={requestFilterables:[new A,t],...n,baseURL:s?.toString()??e.getBaseURL()}}static getBaseURL(){return process.env.SUPPORT_BASE_URL??this.DEFAULT_BASE_URL}action={list:new i(this)};channel={list:new p(this)};contact={get:new R(this),list:new a(this)};conversation={get:new c(this),list:new l(this),update:new x(this),message:{list:new C(this)}};label={create:new u(this),get:new S(this),list:new g(this)};message={list:new m(this)};model={get:new O(this),list:new y(this),response:{create:new b(this)},correction:{create:new h(this)}};source={get:new P(this),list:new f(this)};async _filterRequest(t){for(let s of this.options.requestFilterables)t=await s.filter(t);return t}async send(t,s,{fetch:n=fetch}={}){return await n(new Request(new URL(t,this.options.baseURL),await this._filterRequest(s)))}};export{k as a,Q as b,Z as c,$ as d,tt as e,v as f,Y as g};
@@ -1 +1 @@
1
- "use strict";var D=Object.defineProperty;var St=Object.getOwnPropertyDescriptor;var At=Object.getOwnPropertyNames;var Pt=Object.prototype.hasOwnProperty;var _t=(n,t)=>{for(var e in t)D(n,e,{get:t[e],enumerable:!0})},Et=(n,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of At(t))!Pt.call(n,o)&&o!==e&&D(n,o,{get:()=>t[o],enumerable:!(s=St(t,o))||s.enumerable});return n};var vt=n=>Et(D({},"__esModule",{value:!0}),n);var Tt={};_t(Tt,{default:()=>It});module.exports=vt(Tt);var wt=require("commander");var p=class{async filter(t){return t}};var c=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/actions",{...t,method:"GET"},e).then(s=>new F(s))}},F=class{constructor(t){this.response=t}async result(){return this.response.json()}};var d=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/channels",{...t,method:"GET"},e).then(s=>new G(s))}},G=class{constructor(t){this.response=t}async result(){return this.response.json()}};var ht="https://api.support.greatdetail.com",Ot={"X-Powered-By":"GDSupport/JavaScript"};var l=class{constructor(t){this._client=t}async send({id:t,request:e={},...s}){return this._client.send("/v1/contacts/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new M(o))}},M=class{constructor(t){this.response=t}async result(){return this.response.json()}};var m=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/contacts",{...t,method:"GET"},e).then(s=>new N(s))}},N=class{constructor(t){this.response=t}async result(){return this.response.json()}};var u=class{constructor(t){this._client=t}async send({id:t,request:e={},...s}){return this._client.send("/v1/conversations/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new H(o))}},H=class{constructor(t){this.response=t}async result(){return this.response.json()}};var g=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/conversations",{...t,method:"GET"},e).then(s=>new z(s))}},z=class{constructor(t){this.response=t}async result(){return this.response.json()}};var K=require("zod"),f=class n{constructor(t){this._client=t}static SCHEMA=K.z.object({hasEnded:K.z.boolean()});async send({id:t,body:e,request:s={},...o}){return this._client.send("/v1/conversations/"+encodeURIComponent(t),{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))},o).then(a=>new B(a))}},B=class{constructor(t){this.response=t}async result(){return this.response.json()}};var r=require("zod"),y=class n{constructor(t){this._client=t}static SCHEMA=r.z.object({title:r.z.string(),description:r.z.optional(r.z.string()),account:r.z.string()});async send({body:t,request:e={},...s}){return this._client.send("/v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(t))},s).then(o=>new V(o))}},V=class{constructor(t){this.response=t}async result(){return this.response.json()}};var x=class{constructor(t){this._client=t}async send({id:t,request:e={},...s}){return this._client.send("/v1/labels/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new J(o))}},J=class{constructor(t){this.response=t}async result(){return this.response.json()}};var h=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/labels",{...t,method:"GET"},e).then(s=>new Y(s))}},Y=class{constructor(t){this.response=t}async result(){return this.response.json()}};var O=class{constructor(t){this._client=t}async send({id:t,request:e={},...s}){return this._client.send("/v1/conversations/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"},s).then(o=>new k(o))}},k=class{constructor(t){this.response=t}async result(){return this.response.json()}};var C=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/messages",{...t,method:"GET"},e).then(s=>new W(s))}},W=class{constructor(t){this.response=t}async result(){return this.response.json()}};var b=require("zod"),R=class n{constructor(t){this._client=t}static SCHEMA=b.z.object({input:b.z.string().max(65536),original:b.z.string().max(65536),correction:b.z.string().max(65536)});async send({id:t,body:e,request:s={},...o}){return this._client.send("/v1/models/"+encodeURIComponent(t)+"/correction",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))},o).then(a=>new X(a))}},X=class{constructor(t){this.response=t}async result(){return this.response.json()}};var w=class{constructor(t){this._client=t}async send({id:t,request:e={},...s}){return this._client.send("/v1/models/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new Q(o))}},Q=class{constructor(t){this.response=t}async result(){return this.response.json()}};var S=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/models",{...t,method:"GET"},e).then(s=>new Z(s))}},Z=class{constructor(t){this.response=t}async result(){return this.response.json()}};var A=require("zod"),P=class n{constructor(t){this._client=t}static SCHEMA=A.z.array(A.z.object({role:A.z.enum(["user","assistant"]),content:A.z.string().max(65536).nullable()})).min(1);async send({id:t,body:e,request:s={},...o}){return this._client.send("/v1/models/"+encodeURIComponent(t)+"/response",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))},o).then(a=>new $(a))}},$=class{constructor(t){this.response=t}async result(){return this.response.json()}};var _=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Ot;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var E=class{constructor(t){this._client=t}async send({id:t,request:e={},...s}){return this._client.send("/v1/sources/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new tt(o))}},tt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var v=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/sources",{...t,method:"GET"},e).then(s=>new et(s))}},et=class{constructor(t){this.response=t}async result(){return this.response.json()}};var q=class n{static DEFAULT_BASE_URL=ht;options;constructor(t,e={}){this.options={requestFilterables:[new _,t],baseURL:process.env.SUPPORT_BASE_URL??n.DEFAULT_BASE_URL,...e}}action={list:new c(this)};channel={list:new d(this)};contact={get:new l(this),list:new m(this)};conversation={get:new u(this),list:new g(this),update:new f(this),message:{list:new O(this)}};label={create:new y(this),get:new x(this),list:new h(this)};message={list:new C(this)};model={get:new w(this),list:new S(this),response:{create:new P(this)},correction:{create:new R(this)}};source={get:new E(this),list:new v(this)};async _filterRequest(t){for(let e of this.options.requestFilterables)t=await e.filter(t);return t}async send(t,e,{fetch:s=fetch}={}){return await s(new Request(new URL(t,this.options.baseURL),await this._filterRequest(e)))}};var nt=require("commander"),Ct=require("ora");function st({client:n,ora:t}){let e=new nt.Command("actions").description("Actions");return e.addCommand(new nt.Command("list").description("List actions").action(async()=>{let s=await(0,Ct.oraPromise)(()=>n.action.list.send(),{...t,text:"Finding actions"});console.log(await s.result())})),e}var ot=require("commander"),bt=require("ora");function it({client:n,ora:t}){let e=new ot.Command("channels").description("Channels");return e.addCommand(new ot.Command("list").description("List channels").action(async()=>{let s=await(0,bt.oraPromise)(()=>n.channel.list.send(),{...t,text:"Finding channels"});console.log(await s.result())})),e}var I=require("commander"),rt=require("ora");function at({client:n,ora:t}){let e=new I.Command("contacts").description("Contacts");return e.addCommand(new I.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async s=>{let o=await(0,rt.oraPromise)(()=>n.contact.get.send({id:s}),{...t,text:"Finding contact"});console.log(await o.result())})),e.addCommand(new I.Command("list").description("List contacts").action(async()=>{let s=await(0,rt.oraPromise)(()=>n.contact.list.send(),{...t,text:"Finding contacts"});console.log(await s.result())})),e}var T=require("commander"),pt=require("ora");function ct({client:n,ora:t}){let e=new T.Command("conversations").description("Conversations");return e.addCommand(new T.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async s=>{let o=await(0,pt.oraPromise)(()=>n.conversation.get.send({id:s}),{...t,text:"Finding conversation"});console.log(await o.result())})),e.addCommand(new T.Command("list").description("List conversations").action(async()=>{let s=await(0,pt.oraPromise)(()=>n.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await s.result())})),e}var L=require("commander"),dt=require("ora");function lt({client:n,ora:t}){let e=new L.Command("labels").description("Labels");return e.addCommand(new L.Command("get").description("Find label").argument("<label>","Label ID").action(async s=>{let o=await(0,dt.oraPromise)(()=>n.label.get.send({id:s}),{...t,text:"Finding label"});console.log(await o.result())})),e.addCommand(new L.Command("list").description("List labels").action(async()=>{let s=await(0,dt.oraPromise)(()=>n.label.list.send(),{...t,text:"Finding labels"});console.log(await s.result())})),e}var mt=require("commander"),Rt=require("ora");function ut({client:n,ora:t}){let e=new mt.Command("messages").description("Messages");return e.addCommand(new mt.Command("list").description("List messages").action(async()=>{let s=await(0,Rt.oraPromise)(()=>n.message.list.send(),{...t,text:"Finding messages"});console.log(await s.result())})),e}var j=require("commander"),gt=require("ora");function ft({client:n,ora:t}){let e=new j.Command("models").description("Models");return e.addCommand(new j.Command("get").description("Find model").argument("<model>","Model ID").action(async s=>{let o=await(0,gt.oraPromise)(()=>n.model.get.send({id:s}),{...t,text:"Finding model"});console.log(await o.result())})),e.addCommand(new j.Command("list").description("List models").action(async()=>{let s=await(0,gt.oraPromise)(()=>n.model.list.send(),{...t,text:"Finding models"});console.log(await s.result())})),e}var U=require("commander"),yt=require("ora");function xt({client:n,ora:t}){let e=new U.Command("sources").description("Sources");return e.addCommand(new U.Command("get").description("Find source").argument("<source>","Source ID").action(async s=>{let o=await(0,yt.oraPromise)(()=>n.source.get.send({id:s}),{...t,text:"Finding source"});console.log(await o.result())})),e.addCommand(new U.Command("list").description("List sources").action(async()=>{let s=await(0,yt.oraPromise)(()=>n.source.list.send(),{...t,text:"Finding sources"});console.log(await s.result())})),e}var i={ora:{spinner:"simpleDotsScrolling"},client:new q(new p)},qt=new wt.Command("gds").description("Great Detail Support System").addCommand(st(i)).addCommand(it(i)).addCommand(at(i)).addCommand(ct(i)).addCommand(lt(i)).addCommand(ut(i)).addCommand(ft(i)).addCommand(xt(i)),It=qt;
1
+ "use strict";var D=Object.defineProperty;var wt=Object.getOwnPropertyDescriptor;var At=Object.getOwnPropertyNames;var Pt=Object.prototype.hasOwnProperty;var vt=(n,t)=>{for(var e in t)D(n,e,{get:t[e],enumerable:!0})},_t=(n,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of At(t))!Pt.call(n,o)&&o!==e&&D(n,o,{get:()=>t[o],enumerable:!(s=wt(t,o))||s.enumerable});return n};var Et=n=>_t(D({},"__esModule",{value:!0}),n);var Tt={};vt(Tt,{default:()=>It});module.exports=Et(Tt);var St=require("commander");var p=class{async filter(t){return t}};var c=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("v1/actions",{...t,method:"GET"},e).then(s=>new F(s))}},F=class{constructor(t){this.response=t}async result(){return this.response.json()}};var d=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("v1/channels",{...t,method:"GET"},e).then(s=>new G(s))}},G=class{constructor(t){this.response=t}async result(){return this.response.json()}};var xt="https://api.support.greatdetail.com",ht={"X-Powered-By":"GDSupport/JavaScript"};var l=class{constructor(t){this._client=t}async send({id:t,request:e={},...s}){return this._client.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new M(o))}},M=class{constructor(t){this.response=t}async result(){return this.response.json()}};var m=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("v1/contacts",{...t,method:"GET"},e).then(s=>new N(s))}},N=class{constructor(t){this.response=t}async result(){return this.response.json()}};var u=class{constructor(t){this._client=t}async send({id:t,request:e={},...s}){return this._client.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new H(o))}},H=class{constructor(t){this.response=t}async result(){return this.response.json()}};var g=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("v1/conversations",{...t,method:"GET"},e).then(s=>new z(s))}},z=class{constructor(t){this.response=t}async result(){return this.response.json()}};var B=require("zod"),f=class n{constructor(t){this._client=t}static SCHEMA=B.z.object({hasEnded:B.z.boolean()});async send({id:t,body:e,request:s={},...o}){return this._client.send("v1/conversations/"+encodeURIComponent(t),{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))},o).then(a=>new K(a))}},K=class{constructor(t){this.response=t}async result(){return this.response.json()}};var r=require("zod"),C=class n{constructor(t){this._client=t}static SCHEMA=r.z.object({title:r.z.string(),description:r.z.optional(r.z.string()),account:r.z.string()});async send({body:t,request:e={},...s}){return this._client.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(t))},s).then(o=>new V(o))}},V=class{constructor(t){this.response=t}async result(){return this.response.json()}};var y=class{constructor(t){this._client=t}async send({id:t,request:e={},...s}){return this._client.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new J(o))}},J=class{constructor(t){this.response=t}async result(){return this.response.json()}};var x=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("v1/labels",{...t,method:"GET"},e).then(s=>new Y(s))}},Y=class{constructor(t){this.response=t}async result(){return this.response.json()}};var h=class{constructor(t){this._client=t}async send({id:t,request:e={},...s}){return this._client.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"},s).then(o=>new k(o))}},k=class{constructor(t){this.response=t}async result(){return this.response.json()}};var O=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("v1/messages",{...t,method:"GET"},e).then(s=>new W(s))}},W=class{constructor(t){this.response=t}async result(){return this.response.json()}};var b=require("zod"),R=class n{constructor(t){this._client=t}static SCHEMA=b.z.object({input:b.z.string().max(65536),original:b.z.string().max(65536),correction:b.z.string().max(65536)});async send({id:t,body:e,request:s={},...o}){return this._client.send("v1/models/"+encodeURIComponent(t)+"/correction",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))},o).then(a=>new X(a))}},X=class{constructor(t){this.response=t}async result(){return this.response.json()}};var S=class{constructor(t){this._client=t}async send({id:t,request:e={},...s}){return this._client.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new Q(o))}},Q=class{constructor(t){this.response=t}async result(){return this.response.json()}};var w=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("v1/models",{...t,method:"GET"},e).then(s=>new Z(s))}},Z=class{constructor(t){this.response=t}async result(){return this.response.json()}};var A=require("zod"),P=class n{constructor(t){this._client=t}static SCHEMA=A.z.array(A.z.object({role:A.z.enum(["user","assistant"]),content:A.z.string().max(65536).nullable()})).min(1);async send({id:t,body:e,request:s={},...o}){return this._client.send("v1/models/"+encodeURIComponent(t)+"/response",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))},o).then(a=>new $(a))}},$=class{constructor(t){this.response=t}async result(){return this.response.json()}};var v=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=ht;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var _=class{constructor(t){this._client=t}async send({id:t,request:e={},...s}){return this._client.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new tt(o))}},tt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var E=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("v1/sources",{...t,method:"GET"},e).then(s=>new et(s))}},et=class{constructor(t){this.response=t}async result(){return this.response.json()}};var q=class n{static DEFAULT_BASE_URL=xt;options;constructor(t,{baseURL:e,...s}={}){this.options={requestFilterables:[new v,t],...s,baseURL:e?.toString()??n.getBaseURL()}}static getBaseURL(){return process.env.SUPPORT_BASE_URL??this.DEFAULT_BASE_URL}action={list:new c(this)};channel={list:new d(this)};contact={get:new l(this),list:new m(this)};conversation={get:new u(this),list:new g(this),update:new f(this),message:{list:new h(this)}};label={create:new C(this),get:new y(this),list:new x(this)};message={list:new O(this)};model={get:new S(this),list:new w(this),response:{create:new P(this)},correction:{create:new R(this)}};source={get:new _(this),list:new E(this)};async _filterRequest(t){for(let e of this.options.requestFilterables)t=await e.filter(t);return t}async send(t,e,{fetch:s=fetch}={}){return await s(new Request(new URL(t,this.options.baseURL),await this._filterRequest(e)))}};var nt=require("commander"),Ot=require("ora");function st({client:n,ora:t}){let e=new nt.Command("actions").description("Actions");return e.addCommand(new nt.Command("list").description("List actions").action(async()=>{let s=await(0,Ot.oraPromise)(()=>n.action.list.send(),{...t,text:"Finding actions"});console.log(await s.result())})),e}var ot=require("commander"),bt=require("ora");function it({client:n,ora:t}){let e=new ot.Command("channels").description("Channels");return e.addCommand(new ot.Command("list").description("List channels").action(async()=>{let s=await(0,bt.oraPromise)(()=>n.channel.list.send(),{...t,text:"Finding channels"});console.log(await s.result())})),e}var I=require("commander"),rt=require("ora");function at({client:n,ora:t}){let e=new I.Command("contacts").description("Contacts");return e.addCommand(new I.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async s=>{let o=await(0,rt.oraPromise)(()=>n.contact.get.send({id:s}),{...t,text:"Finding contact"});console.log(await o.result())})),e.addCommand(new I.Command("list").description("List contacts").action(async()=>{let s=await(0,rt.oraPromise)(()=>n.contact.list.send(),{...t,text:"Finding contacts"});console.log(await s.result())})),e}var T=require("commander"),pt=require("ora");function ct({client:n,ora:t}){let e=new T.Command("conversations").description("Conversations");return e.addCommand(new T.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async s=>{let o=await(0,pt.oraPromise)(()=>n.conversation.get.send({id:s}),{...t,text:"Finding conversation"});console.log(await o.result())})),e.addCommand(new T.Command("list").description("List conversations").action(async()=>{let s=await(0,pt.oraPromise)(()=>n.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await s.result())})),e}var L=require("commander"),dt=require("ora");function lt({client:n,ora:t}){let e=new L.Command("labels").description("Labels");return e.addCommand(new L.Command("get").description("Find label").argument("<label>","Label ID").action(async s=>{let o=await(0,dt.oraPromise)(()=>n.label.get.send({id:s}),{...t,text:"Finding label"});console.log(await o.result())})),e.addCommand(new L.Command("list").description("List labels").action(async()=>{let s=await(0,dt.oraPromise)(()=>n.label.list.send(),{...t,text:"Finding labels"});console.log(await s.result())})),e}var mt=require("commander"),Rt=require("ora");function ut({client:n,ora:t}){let e=new mt.Command("messages").description("Messages");return e.addCommand(new mt.Command("list").description("List messages").action(async()=>{let s=await(0,Rt.oraPromise)(()=>n.message.list.send(),{...t,text:"Finding messages"});console.log(await s.result())})),e}var U=require("commander"),gt=require("ora");function ft({client:n,ora:t}){let e=new U.Command("models").description("Models");return e.addCommand(new U.Command("get").description("Find model").argument("<model>","Model ID").action(async s=>{let o=await(0,gt.oraPromise)(()=>n.model.get.send({id:s}),{...t,text:"Finding model"});console.log(await o.result())})),e.addCommand(new U.Command("list").description("List models").action(async()=>{let s=await(0,gt.oraPromise)(()=>n.model.list.send(),{...t,text:"Finding models"});console.log(await s.result())})),e}var j=require("commander"),Ct=require("ora");function yt({client:n,ora:t}){let e=new j.Command("sources").description("Sources");return e.addCommand(new j.Command("get").description("Find source").argument("<source>","Source ID").action(async s=>{let o=await(0,Ct.oraPromise)(()=>n.source.get.send({id:s}),{...t,text:"Finding source"});console.log(await o.result())})),e.addCommand(new j.Command("list").description("List sources").action(async()=>{let s=await(0,Ct.oraPromise)(()=>n.source.list.send(),{...t,text:"Finding sources"});console.log(await s.result())})),e}var i={ora:{spinner:"simpleDotsScrolling"},client:new q(new p)},qt=new St.Command("gds").description("Great Detail Support System").addCommand(st(i)).addCommand(it(i)).addCommand(at(i)).addCommand(ct(i)).addCommand(lt(i)).addCommand(ut(i)).addCommand(ft(i)).addCommand(yt(i)),It=qt;
@@ -1,5 +1,5 @@
1
1
  import { Command } from 'commander';
2
- import { C as Client } from '../index-CNLZqmjo.cjs';
2
+ import { C as Client } from '../index-CAMI8mLN.cjs';
3
3
  import { Options as Options$1 } from 'ora';
4
4
  import 'zod';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { Command } from 'commander';
2
- import { C as Client } from '../index-CNLZqmjo.js';
2
+ import { C as Client } from '../index-CAMI8mLN.js';
3
3
  import { Options as Options$1 } from 'ora';
4
4
  import 'zod';
5
5
 
package/dist/cli/index.js CHANGED
@@ -1 +1 @@
1
- import{a}from"../chunk-ABALSK3N.js";import"../chunk-3N2R6UO2.js";export{a as default};
1
+ import{a}from"../chunk-565FNIKF.js";import"../chunk-K2S74QO7.js";export{a as default};
package/dist/cli.cjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var Rt=require("commander");var p=class{async filter(t){return t}};var c=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/actions",{...t,method:"GET"},e).then(n=>new D(n))}},D=class{constructor(t){this.response=t}async result(){return this.response.json()}};var d=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/channels",{...t,method:"GET"},e).then(n=>new F(n))}},F=class{constructor(t){this.response=t}async result(){return this.response.json()}};var xt="https://api.support.greatdetail.com",ht={"X-Powered-By":"GDSupport/JavaScript"};var l=class{constructor(t){this._client=t}async send({id:t,request:e={},...n}){return this._client.send("/v1/contacts/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new G(o))}},G=class{constructor(t){this.response=t}async result(){return this.response.json()}};var m=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/contacts",{...t,method:"GET"},e).then(n=>new M(n))}},M=class{constructor(t){this.response=t}async result(){return this.response.json()}};var u=class{constructor(t){this._client=t}async send({id:t,request:e={},...n}){return this._client.send("/v1/conversations/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new N(o))}},N=class{constructor(t){this.response=t}async result(){return this.response.json()}};var g=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/conversations",{...t,method:"GET"},e).then(n=>new H(n))}},H=class{constructor(t){this.response=t}async result(){return this.response.json()}};var z=require("zod"),f=class s{constructor(t){this._client=t}static SCHEMA=z.z.object({hasEnded:z.z.boolean()});async send({id:t,body:e,request:n={},...o}){return this._client.send("/v1/conversations/"+encodeURIComponent(t),{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(e))},o).then(a=>new K(a))}},K=class{constructor(t){this.response=t}async result(){return this.response.json()}};var r=require("zod"),y=class s{constructor(t){this._client=t}static SCHEMA=r.z.object({title:r.z.string(),description:r.z.optional(r.z.string()),account:r.z.string()});async send({body:t,request:e={},...n}){return this._client.send("/v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(t))},n).then(o=>new B(o))}},B=class{constructor(t){this.response=t}async result(){return this.response.json()}};var x=class{constructor(t){this._client=t}async send({id:t,request:e={},...n}){return this._client.send("/v1/labels/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new V(o))}},V=class{constructor(t){this.response=t}async result(){return this.response.json()}};var h=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/labels",{...t,method:"GET"},e).then(n=>new J(n))}},J=class{constructor(t){this.response=t}async result(){return this.response.json()}};var O=class{constructor(t){this._client=t}async send({id:t,request:e={},...n}){return this._client.send("/v1/conversations/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"},n).then(o=>new Y(o))}},Y=class{constructor(t){this.response=t}async result(){return this.response.json()}};var C=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/messages",{...t,method:"GET"},e).then(n=>new k(n))}},k=class{constructor(t){this.response=t}async result(){return this.response.json()}};var b=require("zod"),R=class s{constructor(t){this._client=t}static SCHEMA=b.z.object({input:b.z.string().max(65536),original:b.z.string().max(65536),correction:b.z.string().max(65536)});async send({id:t,body:e,request:n={},...o}){return this._client.send("/v1/models/"+encodeURIComponent(t)+"/correction",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(e))},o).then(a=>new W(a))}},W=class{constructor(t){this.response=t}async result(){return this.response.json()}};var w=class{constructor(t){this._client=t}async send({id:t,request:e={},...n}){return this._client.send("/v1/models/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new X(o))}},X=class{constructor(t){this.response=t}async result(){return this.response.json()}};var S=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/models",{...t,method:"GET"},e).then(n=>new Q(n))}},Q=class{constructor(t){this.response=t}async result(){return this.response.json()}};var A=require("zod"),P=class s{constructor(t){this._client=t}static SCHEMA=A.z.array(A.z.object({role:A.z.enum(["user","assistant"]),content:A.z.string().max(65536).nullable()})).min(1);async send({id:t,body:e,request:n={},...o}){return this._client.send("/v1/models/"+encodeURIComponent(t)+"/response",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(e))},o).then(a=>new Z(a))}},Z=class{constructor(t){this.response=t}async result(){return this.response.json()}};var _=class s{constructor(t=s.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=ht;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var E=class{constructor(t){this._client=t}async send({id:t,request:e={},...n}){return this._client.send("/v1/sources/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new $(o))}},$=class{constructor(t){this.response=t}async result(){return this.response.json()}};var v=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/sources",{...t,method:"GET"},e).then(n=>new tt(n))}},tt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var q=class s{static DEFAULT_BASE_URL=xt;options;constructor(t,e={}){this.options={requestFilterables:[new _,t],baseURL:process.env.SUPPORT_BASE_URL??s.DEFAULT_BASE_URL,...e}}action={list:new c(this)};channel={list:new d(this)};contact={get:new l(this),list:new m(this)};conversation={get:new u(this),list:new g(this),update:new f(this),message:{list:new O(this)}};label={create:new y(this),get:new x(this),list:new h(this)};message={list:new C(this)};model={get:new w(this),list:new S(this),response:{create:new P(this)},correction:{create:new R(this)}};source={get:new E(this),list:new v(this)};async _filterRequest(t){for(let e of this.options.requestFilterables)t=await e.filter(t);return t}async send(t,e,{fetch:n=fetch}={}){return await n(new Request(new URL(t,this.options.baseURL),await this._filterRequest(e)))}};var et=require("commander"),Ot=require("ora");function nt({client:s,ora:t}){let e=new et.Command("actions").description("Actions");return e.addCommand(new et.Command("list").description("List actions").action(async()=>{let n=await(0,Ot.oraPromise)(()=>s.action.list.send(),{...t,text:"Finding actions"});console.log(await n.result())})),e}var st=require("commander"),Ct=require("ora");function ot({client:s,ora:t}){let e=new st.Command("channels").description("Channels");return e.addCommand(new st.Command("list").description("List channels").action(async()=>{let n=await(0,Ct.oraPromise)(()=>s.channel.list.send(),{...t,text:"Finding channels"});console.log(await n.result())})),e}var I=require("commander"),it=require("ora");function rt({client:s,ora:t}){let e=new I.Command("contacts").description("Contacts");return e.addCommand(new I.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async n=>{let o=await(0,it.oraPromise)(()=>s.contact.get.send({id:n}),{...t,text:"Finding contact"});console.log(await o.result())})),e.addCommand(new I.Command("list").description("List contacts").action(async()=>{let n=await(0,it.oraPromise)(()=>s.contact.list.send(),{...t,text:"Finding contacts"});console.log(await n.result())})),e}var T=require("commander"),at=require("ora");function pt({client:s,ora:t}){let e=new T.Command("conversations").description("Conversations");return e.addCommand(new T.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let o=await(0,at.oraPromise)(()=>s.conversation.get.send({id:n}),{...t,text:"Finding conversation"});console.log(await o.result())})),e.addCommand(new T.Command("list").description("List conversations").action(async()=>{let n=await(0,at.oraPromise)(()=>s.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await n.result())})),e}var L=require("commander"),ct=require("ora");function dt({client:s,ora:t}){let e=new L.Command("labels").description("Labels");return e.addCommand(new L.Command("get").description("Find label").argument("<label>","Label ID").action(async n=>{let o=await(0,ct.oraPromise)(()=>s.label.get.send({id:n}),{...t,text:"Finding label"});console.log(await o.result())})),e.addCommand(new L.Command("list").description("List labels").action(async()=>{let n=await(0,ct.oraPromise)(()=>s.label.list.send(),{...t,text:"Finding labels"});console.log(await n.result())})),e}var lt=require("commander"),bt=require("ora");function mt({client:s,ora:t}){let e=new lt.Command("messages").description("Messages");return e.addCommand(new lt.Command("list").description("List messages").action(async()=>{let n=await(0,bt.oraPromise)(()=>s.message.list.send(),{...t,text:"Finding messages"});console.log(await n.result())})),e}var j=require("commander"),ut=require("ora");function gt({client:s,ora:t}){let e=new j.Command("models").description("Models");return e.addCommand(new j.Command("get").description("Find model").argument("<model>","Model ID").action(async n=>{let o=await(0,ut.oraPromise)(()=>s.model.get.send({id:n}),{...t,text:"Finding model"});console.log(await o.result())})),e.addCommand(new j.Command("list").description("List models").action(async()=>{let n=await(0,ut.oraPromise)(()=>s.model.list.send(),{...t,text:"Finding models"});console.log(await n.result())})),e}var U=require("commander"),ft=require("ora");function yt({client:s,ora:t}){let e=new U.Command("sources").description("Sources");return e.addCommand(new U.Command("get").description("Find source").argument("<source>","Source ID").action(async n=>{let o=await(0,ft.oraPromise)(()=>s.source.get.send({id:n}),{...t,text:"Finding source"});console.log(await o.result())})),e.addCommand(new U.Command("list").description("List sources").action(async()=>{let n=await(0,ft.oraPromise)(()=>s.source.list.send(),{...t,text:"Finding sources"});console.log(await n.result())})),e}var i={ora:{spinner:"simpleDotsScrolling"},client:new q(new p)},St=new Rt.Command("gds").description("Great Detail Support System").addCommand(nt(i)).addCommand(ot(i)).addCommand(rt(i)).addCommand(pt(i)).addCommand(dt(i)).addCommand(mt(i)).addCommand(gt(i)).addCommand(yt(i)),wt=St;wt.parseAsync(process.argv);
2
+ "use strict";var Rt=require("commander");var p=class{async filter(t){return t}};var c=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("v1/actions",{...t,method:"GET"},e).then(n=>new D(n))}},D=class{constructor(t){this.response=t}async result(){return this.response.json()}};var d=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("v1/channels",{...t,method:"GET"},e).then(n=>new F(n))}},F=class{constructor(t){this.response=t}async result(){return this.response.json()}};var yt="https://api.support.greatdetail.com",xt={"X-Powered-By":"GDSupport/JavaScript"};var l=class{constructor(t){this._client=t}async send({id:t,request:e={},...n}){return this._client.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new G(o))}},G=class{constructor(t){this.response=t}async result(){return this.response.json()}};var m=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("v1/contacts",{...t,method:"GET"},e).then(n=>new M(n))}},M=class{constructor(t){this.response=t}async result(){return this.response.json()}};var u=class{constructor(t){this._client=t}async send({id:t,request:e={},...n}){return this._client.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new N(o))}},N=class{constructor(t){this.response=t}async result(){return this.response.json()}};var g=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("v1/conversations",{...t,method:"GET"},e).then(n=>new H(n))}},H=class{constructor(t){this.response=t}async result(){return this.response.json()}};var z=require("zod"),f=class s{constructor(t){this._client=t}static SCHEMA=z.z.object({hasEnded:z.z.boolean()});async send({id:t,body:e,request:n={},...o}){return this._client.send("v1/conversations/"+encodeURIComponent(t),{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(e))},o).then(a=>new B(a))}},B=class{constructor(t){this.response=t}async result(){return this.response.json()}};var r=require("zod"),C=class s{constructor(t){this._client=t}static SCHEMA=r.z.object({title:r.z.string(),description:r.z.optional(r.z.string()),account:r.z.string()});async send({body:t,request:e={},...n}){return this._client.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(t))},n).then(o=>new K(o))}},K=class{constructor(t){this.response=t}async result(){return this.response.json()}};var y=class{constructor(t){this._client=t}async send({id:t,request:e={},...n}){return this._client.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new V(o))}},V=class{constructor(t){this.response=t}async result(){return this.response.json()}};var x=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("v1/labels",{...t,method:"GET"},e).then(n=>new J(n))}},J=class{constructor(t){this.response=t}async result(){return this.response.json()}};var h=class{constructor(t){this._client=t}async send({id:t,request:e={},...n}){return this._client.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"},n).then(o=>new Y(o))}},Y=class{constructor(t){this.response=t}async result(){return this.response.json()}};var O=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("v1/messages",{...t,method:"GET"},e).then(n=>new k(n))}},k=class{constructor(t){this.response=t}async result(){return this.response.json()}};var b=require("zod"),R=class s{constructor(t){this._client=t}static SCHEMA=b.z.object({input:b.z.string().max(65536),original:b.z.string().max(65536),correction:b.z.string().max(65536)});async send({id:t,body:e,request:n={},...o}){return this._client.send("v1/models/"+encodeURIComponent(t)+"/correction",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(e))},o).then(a=>new W(a))}},W=class{constructor(t){this.response=t}async result(){return this.response.json()}};var S=class{constructor(t){this._client=t}async send({id:t,request:e={},...n}){return this._client.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new X(o))}},X=class{constructor(t){this.response=t}async result(){return this.response.json()}};var w=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("v1/models",{...t,method:"GET"},e).then(n=>new Q(n))}},Q=class{constructor(t){this.response=t}async result(){return this.response.json()}};var A=require("zod"),P=class s{constructor(t){this._client=t}static SCHEMA=A.z.array(A.z.object({role:A.z.enum(["user","assistant"]),content:A.z.string().max(65536).nullable()})).min(1);async send({id:t,body:e,request:n={},...o}){return this._client.send("v1/models/"+encodeURIComponent(t)+"/response",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(e))},o).then(a=>new Z(a))}},Z=class{constructor(t){this.response=t}async result(){return this.response.json()}};var v=class s{constructor(t=s.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=xt;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var _=class{constructor(t){this._client=t}async send({id:t,request:e={},...n}){return this._client.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new $(o))}},$=class{constructor(t){this.response=t}async result(){return this.response.json()}};var E=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("v1/sources",{...t,method:"GET"},e).then(n=>new tt(n))}},tt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var q=class s{static DEFAULT_BASE_URL=yt;options;constructor(t,{baseURL:e,...n}={}){this.options={requestFilterables:[new v,t],...n,baseURL:e?.toString()??s.getBaseURL()}}static getBaseURL(){return process.env.SUPPORT_BASE_URL??this.DEFAULT_BASE_URL}action={list:new c(this)};channel={list:new d(this)};contact={get:new l(this),list:new m(this)};conversation={get:new u(this),list:new g(this),update:new f(this),message:{list:new h(this)}};label={create:new C(this),get:new y(this),list:new x(this)};message={list:new O(this)};model={get:new S(this),list:new w(this),response:{create:new P(this)},correction:{create:new R(this)}};source={get:new _(this),list:new E(this)};async _filterRequest(t){for(let e of this.options.requestFilterables)t=await e.filter(t);return t}async send(t,e,{fetch:n=fetch}={}){return await n(new Request(new URL(t,this.options.baseURL),await this._filterRequest(e)))}};var et=require("commander"),ht=require("ora");function nt({client:s,ora:t}){let e=new et.Command("actions").description("Actions");return e.addCommand(new et.Command("list").description("List actions").action(async()=>{let n=await(0,ht.oraPromise)(()=>s.action.list.send(),{...t,text:"Finding actions"});console.log(await n.result())})),e}var st=require("commander"),Ot=require("ora");function ot({client:s,ora:t}){let e=new st.Command("channels").description("Channels");return e.addCommand(new st.Command("list").description("List channels").action(async()=>{let n=await(0,Ot.oraPromise)(()=>s.channel.list.send(),{...t,text:"Finding channels"});console.log(await n.result())})),e}var I=require("commander"),it=require("ora");function rt({client:s,ora:t}){let e=new I.Command("contacts").description("Contacts");return e.addCommand(new I.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async n=>{let o=await(0,it.oraPromise)(()=>s.contact.get.send({id:n}),{...t,text:"Finding contact"});console.log(await o.result())})),e.addCommand(new I.Command("list").description("List contacts").action(async()=>{let n=await(0,it.oraPromise)(()=>s.contact.list.send(),{...t,text:"Finding contacts"});console.log(await n.result())})),e}var T=require("commander"),at=require("ora");function pt({client:s,ora:t}){let e=new T.Command("conversations").description("Conversations");return e.addCommand(new T.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let o=await(0,at.oraPromise)(()=>s.conversation.get.send({id:n}),{...t,text:"Finding conversation"});console.log(await o.result())})),e.addCommand(new T.Command("list").description("List conversations").action(async()=>{let n=await(0,at.oraPromise)(()=>s.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await n.result())})),e}var L=require("commander"),ct=require("ora");function dt({client:s,ora:t}){let e=new L.Command("labels").description("Labels");return e.addCommand(new L.Command("get").description("Find label").argument("<label>","Label ID").action(async n=>{let o=await(0,ct.oraPromise)(()=>s.label.get.send({id:n}),{...t,text:"Finding label"});console.log(await o.result())})),e.addCommand(new L.Command("list").description("List labels").action(async()=>{let n=await(0,ct.oraPromise)(()=>s.label.list.send(),{...t,text:"Finding labels"});console.log(await n.result())})),e}var lt=require("commander"),bt=require("ora");function mt({client:s,ora:t}){let e=new lt.Command("messages").description("Messages");return e.addCommand(new lt.Command("list").description("List messages").action(async()=>{let n=await(0,bt.oraPromise)(()=>s.message.list.send(),{...t,text:"Finding messages"});console.log(await n.result())})),e}var U=require("commander"),ut=require("ora");function gt({client:s,ora:t}){let e=new U.Command("models").description("Models");return e.addCommand(new U.Command("get").description("Find model").argument("<model>","Model ID").action(async n=>{let o=await(0,ut.oraPromise)(()=>s.model.get.send({id:n}),{...t,text:"Finding model"});console.log(await o.result())})),e.addCommand(new U.Command("list").description("List models").action(async()=>{let n=await(0,ut.oraPromise)(()=>s.model.list.send(),{...t,text:"Finding models"});console.log(await n.result())})),e}var j=require("commander"),ft=require("ora");function Ct({client:s,ora:t}){let e=new j.Command("sources").description("Sources");return e.addCommand(new j.Command("get").description("Find source").argument("<source>","Source ID").action(async n=>{let o=await(0,ft.oraPromise)(()=>s.source.get.send({id:n}),{...t,text:"Finding source"});console.log(await o.result())})),e.addCommand(new j.Command("list").description("List sources").action(async()=>{let n=await(0,ft.oraPromise)(()=>s.source.list.send(),{...t,text:"Finding sources"});console.log(await n.result())})),e}var i={ora:{spinner:"simpleDotsScrolling"},client:new q(new p)},wt=new Rt.Command("gds").description("Great Detail Support System").addCommand(nt(i)).addCommand(ot(i)).addCommand(rt(i)).addCommand(pt(i)).addCommand(dt(i)).addCommand(mt(i)).addCommand(gt(i)).addCommand(Ct(i)),St=wt;St.parseAsync(process.argv);
package/dist/cli.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{a as r}from"./chunk-ABALSK3N.js";import"./chunk-3N2R6UO2.js";r.parseAsync(process.argv);
2
+ import{a as r}from"./chunk-565FNIKF.js";import"./chunk-K2S74QO7.js";r.parseAsync(process.argv);
@@ -199,6 +199,7 @@ type GetConversationResponsePayload = {
199
199
  id: string;
200
200
  name?: string;
201
201
  hasEnded: boolean;
202
+ conversationStatus: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
202
203
  accountChannel: string;
203
204
  createdAt: string;
204
205
  updatedAt: string;
@@ -232,6 +233,7 @@ type ListConversationsResponsePayload = {
232
233
  id: string;
233
234
  name?: string;
234
235
  hasEnded: boolean;
236
+ conversationStatus: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
235
237
  accountChannel: string;
236
238
  createdAt: string;
237
239
  updatedAt: string;
@@ -274,6 +276,7 @@ type UpdateConversationResponsePayload = {
274
276
  id: string;
275
277
  name?: string;
276
278
  hasEnded: boolean;
279
+ conversationStatus: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
277
280
  accountChannel: string;
278
281
  createdAt: string;
279
282
  updatedAt: string;
@@ -711,7 +714,7 @@ interface ClientOptions {
711
714
  baseURL: string;
712
715
  }
713
716
  interface InputClientOptions {
714
- baseURL?: string;
717
+ baseURL?: string | URL;
715
718
  }
716
719
  interface SendOptions {
717
720
  /**
@@ -726,7 +729,8 @@ interface SendOptions {
726
729
  declare class Client {
727
730
  static DEFAULT_BASE_URL: string;
728
731
  options: ClientOptions;
729
- constructor(authentication: Authentication, options?: InputClientOptions);
732
+ constructor(authentication: Authentication, { baseURL, ...options }?: InputClientOptions);
733
+ static getBaseURL(): string;
730
734
  action: {
731
735
  list: ListActionsRequest;
732
736
  };
@@ -199,6 +199,7 @@ type GetConversationResponsePayload = {
199
199
  id: string;
200
200
  name?: string;
201
201
  hasEnded: boolean;
202
+ conversationStatus: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
202
203
  accountChannel: string;
203
204
  createdAt: string;
204
205
  updatedAt: string;
@@ -232,6 +233,7 @@ type ListConversationsResponsePayload = {
232
233
  id: string;
233
234
  name?: string;
234
235
  hasEnded: boolean;
236
+ conversationStatus: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
235
237
  accountChannel: string;
236
238
  createdAt: string;
237
239
  updatedAt: string;
@@ -274,6 +276,7 @@ type UpdateConversationResponsePayload = {
274
276
  id: string;
275
277
  name?: string;
276
278
  hasEnded: boolean;
279
+ conversationStatus: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
277
280
  accountChannel: string;
278
281
  createdAt: string;
279
282
  updatedAt: string;
@@ -711,7 +714,7 @@ interface ClientOptions {
711
714
  baseURL: string;
712
715
  }
713
716
  interface InputClientOptions {
714
- baseURL?: string;
717
+ baseURL?: string | URL;
715
718
  }
716
719
  interface SendOptions {
717
720
  /**
@@ -726,7 +729,8 @@ interface SendOptions {
726
729
  declare class Client {
727
730
  static DEFAULT_BASE_URL: string;
728
731
  options: ClientOptions;
729
- constructor(authentication: Authentication, options?: InputClientOptions);
732
+ constructor(authentication: Authentication, { baseURL, ...options }?: InputClientOptions);
733
+ static getBaseURL(): string;
730
734
  action: {
731
735
  list: ListActionsRequest;
732
736
  };
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var L=Object.defineProperty;var oe=Object.getOwnPropertyDescriptor;var re=Object.getOwnPropertyNames;var ie=Object.prototype.hasOwnProperty;var pe=(t,e)=>{for(var s in e)L(t,s,{get:e[s],enumerable:!0})},ae=(t,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of re(e))!ie.call(t,o)&&o!==s&&L(t,o,{get:()=>e[o],enumerable:!(n=oe(e,o))||n.enumerable});return t};var ce=t=>ae(L({},"__esModule",{value:!0}),t);var le={};pe(le,{Client:()=>i,DEFAULT_SUPPORT_BASE_URL:()=>v,KeyAuthentication:()=>a,PublicAuthentication:()=>l,TokenAuthentication:()=>c,default:()=>i});module.exports=ce(le);var v="https://api.support.greatdetail.com",Z={"X-Powered-By":"GDSupport/JavaScript"},ee="api-key",te="SUPPORT_ACCESS_TOKEN",se="SUPPORT_API_KEY",ne="SUPPORT_KEY_NAME";var a=class t{static DEFAULT_NAME=ee;name;#e;constructor({name:e=process.env[ne]??t.DEFAULT_NAME,key:s=process.env[se]}={}){if(!s)throw new Error("API Key option must be specified when using Key Authentication");this.name=e,this.#e=s}async filter(e){return{...e,headers:{...e.headers,Authorization:`Basic ${btoa(this.name+":"+this.#e)}`}}}};var c=class{#e;constructor({token:e=process.env[te]}={}){if(!e)throw new Error("Access Token option must be specified when using Token Authentication");this.#e=e}async filter(e){return{...e,headers:{...e.headers,Authorization:`Bearer ${this.#e}`}}}};var l=class{async filter(e){return e}};var d=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/actions",{...e,method:"GET"},s).then(n=>new U(n))}},U=class{constructor(e){this.response=e}async result(){return this.response.json()}};var u=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/channels",{...e,method:"GET"},s).then(n=>new N(n))}},N=class{constructor(e){this.response=e}async result(){return this.response.json()}};var m=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/contacts/"+encodeURIComponent(e),{...s,method:"GET"},n).then(o=>new D(o))}},D=class{constructor(e){this.response=e}async result(){return this.response.json()}};var g=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/contacts",{...e,method:"GET"},s).then(n=>new j(n))}},j=class{constructor(e){this.response=e}async result(){return this.response.json()}};var h=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/conversations/"+encodeURIComponent(e),{...s,method:"GET"},n).then(o=>new M(o))}},M=class{constructor(e){this.response=e}async result(){return this.response.json()}};var f=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/conversations",{...e,method:"GET"},s).then(n=>new G(n))}},G=class{constructor(e){this.response=e}async result(){return this.response.json()}};var H=require("zod"),y=class t{constructor(e){this._client=e}static SCHEMA=H.z.object({hasEnded:H.z.boolean()});async send({id:e,body:s,request:n={},...o}){return this._client.send("/v1/conversations/"+encodeURIComponent(e),{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(s))},o).then(p=>new F(p))}},F=class{constructor(e){this.response=e}async result(){return this.response.json()}};var r=require("zod"),R=class t{constructor(e){this._client=e}static SCHEMA=r.z.object({title:r.z.string(),description:r.z.optional(r.z.string()),account:r.z.string()});async send({body:e,request:s={},...n}){return this._client.send("/v1/labels",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(e))},n).then(o=>new K(o))}},K=class{constructor(e){this.response=e}async result(){return this.response.json()}};var b=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/labels/"+encodeURIComponent(e),{...s,method:"GET"},n).then(o=>new V(o))}},V=class{constructor(e){this.response=e}async result(){return this.response.json()}};var x=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/labels",{...e,method:"GET"},s).then(n=>new z(n))}},z=class{constructor(e){this.response=e}async result(){return this.response.json()}};var A=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/conversations/"+encodeURIComponent(e)+"/messages",{...s,method:"GET"},n).then(o=>new B(o))}},B=class{constructor(e){this.response=e}async result(){return this.response.json()}};var O=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/messages",{...e,method:"GET"},s).then(n=>new k(n))}},k=class{constructor(e){this.response=e}async result(){return this.response.json()}};var C=require("zod"),S=class t{constructor(e){this._client=e}static SCHEMA=C.z.object({input:C.z.string().max(65536),original:C.z.string().max(65536),correction:C.z.string().max(65536)});async send({id:e,body:s,request:n={},...o}){return this._client.send("/v1/models/"+encodeURIComponent(e)+"/correction",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(s))},o).then(p=>new Y(p))}},Y=class{constructor(e){this.response=e}async result(){return this.response.json()}};var P=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/models/"+encodeURIComponent(e),{...s,method:"GET"},n).then(o=>new J(o))}},J=class{constructor(e){this.response=e}async result(){return this.response.json()}};var E=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/models",{...e,method:"GET"},s).then(n=>new $(n))}},$=class{constructor(e){this.response=e}async result(){return this.response.json()}};var _=require("zod"),T=class t{constructor(e){this._client=e}static SCHEMA=_.z.array(_.z.object({role:_.z.enum(["user","assistant"]),content:_.z.string().max(65536).nullable()})).min(1);async send({id:e,body:s,request:n={},...o}){return this._client.send("/v1/models/"+encodeURIComponent(e)+"/response",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(s))},o).then(p=>new W(p))}},W=class{constructor(e){this.response=e}async result(){return this.response.json()}};var w=class t{constructor(e=t.STANDARD_HEADERS){this._standardHeaders=e}static STANDARD_HEADERS=Z;async filter(e){return{...e,headers:{...e.headers,...this._standardHeaders}}}};var q=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/sources/"+encodeURIComponent(e),{...s,method:"GET"},n).then(o=>new X(o))}},X=class{constructor(e){this.response=e}async result(){return this.response.json()}};var I=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/sources",{...e,method:"GET"},s).then(n=>new Q(n))}},Q=class{constructor(e){this.response=e}async result(){return this.response.json()}};var i=class t{static DEFAULT_BASE_URL=v;options;constructor(e,s={}){this.options={requestFilterables:[new w,e],baseURL:process.env.SUPPORT_BASE_URL??t.DEFAULT_BASE_URL,...s}}action={list:new d(this)};channel={list:new u(this)};contact={get:new m(this),list:new g(this)};conversation={get:new h(this),list:new f(this),update:new y(this),message:{list:new A(this)}};label={create:new R(this),get:new b(this),list:new x(this)};message={list:new O(this)};model={get:new P(this),list:new E(this),response:{create:new T(this)},correction:{create:new S(this)}};source={get:new q(this),list:new I(this)};async _filterRequest(e){for(let s of this.options.requestFilterables)e=await s.filter(e);return e}async send(e,s,{fetch:n=fetch}={}){return await n(new Request(new URL(e,this.options.baseURL),await this._filterRequest(s)))}};0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,KeyAuthentication,PublicAuthentication,TokenAuthentication});
1
+ "use strict";var L=Object.defineProperty;var ot=Object.getOwnPropertyDescriptor;var rt=Object.getOwnPropertyNames;var it=Object.prototype.hasOwnProperty;var at=(e,t)=>{for(var s in t)L(e,s,{get:t[s],enumerable:!0})},pt=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of rt(t))!it.call(e,o)&&o!==s&&L(e,o,{get:()=>t[o],enumerable:!(n=ot(t,o))||n.enumerable});return e};var ct=e=>pt(L({},"__esModule",{value:!0}),e);var lt={};at(lt,{Client:()=>i,DEFAULT_SUPPORT_BASE_URL:()=>I,KeyAuthentication:()=>p,PublicAuthentication:()=>l,TokenAuthentication:()=>c,default:()=>i});module.exports=ct(lt);var I="https://api.support.greatdetail.com",Z={"X-Powered-By":"GDSupport/JavaScript"},tt="api-key",et="SUPPORT_ACCESS_TOKEN",st="SUPPORT_API_KEY",nt="SUPPORT_KEY_NAME";var p=class e{static DEFAULT_NAME=tt;name;#t;constructor({name:t=process.env[nt]??e.DEFAULT_NAME,key:s=process.env[st]}={}){if(!s)throw new Error("API Key option must be specified when using Key Authentication");this.name=t,this.#t=s}async filter(t){return{...t,headers:{...t.headers,Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}}};var c=class{#t;constructor({token:t=process.env[et]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}async filter(t){return{...t,headers:{...t.headers,Authorization:`Bearer ${this.#t}`}}}};var l=class{async filter(t){return t}};var d=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("v1/actions",{...t,method:"GET"},s).then(n=>new U(n))}},U=class{constructor(t){this.response=t}async result(){return this.response.json()}};var u=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("v1/channels",{...t,method:"GET"},s).then(n=>new N(n))}},N=class{constructor(t){this.response=t}async result(){return this.response.json()}};var m=class{constructor(t){this._client=t}async send({id:t,request:s={},...n}){return this._client.send("v1/contacts/"+encodeURIComponent(t),{...s,method:"GET"},n).then(o=>new D(o))}},D=class{constructor(t){this.response=t}async result(){return this.response.json()}};var g=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("v1/contacts",{...t,method:"GET"},s).then(n=>new j(n))}},j=class{constructor(t){this.response=t}async result(){return this.response.json()}};var h=class{constructor(t){this._client=t}async send({id:t,request:s={},...n}){return this._client.send("v1/conversations/"+encodeURIComponent(t),{...s,method:"GET"},n).then(o=>new M(o))}},M=class{constructor(t){this.response=t}async result(){return this.response.json()}};var f=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("v1/conversations",{...t,method:"GET"},s).then(n=>new G(n))}},G=class{constructor(t){this.response=t}async result(){return this.response.json()}};var H=require("zod"),y=class e{constructor(t){this._client=t}static SCHEMA=H.z.object({hasEnded:H.z.boolean()});async send({id:t,body:s,request:n={},...o}){return this._client.send("v1/conversations/"+encodeURIComponent(t),{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))},o).then(a=>new F(a))}},F=class{constructor(t){this.response=t}async result(){return this.response.json()}};var r=require("zod"),R=class e{constructor(t){this._client=t}static SCHEMA=r.z.object({title:r.z.string(),description:r.z.optional(r.z.string()),account:r.z.string()});async send({body:t,request:s={},...n}){return this._client.send("v1/labels",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))},n).then(o=>new K(o))}},K=class{constructor(t){this.response=t}async result(){return this.response.json()}};var b=class{constructor(t){this._client=t}async send({id:t,request:s={},...n}){return this._client.send("v1/labels/"+encodeURIComponent(t),{...s,method:"GET"},n).then(o=>new V(o))}},V=class{constructor(t){this.response=t}async result(){return this.response.json()}};var x=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("v1/labels",{...t,method:"GET"},s).then(n=>new B(n))}},B=class{constructor(t){this.response=t}async result(){return this.response.json()}};var A=class{constructor(t){this._client=t}async send({id:t,request:s={},...n}){return this._client.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...s,method:"GET"},n).then(o=>new z(o))}},z=class{constructor(t){this.response=t}async result(){return this.response.json()}};var C=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("v1/messages",{...t,method:"GET"},s).then(n=>new k(n))}},k=class{constructor(t){this.response=t}async result(){return this.response.json()}};var S=require("zod"),O=class e{constructor(t){this._client=t}static SCHEMA=S.z.object({input:S.z.string().max(65536),original:S.z.string().max(65536),correction:S.z.string().max(65536)});async send({id:t,body:s,request:n={},...o}){return this._client.send("v1/models/"+encodeURIComponent(t)+"/correction",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))},o).then(a=>new Y(a))}},Y=class{constructor(t){this.response=t}async result(){return this.response.json()}};var P=class{constructor(t){this._client=t}async send({id:t,request:s={},...n}){return this._client.send("v1/models/"+encodeURIComponent(t),{...s,method:"GET"},n).then(o=>new J(o))}},J=class{constructor(t){this.response=t}async result(){return this.response.json()}};var E=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("v1/models",{...t,method:"GET"},s).then(n=>new $(n))}},$=class{constructor(t){this.response=t}async result(){return this.response.json()}};var _=require("zod"),v=class e{constructor(t){this._client=t}static SCHEMA=_.z.array(_.z.object({role:_.z.enum(["user","assistant"]),content:_.z.string().max(65536).nullable()})).min(1);async send({id:t,body:s,request:n={},...o}){return this._client.send("v1/models/"+encodeURIComponent(t)+"/response",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))},o).then(a=>new W(a))}},W=class{constructor(t){this.response=t}async result(){return this.response.json()}};var w=class e{constructor(t=e.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Z;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var T=class{constructor(t){this._client=t}async send({id:t,request:s={},...n}){return this._client.send("v1/sources/"+encodeURIComponent(t),{...s,method:"GET"},n).then(o=>new X(o))}},X=class{constructor(t){this.response=t}async result(){return this.response.json()}};var q=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("v1/sources",{...t,method:"GET"},s).then(n=>new Q(n))}},Q=class{constructor(t){this.response=t}async result(){return this.response.json()}};var i=class e{static DEFAULT_BASE_URL=I;options;constructor(t,{baseURL:s,...n}={}){this.options={requestFilterables:[new w,t],...n,baseURL:s?.toString()??e.getBaseURL()}}static getBaseURL(){return process.env.SUPPORT_BASE_URL??this.DEFAULT_BASE_URL}action={list:new d(this)};channel={list:new u(this)};contact={get:new m(this),list:new g(this)};conversation={get:new h(this),list:new f(this),update:new y(this),message:{list:new A(this)}};label={create:new R(this),get:new b(this),list:new x(this)};message={list:new C(this)};model={get:new P(this),list:new E(this),response:{create:new v(this)},correction:{create:new O(this)}};source={get:new T(this),list:new q(this)};async _filterRequest(t){for(let s of this.options.requestFilterables)t=await s.filter(t);return t}async send(t,s,{fetch:n=fetch}={}){return await n(new Request(new URL(t,this.options.baseURL),await this._filterRequest(s)))}};0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,KeyAuthentication,PublicAuthentication,TokenAuthentication});
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as Authentication } from './index-CNLZqmjo.cjs';
2
- export { C as Client, h as CreateCorrectionResponsePayload, d as CreateLabelResponsePayload, i as CreateResponseResponsePayload, G as GetConversationResponsePayload, L as ListActionsResponsePayload, a as ListChannelsResponsePayload, b as ListContactsResponsePayload, c as ListConversationsResponsePayload, e as ListLabelsResponsePayload, f as ListMessagesResponsePayload, g as ListModelsResponsePayload, j as ListSourcesResponsePayload, R as RequestFilterable, C as default } from './index-CNLZqmjo.cjs';
1
+ import { A as Authentication } from './index-CAMI8mLN.cjs';
2
+ export { C as Client, h as CreateCorrectionResponsePayload, d as CreateLabelResponsePayload, i as CreateResponseResponsePayload, G as GetConversationResponsePayload, L as ListActionsResponsePayload, a as ListChannelsResponsePayload, b as ListContactsResponsePayload, c as ListConversationsResponsePayload, e as ListLabelsResponsePayload, f as ListMessagesResponsePayload, g as ListModelsResponsePayload, j as ListSourcesResponsePayload, R as RequestFilterable, C as default } from './index-CAMI8mLN.cjs';
3
3
  import 'zod';
4
4
 
5
5
  /**
@@ -67,6 +67,10 @@ declare class TokenAuthentication implements Authentication {
67
67
 
68
68
  /**
69
69
  * Public Authentication Configuration.
70
+ * This type of authentication doesn't define any authentication for outgoing
71
+ * HTTP requests. This functionality may work well when using a proxying method
72
+ * to add credentials to a request after-the-fact.
73
+ *
70
74
  * Note: Not all APIs and endpoints will work with this authentication type.
71
75
  *
72
76
  * @since 1.0.l0
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as Authentication } from './index-CNLZqmjo.js';
2
- export { C as Client, h as CreateCorrectionResponsePayload, d as CreateLabelResponsePayload, i as CreateResponseResponsePayload, G as GetConversationResponsePayload, L as ListActionsResponsePayload, a as ListChannelsResponsePayload, b as ListContactsResponsePayload, c as ListConversationsResponsePayload, e as ListLabelsResponsePayload, f as ListMessagesResponsePayload, g as ListModelsResponsePayload, j as ListSourcesResponsePayload, R as RequestFilterable, C as default } from './index-CNLZqmjo.js';
1
+ import { A as Authentication } from './index-CAMI8mLN.js';
2
+ export { C as Client, h as CreateCorrectionResponsePayload, d as CreateLabelResponsePayload, i as CreateResponseResponsePayload, G as GetConversationResponsePayload, L as ListActionsResponsePayload, a as ListChannelsResponsePayload, b as ListContactsResponsePayload, c as ListConversationsResponsePayload, e as ListLabelsResponsePayload, f as ListMessagesResponsePayload, g as ListModelsResponsePayload, j as ListSourcesResponsePayload, R as RequestFilterable, C as default } from './index-CAMI8mLN.js';
3
3
  import 'zod';
4
4
 
5
5
  /**
@@ -67,6 +67,10 @@ declare class TokenAuthentication implements Authentication {
67
67
 
68
68
  /**
69
69
  * Public Authentication Configuration.
70
+ * This type of authentication doesn't define any authentication for outgoing
71
+ * HTTP requests. This functionality may work well when using a proxying method
72
+ * to add credentials to a request after-the-fact.
73
+ *
70
74
  * Note: Not all APIs and endpoints will work with this authentication type.
71
75
  *
72
76
  * @since 1.0.l0
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{a as l,b as i,c as n,d as a,e as p,f as m,g as f}from"./chunk-3N2R6UO2.js";var t=class s{static DEFAULT_NAME=i;name;#e;constructor({name:e=process.env[p]??s.DEFAULT_NAME,key:r=process.env[a]}={}){if(!r)throw new Error("API Key option must be specified when using Key Authentication");this.name=e,this.#e=r}async filter(e){return{...e,headers:{...e.headers,Authorization:`Basic ${btoa(this.name+":"+this.#e)}`}}}};var o=class{#e;constructor({token:e=process.env[n]}={}){if(!e)throw new Error("Access Token option must be specified when using Token Authentication");this.#e=e}async filter(e){return{...e,headers:{...e.headers,Authorization:`Bearer ${this.#e}`}}}};export{f as Client,l as DEFAULT_SUPPORT_BASE_URL,t as KeyAuthentication,m as PublicAuthentication,o as TokenAuthentication,f as default};
1
+ import{a as l,b as i,c as n,d as a,e as p,f as m,g as f}from"./chunk-K2S74QO7.js";var t=class s{static DEFAULT_NAME=i;name;#e;constructor({name:e=process.env[p]??s.DEFAULT_NAME,key:r=process.env[a]}={}){if(!r)throw new Error("API Key option must be specified when using Key Authentication");this.name=e,this.#e=r}async filter(e){return{...e,headers:{...e.headers,Authorization:`Basic ${btoa(this.name+":"+this.#e)}`}}}};var o=class{#e;constructor({token:e=process.env[n]}={}){if(!e)throw new Error("Access Token option must be specified when using Token Authentication");this.#e=e}async filter(e){return{...e,headers:{...e.headers,Authorization:`Bearer ${this.#e}`}}}};export{f as Client,l as DEFAULT_SUPPORT_BASE_URL,t as KeyAuthentication,m as PublicAuthentication,o as TokenAuthentication,f as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@great-detail/support-sdk",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "type": "module",
5
5
  "description": "JavaScript SDK for the Great Detail Support System",
6
6
  "author": "Great Detail Ltd <info@greatdetail.com>",
@@ -19,7 +19,7 @@ export default class ListActionsRequest {
19
19
  public async send({ request = {}, ...options }: Options = {}) {
20
20
  return this._client
21
21
  .send(
22
- "/v1/actions",
22
+ "v1/actions",
23
23
  {
24
24
  ...request,
25
25
  method: "GET",
@@ -11,6 +11,10 @@ import Authentication from "./index.js";
11
11
 
12
12
  /**
13
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
+ *
14
18
  * Note: Not all APIs and endpoints will work with this authentication type.
15
19
  *
16
20
  * @since 1.0.l0
@@ -19,7 +19,7 @@ export default class ListChannelsRequest {
19
19
  public async send({ request = {}, ...options }: Options = {}) {
20
20
  return this._client
21
21
  .send(
22
- "/v1/channels",
22
+ "v1/channels",
23
23
  {
24
24
  ...request,
25
25
  method: "GET",
@@ -36,7 +36,7 @@ export interface ClientOptions {
36
36
  }
37
37
 
38
38
  export interface InputClientOptions {
39
- baseURL?: string;
39
+ baseURL?: string | URL;
40
40
  }
41
41
 
42
42
  export interface SendOptions {
@@ -57,15 +57,19 @@ export default class Client {
57
57
 
58
58
  constructor(
59
59
  authentication: Authentication,
60
- options: InputClientOptions = {},
60
+ { baseURL, ...options }: InputClientOptions = {},
61
61
  ) {
62
62
  this.options = {
63
63
  requestFilterables: [new RequestStandardHeaders(), authentication],
64
- baseURL: process.env.SUPPORT_BASE_URL ?? Client.DEFAULT_BASE_URL,
65
64
  ...options,
65
+ baseURL: baseURL?.toString() ?? Client.getBaseURL(),
66
66
  };
67
67
  }
68
68
 
69
+ public static getBaseURL(): string {
70
+ return process.env.SUPPORT_BASE_URL ?? this.DEFAULT_BASE_URL;
71
+ }
72
+
69
73
  public action = {
70
74
  list: new ListActionsRequest(this),
71
75
  };
@@ -20,7 +20,7 @@ export default class GetContactRequest {
20
20
  public async send({ id, request = {}, ...options }: Options) {
21
21
  return this._client
22
22
  .send(
23
- "/v1/contacts/" + encodeURIComponent(id),
23
+ "v1/contacts/" + encodeURIComponent(id),
24
24
  {
25
25
  ...request,
26
26
  method: "GET",
@@ -19,7 +19,7 @@ export default class ListContactsRequest {
19
19
  public async send({ request = {}, ...options }: Options = {}) {
20
20
  return this._client
21
21
  .send(
22
- "/v1/contacts",
22
+ "v1/contacts",
23
23
  {
24
24
  ...request,
25
25
  method: "GET",
@@ -20,7 +20,7 @@ export default class GetConversationRequest {
20
20
  public async send({ id, request = {}, ...options }: Options) {
21
21
  return this._client
22
22
  .send(
23
- "/v1/conversations/" + encodeURIComponent(id),
23
+ "v1/conversations/" + encodeURIComponent(id),
24
24
  {
25
25
  ...request,
26
26
  method: "GET",
@@ -36,6 +36,11 @@ export type GetConversationResponsePayload = {
36
36
  id: string;
37
37
  name?: string;
38
38
  hasEnded: boolean;
39
+ conversationStatus:
40
+ | "AwaitingContactConversationStatus"
41
+ | "AwaitingAgentConversationStatus"
42
+ | "ResolvedConversationStatus"
43
+ | "ClosedConversationStatus";
39
44
  accountChannel: string;
40
45
  createdAt: string;
41
46
  updatedAt: string;
@@ -19,7 +19,7 @@ export default class ListConversationsRequest {
19
19
  public async send({ request = {}, ...options }: Options = {}) {
20
20
  return this._client
21
21
  .send(
22
- "/v1/conversations",
22
+ "v1/conversations",
23
23
  {
24
24
  ...request,
25
25
  method: "GET",
@@ -35,6 +35,11 @@ export type ListConversationsResponsePayload = {
35
35
  id: string;
36
36
  name?: string;
37
37
  hasEnded: boolean;
38
+ conversationStatus:
39
+ | "AwaitingContactConversationStatus"
40
+ | "AwaitingAgentConversationStatus"
41
+ | "ResolvedConversationStatus"
42
+ | "ClosedConversationStatus";
38
43
  accountChannel: string;
39
44
  createdAt: string;
40
45
  updatedAt: string;
@@ -26,7 +26,7 @@ export default class UpdateConversationRequest {
26
26
  public async send({ id, body, request = {}, ...options }: Options) {
27
27
  return this._client
28
28
  .send(
29
- "/v1/conversations/" + encodeURIComponent(id),
29
+ "v1/conversations/" + encodeURIComponent(id),
30
30
  {
31
31
  ...request,
32
32
  method: "POST",
@@ -47,6 +47,11 @@ export type UpdateConversationResponsePayload = {
47
47
  id: string;
48
48
  name?: string;
49
49
  hasEnded: boolean;
50
+ conversationStatus:
51
+ | "AwaitingContactConversationStatus"
52
+ | "AwaitingAgentConversationStatus"
53
+ | "ResolvedConversationStatus"
54
+ | "ClosedConversationStatus";
50
55
  accountChannel: string;
51
56
  createdAt: string;
52
57
  updatedAt: string;
@@ -27,7 +27,7 @@ export default class CreateLabelRequest {
27
27
  public async send({ body, request = {}, ...options }: Options) {
28
28
  return this._client
29
29
  .send(
30
- "/v1/labels",
30
+ "v1/labels",
31
31
  {
32
32
  ...request,
33
33
  method: "POST",
@@ -20,7 +20,7 @@ export default class GetLabelRequest {
20
20
  public async send({ id, request = {}, ...options }: Options) {
21
21
  return this._client
22
22
  .send(
23
- "/v1/labels/" + encodeURIComponent(id),
23
+ "v1/labels/" + encodeURIComponent(id),
24
24
  {
25
25
  ...request,
26
26
  method: "GET",
@@ -19,7 +19,7 @@ export default class ListLabelsRequest {
19
19
  public async send({ request = {}, ...options }: Options = {}) {
20
20
  return this._client
21
21
  .send(
22
- "/v1/labels",
22
+ "v1/labels",
23
23
  {
24
24
  ...request,
25
25
  method: "GET",
@@ -20,7 +20,7 @@ export default class ListConversationMessages {
20
20
  public async send({ id, request = {}, ...options }: Options) {
21
21
  return this._client
22
22
  .send(
23
- "/v1/conversations/" + encodeURIComponent(id) + "/messages",
23
+ "v1/conversations/" + encodeURIComponent(id) + "/messages",
24
24
  {
25
25
  ...request,
26
26
  method: "GET",
@@ -19,7 +19,7 @@ export default class ListMessagesRequest {
19
19
  public async send({ request = {}, ...options }: Options = {}) {
20
20
  return this._client
21
21
  .send(
22
- "/v1/messages",
22
+ "v1/messages",
23
23
  {
24
24
  ...request,
25
25
  method: "GET",
@@ -28,7 +28,7 @@ export default class CreateCorrectionModelRequest {
28
28
  public async send({ id, body, request = {}, ...options }: Options) {
29
29
  return this._client
30
30
  .send(
31
- "/v1/models/" + encodeURIComponent(id) + "/correction",
31
+ "v1/models/" + encodeURIComponent(id) + "/correction",
32
32
  {
33
33
  ...request,
34
34
  method: "POST",
@@ -20,7 +20,7 @@ export default class GetModelRequest {
20
20
  public async send({ id, request = {}, ...options }: Options) {
21
21
  return this._client
22
22
  .send(
23
- "/v1/models/" + encodeURIComponent(id),
23
+ "v1/models/" + encodeURIComponent(id),
24
24
  {
25
25
  ...request,
26
26
  method: "GET",
@@ -19,7 +19,7 @@ export default class ListModelsRequest {
19
19
  public async send({ request = {}, ...options }: Options = {}) {
20
20
  return this._client
21
21
  .send(
22
- "/v1/models",
22
+ "v1/models",
23
23
  {
24
24
  ...request,
25
25
  method: "GET",
@@ -31,7 +31,7 @@ export default class CreateResponseModelRequest {
31
31
  public async send({ id, body, request = {}, ...options }: Options) {
32
32
  return this._client
33
33
  .send(
34
- "/v1/models/" + encodeURIComponent(id) + "/response",
34
+ "v1/models/" + encodeURIComponent(id) + "/response",
35
35
  {
36
36
  ...request,
37
37
  method: "POST",
@@ -20,7 +20,7 @@ export default class GetSourceRequest {
20
20
  public async send({ id, request = {}, ...options }: Options) {
21
21
  return this._client
22
22
  .send(
23
- "/v1/sources/" + encodeURIComponent(id),
23
+ "v1/sources/" + encodeURIComponent(id),
24
24
  {
25
25
  ...request,
26
26
  method: "GET",
@@ -19,7 +19,7 @@ export default class ListSourcesRequest {
19
19
  public async send({ request = {}, ...options }: Options = {}) {
20
20
  return this._client
21
21
  .send(
22
- "/v1/sources",
22
+ "v1/sources",
23
23
  {
24
24
  ...request,
25
25
  method: "GET",
@@ -1 +0,0 @@
1
- var k="https://api.support.greatdetail.com",W={"X-Powered-By":"GDSupport/JavaScript"},Q="api-key",Z="SUPPORT_ACCESS_TOKEN",$="SUPPORT_API_KEY",ee="SUPPORT_KEY_NAME";var w=class{async filter(e){return e}};var o=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/actions",{...e,method:"GET"},s).then(n=>new q(n))}},q=class{constructor(e){this.response=e}async result(){return this.response.json()}};var p=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/channels",{...e,method:"GET"},s).then(n=>new T(n))}},T=class{constructor(e){this.response=e}async result(){return this.response.json()}};var c=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/contacts",{...e,method:"GET"},s).then(n=>new I(n))}},I=class{constructor(e){this.response=e}async result(){return this.response.json()}};var a=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/conversations/"+encodeURIComponent(e),{...s,method:"GET"},n).then(r=>new v(r))}},v=class{constructor(e){this.response=e}async result(){return this.response.json()}};var l=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/conversations",{...e,method:"GET"},s).then(n=>new U(n))}},U=class{constructor(e){this.response=e}async result(){return this.response.json()}};import{z as d}from"zod";var u=class t{constructor(e){this._client=e}static SCHEMA=d.object({title:d.string(),description:d.optional(d.string()),account:d.string()});async send({body:e,request:s={},...n}){return this._client.send("/v1/labels",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(e))},n).then(r=>new L(r))}},L=class{constructor(e){this.response=e}async result(){return this.response.json()}};var m=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/labels",{...e,method:"GET"},s).then(n=>new j(n))}},j=class{constructor(e){this.response=e}async result(){return this.response.json()}};var g=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/messages",{...e,method:"GET"},s).then(n=>new D(n))}},D=class{constructor(e){this.response=e}async result(){return this.response.json()}};import{z as _}from"zod";var h=class t{constructor(e){this._client=e}static SCHEMA=_.object({input:_.string().max(65536),original:_.string().max(65536),correction:_.string().max(65536)});async send({id:e,body:s,request:n={},...r}){return this._client.send("/v1/models/"+encodeURIComponent(e)+"/correction",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(s))},r).then(i=>new G(i))}},G=class{constructor(e){this.response=e}async result(){return this.response.json()}};var y=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/models",{...e,method:"GET"},s).then(n=>new N(n))}},N=class{constructor(e){this.response=e}async result(){return this.response.json()}};import{z as E}from"zod";var b=class t{constructor(e){this._client=e}static SCHEMA=E.array(E.object({role:E.enum(["user","assistant"]),content:E.string().max(65536).nullable()})).min(1);async send({id:e,body:s,request:n={},...r}){return this._client.send("/v1/models/"+encodeURIComponent(e)+"/response",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(s))},r).then(i=>new H(i))}},H=class{constructor(e){this.response=e}async result(){return this.response.json()}};var f=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/sources",{...e,method:"GET"},s).then(n=>new M(n))}},M=class{constructor(e){this.response=e}async result(){return this.response.json()}};var R=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/contacts/"+encodeURIComponent(e),{...s,method:"GET"},n).then(r=>new F(r))}},F=class{constructor(e){this.response=e}async result(){return this.response.json()}};import{z as X}from"zod";var x=class t{constructor(e){this._client=e}static SCHEMA=X.object({hasEnded:X.boolean()});async send({id:e,body:s,request:n={},...r}){return this._client.send("/v1/conversations/"+encodeURIComponent(e),{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(s))},r).then(i=>new z(i))}},z=class{constructor(e){this.response=e}async result(){return this.response.json()}};var O=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/labels/"+encodeURIComponent(e),{...s,method:"GET"},n).then(r=>new K(r))}},K=class{constructor(e){this.response=e}async result(){return this.response.json()}};var S=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/conversations/"+encodeURIComponent(e)+"/messages",{...s,method:"GET"},n).then(r=>new B(r))}},B=class{constructor(e){this.response=e}async result(){return this.response.json()}};var C=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/models/"+encodeURIComponent(e),{...s,method:"GET"},n).then(r=>new V(r))}},V=class{constructor(e){this.response=e}async result(){return this.response.json()}};var A=class t{constructor(e=t.STANDARD_HEADERS){this._standardHeaders=e}static STANDARD_HEADERS=W;async filter(e){return{...e,headers:{...e.headers,...this._standardHeaders}}}};var P=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/sources/"+encodeURIComponent(e),{...s,method:"GET"},n).then(r=>new J(r))}},J=class{constructor(e){this.response=e}async result(){return this.response.json()}};var Y=class t{static DEFAULT_BASE_URL=k;options;constructor(e,s={}){this.options={requestFilterables:[new A,e],baseURL:process.env.SUPPORT_BASE_URL??t.DEFAULT_BASE_URL,...s}}action={list:new o(this)};channel={list:new p(this)};contact={get:new R(this),list:new c(this)};conversation={get:new a(this),list:new l(this),update:new x(this),message:{list:new S(this)}};label={create:new u(this),get:new O(this),list:new m(this)};message={list:new g(this)};model={get:new C(this),list:new y(this),response:{create:new b(this)},correction:{create:new h(this)}};source={get:new P(this),list:new f(this)};async _filterRequest(e){for(let s of this.options.requestFilterables)e=await s.filter(e);return e}async send(e,s,{fetch:n=fetch}={}){return await n(new Request(new URL(e,this.options.baseURL),await this._filterRequest(s)))}};export{k as a,Q as b,Z as c,$ as d,ee as e,w as f,Y as g};