@great-detail/support-sdk 0.0.9 → 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-5SRPGK6C.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-DtLhj7uf.d.cts → index-CAMI8mLN.d.cts} +3 -2
  10. package/dist/{index-DtLhj7uf.d.ts → index-CAMI8mLN.d.ts} +3 -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 +1 -1
  23. package/src/Conversation/ListConversations.ts +1 -1
  24. package/src/Conversation/UpdateConversation.ts +1 -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-XBTUUC2M.js +0 -1
@@ -1 +1 @@
1
- import{f as x,g as y}from"./chunk-XBTUUC2M.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 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 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"),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,e={}){this.options={requestFilterables:[new v,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 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 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"),Ct=require("ora");function yt({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,Ct.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,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
+ "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-DtLhj7uf.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-DtLhj7uf.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-5SRPGK6C.js";import"../chunk-XBTUUC2M.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 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 K(a))}},K=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 B(o))}},B=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,e={}){this.options={requestFilterables:[new v,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 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 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 Ct({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)},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);
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-5SRPGK6C.js";import"./chunk-XBTUUC2M.js";r.parseAsync(process.argv);
2
+ import{a as r}from"./chunk-565FNIKF.js";import"./chunk-K2S74QO7.js";r.parseAsync(process.argv);
@@ -714,7 +714,7 @@ interface ClientOptions {
714
714
  baseURL: string;
715
715
  }
716
716
  interface InputClientOptions {
717
- baseURL?: string;
717
+ baseURL?: string | URL;
718
718
  }
719
719
  interface SendOptions {
720
720
  /**
@@ -729,7 +729,8 @@ interface SendOptions {
729
729
  declare class Client {
730
730
  static DEFAULT_BASE_URL: string;
731
731
  options: ClientOptions;
732
- constructor(authentication: Authentication, options?: InputClientOptions);
732
+ constructor(authentication: Authentication, { baseURL, ...options }?: InputClientOptions);
733
+ static getBaseURL(): string;
733
734
  action: {
734
735
  list: ListActionsRequest;
735
736
  };
@@ -714,7 +714,7 @@ interface ClientOptions {
714
714
  baseURL: string;
715
715
  }
716
716
  interface InputClientOptions {
717
- baseURL?: string;
717
+ baseURL?: string | URL;
718
718
  }
719
719
  interface SendOptions {
720
720
  /**
@@ -729,7 +729,8 @@ interface SendOptions {
729
729
  declare class Client {
730
730
  static DEFAULT_BASE_URL: string;
731
731
  options: ClientOptions;
732
- constructor(authentication: Authentication, options?: InputClientOptions);
732
+ constructor(authentication: Authentication, { baseURL, ...options }?: InputClientOptions);
733
+ static getBaseURL(): string;
733
734
  action: {
734
735
  list: ListActionsRequest;
735
736
  };
package/dist/index.cjs CHANGED
@@ -1 +1 @@
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 z(n))}},z=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 B(o))}},B=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,s={}){this.options={requestFilterables:[new w,t],baseURL:process.env.SUPPORT_BASE_URL??e.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 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});
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-DtLhj7uf.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-DtLhj7uf.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-DtLhj7uf.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-DtLhj7uf.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-XBTUUC2M.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.9",
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",
@@ -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",
@@ -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",
@@ -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",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(o=>new I(o))}},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(o=>new L(o))}},L=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/labels",{...t,method:"GET"},s).then(n=>new j(n))}},j=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/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={},...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(r=>new G(r))}},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={},...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(r=>new H(r))}},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(o=>new F(o))}},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={},...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(r=>new z(r))}},z=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/labels/"+encodeURIComponent(t),{...s,method:"GET"},n).then(o=>new K(o))}},K=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/conversations/"+encodeURIComponent(t)+"/messages",{...s,method:"GET"},n).then(o=>new B(o))}},B=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(o=>new V(o))}},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(o=>new J(o))}},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,s={}){this.options={requestFilterables:[new A,t],baseURL:process.env.SUPPORT_BASE_URL??e.DEFAULT_BASE_URL,...s}}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 S(this)}};label={create:new u(this),get:new C(this),list:new m(this)};message={list:new g(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};