@great-detail/support-sdk 0.0.6 → 0.0.8

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.
@@ -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",ee="SUPPORT_KEY_NAME";var w=class{async filter(e){return e}};var o=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/actions",{...e,method:"GET"},s).then(n=>new q(n))}},q=class{constructor(e){this.response=e}async result(){return this.response.json()}};var p=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/channels",{...e,method:"GET"},s).then(n=>new T(n))}},T=class{constructor(e){this.response=e}async result(){return this.response.json()}};var c=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/contacts",{...e,method:"GET"},s).then(n=>new I(n))}},I=class{constructor(e){this.response=e}async result(){return this.response.json()}};var a=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/conversations/"+encodeURIComponent(e),{...s,method:"GET"},n).then(r=>new v(r))}},v=class{constructor(e){this.response=e}async result(){return this.response.json()}};var l=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/conversations",{...e,method:"GET"},s).then(n=>new U(n))}},U=class{constructor(e){this.response=e}async result(){return this.response.json()}};import{z as d}from"zod";var u=class t{constructor(e){this._client=e}static SCHEMA=d.object({title:d.string(),description:d.optional(d.string()),account:d.string()});async send({body:e,request:s={},...n}){return this._client.send("/v1/labels",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(e))},n).then(r=>new L(r))}},L=class{constructor(e){this.response=e}async result(){return this.response.json()}};var m=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/labels",{...e,method:"GET"},s).then(n=>new j(n))}},j=class{constructor(e){this.response=e}async result(){return this.response.json()}};var g=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/messages",{...e,method:"GET"},s).then(n=>new D(n))}},D=class{constructor(e){this.response=e}async result(){return this.response.json()}};import{z as _}from"zod";var h=class t{constructor(e){this._client=e}static SCHEMA=_.object({input:_.string().max(65536),original:_.string().max(65536),correction:_.string().max(65536)});async send({id:e,body:s,request:n={},...r}){return this._client.send("/v1/models/"+encodeURIComponent(e)+"/correction",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(s))},r).then(i=>new G(i))}},G=class{constructor(e){this.response=e}async result(){return this.response.json()}};var y=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/models",{...e,method:"GET"},s).then(n=>new N(n))}},N=class{constructor(e){this.response=e}async result(){return this.response.json()}};import{z as E}from"zod";var b=class t{constructor(e){this._client=e}static SCHEMA=E.array(E.object({role:E.enum(["user","assistant"]),content:E.string().max(65536).nullable()})).min(1);async send({id:e,body:s,request:n={},...r}){return this._client.send("/v1/models/"+encodeURIComponent(e)+"/response",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(s))},r).then(i=>new H(i))}},H=class{constructor(e){this.response=e}async result(){return this.response.json()}};var f=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/sources",{...e,method:"GET"},s).then(n=>new M(n))}},M=class{constructor(e){this.response=e}async result(){return this.response.json()}};var R=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/contacts/"+encodeURIComponent(e),{...s,method:"GET"},n).then(r=>new F(r))}},F=class{constructor(e){this.response=e}async result(){return this.response.json()}};import{z as X}from"zod";var x=class t{constructor(e){this._client=e}static SCHEMA=X.object({hasEnded:X.boolean()});async send({id:e,body:s,request:n={},...r}){return this._client.send("/v1/conversations/"+encodeURIComponent(e),{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(s))},r).then(i=>new z(i))}},z=class{constructor(e){this.response=e}async result(){return this.response.json()}};var O=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/labels/"+encodeURIComponent(e),{...s,method:"GET"},n).then(r=>new K(r))}},K=class{constructor(e){this.response=e}async result(){return this.response.json()}};var S=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/conversations/"+encodeURIComponent(e)+"/messages",{...s,method:"GET"},n).then(r=>new B(r))}},B=class{constructor(e){this.response=e}async result(){return this.response.json()}};var C=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/models/"+encodeURIComponent(e),{...s,method:"GET"},n).then(r=>new V(r))}},V=class{constructor(e){this.response=e}async result(){return this.response.json()}};var A=class t{constructor(e=t.STANDARD_HEADERS){this._standardHeaders=e}static STANDARD_HEADERS=W;async filter(e){return{...e,headers:{...e.headers,...this._standardHeaders}}}};var P=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/sources/"+encodeURIComponent(e),{...s,method:"GET"},n).then(r=>new J(r))}},J=class{constructor(e){this.response=e}async result(){return this.response.json()}};var Y=class t{static DEFAULT_BASE_URL=k;options;constructor(e,s={}){this.options={requestFilterables:[new A,e],baseURL:process.env.SUPPORT_BASE_URL??t.DEFAULT_BASE_URL,...s}}action={list:new o(this)};channel={list:new p(this)};contact={get:new R(this),list:new c(this)};conversation={get:new a(this),list:new l(this),update:new x(this),message:{list:new S(this)}};label={create:new u(this),get:new O(this),list:new m(this)};message={list:new g(this)};model={get:new C(this),list:new y(this),response:{create:new b(this)},correction:{create:new h(this)}};source={get:new P(this),list:new f(this)};async _filterRequest(e){for(let s of this.options.requestFilterables)e=await s.filter(e);return e}async send(e,s,{fetch:n=fetch}={}){return await n(new Request(new URL(e,this.options.baseURL),await this._filterRequest(s)))}};export{k as a,Q as b,Z as c,$ as d,ee as e,w as f,Y as g};
@@ -1 +1 @@
1
- import{f as O,g as y}from"./chunk-OVSCTY74.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 r({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 m}from"commander";import{oraPromise as v}from"ora";function d({client:n,ora:s}){let o=new m("contacts").description("Contacts");return o.addCommand(new m("get").description("Find contact").argument("<contact>","Contact ID").action(async t=>{let e=await v(()=>n.contact.get.send({id:t}),{...s,text:"Finding contact"});console.log(await e.result())})),o.addCommand(new m("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 e=await L(()=>n.conversation.get.send({id:t}),{...s,text:"Finding conversation"});console.log(await e.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 e=await P(()=>n.label.get.send({id:t}),{...s,text:"Finding label"});console.log(await e.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 e=await j(()=>n.model.get.send({id:t}),{...s,text:"Finding model"});console.log(await e.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 x({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 e=await D(()=>n.source.get.send({id:t}),{...s,text:"Finding source"});console.log(await e.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 i={ora:{spinner:"simpleDotsScrolling"},client:new y(new O)},G=new A("gds").description("Great Detail Support System").addCommand(a(i)).addCommand(r(i)).addCommand(d(i)).addCommand(p(i)).addCommand(u(i)).addCommand(f(i)).addCommand(g(i)).addCommand(x(i)),go=G;export{go as a};
1
+ import{f as x,g as y}from"./chunk-3N2R6UO2.js";import{Command as A}from"commander";import{Command as F}from"commander";import{oraPromise as I}from"ora";function a({client:n,ora:s}){let o=new F("actions").description("Actions");return o.addCommand(new F("list").description("List actions").action(async()=>{let t=await I(()=>n.action.list.send(),{...s,text:"Finding actions"});console.log(await t.result())})),o}import{Command as b}from"commander";import{oraPromise as S}from"ora";function m({client:n,ora:s}){let o=new b("channels").description("Channels");return o.addCommand(new b("list").description("List channels").action(async()=>{let t=await S(()=>n.channel.list.send(),{...s,text:"Finding channels"});console.log(await t.result())})),o}import{Command as r}from"commander";import{oraPromise as v}from"ora";function d({client:n,ora:s}){let o=new r("contacts").description("Contacts");return o.addCommand(new r("get").description("Find contact").argument("<contact>","Contact ID").action(async t=>{let i=await v(()=>n.contact.get.send({id:t}),{...s,text:"Finding contact"});console.log(await i.result())})),o.addCommand(new r("list").description("List contacts").action(async()=>{let t=await v(()=>n.contact.list.send(),{...s,text:"Finding contacts"});console.log(await t.result())})),o}import{Command as c}from"commander";import{oraPromise as L}from"ora";function p({client:n,ora:s}){let o=new c("conversations").description("Conversations");return o.addCommand(new c("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async t=>{let i=await L(()=>n.conversation.get.send({id:t}),{...s,text:"Finding conversation"});console.log(await i.result())})),o.addCommand(new c("list").description("List conversations").action(async()=>{let t=await L(()=>n.conversation.list.send(),{...s,text:"Finding conversations"});console.log(await t.result())})),o}import{Command as l}from"commander";import{oraPromise as P}from"ora";function u({client:n,ora:s}){let o=new l("labels").description("Labels");return o.addCommand(new l("get").description("Find label").argument("<label>","Label ID").action(async t=>{let i=await P(()=>n.label.get.send({id:t}),{...s,text:"Finding label"});console.log(await i.result())})),o.addCommand(new l("list").description("List labels").action(async()=>{let t=await P(()=>n.label.list.send(),{...s,text:"Finding labels"});console.log(await t.result())})),o}import{Command as h}from"commander";import{oraPromise as M}from"ora";function f({client:n,ora:s}){let o=new h("messages").description("Messages");return o.addCommand(new h("list").description("List messages").action(async()=>{let t=await M(()=>n.message.list.send(),{...s,text:"Finding messages"});console.log(await t.result())})),o}import{Command as C}from"commander";import{oraPromise as j}from"ora";function g({client:n,ora:s}){let o=new C("models").description("Models");return o.addCommand(new C("get").description("Find model").argument("<model>","Model ID").action(async t=>{let i=await j(()=>n.model.get.send({id:t}),{...s,text:"Finding model"});console.log(await i.result())})),o.addCommand(new C("list").description("List models").action(async()=>{let t=await j(()=>n.model.list.send(),{...s,text:"Finding models"});console.log(await t.result())})),o}import{Command as w}from"commander";import{oraPromise as D}from"ora";function O({client:n,ora:s}){let o=new w("sources").description("Sources");return o.addCommand(new w("get").description("Find source").argument("<source>","Source ID").action(async t=>{let i=await D(()=>n.source.get.send({id:t}),{...s,text:"Finding source"});console.log(await i.result())})),o.addCommand(new w("list").description("List sources").action(async()=>{let t=await D(()=>n.source.list.send(),{...s,text:"Finding sources"});console.log(await t.result())})),o}var e={ora:{spinner:"simpleDotsScrolling"},client:new y(new x)},G=new A("gds").description("Great Detail Support System").addCommand(a(e)).addCommand(m(e)).addCommand(d(e)).addCommand(p(e)).addCommand(u(e)).addCommand(f(e)).addCommand(g(e)).addCommand(O(e)),go=G;export{go as a};
@@ -1 +1 @@
1
- "use strict";var j=Object.defineProperty;var ht=Object.getOwnPropertyDescriptor;var Ct=Object.getOwnPropertyNames;var bt=Object.prototype.hasOwnProperty;var Rt=(n,t)=>{for(var e in t)j(n,e,{get:t[e],enumerable:!0})},wt=(n,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ct(t))!bt.call(n,o)&&o!==e&&j(n,o,{get:()=>t[o],enumerable:!(s=ht(t,o))||s.enumerable});return n};var St=n=>wt(j({},"__esModule",{value:!0}),n);var _t={};Rt(_t,{default:()=>At});module.exports=St(_t);var yt=require("commander");var a=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 D(s))}},D=class{constructor(t){this.response=t}async result(){return this.response.json()}};var p=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/channels",{...t,method:"GET"},e).then(s=>new U(s))}},U=class{constructor(t){this.response=t}async result(){return this.response.json()}};var ut="https://api.support.greatdetail.com",gt={"X-Powered-By":"GDSupport/JavaScript"};var d=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 F(o))}},F=class{constructor(t){this.response=t}async result(){return this.response.json()}};var l=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/contacts",{...t,method:"GET"},e).then(s=>new G(s))}},G=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:e={},...s}){return this._client.send("/v1/conversations/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new N(o))}},N=class{constructor(t){this.response=t}async result(){return this.response.json()}};var u=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/conversations",{...t,method:"GET"},e).then(s=>new M(s))}},M=class{constructor(t){this.response=t}async result(){return this.response.json()}};var r=require("zod"),g=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 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({id:t,request:e={},...s}){return this._client.send("/v1/labels/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new K(o))}},K=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 z(s))}},z=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 B(s))}},B=class{constructor(t){this.response=t}async result(){return this.response.json()}};var y=require("zod"),h=class n{constructor(t){this._client=t}static SCHEMA=y.z.object({input:y.z.string().max(65536),original:y.z.string().max(65536),correction:y.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(L=>new V(L))}},V=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:e={},...s}){return this._client.send("/v1/models/"+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 b=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/models",{...t,method:"GET"},e).then(s=>new Y(s))}},Y=class{constructor(t){this.response=t}async result(){return this.response.json()}};var R=require("zod"),w=class n{constructor(t){this._client=t}static SCHEMA=R.z.array(R.z.object({role:R.z.enum(["user","assistant"]),content:R.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(L=>new k(L))}},k=class{constructor(t){this.response=t}async result(){return this.response.json()}};var S=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=gt;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var P=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 W(o))}},W=class{constructor(t){this.response=t}async result(){return this.response.json()}};var A=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/sources",{...t,method:"GET"},e).then(s=>new X(s))}},X=class{constructor(t){this.response=t}async result(){return this.response.json()}};var _=class n{static DEFAULT_BASE_URL=ut;options;constructor(t,e={}){this.options={requestFilterables:[new S,t],baseURL:process.env.SUPPORT_BASE_URL??n.DEFAULT_BASE_URL,...e}}action={list:new c(this)};channel={list:new p(this)};contact={get:new d(this),list:new l(this)};conversation={get:new m(this),list:new u(this)};label={create:new g(this),get:new f(this),list:new x(this)};message={list:new O(this)};model={get:new C(this),list:new b(this),response:{create:new w(this)},correction:{create:new h(this)}};source={get:new P(this),list:new A(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 Q=require("commander"),ft=require("ora");function Z({client:n,ora:t}){let e=new Q.Command("actions").description("Actions");return e.addCommand(new Q.Command("list").description("List actions").action(async()=>{let s=await(0,ft.oraPromise)(()=>n.action.list.send(),{...t,text:"Finding actions"});console.log(await s.result())})),e}var $=require("commander"),xt=require("ora");function tt({client:n,ora:t}){let e=new $.Command("channels").description("Channels");return e.addCommand(new $.Command("list").description("List channels").action(async()=>{let s=await(0,xt.oraPromise)(()=>n.channel.list.send(),{...t,text:"Finding channels"});console.log(await s.result())})),e}var E=require("commander"),et=require("ora");function nt({client:n,ora:t}){let e=new E.Command("contacts").description("Contacts");return e.addCommand(new E.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async s=>{let o=await(0,et.oraPromise)(()=>n.contact.get.send({id:s}),{...t,text:"Finding contact"});console.log(await o.result())})),e.addCommand(new E.Command("list").description("List contacts").action(async()=>{let s=await(0,et.oraPromise)(()=>n.contact.list.send(),{...t,text:"Finding contacts"});console.log(await s.result())})),e}var q=require("commander"),st=require("ora");function ot({client:n,ora:t}){let e=new q.Command("conversations").description("Conversations");return e.addCommand(new q.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async s=>{let o=await(0,st.oraPromise)(()=>n.conversation.get.send({id:s}),{...t,text:"Finding conversation"});console.log(await o.result())})),e.addCommand(new q.Command("list").description("List conversations").action(async()=>{let s=await(0,st.oraPromise)(()=>n.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await s.result())})),e}var v=require("commander"),it=require("ora");function rt({client:n,ora:t}){let e=new v.Command("labels").description("Labels");return e.addCommand(new v.Command("get").description("Find label").argument("<label>","Label ID").action(async s=>{let o=await(0,it.oraPromise)(()=>n.label.get.send({id:s}),{...t,text:"Finding label"});console.log(await o.result())})),e.addCommand(new v.Command("list").description("List labels").action(async()=>{let s=await(0,it.oraPromise)(()=>n.label.list.send(),{...t,text:"Finding labels"});console.log(await s.result())})),e}var at=require("commander"),Ot=require("ora");function ct({client:n,ora:t}){let e=new at.Command("messages").description("Messages");return e.addCommand(new at.Command("list").description("List messages").action(async()=>{let s=await(0,Ot.oraPromise)(()=>n.message.list.send(),{...t,text:"Finding messages"});console.log(await s.result())})),e}var I=require("commander"),pt=require("ora");function dt({client:n,ora:t}){let e=new I.Command("models").description("Models");return e.addCommand(new I.Command("get").description("Find model").argument("<model>","Model ID").action(async s=>{let o=await(0,pt.oraPromise)(()=>n.model.get.send({id:s}),{...t,text:"Finding model"});console.log(await o.result())})),e.addCommand(new I.Command("list").description("List models").action(async()=>{let s=await(0,pt.oraPromise)(()=>n.model.list.send(),{...t,text:"Finding models"});console.log(await s.result())})),e}var T=require("commander"),lt=require("ora");function mt({client:n,ora:t}){let e=new T.Command("sources").description("Sources");return e.addCommand(new T.Command("get").description("Find source").argument("<source>","Source ID").action(async s=>{let o=await(0,lt.oraPromise)(()=>n.source.get.send({id:s}),{...t,text:"Finding source"});console.log(await o.result())})),e.addCommand(new T.Command("list").description("List sources").action(async()=>{let s=await(0,lt.oraPromise)(()=>n.source.list.send(),{...t,text:"Finding sources"});console.log(await s.result())})),e}var i={ora:{spinner:"simpleDotsScrolling"},client:new _(new a)},Pt=new yt.Command("gds").description("Great Detail Support System").addCommand(Z(i)).addCommand(tt(i)).addCommand(nt(i)).addCommand(ot(i)).addCommand(rt(i)).addCommand(ct(i)).addCommand(dt(i)).addCommand(mt(i)),At=Pt;
1
+ "use strict";var D=Object.defineProperty;var St=Object.getOwnPropertyDescriptor;var At=Object.getOwnPropertyNames;var Pt=Object.prototype.hasOwnProperty;var _t=(n,t)=>{for(var e in t)D(n,e,{get:t[e],enumerable:!0})},Et=(n,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of At(t))!Pt.call(n,o)&&o!==e&&D(n,o,{get:()=>t[o],enumerable:!(s=St(t,o))||s.enumerable});return n};var vt=n=>Et(D({},"__esModule",{value:!0}),n);var Tt={};_t(Tt,{default:()=>It});module.exports=vt(Tt);var wt=require("commander");var p=class{async filter(t){return t}};var c=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/actions",{...t,method:"GET"},e).then(s=>new F(s))}},F=class{constructor(t){this.response=t}async result(){return this.response.json()}};var d=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/channels",{...t,method:"GET"},e).then(s=>new G(s))}},G=class{constructor(t){this.response=t}async result(){return this.response.json()}};var ht="https://api.support.greatdetail.com",Ot={"X-Powered-By":"GDSupport/JavaScript"};var l=class{constructor(t){this._client=t}async send({id:t,request:e={},...s}){return this._client.send("/v1/contacts/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new M(o))}},M=class{constructor(t){this.response=t}async result(){return this.response.json()}};var m=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/contacts",{...t,method:"GET"},e).then(s=>new N(s))}},N=class{constructor(t){this.response=t}async result(){return this.response.json()}};var u=class{constructor(t){this._client=t}async send({id:t,request:e={},...s}){return this._client.send("/v1/conversations/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new H(o))}},H=class{constructor(t){this.response=t}async result(){return this.response.json()}};var g=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/conversations",{...t,method:"GET"},e).then(s=>new z(s))}},z=class{constructor(t){this.response=t}async result(){return this.response.json()}};var K=require("zod"),f=class n{constructor(t){this._client=t}static SCHEMA=K.z.object({hasEnded:K.z.boolean()});async send({id:t,body:e,request:s={},...o}){return this._client.send("/v1/conversations/"+encodeURIComponent(t),{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))},o).then(a=>new B(a))}},B=class{constructor(t){this.response=t}async result(){return this.response.json()}};var r=require("zod"),y=class n{constructor(t){this._client=t}static SCHEMA=r.z.object({title:r.z.string(),description:r.z.optional(r.z.string()),account:r.z.string()});async send({body:t,request:e={},...s}){return this._client.send("/v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(t))},s).then(o=>new V(o))}},V=class{constructor(t){this.response=t}async result(){return this.response.json()}};var x=class{constructor(t){this._client=t}async send({id:t,request:e={},...s}){return this._client.send("/v1/labels/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new J(o))}},J=class{constructor(t){this.response=t}async result(){return this.response.json()}};var h=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/labels",{...t,method:"GET"},e).then(s=>new Y(s))}},Y=class{constructor(t){this.response=t}async result(){return this.response.json()}};var O=class{constructor(t){this._client=t}async send({id:t,request:e={},...s}){return this._client.send("/v1/conversations/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"},s).then(o=>new k(o))}},k=class{constructor(t){this.response=t}async result(){return this.response.json()}};var C=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/messages",{...t,method:"GET"},e).then(s=>new W(s))}},W=class{constructor(t){this.response=t}async result(){return this.response.json()}};var b=require("zod"),R=class n{constructor(t){this._client=t}static SCHEMA=b.z.object({input:b.z.string().max(65536),original:b.z.string().max(65536),correction:b.z.string().max(65536)});async send({id:t,body:e,request:s={},...o}){return this._client.send("/v1/models/"+encodeURIComponent(t)+"/correction",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))},o).then(a=>new X(a))}},X=class{constructor(t){this.response=t}async result(){return this.response.json()}};var w=class{constructor(t){this._client=t}async send({id:t,request:e={},...s}){return this._client.send("/v1/models/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new Q(o))}},Q=class{constructor(t){this.response=t}async result(){return this.response.json()}};var S=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/models",{...t,method:"GET"},e).then(s=>new Z(s))}},Z=class{constructor(t){this.response=t}async result(){return this.response.json()}};var A=require("zod"),P=class n{constructor(t){this._client=t}static SCHEMA=A.z.array(A.z.object({role:A.z.enum(["user","assistant"]),content:A.z.string().max(65536).nullable()})).min(1);async send({id:t,body:e,request:s={},...o}){return this._client.send("/v1/models/"+encodeURIComponent(t)+"/response",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))},o).then(a=>new $(a))}},$=class{constructor(t){this.response=t}async result(){return this.response.json()}};var _=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Ot;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var E=class{constructor(t){this._client=t}async send({id:t,request:e={},...s}){return this._client.send("/v1/sources/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new tt(o))}},tt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var v=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/sources",{...t,method:"GET"},e).then(s=>new et(s))}},et=class{constructor(t){this.response=t}async result(){return this.response.json()}};var q=class n{static DEFAULT_BASE_URL=ht;options;constructor(t,e={}){this.options={requestFilterables:[new _,t],baseURL:process.env.SUPPORT_BASE_URL??n.DEFAULT_BASE_URL,...e}}action={list:new c(this)};channel={list:new d(this)};contact={get:new l(this),list:new m(this)};conversation={get:new u(this),list:new g(this),update:new f(this),message:{list:new O(this)}};label={create:new y(this),get:new x(this),list:new h(this)};message={list:new C(this)};model={get:new w(this),list:new S(this),response:{create:new P(this)},correction:{create:new R(this)}};source={get:new E(this),list:new v(this)};async _filterRequest(t){for(let e of this.options.requestFilterables)t=await e.filter(t);return t}async send(t,e,{fetch:s=fetch}={}){return await s(new Request(new URL(t,this.options.baseURL),await this._filterRequest(e)))}};var nt=require("commander"),Ct=require("ora");function st({client:n,ora:t}){let e=new nt.Command("actions").description("Actions");return e.addCommand(new nt.Command("list").description("List actions").action(async()=>{let s=await(0,Ct.oraPromise)(()=>n.action.list.send(),{...t,text:"Finding actions"});console.log(await s.result())})),e}var ot=require("commander"),bt=require("ora");function it({client:n,ora:t}){let e=new ot.Command("channels").description("Channels");return e.addCommand(new ot.Command("list").description("List channels").action(async()=>{let s=await(0,bt.oraPromise)(()=>n.channel.list.send(),{...t,text:"Finding channels"});console.log(await s.result())})),e}var I=require("commander"),rt=require("ora");function at({client:n,ora:t}){let e=new I.Command("contacts").description("Contacts");return e.addCommand(new I.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async s=>{let o=await(0,rt.oraPromise)(()=>n.contact.get.send({id:s}),{...t,text:"Finding contact"});console.log(await o.result())})),e.addCommand(new I.Command("list").description("List contacts").action(async()=>{let s=await(0,rt.oraPromise)(()=>n.contact.list.send(),{...t,text:"Finding contacts"});console.log(await s.result())})),e}var T=require("commander"),pt=require("ora");function ct({client:n,ora:t}){let e=new T.Command("conversations").description("Conversations");return e.addCommand(new T.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async s=>{let o=await(0,pt.oraPromise)(()=>n.conversation.get.send({id:s}),{...t,text:"Finding conversation"});console.log(await o.result())})),e.addCommand(new T.Command("list").description("List conversations").action(async()=>{let s=await(0,pt.oraPromise)(()=>n.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await s.result())})),e}var L=require("commander"),dt=require("ora");function lt({client:n,ora:t}){let e=new L.Command("labels").description("Labels");return e.addCommand(new L.Command("get").description("Find label").argument("<label>","Label ID").action(async s=>{let o=await(0,dt.oraPromise)(()=>n.label.get.send({id:s}),{...t,text:"Finding label"});console.log(await o.result())})),e.addCommand(new L.Command("list").description("List labels").action(async()=>{let s=await(0,dt.oraPromise)(()=>n.label.list.send(),{...t,text:"Finding labels"});console.log(await s.result())})),e}var mt=require("commander"),Rt=require("ora");function ut({client:n,ora:t}){let e=new mt.Command("messages").description("Messages");return e.addCommand(new mt.Command("list").description("List messages").action(async()=>{let s=await(0,Rt.oraPromise)(()=>n.message.list.send(),{...t,text:"Finding messages"});console.log(await s.result())})),e}var j=require("commander"),gt=require("ora");function ft({client:n,ora:t}){let e=new j.Command("models").description("Models");return e.addCommand(new j.Command("get").description("Find model").argument("<model>","Model ID").action(async s=>{let o=await(0,gt.oraPromise)(()=>n.model.get.send({id:s}),{...t,text:"Finding model"});console.log(await o.result())})),e.addCommand(new j.Command("list").description("List models").action(async()=>{let s=await(0,gt.oraPromise)(()=>n.model.list.send(),{...t,text:"Finding models"});console.log(await s.result())})),e}var U=require("commander"),yt=require("ora");function xt({client:n,ora:t}){let e=new U.Command("sources").description("Sources");return e.addCommand(new U.Command("get").description("Find source").argument("<source>","Source ID").action(async s=>{let o=await(0,yt.oraPromise)(()=>n.source.get.send({id:s}),{...t,text:"Finding source"});console.log(await o.result())})),e.addCommand(new U.Command("list").description("List sources").action(async()=>{let s=await(0,yt.oraPromise)(()=>n.source.list.send(),{...t,text:"Finding sources"});console.log(await s.result())})),e}var i={ora:{spinner:"simpleDotsScrolling"},client:new q(new p)},qt=new wt.Command("gds").description("Great Detail Support System").addCommand(st(i)).addCommand(it(i)).addCommand(at(i)).addCommand(ct(i)).addCommand(lt(i)).addCommand(ut(i)).addCommand(ft(i)).addCommand(xt(i)),It=qt;
@@ -1,5 +1,5 @@
1
1
  import { Command } from 'commander';
