@great-detail/support-sdk 0.0.7 → 0.0.9

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