2
- import { C as Client } from '../index-zrmJVCfU.cjs';
2
+ import { C as Client } from '../index-CNLZqmjo.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-zrmJVCfU.js';
2
+ import { C as Client } from '../index-CNLZqmjo.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-CQGIX6CO.js";import"../chunk-OVSCTY74.js";export{a as default};
1
+ import{a}from"../chunk-ABALSK3N.js";import"../chunk-3N2R6UO2.js";export{a as default};
package/dist/cli.cjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var Ot=require("commander");var a=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 j(n))}},j=class{constructor(t){this.response=t}async result(){return this.response.json()}};var p=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/channels",{...t,method:"GET"},e).then(n=>new D(n))}},D=class{constructor(t){this.response=t}async result(){return this.response.json()}};var mt="https://api.support.greatdetail.com",ut={"X-Powered-By":"GDSupport/JavaScript"};var d=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 U(o))}},U=class{constructor(t){this.response=t}async result(){return this.response.json()}};var l=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/contacts",{...t,method:"GET"},e).then(n=>new F(n))}},F=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:e={},...n}){return this._client.send("/v1/conversations/"+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 u=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/conversations",{...t,method:"GET"},e).then(n=>new N(n))}},N=class{constructor(t){this.response=t}async result(){return this.response.json()}};var r=require("zod"),g=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 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({id:t,request:e={},...n}){return this._client.send("/v1/labels/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new H(o))}},H=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 K(n))}},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(n=>new z(n))}},z=class{constructor(t){this.response=t}async result(){return this.response.json()}};var y=require("zod"),h=class s{constructor(t){this._client=t}static SCHEMA=y.z.object({input:y.z.string().max(65536),original:y.z.string().max(65536),correction:y.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(L=>new B(L))}},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:e={},...n}){return this._client.send("/v1/models/"+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 b=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/models",{...t,method:"GET"},e).then(n=>new J(n))}},J=class{constructor(t){this.response=t}async result(){return this.response.json()}};var R=require("zod"),w=class s{constructor(t){this._client=t}static SCHEMA=R.z.array(R.z.object({role:R.z.enum(["user","assistant"]),content:R.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(L=>new Y(L))}},Y=class{constructor(t){this.response=t}async result(){return this.response.json()}};var S=class s{constructor(t=s.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=ut;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var A=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 k(o))}},k=class{constructor(t){this.response=t}async result(){return this.response.json()}};var P=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/sources",{...t,method:"GET"},e).then(n=>new W(n))}},W=class{constructor(t){this.response=t}async result(){return this.response.json()}};var _=class s{static DEFAULT_BASE_URL=mt;options;constructor(t,e={}){this.options={requestFilterables:[new S,t],baseURL:process.env.SUPPORT_BASE_URL??s.DEFAULT_BASE_URL,...e}}action={list:new c(this)};channel={list:new p(this)};contact={get:new d(this),list:new l(this)};conversation={get:new m(this),list:new u(this)};label={create:new g(this),get:new f(this),list:new x(this)};message={list:new O(this)};model={get:new C(this),list:new b(this),response:{create:new w(this)},correction:{create:new h(this)}};source={get:new A(this),list:new P(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 X=require("commander"),gt=require("ora");function Q({client:s,ora:t}){let e=new X.Command("actions").description("Actions");return e.addCommand(new X.Command("list").description("List actions").action(async()=>{let n=await(0,gt.oraPromise)(()=>s.action.list.send(),{...t,text:"Finding actions"});console.log(await n.result())})),e}var Z=require("commander"),ft=require("ora");function $({client:s,ora:t}){let e=new Z.Command("channels").description("Channels");return e.addCommand(new Z.Command("list").description("List channels").action(async()=>{let n=await(0,ft.oraPromise)(()=>s.channel.list.send(),{...t,text:"Finding channels"});console.log(await n.result())})),e}var E=require("commander"),tt=require("ora");function et({client:s,ora:t}){let e=new E.Command("contacts").description("Contacts");return e.addCommand(new E.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async n=>{let o=await(0,tt.oraPromise)(()=>s.contact.get.send({id:n}),{...t,text:"Finding contact"});console.log(await o.result())})),e.addCommand(new E.Command("list").description("List contacts").action(async()=>{let n=await(0,tt.oraPromise)(()=>s.contact.list.send(),{...t,text:"Finding contacts"});console.log(await n.result())})),e}var q=require("commander"),nt=require("ora");function st({client:s,ora:t}){let e=new q.Command("conversations").description("Conversations");return e.addCommand(new q.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let o=await(0,nt.oraPromise)(()=>s.conversation.get.send({id:n}),{...t,text:"Finding conversation"});console.log(await o.result())})),e.addCommand(new q.Command("list").description("List conversations").action(async()=>{let n=await(0,nt.oraPromise)(()=>s.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await n.result())})),e}var v=require("commander"),ot=require("ora");function it({client:s,ora:t}){let e=new v.Command("labels").description("Labels");return e.addCommand(new v.Command("get").description("Find label").argument("<label>","Label ID").action(async n=>{let o=await(0,ot.oraPromise)(()=>s.label.get.send({id:n}),{...t,text:"Finding label"});console.log(await o.result())})),e.addCommand(new v.Command("list").description("List labels").action(async()=>{let n=await(0,ot.oraPromise)(()=>s.label.list.send(),{...t,text:"Finding labels"});console.log(await n.result())})),e}var rt=require("commander"),xt=require("ora");function at({client:s,ora:t}){let e=new rt.Command("messages").description("Messages");return e.addCommand(new rt.Command("list").description("List messages").action(async()=>{let n=await(0,xt.oraPromise)(()=>s.message.list.send(),{...t,text:"Finding messages"});console.log(await n.result())})),e}var I=require("commander"),ct=require("ora");function pt({client:s,ora:t}){let e=new I.Command("models").description("Models");return e.addCommand(new I.Command("get").description("Find model").argument("<model>","Model ID").action(async n=>{let o=await(0,ct.oraPromise)(()=>s.model.get.send({id:n}),{...t,text:"Finding model"});console.log(await o.result())})),e.addCommand(new I.Command("list").description("List models").action(async()=>{let n=await(0,ct.oraPromise)(()=>s.model.list.send(),{...t,text:"Finding models"});console.log(await n.result())})),e}var T=require("commander"),dt=require("ora");function lt({client:s,ora:t}){let e=new T.Command("sources").description("Sources");return e.addCommand(new T.Command("get").description("Find source").argument("<source>","Source ID").action(async n=>{let o=await(0,dt.oraPromise)(()=>s.source.get.send({id:n}),{...t,text:"Finding source"});console.log(await o.result())})),e.addCommand(new T.Command("list").description("List sources").action(async()=>{let n=await(0,dt.oraPromise)(()=>s.source.list.send(),{...t,text:"Finding sources"});console.log(await n.result())})),e}var i={ora:{spinner:"simpleDotsScrolling"},client:new _(new a)},ht=new Ot.Command("gds").description("Great Detail Support System").addCommand(Q(i)).addCommand($(i)).addCommand(et(i)).addCommand(st(i)).addCommand(it(i)).addCommand(at(i)).addCommand(pt(i)).addCommand(lt(i)),yt=ht;yt.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 xt="https://api.support.greatdetail.com",ht={"X-Powered-By":"GDSupport/JavaScript"};var l=class{constructor(t){this._client=t}async send({id:t,request:e={},...n}){return this._client.send("/v1/contacts/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new G(o))}},G=class{constructor(t){this.response=t}async result(){return this.response.json()}};var m=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/contacts",{...t,method:"GET"},e).then(n=>new M(n))}},M=class{constructor(t){this.response=t}async result(){return this.response.json()}};var u=class{constructor(t){this._client=t}async send({id:t,request:e={},...n}){return this._client.send("/v1/conversations/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new N(o))}},N=class{constructor(t){this.response=t}async result(){return this.response.json()}};var g=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/conversations",{...t,method:"GET"},e).then(n=>new H(n))}},H=class{constructor(t){this.response=t}async result(){return this.response.json()}};var z=require("zod"),f=class s{constructor(t){this._client=t}static SCHEMA=z.z.object({hasEnded:z.z.boolean()});async send({id:t,body:e,request:n={},...o}){return this._client.send("/v1/conversations/"+encodeURIComponent(t),{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(e))},o).then(a=>new K(a))}},K=class{constructor(t){this.response=t}async result(){return this.response.json()}};var r=require("zod"),y=class s{constructor(t){this._client=t}static SCHEMA=r.z.object({title:r.z.string(),description:r.z.optional(r.z.string()),account:r.z.string()});async send({body:t,request:e={},...n}){return this._client.send("/v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(t))},n).then(o=>new B(o))}},B=class{constructor(t){this.response=t}async result(){return this.response.json()}};var x=class{constructor(t){this._client=t}async send({id:t,request:e={},...n}){return this._client.send("/v1/labels/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new V(o))}},V=class{constructor(t){this.response=t}async result(){return this.response.json()}};var h=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/labels",{...t,method:"GET"},e).then(n=>new J(n))}},J=class{constructor(t){this.response=t}async result(){return this.response.json()}};var O=class{constructor(t){this._client=t}async send({id:t,request:e={},...n}){return this._client.send("/v1/conversations/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"},n).then(o=>new Y(o))}},Y=class{constructor(t){this.response=t}async result(){return this.response.json()}};var C=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/messages",{...t,method:"GET"},e).then(n=>new k(n))}},k=class{constructor(t){this.response=t}async result(){return this.response.json()}};var b=require("zod"),R=class s{constructor(t){this._client=t}static SCHEMA=b.z.object({input:b.z.string().max(65536),original:b.z.string().max(65536),correction:b.z.string().max(65536)});async send({id:t,body:e,request:n={},...o}){return this._client.send("/v1/models/"+encodeURIComponent(t)+"/correction",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(e))},o).then(a=>new W(a))}},W=class{constructor(t){this.response=t}async result(){return this.response.json()}};var w=class{constructor(t){this._client=t}async send({id:t,request:e={},...n}){return this._client.send("/v1/models/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new X(o))}},X=class{constructor(t){this.response=t}async result(){return this.response.json()}};var S=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/models",{...t,method:"GET"},e).then(n=>new Q(n))}},Q=class{constructor(t){this.response=t}async result(){return this.response.json()}};var A=require("zod"),P=class s{constructor(t){this._client=t}static SCHEMA=A.z.array(A.z.object({role:A.z.enum(["user","assistant"]),content:A.z.string().max(65536).nullable()})).min(1);async send({id:t,body:e,request:n={},...o}){return this._client.send("/v1/models/"+encodeURIComponent(t)+"/response",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(e))},o).then(a=>new Z(a))}},Z=class{constructor(t){this.response=t}async result(){return this.response.json()}};var _=class s{constructor(t=s.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=ht;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var E=class{constructor(t){this._client=t}async send({id:t,request:e={},...n}){return this._client.send("/v1/sources/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new $(o))}},$=class{constructor(t){this.response=t}async result(){return this.response.json()}};var v=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/sources",{...t,method:"GET"},e).then(n=>new tt(n))}},tt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var q=class s{static DEFAULT_BASE_URL=xt;options;constructor(t,e={}){this.options={requestFilterables:[new _,t],baseURL:process.env.SUPPORT_BASE_URL??s.DEFAULT_BASE_URL,...e}}action={list:new c(this)};channel={list:new d(this)};contact={get:new l(this),list:new m(this)};conversation={get:new u(this),list:new g(this),update:new f(this),message:{list:new O(this)}};label={create:new y(this),get:new x(this),list:new h(this)};message={list:new C(this)};model={get:new w(this),list:new S(this),response:{create:new P(this)},correction:{create:new R(this)}};source={get:new E(this),list:new v(this)};async _filterRequest(t){for(let e of this.options.requestFilterables)t=await e.filter(t);return t}async send(t,e,{fetch:n=fetch}={}){return await n(new Request(new URL(t,this.options.baseURL),await this._filterRequest(e)))}};var et=require("commander"),Ot=require("ora");function nt({client:s,ora:t}){let e=new et.Command("actions").description("Actions");return e.addCommand(new et.Command("list").description("List actions").action(async()=>{let n=await(0,Ot.oraPromise)(()=>s.action.list.send(),{...t,text:"Finding actions"});console.log(await n.result())})),e}var st=require("commander"),Ct=require("ora");function ot({client:s,ora:t}){let e=new st.Command("channels").description("Channels");return e.addCommand(new st.Command("list").description("List channels").action(async()=>{let n=await(0,Ct.oraPromise)(()=>s.channel.list.send(),{...t,text:"Finding channels"});console.log(await n.result())})),e}var I=require("commander"),it=require("ora");function rt({client:s,ora:t}){let e=new I.Command("contacts").description("Contacts");return e.addCommand(new I.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async n=>{let o=await(0,it.oraPromise)(()=>s.contact.get.send({id:n}),{...t,text:"Finding contact"});console.log(await o.result())})),e.addCommand(new I.Command("list").description("List contacts").action(async()=>{let n=await(0,it.oraPromise)(()=>s.contact.list.send(),{...t,text:"Finding contacts"});console.log(await n.result())})),e}var T=require("commander"),at=require("ora");function pt({client:s,ora:t}){let e=new T.Command("conversations").description("Conversations");return e.addCommand(new T.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let o=await(0,at.oraPromise)(()=>s.conversation.get.send({id:n}),{...t,text:"Finding conversation"});console.log(await o.result())})),e.addCommand(new T.Command("list").description("List conversations").action(async()=>{let n=await(0,at.oraPromise)(()=>s.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await n.result())})),e}var L=require("commander"),ct=require("ora");function dt({client:s,ora:t}){let e=new L.Command("labels").description("Labels");return e.addCommand(new L.Command("get").description("Find label").argument("<label>","Label ID").action(async n=>{let o=await(0,ct.oraPromise)(()=>s.label.get.send({id:n}),{...t,text:"Finding label"});console.log(await o.result())})),e.addCommand(new L.Command("list").description("List labels").action(async()=>{let n=await(0,ct.oraPromise)(()=>s.label.list.send(),{...t,text:"Finding labels"});console.log(await n.result())})),e}var lt=require("commander"),bt=require("ora");function mt({client:s,ora:t}){let e=new lt.Command("messages").description("Messages");return e.addCommand(new lt.Command("list").description("List messages").action(async()=>{let n=await(0,bt.oraPromise)(()=>s.message.list.send(),{...t,text:"Finding messages"});console.log(await n.result())})),e}var j=require("commander"),ut=require("ora");function gt({client:s,ora:t}){let e=new j.Command("models").description("Models");return e.addCommand(new j.Command("get").description("Find model").argument("<model>","Model ID").action(async n=>{let o=await(0,ut.oraPromise)(()=>s.model.get.send({id:n}),{...t,text:"Finding model"});console.log(await o.result())})),e.addCommand(new j.Command("list").description("List models").action(async()=>{let n=await(0,ut.oraPromise)(()=>s.model.list.send(),{...t,text:"Finding models"});console.log(await n.result())})),e}var U=require("commander"),ft=require("ora");function yt({client:s,ora:t}){let e=new U.Command("sources").description("Sources");return e.addCommand(new U.Command("get").description("Find source").argument("<source>","Source ID").action(async n=>{let o=await(0,ft.oraPromise)(()=>s.source.get.send({id:n}),{...t,text:"Finding source"});console.log(await o.result())})),e.addCommand(new U.Command("list").description("List sources").action(async()=>{let n=await(0,ft.oraPromise)(()=>s.source.list.send(),{...t,text:"Finding sources"});console.log(await n.result())})),e}var i={ora:{spinner:"simpleDotsScrolling"},client:new q(new p)},St=new Rt.Command("gds").description("Great Detail Support System").addCommand(nt(i)).addCommand(ot(i)).addCommand(rt(i)).addCommand(pt(i)).addCommand(dt(i)).addCommand(mt(i)).addCommand(gt(i)).addCommand(yt(i)),wt=St;wt.parseAsync(process.argv);
package/dist/cli.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{a as r}from"./chunk-CQGIX6CO.js";import"./chunk-OVSCTY74.js";r.parseAsync(process.argv);
2
+ import{a as r}from"./chunk-ABALSK3N.js";import"./chunk-3N2R6UO2.js";r.parseAsync(process.argv);
@@ -21,8 +21,7 @@ interface RequestFilterable {
21
21
  * @see https://greatdetail.com
22
22
  */
23
23
 
24
- interface Authentication extends RequestFilterable {
25
- }
24
+ type Authentication = RequestFilterable;
26
25
 
27
26
  /**
28
27
  * Great Detail Support System.
@@ -33,13 +32,13 @@ interface Authentication extends RequestFilterable {
33
32
  * @see https://greatdetail.com
34
33
  */
35
34
 
36
- interface Options$f extends SendOptions {
35
+ interface Options$h extends SendOptions {
37
36
  request?: RequestInit;
38
37
  }
39
38
  declare class ListActionsRequest {
40
39
  protected _client: Client;
41
40
  constructor(_client: Client);
42
- send({ request, ...options }?: Options$f): Promise<ListActionsResponse>;
41
+ send({ request, ...options }?: Options$h): Promise<ListActionsResponse>;
43
42
  }
44
43
  type ListActionsResponsePayload = {
45
44
  actions: {
@@ -70,13 +69,13 @@ declare class ListActionsResponse {
70
69
  * @see https://greatdetail.com
71
70
  */
72
71
 
73
- interface Options$e extends SendOptions {
72
+ interface Options$g extends SendOptions {
74
73
  request?: RequestInit;
75
74
  }
76
75
  declare class ListChannelsRequest {
77
76
  protected _client: Client;
78
77
  constructor(_client: Client);
79
- send({ request, ...options }?: Options$e): Promise<ListChannelsResponse>;
78
+ send({ request, ...options }?: Options$g): Promise<ListChannelsResponse>;
80
79
  }
81
80
  type ListChannelsResponsePayload = {
82
81
  channels: ({
@@ -117,14 +116,14 @@ declare class ListChannelsResponse {
117
116
  * @see https://greatdetail.com
118
117
  */
119
118
 
120
- interface Options$d extends SendOptions {
119
+ interface Options$f extends SendOptions {
121
120
  id: string;
122
121
  request?: RequestInit;
123
122
  }
124
123
  declare class GetContactRequest {
125
124
  protected _client: Client;
126
125
  constructor(_client: Client);
127
- send({ id, request, ...options }: Options$d): Promise<GetContactResponse>;
126
+ send({ id, request, ...options }: Options$f): Promise<GetContactResponse>;
128
127
  }
129
128
  type GetContactResponsePayload = {
130
129
  contact: {
@@ -152,13 +151,13 @@ declare class GetContactResponse {
152
151
  * @see https://greatdetail.com
153
152
  */
154
153
 
155
- interface Options$c extends SendOptions {
154
+ interface Options$e extends SendOptions {
156
155
  request?: RequestInit;
157
156
  }
158
157
  declare class ListContactsRequest {
159
158
  protected _client: Client;
160
159
  constructor(_client: Client);
161
- send({ request, ...options }?: Options$c): Promise<ListContactsResponse>;
160
+ send({ request, ...options }?: Options$e): Promise<ListContactsResponse>;
162
161
  }
163
162
  type ListContactsResponsePayload = {
164
163
  contacts: {
@@ -186,18 +185,19 @@ declare class ListContactsResponse {
186
185
  * @see https://greatdetail.com
187
186
  */
188
187
 
189
- interface Options$b extends SendOptions {
188
+ interface Options$d extends SendOptions {
190
189
  id: string;
191
190
  request?: RequestInit;
192
191
  }
193
192
  declare class GetConversationRequest {
194
193
  protected _client: Client;
195
194
  constructor(_client: Client);
196
- send({ id, request, ...options }: Options$b): Promise<GetConversationResponse>;
195
+ send({ id, request, ...options }: Options$d): Promise<GetConversationResponse>;
197
196
  }
198
197
  type GetConversationResponsePayload = {
199
198
  conversation: {
200
199
  id: string;
200
+ name?: string;
201
201
  hasEnded: boolean;
202
202
  accountChannel: string;
203
203
  createdAt: string;
@@ -219,17 +219,18 @@ declare class GetConversationResponse {
219
219
  * @see https://greatdetail.com
220
220
  */
221
221
 
222
- interface Options$a extends SendOptions {
222
+ interface Options$c extends SendOptions {
223
223
  request?: RequestInit;
224
224
  }
225
225
  declare class ListConversationsRequest {
226
226
  protected _client: Client;
227
227
  constructor(_client: Client);
228
- send({ request, ...options }?: Options$a): Promise<ListConversationsResponse>;
228
+ send({ request, ...options }?: Options$c): Promise<ListConversationsResponse>;
229
229
  }
230
230
  type ListConversationsResponsePayload = {
231
231
  conversations: {
232
232
  id: string;
233
+ name?: string;
233
234
  hasEnded: boolean;
234
235
  accountChannel: string;
235
236
  createdAt: string;
@@ -251,7 +252,49 @@ declare class ListConversationsResponse {
251
252
  * @see https://greatdetail.com
252
253
  */
253
254
 
254
- interface Options$9 extends SendOptions {
255
+ interface Options$b extends SendOptions {
256
+ id: string;
257
+ body: z.infer<typeof UpdateConversationRequest.SCHEMA>;
258
+ request?: RequestInit;
259
+ }
260
+ declare class UpdateConversationRequest {
261
+ protected _client: Client;
262
+ static SCHEMA: z.ZodObject<{
263
+ hasEnded: z.ZodBoolean;
264
+ }, "strip", z.ZodTypeAny, {
265
+ hasEnded: boolean;
266
+ }, {
267
+ hasEnded: boolean;
268
+ }>;
269
+ constructor(_client: Client);
270
+ send({ id, body, request, ...options }: Options$b): Promise<UpdateConversationResponse>;
271
+ }
272
+ type UpdateConversationResponsePayload = {
273
+ conversation: {
274
+ id: string;
275
+ name?: string;
276
+ hasEnded: boolean;
277
+ accountChannel: string;
278
+ createdAt: string;
279
+ updatedAt: string;
280
+ };
281
+ };
282
+ declare class UpdateConversationResponse {
283
+ response: Response;
284
+ constructor(response: Response);
285
+ result(): Promise<UpdateConversationResponsePayload>;
286
+ }
287
+
288
+ /**
289
+ * Great Detail Support System.
290
+ *
291
+ * @copyright 2024 Great Detail Ltd
292
+ * @author Great Detail Ltd <info@greatdetail.com>
293
+ * @author Dom Webber <dom.webber@greatdetail.com>
294
+ * @see https://greatdetail.com
295
+ */
296
+
297
+ interface Options$a extends SendOptions {
255
298
  body: z.infer<typeof CreateLabelRequest.SCHEMA>;
256
299
  request?: RequestInit;
257
300
  }
@@ -271,7 +314,7 @@ declare class CreateLabelRequest {
271
314
  description?: string | undefined;
272
315
  }>;
273
316
  constructor(_client: Client);
274
- send({ body, request, ...options }: Options$9): Promise<CreateLabelResponse>;
317
+ send({ body, request, ...options }: Options$a): Promise<CreateLabelResponse>;
275
318
  }
276
319
  type CreateLabelResponsePayload = {
277
320
  label: {
@@ -298,14 +341,14 @@ declare class CreateLabelResponse {
298
341
  * @see https://greatdetail.com
299
342
  */
300
343
 
301
- interface Options$8 extends SendOptions {
344
+ interface Options$9 extends SendOptions {
302
345
  id: string;
303
346
  request?: RequestInit;
304
347
  }
305
348
  declare class GetLabelRequest {
306
349
  protected _client: Client;
307
350
  constructor(_client: Client);
308
- send({ id, request, ...options }: Options$8): Promise<GetLabelResponse>;
351
+ send({ id, request, ...options }: Options$9): Promise<GetLabelResponse>;
309
352
  }
310
353
  type GetLabelResponsePayload = {
311
354
  label: {
@@ -332,13 +375,13 @@ declare class GetLabelResponse {
332
375
  * @see https://greatdetail.com
333
376
  */
334
377
 
335
- interface Options$7 extends SendOptions {
378
+ interface Options$8 extends SendOptions {
336
379
  request?: RequestInit;
337
380
  }
338
381
  declare class ListLabelsRequest {
339
382
  protected _client: Client;
340
383
  constructor(_client: Client);
341
- send({ request, ...options }?: Options$7): Promise<ListLabelsResponse>;
384
+ send({ request, ...options }?: Options$8): Promise<ListLabelsResponse>;
342
385
  }
343
386
  type ListLabelsResponsePayload = {
344
387
  labels: {
@@ -356,6 +399,49 @@ declare class ListLabelsResponse {
356
399
  result(): Promise<ListLabelsResponsePayload>;
357
400
  }
358
401
 
402
+ /**
403
+ * Great Detail Support System.
404
+ *
405
+ * @copyright 2024 Great Detail Ltd
406
+ * @author Great Detail Ltd <info@greatdetail.com>
407
+ * @author Dom Webber <dom.webber@greatdetail.com>
408
+ * @see https://greatdetail.com
409
+ */
410
+
411
+ interface Options$7 extends SendOptions {
412
+ id: string;
413
+ request?: RequestInit;
414
+ }
415
+ declare class ListConversationMessages {
416
+ protected _client: Client;
417
+ constructor(_client: Client);
418
+ send({ id, request, ...options }: Options$7): Promise<ListConversationMessagesResponse>;
419
+ }
420
+ type ListConversationMessagesResponsePayload = {
421
+ messages: {
422
+ id: string;
423
+ role: "user" | "assistant";
424
+ messageStatus: string;
425
+ externalIdentifier?: string;
426
+ conversation: string;
427
+ contact: string;
428
+ messageEvents: {
429
+ id: string;
430
+ messageEventType: string;
431
+ triggeredAt: string;
432
+ createdAt: string;
433
+ updatedAt?: string;
434
+ }[];
435
+ createdAt: string;
436
+ updatedAt: string;
437
+ }[];
438
+ };
439
+ declare class ListConversationMessagesResponse {
440
+ response: Response;
441
+ constructor(response: Response);
442
+ result(): Promise<ListConversationMessagesResponsePayload>;
443
+ }
444
+
359
445
  /**
360
446
  * Great Detail Support System.
361
447
  *
@@ -654,6 +740,10 @@ declare class Client {
654
740
  conversation: {
655
741
  get: GetConversationRequest;
656
742
  list: ListConversationsRequest;
743
+ update: UpdateConversationRequest;
744
+ message: {
745
+ list: ListConversationMessages;
746
+ };
657
747
  };
658
748
  label: {
659
749
  create: CreateLabelRequest;
@@ -21,8 +21,7 @@ interface RequestFilterable {
21
21
  * @see https://greatdetail.com
22
22
  */
23
23
 
24
- interface Authentication extends RequestFilterable {
25
- }
24
+ type Authentication = RequestFilterable;
26
25
 
27
26
  /**
28
27
  * Great Detail Support System.
@@ -33,13 +32,13 @@ interface Authentication extends RequestFilterable {
33
32
  * @see https://greatdetail.com
34
33
  */
35
34
 
36
- interface Options$f extends SendOptions {
35
+ interface Options$h extends SendOptions {
37
36
  request?: RequestInit;
38
37
  }
39
38
  declare class ListActionsRequest {
40
39
  protected _client: Client;
41
40
  constructor(_client: Client);
42
- send({ request, ...options }?: Options$f): Promise<ListActionsResponse>;
41
+ send({ request, ...options }?: Options$h): Promise<ListActionsResponse>;
43
42
  }
44
43
  type ListActionsResponsePayload = {
45
44
  actions: {
@@ -70,13 +69,13 @@ declare class ListActionsResponse {
70
69
  * @see https://greatdetail.com
71
70
  */
72
71
 
73
- interface Options$e extends SendOptions {
72
+ interface Options$g extends SendOptions {
74
73
  request?: RequestInit;
75
74
  }
76
75
  declare class ListChannelsRequest {
77
76
  protected _client: Client;
78
77
  constructor(_client: Client);
79
- send({ request, ...options }?: Options$e): Promise<ListChannelsResponse>;
78
+ send({ request, ...options }?: Options$g): Promise<ListChannelsResponse>;
80
79
  }
81
80
  type ListChannelsResponsePayload = {
82
81
  channels: ({
@@ -117,14 +116,14 @@ declare class ListChannelsResponse {
117
116
  * @see https://greatdetail.com
118
117
  */
119
118
 
120
- interface Options$d extends SendOptions {
119
+ interface Options$f extends SendOptions {
121
120
  id: string;
122
121
  request?: RequestInit;
123
122
  }
124
123
  declare class GetContactRequest {
125
124
  protected _client: Client;
126
125
  constructor(_client: Client);
127
- send({ id, request, ...options }: Options$d): Promise<GetContactResponse>;
126
+ send({ id, request, ...options }: Options$f): Promise<GetContactResponse>;
128
127
  }
129
128
  type GetContactResponsePayload = {
130
129
  contact: {
@@ -152,13 +151,13 @@ declare class GetContactResponse {
152
151
  * @see https://greatdetail.com
153
152
  */
154
153
 
155
- interface Options$c extends SendOptions {
154
+ interface Options$e extends SendOptions {
156
155
  request?: RequestInit;
157
156
  }
158
157
  declare class ListContactsRequest {
159
158
  protected _client: Client;
160
159
  constructor(_client: Client);
161
- send({ request, ...options }?: Options$c): Promise<ListContactsResponse>;
160
+ send({ request, ...options }?: Options$e): Promise<ListContactsResponse>;
162
161
  }
163
162
  type ListContactsResponsePayload = {
164
163
  contacts: {
@@ -186,18 +185,19 @@ declare class ListContactsResponse {
186
185
  * @see https://greatdetail.com
187
186
  */
188
187
 
189
- interface Options$b extends SendOptions {
188
+ interface Options$d extends SendOptions {
190
189
  id: string;
191
190
  request?: RequestInit;
192
191
  }
193
192
  declare class GetConversationRequest {
194
193
  protected _client: Client;
195
194
  constructor(_client: Client);
196
- send({ id, request, ...options }: Options$b): Promise<GetConversationResponse>;
195
+ send({ id, request, ...options }: Options$d): Promise<GetConversationResponse>;
197
196
  }
198
197
  type GetConversationResponsePayload = {
199
198
  conversation: {
200
199
  id: string;
200
+ name?: string;
201
201
  hasEnded: boolean;
202
202
  accountChannel: string;
203
203
  createdAt: string;
@@ -219,17 +219,18 @@ declare class GetConversationResponse {
219
219
  * @see https://greatdetail.com
220
220
  */
221
221
 
222
- interface Options$a extends SendOptions {
222
+ interface Options$c extends SendOptions {
223
223
  request?: RequestInit;
224
224
  }
225
225
  declare class ListConversationsRequest {
226
226
  protected _client: Client;
227
227
  constructor(_client: Client);
228
- send({ request, ...options }?: Options$a): Promise<ListConversationsResponse>;
228
+ send({ request, ...options }?: Options$c): Promise<ListConversationsResponse>;
229
229
  }
230
230
  type ListConversationsResponsePayload = {
231
231
  conversations: {
232
232
  id: string;
233
+ name?: string;
233
234
  hasEnded: boolean;
234
235
  accountChannel: string;
235
236
  createdAt: string;
@@ -251,7 +252,49 @@ declare class ListConversationsResponse {
251
252
  * @see https://greatdetail.com
252
253
  */
253
254
 
254
- interface Options$9 extends SendOptions {
255
+ interface Options$b extends SendOptions {
256
+ id: string;
257
+ body: z.infer<typeof UpdateConversationRequest.SCHEMA>;
258
+ request?: RequestInit;
259
+ }
260
+ declare class UpdateConversationRequest {
261
+ protected _client: Client;
262
+ static SCHEMA: z.ZodObject<{
263
+ hasEnded: z.ZodBoolean;
264
+ }, "strip", z.ZodTypeAny, {
265
+ hasEnded: boolean;
266
+ }, {
267
+ hasEnded: boolean;
268
+ }>;
269
+ constructor(_client: Client);
270
+ send({ id, body, request, ...options }: Options$b): Promise<UpdateConversationResponse>;
271
+ }
272
+ type UpdateConversationResponsePayload = {
273
+ conversation: {
274
+ id: string;
275
+ name?: string;
276
+ hasEnded: boolean;
277
+ accountChannel: string;
278
+ createdAt: string;
279
+ updatedAt: string;
280
+ };
281
+ };
282
+ declare class UpdateConversationResponse {
283
+ response: Response;
284
+ constructor(response: Response);
285
+ result(): Promise<UpdateConversationResponsePayload>;
286
+ }
287
+
288
+ /**
289
+ * Great Detail Support System.
290
+ *
291
+ * @copyright 2024 Great Detail Ltd
292
+ * @author Great Detail Ltd <info@greatdetail.com>
293
+ * @author Dom Webber <dom.webber@greatdetail.com>
294
+ * @see https://greatdetail.com
295
+ */
296
+
297
+ interface Options$a extends SendOptions {
255
298
  body: z.infer<typeof CreateLabelRequest.SCHEMA>;
256
299
  request?: RequestInit;
257
300
  }
@@ -271,7 +314,7 @@ declare class CreateLabelRequest {
271
314
  description?: string | undefined;
272
315
  }>;
273
316
  constructor(_client: Client);
274
- send({ body, request, ...options }: Options$9): Promise<CreateLabelResponse>;
317
+ send({ body, request, ...options }: Options$a): Promise<CreateLabelResponse>;
275
318
  }
276
319
  type CreateLabelResponsePayload = {
277
320
  label: {
@@ -298,14 +341,14 @@ declare class CreateLabelResponse {
298
341
  * @see https://greatdetail.com
299
342
  */
300
343
 
301
- interface Options$8 extends SendOptions {
344
+ interface Options$9 extends SendOptions {
302
345
  id: string;
303
346
  request?: RequestInit;
304
347
  }
305
348
  declare class GetLabelRequest {
306
349
  protected _client: Client;
307
350
  constructor(_client: Client);
308
- send({ id, request, ...options }: Options$8): Promise<GetLabelResponse>;
351
+ send({ id, request, ...options }: Options$9): Promise<GetLabelResponse>;
309
352
  }
310
353
  type GetLabelResponsePayload = {
311
354
  label: {
@@ -332,13 +375,13 @@ declare class GetLabelResponse {
332
375
  * @see https://greatdetail.com
333
376
  */
334
377
 
335
- interface Options$7 extends SendOptions {
378
+ interface Options$8 extends SendOptions {
336
379
  request?: RequestInit;
337
380
  }
338
381
  declare class ListLabelsRequest {
339
382
  protected _client: Client;
340
383
  constructor(_client: Client);
341
- send({ request, ...options }?: Options$7): Promise<ListLabelsResponse>;
384
+ send({ request, ...options }?: Options$8): Promise<ListLabelsResponse>;
342
385
  }
343
386
  type ListLabelsResponsePayload = {
344
387
  labels: {
@@ -356,6 +399,49 @@ declare class ListLabelsResponse {
356
399
  result(): Promise<ListLabelsResponsePayload>;
357
400
  }
358
401
 
402
+ /**
403
+ * Great Detail Support System.
404
+ *
405
+ * @copyright 2024 Great Detail Ltd
406
+ * @author Great Detail Ltd <info@greatdetail.com>
407
+ * @author Dom Webber <dom.webber@greatdetail.com>
408
+ * @see https://greatdetail.com
409
+ */
410
+
411
+ interface Options$7 extends SendOptions {
412
+ id: string;
413
+ request?: RequestInit;
414
+ }
415
+ declare class ListConversationMessages {
416
+ protected _client: Client;
417
+ constructor(_client: Client);
418
+ send({ id, request, ...options }: Options$7): Promise<ListConversationMessagesResponse>;
419
+ }
420
+ type ListConversationMessagesResponsePayload = {
421
+ messages: {
422
+ id: string;
423
+ role: "user" | "assistant";
424
+ messageStatus: string;
425
+ externalIdentifier?: string;
426
+ conversation: string;
427
+ contact: string;
428
+ messageEvents: {
429
+ id: string;
430
+ messageEventType: string;
431
+ triggeredAt: string;
432
+ createdAt: string;
433
+ updatedAt?: string;
434
+ }[];
435
+ createdAt: string;
436
+ updatedAt: string;
437
+ }[];
438
+ };
439
+ declare class ListConversationMessagesResponse {
440
+ response: Response;
441
+ constructor(response: Response);
442
+ result(): Promise<ListConversationMessagesResponsePayload>;
443
+ }
444
+
359
445
  /**
360
446
  * Great Detail Support System.
361
447
  *
@@ -654,6 +740,10 @@ declare class Client {
654
740
  conversation: {
655
741
  get: GetConversationRequest;
656
742
  list: ListConversationsRequest;
743
+ update: UpdateConversationRequest;
744
+ message: {
745
+ list: ListConversationMessages;
746
+ };
657
747
  };
658
748
  label: {
659
749
  create: CreateLabelRequest;
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var I=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var ee=Object.getOwnPropertyNames;var te=Object.prototype.hasOwnProperty;var se=(t,e)=>{for(var s in e)I(t,s,{get:e[s],enumerable:!0})},ne=(t,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ee(e))!te.call(t,o)&&o!==s&&I(t,o,{get:()=>e[o],enumerable:!(n=Z(e,o))||n.enumerable});return t};var oe=t=>ne(I({},"__esModule",{value:!0}),t);var re={};se(re,{Client:()=>i,DEFAULT_SUPPORT_BASE_URL:()=>w,KeyAuthentication:()=>p,PublicAuthentication:()=>c,TokenAuthentication:()=>a,default:()=>i});module.exports=oe(re);var w="https://api.support.greatdetail.com",J={"X-Powered-By":"GDSupport/JavaScript"},$="api-key",W="SUPPORT_ACCESS_TOKEN",X="SUPPORT_API_KEY",Q="SUPPORT_KEY_NAME";var p=class t{static DEFAULT_NAME=$;name;#e;constructor({name:e=process.env[Q]??t.DEFAULT_NAME,key:s=process.env[X]}={}){if(!s)throw new Error("API Key option must be specified when using Key Authentication");this.name=e,this.#e=s}async filter(e){return{...e,headers:{...e.headers,Authorization:`Basic ${btoa(this.name+":"+this.#e)}`}}}};var a=class{#e;constructor({token:e=process.env[W]}={}){if(!e)throw new Error("Access Token option must be specified when using Token Authentication");this.#e=e}async filter(e){return{...e,headers:{...e.headers,Authorization:`Bearer ${this.#e}`}}}};var c=class{async filter(e){return e}};var l=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/actions",{...e,method:"GET"},s).then(n=>new L(n))}},L=class{constructor(e){this.response=e}async result(){return this.response.json()}};var d=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/channels",{...e,method:"GET"},s).then(n=>new U(n))}},U=class{constructor(e){this.response=e}async result(){return this.response.json()}};var u=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/contacts/"+encodeURIComponent(e),{...s,method:"GET"},n).then(o=>new v(o))}},v=class{constructor(e){this.response=e}async result(){return this.response.json()}};var m=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/contacts",{...e,method:"GET"},s).then(n=>new D(n))}},D=class{constructor(e){this.response=e}async result(){return this.response.json()}};var g=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/conversations/"+encodeURIComponent(e),{...s,method:"GET"},n).then(o=>new N(o))}},N=class{constructor(e){this.response=e}async result(){return this.response.json()}};var h=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/conversations",{...e,method:"GET"},s).then(n=>new j(n))}},j=class{constructor(e){this.response=e}async result(){return this.response.json()}};var r=require("zod"),f=class t{constructor(e){this._client=e}static SCHEMA=r.z.object({title:r.z.string(),description:r.z.optional(r.z.string()),account:r.z.string()});async send({body:e,request:s={},...n}){return this._client.send("/v1/labels",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(e))},n).then(o=>new G(o))}},G=class{constructor(e){this.response=e}async result(){return this.response.json()}};var y=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/labels/"+encodeURIComponent(e),{...s,method:"GET"},n).then(o=>new M(o))}},M=class{constructor(e){this.response=e}async result(){return this.response.json()}};var R=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/labels",{...e,method:"GET"},s).then(n=>new F(n))}},F=class{constructor(e){this.response=e}async result(){return this.response.json()}};var b=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/messages",{...e,method:"GET"},s).then(n=>new H(n))}},H=class{constructor(e){this.response=e}async result(){return this.response.json()}};var x=require("zod"),A=class t{constructor(e){this._client=e}static SCHEMA=x.z.object({input:x.z.string().max(65536),original:x.z.string().max(65536),correction:x.z.string().max(65536)});async send({id:e,body:s,request:n={},...o}){return this._client.send("/v1/models/"+encodeURIComponent(e)+"/correction",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(s))},o).then(q=>new K(q))}},K=class{constructor(e){this.response=e}async result(){return this.response.json()}};var O=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/models/"+encodeURIComponent(e),{...s,method:"GET"},n).then(o=>new V(o))}},V=class{constructor(e){this.response=e}async result(){return this.response.json()}};var P=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/models",{...e,method:"GET"},s).then(n=>new B(n))}},B=class{constructor(e){this.response=e}async result(){return this.response.json()}};var S=require("zod"),C=class t{constructor(e){this._client=e}static SCHEMA=S.z.array(S.z.object({role:S.z.enum(["user","assistant"]),content:S.z.string().max(65536).nullable()})).min(1);async send({id:e,body:s,request:n={},...o}){return this._client.send("/v1/models/"+encodeURIComponent(e)+"/response",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(s))},o).then(q=>new z(q))}},z=class{constructor(e){this.response=e}async result(){return this.response.json()}};var _=class t{constructor(e=t.STANDARD_HEADERS){this._standardHeaders=e}static STANDARD_HEADERS=J;async filter(e){return{...e,headers:{...e.headers,...this._standardHeaders}}}};var E=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/sources/"+encodeURIComponent(e),{...s,method:"GET"},n).then(o=>new k(o))}},k=class{constructor(e){this.response=e}async result(){return this.response.json()}};var T=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/sources",{...e,method:"GET"},s).then(n=>new Y(n))}},Y=class{constructor(e){this.response=e}async result(){return this.response.json()}};var i=class t{static DEFAULT_BASE_URL=w;options;constructor(e,s={}){this.options={requestFilterables:[new _,e],baseURL:process.env.SUPPORT_BASE_URL??t.DEFAULT_BASE_URL,...s}}action={list:new l(this)};channel={list:new d(this)};contact={get:new u(this),list:new m(this)};conversation={get:new g(this),list:new h(this)};label={create:new f(this),get:new y(this),list:new R(this)};message={list:new b(this)};model={get:new O(this),list:new P(this),response:{create:new C(this)},correction:{create:new A(this)}};source={get:new E(this),list:new T(this)};async _filterRequest(e){for(let s of this.options.requestFilterables)e=await s.filter(e);return e}async send(e,s,{fetch:n=fetch}={}){return await n(new Request(new URL(e,this.options.baseURL),await this._filterRequest(s)))}};0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,KeyAuthentication,PublicAuthentication,TokenAuthentication});
1
+ "use strict";var L=Object.defineProperty;var oe=Object.getOwnPropertyDescriptor;var re=Object.getOwnPropertyNames;var ie=Object.prototype.hasOwnProperty;var pe=(t,e)=>{for(var s in e)L(t,s,{get:e[s],enumerable:!0})},ae=(t,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of re(e))!ie.call(t,o)&&o!==s&&L(t,o,{get:()=>e[o],enumerable:!(n=oe(e,o))||n.enumerable});return t};var ce=t=>ae(L({},"__esModule",{value:!0}),t);var le={};pe(le,{Client:()=>i,DEFAULT_SUPPORT_BASE_URL:()=>v,KeyAuthentication:()=>a,PublicAuthentication:()=>l,TokenAuthentication:()=>c,default:()=>i});module.exports=ce(le);var v="https://api.support.greatdetail.com",Z={"X-Powered-By":"GDSupport/JavaScript"},ee="api-key",te="SUPPORT_ACCESS_TOKEN",se="SUPPORT_API_KEY",ne="SUPPORT_KEY_NAME";var a=class t{static DEFAULT_NAME=ee;name;#e;constructor({name:e=process.env[ne]??t.DEFAULT_NAME,key:s=process.env[se]}={}){if(!s)throw new Error("API Key option must be specified when using Key Authentication");this.name=e,this.#e=s}async filter(e){return{...e,headers:{...e.headers,Authorization:`Basic ${btoa(this.name+":"+this.#e)}`}}}};var c=class{#e;constructor({token:e=process.env[te]}={}){if(!e)throw new Error("Access Token option must be specified when using Token Authentication");this.#e=e}async filter(e){return{...e,headers:{...e.headers,Authorization:`Bearer ${this.#e}`}}}};var l=class{async filter(e){return e}};var d=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/actions",{...e,method:"GET"},s).then(n=>new U(n))}},U=class{constructor(e){this.response=e}async result(){return this.response.json()}};var u=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/channels",{...e,method:"GET"},s).then(n=>new N(n))}},N=class{constructor(e){this.response=e}async result(){return this.response.json()}};var m=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/contacts/"+encodeURIComponent(e),{...s,method:"GET"},n).then(o=>new D(o))}},D=class{constructor(e){this.response=e}async result(){return this.response.json()}};var g=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/contacts",{...e,method:"GET"},s).then(n=>new j(n))}},j=class{constructor(e){this.response=e}async result(){return this.response.json()}};var h=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/conversations/"+encodeURIComponent(e),{...s,method:"GET"},n).then(o=>new M(o))}},M=class{constructor(e){this.response=e}async result(){return this.response.json()}};var f=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/conversations",{...e,method:"GET"},s).then(n=>new G(n))}},G=class{constructor(e){this.response=e}async result(){return this.response.json()}};var H=require("zod"),y=class t{constructor(e){this._client=e}static SCHEMA=H.z.object({hasEnded:H.z.boolean()});async send({id:e,body:s,request:n={},...o}){return this._client.send("/v1/conversations/"+encodeURIComponent(e),{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(s))},o).then(p=>new F(p))}},F=class{constructor(e){this.response=e}async result(){return this.response.json()}};var r=require("zod"),R=class t{constructor(e){this._client=e}static SCHEMA=r.z.object({title:r.z.string(),description:r.z.optional(r.z.string()),account:r.z.string()});async send({body:e,request:s={},...n}){return this._client.send("/v1/labels",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(e))},n).then(o=>new K(o))}},K=class{constructor(e){this.response=e}async result(){return this.response.json()}};var b=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/labels/"+encodeURIComponent(e),{...s,method:"GET"},n).then(o=>new V(o))}},V=class{constructor(e){this.response=e}async result(){return this.response.json()}};var x=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/labels",{...e,method:"GET"},s).then(n=>new z(n))}},z=class{constructor(e){this.response=e}async result(){return this.response.json()}};var A=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/conversations/"+encodeURIComponent(e)+"/messages",{...s,method:"GET"},n).then(o=>new B(o))}},B=class{constructor(e){this.response=e}async result(){return this.response.json()}};var O=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/messages",{...e,method:"GET"},s).then(n=>new k(n))}},k=class{constructor(e){this.response=e}async result(){return this.response.json()}};var C=require("zod"),S=class t{constructor(e){this._client=e}static SCHEMA=C.z.object({input:C.z.string().max(65536),original:C.z.string().max(65536),correction:C.z.string().max(65536)});async send({id:e,body:s,request:n={},...o}){return this._client.send("/v1/models/"+encodeURIComponent(e)+"/correction",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(s))},o).then(p=>new Y(p))}},Y=class{constructor(e){this.response=e}async result(){return this.response.json()}};var P=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/models/"+encodeURIComponent(e),{...s,method:"GET"},n).then(o=>new J(o))}},J=class{constructor(e){this.response=e}async result(){return this.response.json()}};var E=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/models",{...e,method:"GET"},s).then(n=>new $(n))}},$=class{constructor(e){this.response=e}async result(){return this.response.json()}};var _=require("zod"),T=class t{constructor(e){this._client=e}static SCHEMA=_.z.array(_.z.object({role:_.z.enum(["user","assistant"]),content:_.z.string().max(65536).nullable()})).min(1);async send({id:e,body:s,request:n={},...o}){return this._client.send("/v1/models/"+encodeURIComponent(e)+"/response",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(s))},o).then(p=>new W(p))}},W=class{constructor(e){this.response=e}async result(){return this.response.json()}};var w=class t{constructor(e=t.STANDARD_HEADERS){this._standardHeaders=e}static STANDARD_HEADERS=Z;async filter(e){return{...e,headers:{...e.headers,...this._standardHeaders}}}};var q=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/sources/"+encodeURIComponent(e),{...s,method:"GET"},n).then(o=>new X(o))}},X=class{constructor(e){this.response=e}async result(){return this.response.json()}};var I=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/sources",{...e,method:"GET"},s).then(n=>new Q(n))}},Q=class{constructor(e){this.response=e}async result(){return this.response.json()}};var i=class t{static DEFAULT_BASE_URL=v;options;constructor(e,s={}){this.options={requestFilterables:[new w,e],baseURL:process.env.SUPPORT_BASE_URL??t.DEFAULT_BASE_URL,...s}}action={list:new d(this)};channel={list:new u(this)};contact={get:new m(this),list:new g(this)};conversation={get:new h(this),list:new f(this),update:new y(this),message:{list:new A(this)}};label={create:new R(this),get:new b(this),list:new x(this)};message={list:new O(this)};model={get:new P(this),list:new E(this),response:{create:new T(this)},correction:{create:new S(this)}};source={get:new q(this),list:new I(this)};async _filterRequest(e){for(let s of this.options.requestFilterables)e=await s.filter(e);return e}async send(e,s,{fetch:n=fetch}={}){return await n(new Request(new URL(e,this.options.baseURL),await this._filterRequest(s)))}};0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,KeyAuthentication,PublicAuthentication,TokenAuthentication});
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as Authentication } from './index-zrmJVCfU.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-zrmJVCfU.cjs';
1
+ import { A as Authentication } from './index-CNLZqmjo.cjs';
2
+ export { C as Client, h as CreateCorrectionResponsePayload, d as CreateLabelResponsePayload, i as CreateResponseResponsePayload, G as GetConversationResponsePayload, L as ListActionsResponsePayload, a as ListChannelsResponsePayload, b as ListContactsResponsePayload, c as ListConversationsResponsePayload, e as ListLabelsResponsePayload, f as ListMessagesResponsePayload, g as ListModelsResponsePayload, j as ListSourcesResponsePayload, R as RequestFilterable, C as default } from './index-CNLZqmjo.cjs';
3
3
  import 'zod';
4
4
 
5
5
  /**
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as Authentication } from './index-zrmJVCfU.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-zrmJVCfU.js';
1
+ import { A as Authentication } from './index-CNLZqmjo.js';
2
+ export { C as Client, h as CreateCorrectionResponsePayload, d as CreateLabelResponsePayload, i as CreateResponseResponsePayload, G as GetConversationResponsePayload, L as ListActionsResponsePayload, a as ListChannelsResponsePayload, b as ListContactsResponsePayload, c as ListConversationsResponsePayload, e as ListLabelsResponsePayload, f as ListMessagesResponsePayload, g as ListModelsResponsePayload, j as ListSourcesResponsePayload, R as RequestFilterable, C as default } from './index-CNLZqmjo.js';
3
3
  import 'zod';
4
4
 
5
5
  /**
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-OVSCTY74.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-3N2R6UO2.js";var t=class s{static DEFAULT_NAME=i;name;#e;constructor({name:e=process.env[p]??s.DEFAULT_NAME,key:r=process.env[a]}={}){if(!r)throw new Error("API Key option must be specified when using Key Authentication");this.name=e,this.#e=r}async filter(e){return{...e,headers:{...e.headers,Authorization:`Basic ${btoa(this.name+":"+this.#e)}`}}}};var o=class{#e;constructor({token:e=process.env[n]}={}){if(!e)throw new Error("Access Token option must be specified when using Token Authentication");this.#e=e}async filter(e){return{...e,headers:{...e.headers,Authorization:`Bearer ${this.#e}`}}}};export{f as Client,l as DEFAULT_SUPPORT_BASE_URL,t as KeyAuthentication,m as PublicAuthentication,o as TokenAuthentication,f as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@great-detail/support-sdk",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "type": "module",
5
5
  "description": "JavaScript SDK for the Great Detail Support System",
6
6
  "author": "Great Detail Ltd <info@greatdetail.com>",
@@ -67,19 +67,20 @@
67
67
  },
68
68
  "devDependencies": {
69
69
  "@changesets/cli": "^2.27.7",
70
- "@great-detail/eslint-config": "^1.0.4",
71
- "@great-detail/prettier-config": "^0.2.4",
70
+ "@great-detail/eslint-config": "^1.0.5",
71
+ "@great-detail/prettier-config": "^0.3.0",
72
72
  "@jest/globals": "^29.7.0",
73
- "@types/node": "^20.14.12",
73
+ "@types/node": "^22.4.2",
74
74
  "cross-env": "^7.0.3",
75
- "eslint": "^8.57.0",
75
+ "eslint": "^9.9.0",
76
76
  "jest": "^29.7.0",
77
77
  "npm-run-all": "^4.1.5",
78
+ "openapi-typescript": "^7.3.0",
78
79
  "prettier": "^3.3.3",
79
- "publint": "^0.2.9",
80
- "ts-jest": "^29.2.3",
80
+ "publint": "^0.2.10",
81
+ "ts-jest": "^29.2.4",
81
82
  "ts-node": "^10.9.2",
82
- "tsup": "^8.2.3",
83
+ "tsup": "^8.2.4",
83
84
  "typescript": "^5.5.4"
84
85
  },
85
86
  "publishConfig": {
@@ -9,4 +9,5 @@
9
9
 
10
10
  import RequestFilterable from "../Request/RequestFilterable.js";
11
11
 
12
- export default interface Authentication extends RequestFilterable {}
12
+ type Authentication = RequestFilterable;
13
+ export default Authentication;
@@ -15,9 +15,11 @@ import GetContactRequest from "../Contact/GetContact.js";
15
15
  import ListContactsRequest from "../Contact/ListContacts.js";
16
16
  import GetConversationRequest from "../Conversation/GetConversation.js";
17
17
  import ListConversationsRequest from "../Conversation/ListConversations.js";
18
+ import UpdateConversationRequest from "../Conversation/UpdateConversation.js";
18
19
  import CreateLabelRequest from "../Label/CreateLabel.js";
19
20
  import GetLabelRequest from "../Label/GetLabel.js";
20
21
  import ListLabelsRequest from "../Label/ListLabels.js";
22
+ import ListConversationMessages from "../Message/ListConversationMessages.js";
21
23
  import ListMessagesRequest from "../Message/ListMessages.js";
22
24
  import CreateCorrectionModelRequest from "../Model/Correction/CreateCorrectionModel.js";
23
25
  import GetModelRequest from "../Model/GetModel.js";
@@ -80,6 +82,10 @@ export default class Client {
80
82
  public conversation = {
81
83
  get: new GetConversationRequest(this),
82
84
  list: new ListConversationsRequest(this),
85
+ update: new UpdateConversationRequest(this),
86
+ message: {
87
+ list: new ListConversationMessages(this),
88
+ },
83
89
  };
84
90
 
85
91
  public label = {
@@ -34,6 +34,7 @@ export default class GetConversationRequest {
34
34
  export type GetConversationResponsePayload = {
35
35
  conversation: {
36
36
  id: string;
37
+ name?: string;
37
38
  hasEnded: boolean;
38
39
  accountChannel: string;
39
40
  createdAt: string;
@@ -33,6 +33,7 @@ export default class ListConversationsRequest {
33
33
  export type ListConversationsResponsePayload = {
34
34
  conversations: {
35
35
  id: string;
36
+ name?: string;
36
37
  hasEnded: boolean;
37
38
  accountChannel: string;
38
39
  createdAt: string;
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Great Detail Support System.
3
+ *
4
+ * @copyright 2024 Great Detail Ltd
5
+ * @author Great Detail Ltd <info@greatdetail.com>
6
+ * @author Dom Webber <dom.webber@greatdetail.com>
7
+ * @see https://greatdetail.com
8
+ */
9
+
10
+ import { z } from "zod";
11
+ import Client, { SendOptions } from "../Client/index.js";
12
+
13
+ export interface Options extends SendOptions {
14
+ id: string;
15
+ body: z.infer<typeof UpdateConversationRequest.SCHEMA>;
16
+ request?: RequestInit;
17
+ }
18
+
19
+ export default class UpdateConversationRequest {
20
+ public static SCHEMA = z.object({
21
+ hasEnded: z.boolean(),
22
+ });
23
+
24
+ constructor(protected _client: Client) {}
25
+
26
+ public async send({ id, body, request = {}, ...options }: Options) {
27
+ return this._client
28
+ .send(
29
+ "/v1/conversations/" + encodeURIComponent(id),
30
+ {
31
+ ...request,
32
+ method: "POST",
33
+ headers: {
34
+ ...request.headers,
35
+ "Content-Type": "application/json",
36
+ },
37
+ body: JSON.stringify(UpdateConversationRequest.SCHEMA.parse(body)),
38
+ },
39
+ options,
40
+ )
41
+ .then((response) => new UpdateConversationResponse(response));
42
+ }
43
+ }
44
+
45
+ export type UpdateConversationResponsePayload = {
46
+ conversation: {
47
+ id: string;
48
+ name?: string;
49
+ hasEnded: boolean;
50
+ accountChannel: string;
51
+ createdAt: string;
52
+ updatedAt: string;
53
+ };
54
+ };
55
+
56
+ export class UpdateConversationResponse {
57
+ constructor(public response: Response) {}
58
+
59
+ public async result(): Promise<UpdateConversationResponsePayload> {
60
+ return this.response.json();
61
+ }
62
+ }
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Great Detail Support System.
3
+ *
4
+ * @copyright 2024 Great Detail Ltd
5
+ * @author Great Detail Ltd <info@greatdetail.com>
6
+ * @author Dom Webber <dom.webber@greatdetail.com>
7
+ * @see https://greatdetail.com
8
+ */
9
+
10
+ import Client, { SendOptions } from "../Client/index.js";
11
+
12
+ export interface Options extends SendOptions {
13
+ id: string;
14
+ request?: RequestInit;
15
+ }
16
+
17
+ export default class ListConversationMessages {
18
+ constructor(protected _client: Client) {}
19
+
20
+ public async send({ id, request = {}, ...options }: Options) {
21
+ return this._client
22
+ .send(
23
+ "/v1/conversations/" + encodeURIComponent(id) + "/messages",
24
+ {
25
+ ...request,
26
+ method: "GET",
27
+ },
28
+ options,
29
+ )
30
+ .then((response) => new ListConversationMessagesResponse(response));
31
+ }
32
+ }
33
+
34
+ export type ListConversationMessagesResponsePayload = {
35
+ messages: {
36
+ id: string;
37
+ role: "user" | "assistant";
38
+ messageStatus: string;
39
+ externalIdentifier?: string;
40
+ conversation: string;
41
+ contact: string;
42
+ messageEvents: {
43
+ id: string;
44
+ messageEventType: string;
45
+ triggeredAt: string;
46
+ createdAt: string;
47
+ updatedAt?: string;
48
+ }[];
49
+ createdAt: string;
50
+ updatedAt: string;
51
+ }[];
52
+ };
53
+
54
+ export class ListConversationMessagesResponse {
55
+ constructor(public response: Response) {}
56
+
57
+ public async result(): Promise<ListConversationMessagesResponsePayload> {
58
+ return this.response.json();
59
+ }
60
+ }
@@ -11,7 +11,7 @@ import { Command } from "commander";
11
11
  import { oraPromise } from "ora";
12
12
  import type { Options as CommandOptions } from "./index.js";
13
13
 
14
- export interface Options extends CommandOptions {}
14
+ export type Options = CommandOptions;
15
15
 
16
16
  export default function actions({ client, ora }: Options) {
17
17
  const command = new Command("actions").description("Actions");
@@ -11,7 +11,7 @@ import { Command } from "commander";
11
11
  import { oraPromise } from "ora";
12
12
  import type { Options as CommandOptions } from "./index.js";
13
13
 
14
- export interface Options extends CommandOptions {}
14
+ export type Options = CommandOptions;
15
15
 
16
16
  export default function channels({ client, ora }: Options) {
17
17
  const command = new Command("channels").description("Channels");
@@ -11,7 +11,7 @@ import { Command } from "commander";
11
11
  import { oraPromise } from "ora";
12
12
  import type { Options as CommandOptions } from "./index.js";
13
13
 
14
- export interface Options extends CommandOptions {}
14
+ export type Options = CommandOptions;
15
15
 
16
16
  export default function contacts({ client, ora }: Options) {
17
17
  const command = new Command("contacts").description("Contacts");
@@ -11,7 +11,7 @@ import { Command } from "commander";
11
11
  import { oraPromise } from "ora";
12
12
  import type { Options as CommandOptions } from "./index.js";
13
13
 
14
- export interface Options extends CommandOptions {}
14
+ export type Options = CommandOptions;
15
15
 
16
16
  export default function conversations({ client, ora }: Options) {
17
17
  const command = new Command("conversations").description("Conversations");
package/src/cli/labels.ts CHANGED
@@ -11,7 +11,7 @@ import { Command } from "commander";
11
11
  import { oraPromise } from "ora";
12
12
  import type { Options as CommandOptions } from "./index.js";
13
13
 
14
- export interface Options extends CommandOptions {}
14
+ export type Options = CommandOptions;
15
15
 
16
16
  export default function labels({ client, ora }: Options) {
17
17
  const command = new Command("labels").description("Labels");
@@ -11,7 +11,7 @@ import { Command } from "commander";
11
11
  import { oraPromise } from "ora";
12
12
  import type { Options as CommandOptions } from "./index.js";
13
13
 
14
- export interface Options extends CommandOptions {}
14
+ export type Options = CommandOptions;
15
15
 
16
16
  export default function messages({ client, ora }: Options) {
17
17
  const command = new Command("messages").description("Messages");
package/src/cli/models.ts CHANGED
@@ -11,7 +11,7 @@ import { Command } from "commander";
11
11
  import { oraPromise } from "ora";
12
12
  import type { Options as CommandOptions } from "./index.js";
13
13
 
14
- export interface Options extends CommandOptions {}
14
+ export type Options = CommandOptions;
15
15
 
16
16
  export default function models({ client, ora }: Options) {
17
17
  const command = new Command("models").description("Models");
@@ -11,7 +11,7 @@ import { Command } from "commander";
11
11
  import { oraPromise } from "ora";
12
12
  import type { Options as CommandOptions } from "./index.js";
13
13
 
14
- export interface Options extends CommandOptions {}
14
+ export type Options = CommandOptions;
15
15
 
16
16
  export default function sources({ client, ora }: Options) {
17
17
  const command = new Command("sources").description("Sources");
@@ -1 +0,0 @@
1
- var B="https://api.support.greatdetail.com",V={"X-Powered-By":"GDSupport/JavaScript"},J="api-key",Y="SUPPORT_ACCESS_TOKEN",k="SUPPORT_API_KEY",W="SUPPORT_KEY_NAME";var _=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 E(n))}},E=class{constructor(t){this.response=t}async result(){return this.response.json()}};var o=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/channels",{...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/contacts",{...t,method:"GET"},s).then(n=>new q(n))}},q=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 T(r))}},T=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/conversations",{...t,method:"GET"},s).then(n=>new I(n))}},I=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as l}from"zod";var d=class e{constructor(t){this._client=t}static SCHEMA=l.object({title:l.string(),description:l.optional(l.string()),account:l.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 U(r))}},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/labels",{...t,method:"GET"},s).then(n=>new v(n))}},v=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 L(n))}},L=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as C}from"zod";var g=class e{constructor(t){this._client=t}static SCHEMA=C.object({input:C.string().max(65536),original:C.string().max(65536),correction:C.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(P=>new D(P))}},D=class{constructor(t){this.response=t}async result(){return this.response.json()}};var h=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/models",{...t,method:"GET"},s).then(n=>new j(n))}},j=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as A}from"zod";var b=class e{constructor(t){this._client=t}static SCHEMA=A.array(A.object({role:A.enum(["user","assistant"]),content:A.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(P=>new G(P))}},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/sources",{...t,method:"GET"},s).then(n=>new N(n))}},N=class{constructor(t){this.response=t}async result(){return this.response.json()}};var f=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 H(r))}},H=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/labels/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new M(r))}},M=class{constructor(t){this.response=t}async result(){return this.response.json()}};var x=class{constructor(t){this._client=t}async send({id:t,request:s={},...n}){return this._client.send("/v1/models/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new F(r))}},F=class{constructor(t){this.response=t}async result(){return this.response.json()}};var O=class e{constructor(t=e.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=V;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var S=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 K(r))}},K=class{constructor(t){this.response=t}async result(){return this.response.json()}};var z=class e{static DEFAULT_BASE_URL=B;options;constructor(t,s={}){this.options={requestFilterables:[new O,t],baseURL:process.env.SUPPORT_BASE_URL??e.DEFAULT_BASE_URL,...s}}action={list:new i(this)};channel={list:new o(this)};contact={get:new f(this),list:new p(this)};conversation={get:new c(this),list:new a(this)};label={create:new d(this),get:new R(this),list:new u(this)};message={list:new m(this)};model={get:new x(this),list:new h(this),response:{create:new b(this)},correction:{create:new g(this)}};source={get:new S(this),list:new y(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{B as a,J as b,Y as c,k as d,W as e,_ as f,z as g};