@great-detail/support-sdk 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ var k="https://api.support.greatdetail.com",W={"X-Powered-By":"GDSupport/JavaScript"},Q="api-key",Z="SUPPORT_ACCESS_TOKEN",$="SUPPORT_API_KEY",ee="SUPPORT_KEY_NAME";var w=class{async filter(e){return e}};var o=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/actions",{...e,method:"GET"},s).then(n=>new q(n))}},q=class{constructor(e){this.response=e}async result(){return this.response.json()}};var p=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/channels",{...e,method:"GET"},s).then(n=>new T(n))}},T=class{constructor(e){this.response=e}async result(){return this.response.json()}};var c=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/contacts",{...e,method:"GET"},s).then(n=>new I(n))}},I=class{constructor(e){this.response=e}async result(){return this.response.json()}};var a=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/conversations/"+encodeURIComponent(e),{...s,method:"GET"},n).then(r=>new v(r))}},v=class{constructor(e){this.response=e}async result(){return this.response.json()}};var l=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/conversations",{...e,method:"GET"},s).then(n=>new U(n))}},U=class{constructor(e){this.response=e}async result(){return this.response.json()}};import{z as d}from"zod";var u=class t{constructor(e){this._client=e}static SCHEMA=d.object({title:d.string(),description:d.optional(d.string()),account:d.string()});async send({body:e,request:s={},...n}){return this._client.send("/v1/labels",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(e))},n).then(r=>new L(r))}},L=class{constructor(e){this.response=e}async result(){return this.response.json()}};var m=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/labels",{...e,method:"GET"},s).then(n=>new j(n))}},j=class{constructor(e){this.response=e}async result(){return this.response.json()}};var g=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/messages",{...e,method:"GET"},s).then(n=>new D(n))}},D=class{constructor(e){this.response=e}async result(){return this.response.json()}};import{z as _}from"zod";var h=class t{constructor(e){this._client=e}static SCHEMA=_.object({input:_.string().max(65536),original:_.string().max(65536),correction:_.string().max(65536)});async send({id:e,body:s,request:n={},...r}){return this._client.send("/v1/models/"+encodeURIComponent(e)+"/correction",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(s))},r).then(i=>new G(i))}},G=class{constructor(e){this.response=e}async result(){return this.response.json()}};var y=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/models",{...e,method:"GET"},s).then(n=>new N(n))}},N=class{constructor(e){this.response=e}async result(){return this.response.json()}};import{z as E}from"zod";var b=class t{constructor(e){this._client=e}static SCHEMA=E.array(E.object({role:E.enum(["user","assistant"]),content:E.string().max(65536).nullable()})).min(1);async send({id:e,body:s,request:n={},...r}){return this._client.send("/v1/models/"+encodeURIComponent(e)+"/response",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(s))},r).then(i=>new H(i))}},H=class{constructor(e){this.response=e}async result(){return this.response.json()}};var f=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/sources",{...e,method:"GET"},s).then(n=>new M(n))}},M=class{constructor(e){this.response=e}async result(){return this.response.json()}};var R=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/contacts/"+encodeURIComponent(e),{...s,method:"GET"},n).then(r=>new F(r))}},F=class{constructor(e){this.response=e}async result(){return this.response.json()}};import{z as X}from"zod";var x=class t{constructor(e){this._client=e}static SCHEMA=X.object({hasEnded:X.boolean()});async send({id:e,body:s,request:n={},...r}){return this._client.send("/v1/conversations/"+encodeURIComponent(e),{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(s))},r).then(i=>new z(i))}},z=class{constructor(e){this.response=e}async result(){return this.response.json()}};var O=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/labels/"+encodeURIComponent(e),{...s,method:"GET"},n).then(r=>new K(r))}},K=class{constructor(e){this.response=e}async result(){return this.response.json()}};var S=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/conversations/"+encodeURIComponent(e)+"/messages",{...s,method:"GET"},n).then(r=>new B(r))}},B=class{constructor(e){this.response=e}async result(){return this.response.json()}};var C=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/models/"+encodeURIComponent(e),{...s,method:"GET"},n).then(r=>new V(r))}},V=class{constructor(e){this.response=e}async result(){return this.response.json()}};var A=class t{constructor(e=t.STANDARD_HEADERS){this._standardHeaders=e}static STANDARD_HEADERS=W;async filter(e){return{...e,headers:{...e.headers,...this._standardHeaders}}}};var P=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/sources/"+encodeURIComponent(e),{...s,method:"GET"},n).then(r=>new J(r))}},J=class{constructor(e){this.response=e}async result(){return this.response.json()}};var Y=class t{static DEFAULT_BASE_URL=k;options;constructor(e,s={}){this.options={requestFilterables:[new A,e],baseURL:process.env.SUPPORT_BASE_URL??t.DEFAULT_BASE_URL,...s}}action={list:new o(this)};channel={list:new p(this)};contact={get:new R(this),list:new c(this)};conversation={get:new a(this),list:new l(this),update:new x(this),message:{list:new S(this)}};label={create:new u(this),get:new O(this),list:new m(this)};message={list:new g(this)};model={get:new C(this),list:new y(this),response:{create:new b(this)},correction:{create:new h(this)}};source={get:new P(this),list:new f(this)};async _filterRequest(e){for(let s of this.options.requestFilterables)e=await s.filter(e);return e}async send(e,s,{fetch:n=fetch}={}){return await n(new Request(new URL(e,this.options.baseURL),await this._filterRequest(s)))}};export{k as a,Q as b,Z as c,$ as d,ee as e,w as f,Y as g};
@@ -1 +1 @@
1
- import{f as 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-3N2R6UO2.js";import{Command as A}from"commander";import{Command as F}from"commander";import{oraPromise as I}from"ora";function a({client:n,ora:s}){let o=new F("actions").description("Actions");return o.addCommand(new F("list").description("List actions").action(async()=>{let t=await I(()=>n.action.list.send(),{...s,text:"Finding actions"});console.log(await t.result())})),o}import{Command as b}from"commander";import{oraPromise as S}from"ora";function m({client:n,ora:s}){let o=new b("channels").description("Channels");return o.addCommand(new b("list").description("List channels").action(async()=>{let t=await S(()=>n.channel.list.send(),{...s,text:"Finding channels"});console.log(await t.result())})),o}import{Command as r}from"commander";import{oraPromise as v}from"ora";function d({client:n,ora:s}){let o=new r("contacts").description("Contacts");return o.addCommand(new r("get").description("Find contact").argument("<contact>","Contact ID").action(async t=>{let i=await v(()=>n.contact.get.send({id:t}),{...s,text:"Finding contact"});console.log(await i.result())})),o.addCommand(new r("list").description("List contacts").action(async()=>{let t=await v(()=>n.contact.list.send(),{...s,text:"Finding contacts"});console.log(await t.result())})),o}import{Command as c}from"commander";import{oraPromise as L}from"ora";function p({client:n,ora:s}){let o=new c("conversations").description("Conversations");return o.addCommand(new c("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async t=>{let i=await L(()=>n.conversation.get.send({id:t}),{...s,text:"Finding conversation"});console.log(await i.result())})),o.addCommand(new c("list").description("List conversations").action(async()=>{let t=await L(()=>n.conversation.list.send(),{...s,text:"Finding conversations"});console.log(await t.result())})),o}import{Command as l}from"commander";import{oraPromise as P}from"ora";function u({client:n,ora:s}){let o=new l("labels").description("Labels");return o.addCommand(new l("get").description("Find label").argument("<label>","Label ID").action(async t=>{let i=await P(()=>n.label.get.send({id:t}),{...s,text:"Finding label"});console.log(await i.result())})),o.addCommand(new l("list").description("List labels").action(async()=>{let t=await P(()=>n.label.list.send(),{...s,text:"Finding labels"});console.log(await t.result())})),o}import{Command as h}from"commander";import{oraPromise as M}from"ora";function f({client:n,ora:s}){let o=new h("messages").description("Messages");return o.addCommand(new h("list").description("List messages").action(async()=>{let t=await M(()=>n.message.list.send(),{...s,text:"Finding messages"});console.log(await t.result())})),o}import{Command as C}from"commander";import{oraPromise as j}from"ora";function g({client:n,ora:s}){let o=new C("models").description("Models");return o.addCommand(new C("get").description("Find model").argument("<model>","Model ID").action(async t=>{let i=await j(()=>n.model.get.send({id:t}),{...s,text:"Finding model"});console.log(await i.result())})),o.addCommand(new C("list").description("List models").action(async()=>{let t=await j(()=>n.model.list.send(),{...s,text:"Finding models"});console.log(await t.result())})),o}import{Command as w}from"commander";import{oraPromise as D}from"ora";function O({client:n,ora:s}){let o=new w("sources").description("Sources");return o.addCommand(new w("get").description("Find source").argument("<source>","Source ID").action(async t=>{let i=await D(()=>n.source.get.send({id:t}),{...s,text:"Finding source"});console.log(await i.result())})),o.addCommand(new w("list").description("List sources").action(async()=>{let t=await D(()=>n.source.list.send(),{...s,text:"Finding sources"});console.log(await t.result())})),o}var e={ora:{spinner:"simpleDotsScrolling"},client:new y(new x)},G=new A("gds").description("Great Detail Support System").addCommand(a(e)).addCommand(m(e)).addCommand(d(e)).addCommand(p(e)).addCommand(u(e)).addCommand(f(e)).addCommand(g(e)).addCommand(O(e)),go=G;export{go as a};
@@ -1 +1 @@
1
- "use strict";var 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 St=Object.getOwnPropertyDescriptor;var At=Object.getOwnPropertyNames;var Pt=Object.prototype.hasOwnProperty;var _t=(n,t)=>{for(var e in t)D(n,e,{get:t[e],enumerable:!0})},Et=(n,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of At(t))!Pt.call(n,o)&&o!==e&&D(n,o,{get:()=>t[o],enumerable:!(s=St(t,o))||s.enumerable});return n};var vt=n=>Et(D({},"__esModule",{value:!0}),n);var Tt={};_t(Tt,{default:()=>It});module.exports=vt(Tt);var wt=require("commander");var p=class{async filter(t){return t}};var c=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/actions",{...t,method:"GET"},e).then(s=>new F(s))}},F=class{constructor(t){this.response=t}async result(){return this.response.json()}};var d=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/channels",{...t,method:"GET"},e).then(s=>new G(s))}},G=class{constructor(t){this.response=t}async result(){return this.response.json()}};var ht="https://api.support.greatdetail.com",Ot={"X-Powered-By":"GDSupport/JavaScript"};var l=class{constructor(t){this._client=t}async send({id:t,request:e={},...s}){return this._client.send("/v1/contacts/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new M(o))}},M=class{constructor(t){this.response=t}async result(){return this.response.json()}};var m=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/contacts",{...t,method:"GET"},e).then(s=>new N(s))}},N=class{constructor(t){this.response=t}async result(){return this.response.json()}};var u=class{constructor(t){this._client=t}async send({id:t,request:e={},...s}){return this._client.send("/v1/conversations/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new H(o))}},H=class{constructor(t){this.response=t}async result(){return this.response.json()}};var g=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/conversations",{...t,method:"GET"},e).then(s=>new z(s))}},z=class{constructor(t){this.response=t}async result(){return this.response.json()}};var K=require("zod"),f=class n{constructor(t){this._client=t}static SCHEMA=K.z.object({hasEnded:K.z.boolean()});async send({id:t,body:e,request:s={},...o}){return this._client.send("/v1/conversations/"+encodeURIComponent(t),{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))},o).then(a=>new B(a))}},B=class{constructor(t){this.response=t}async result(){return this.response.json()}};var r=require("zod"),y=class n{constructor(t){this._client=t}static SCHEMA=r.z.object({title:r.z.string(),description:r.z.optional(r.z.string()),account:r.z.string()});async send({body:t,request:e={},...s}){return this._client.send("/v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(t))},s).then(o=>new V(o))}},V=class{constructor(t){this.response=t}async result(){return this.response.json()}};var x=class{constructor(t){this._client=t}async send({id:t,request:e={},...s}){return this._client.send("/v1/labels/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new J(o))}},J=class{constructor(t){this.response=t}async result(){return this.response.json()}};var h=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/labels",{...t,method:"GET"},e).then(s=>new Y(s))}},Y=class{constructor(t){this.response=t}async result(){return this.response.json()}};var O=class{constructor(t){this._client=t}async send({id:t,request:e={},...s}){return this._client.send("/v1/conversations/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"},s).then(o=>new k(o))}},k=class{constructor(t){this.response=t}async result(){return this.response.json()}};var C=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/messages",{...t,method:"GET"},e).then(s=>new W(s))}},W=class{constructor(t){this.response=t}async result(){return this.response.json()}};var b=require("zod"),R=class n{constructor(t){this._client=t}static SCHEMA=b.z.object({input:b.z.string().max(65536),original:b.z.string().max(65536),correction:b.z.string().max(65536)});async send({id:t,body:e,request:s={},...o}){return this._client.send("/v1/models/"+encodeURIComponent(t)+"/correction",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))},o).then(a=>new X(a))}},X=class{constructor(t){this.response=t}async result(){return this.response.json()}};var w=class{constructor(t){this._client=t}async send({id:t,request:e={},...s}){return this._client.send("/v1/models/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new Q(o))}},Q=class{constructor(t){this.response=t}async result(){return this.response.json()}};var S=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/models",{...t,method:"GET"},e).then(s=>new Z(s))}},Z=class{constructor(t){this.response=t}async result(){return this.response.json()}};var A=require("zod"),P=class n{constructor(t){this._client=t}static SCHEMA=A.z.array(A.z.object({role:A.z.enum(["user","assistant"]),content:A.z.string().max(65536).nullable()})).min(1);async send({id:t,body:e,request:s={},...o}){return this._client.send("/v1/models/"+encodeURIComponent(t)+"/response",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))},o).then(a=>new $(a))}},$=class{constructor(t){this.response=t}async result(){return this.response.json()}};var _=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Ot;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var E=class{constructor(t){this._client=t}async send({id:t,request:e={},...s}){return this._client.send("/v1/sources/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new tt(o))}},tt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var v=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/sources",{...t,method:"GET"},e).then(s=>new et(s))}},et=class{constructor(t){this.response=t}async result(){return this.response.json()}};var q=class n{static DEFAULT_BASE_URL=ht;options;constructor(t,e={}){this.options={requestFilterables:[new _,t],baseURL:process.env.SUPPORT_BASE_URL??n.DEFAULT_BASE_URL,...e}}action={list:new c(this)};channel={list:new d(this)};contact={get:new l(this),list:new m(this)};conversation={get:new u(this),list:new g(this),update:new f(this),message:{list:new O(this)}};label={create:new y(this),get:new x(this),list:new h(this)};message={list:new C(this)};model={get:new w(this),list:new S(this),response:{create:new P(this)},correction:{create:new R(this)}};source={get:new E(this),list:new v(this)};async _filterRequest(t){for(let e of this.options.requestFilterables)t=await e.filter(t);return t}async send(t,e,{fetch:s=fetch}={}){return await s(new Request(new URL(t,this.options.baseURL),await this._filterRequest(e)))}};var nt=require("commander"),Ct=require("ora");function st({client:n,ora:t}){let e=new nt.Command("actions").description("Actions");return e.addCommand(new nt.Command("list").description("List actions").action(async()=>{let s=await(0,Ct.oraPromise)(()=>n.action.list.send(),{...t,text:"Finding actions"});console.log(await s.result())})),e}var ot=require("commander"),bt=require("ora");function it({client:n,ora:t}){let e=new ot.Command("channels").description("Channels");return e.addCommand(new ot.Command("list").description("List channels").action(async()=>{let s=await(0,bt.oraPromise)(()=>n.channel.list.send(),{...t,text:"Finding channels"});console.log(await s.result())})),e}var I=require("commander"),rt=require("ora");function at({client:n,ora:t}){let e=new I.Command("contacts").description("Contacts");return e.addCommand(new I.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async s=>{let o=await(0,rt.oraPromise)(()=>n.contact.get.send({id:s}),{...t,text:"Finding contact"});console.log(await o.result())})),e.addCommand(new I.Command("list").description("List contacts").action(async()=>{let s=await(0,rt.oraPromise)(()=>n.contact.list.send(),{...t,text:"Finding contacts"});console.log(await s.result())})),e}var T=require("commander"),pt=require("ora");function ct({client:n,ora:t}){let e=new T.Command("conversations").description("Conversations");return e.addCommand(new T.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async s=>{let o=await(0,pt.oraPromise)(()=>n.conversation.get.send({id:s}),{...t,text:"Finding conversation"});console.log(await o.result())})),e.addCommand(new T.Command("list").description("List conversations").action(async()=>{let s=await(0,pt.oraPromise)(()=>n.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await s.result())})),e}var L=require("commander"),dt=require("ora");function lt({client:n,ora:t}){let e=new L.Command("labels").description("Labels");return e.addCommand(new L.Command("get").description("Find label").argument("<label>","Label ID").action(async s=>{let o=await(0,dt.oraPromise)(()=>n.label.get.send({id:s}),{...t,text:"Finding label"});console.log(await o.result())})),e.addCommand(new L.Command("list").description("List labels").action(async()=>{let s=await(0,dt.oraPromise)(()=>n.label.list.send(),{...t,text:"Finding labels"});console.log(await s.result())})),e}var mt=require("commander"),Rt=require("ora");function ut({client:n,ora:t}){let e=new mt.Command("messages").description("Messages");return e.addCommand(new mt.Command("list").description("List messages").action(async()=>{let s=await(0,Rt.oraPromise)(()=>n.message.list.send(),{...t,text:"Finding messages"});console.log(await s.result())})),e}var j=require("commander"),gt=require("ora");function ft({client:n,ora:t}){let e=new j.Command("models").description("Models");return e.addCommand(new j.Command("get").description("Find model").argument("<model>","Model ID").action(async s=>{let o=await(0,gt.oraPromise)(()=>n.model.get.send({id:s}),{...t,text:"Finding model"});console.log(await o.result())})),e.addCommand(new j.Command("list").description("List models").action(async()=>{let s=await(0,gt.oraPromise)(()=>n.model.list.send(),{...t,text:"Finding models"});console.log(await s.result())})),e}var U=require("commander"),yt=require("ora");function xt({client:n,ora:t}){let e=new U.Command("sources").description("Sources");return e.addCommand(new U.Command("get").description("Find source").argument("<source>","Source ID").action(async s=>{let o=await(0,yt.oraPromise)(()=>n.source.get.send({id:s}),{...t,text:"Finding source"});console.log(await o.result())})),e.addCommand(new U.Command("list").description("List sources").action(async()=>{let s=await(0,yt.oraPromise)(()=>n.source.list.send(),{...t,text:"Finding sources"});console.log(await s.result())})),e}var i={ora:{spinner:"simpleDotsScrolling"},client:new q(new p)},qt=new wt.Command("gds").description("Great Detail Support System").addCommand(st(i)).addCommand(it(i)).addCommand(at(i)).addCommand(ct(i)).addCommand(lt(i)).addCommand(ut(i)).addCommand(ft(i)).addCommand(xt(i)),It=qt;
@@ -1,5 +1,5 @@
1
1
  import { Command } from 'commander';
2
- import { C as Client } from '../index-ByUz_hOL.cjs';
2
+ import { C as Client } from '../index-CNLZqmjo.cjs';
3
3
  import { Options as Options$1 } from 'ora';
4
4
  import 'zod';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { Command } from 'commander';
2
- import { C as Client } from '../index-ByUz_hOL.js';
2
+ import { C as Client } from '../index-CNLZqmjo.js';
3
3
  import { Options as Options$1 } from 'ora';
4
4
  import 'zod';
5
5
 
package/dist/cli/index.js CHANGED
@@ -1 +1 @@
1
- import{a}from"../chunk-QYWS5WK5.js";import"../chunk-PWDTRAX2.js";export{a as default};
1
+ import{a}from"../chunk-ABALSK3N.js";import"../chunk-3N2R6UO2.js";export{a as default};
package/dist/cli.cjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var 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 xt="https://api.support.greatdetail.com",ht={"X-Powered-By":"GDSupport/JavaScript"};var l=class{constructor(t){this._client=t}async send({id:t,request:e={},...n}){return this._client.send("/v1/contacts/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new G(o))}},G=class{constructor(t){this.response=t}async result(){return this.response.json()}};var m=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/contacts",{...t,method:"GET"},e).then(n=>new M(n))}},M=class{constructor(t){this.response=t}async result(){return this.response.json()}};var u=class{constructor(t){this._client=t}async send({id:t,request:e={},...n}){return this._client.send("/v1/conversations/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new N(o))}},N=class{constructor(t){this.response=t}async result(){return this.response.json()}};var g=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/conversations",{...t,method:"GET"},e).then(n=>new H(n))}},H=class{constructor(t){this.response=t}async result(){return this.response.json()}};var z=require("zod"),f=class s{constructor(t){this._client=t}static SCHEMA=z.z.object({hasEnded:z.z.boolean()});async send({id:t,body:e,request:n={},...o}){return this._client.send("/v1/conversations/"+encodeURIComponent(t),{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(e))},o).then(a=>new K(a))}},K=class{constructor(t){this.response=t}async result(){return this.response.json()}};var r=require("zod"),y=class s{constructor(t){this._client=t}static SCHEMA=r.z.object({title:r.z.string(),description:r.z.optional(r.z.string()),account:r.z.string()});async send({body:t,request:e={},...n}){return this._client.send("/v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(t))},n).then(o=>new B(o))}},B=class{constructor(t){this.response=t}async result(){return this.response.json()}};var x=class{constructor(t){this._client=t}async send({id:t,request:e={},...n}){return this._client.send("/v1/labels/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new V(o))}},V=class{constructor(t){this.response=t}async result(){return this.response.json()}};var h=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/labels",{...t,method:"GET"},e).then(n=>new J(n))}},J=class{constructor(t){this.response=t}async result(){return this.response.json()}};var O=class{constructor(t){this._client=t}async send({id:t,request:e={},...n}){return this._client.send("/v1/conversations/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"},n).then(o=>new Y(o))}},Y=class{constructor(t){this.response=t}async result(){return this.response.json()}};var C=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/messages",{...t,method:"GET"},e).then(n=>new k(n))}},k=class{constructor(t){this.response=t}async result(){return this.response.json()}};var b=require("zod"),R=class s{constructor(t){this._client=t}static SCHEMA=b.z.object({input:b.z.string().max(65536),original:b.z.string().max(65536),correction:b.z.string().max(65536)});async send({id:t,body:e,request:n={},...o}){return this._client.send("/v1/models/"+encodeURIComponent(t)+"/correction",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(e))},o).then(a=>new W(a))}},W=class{constructor(t){this.response=t}async result(){return this.response.json()}};var w=class{constructor(t){this._client=t}async send({id:t,request:e={},...n}){return this._client.send("/v1/models/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new X(o))}},X=class{constructor(t){this.response=t}async result(){return this.response.json()}};var S=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/models",{...t,method:"GET"},e).then(n=>new Q(n))}},Q=class{constructor(t){this.response=t}async result(){return this.response.json()}};var A=require("zod"),P=class s{constructor(t){this._client=t}static SCHEMA=A.z.array(A.z.object({role:A.z.enum(["user","assistant"]),content:A.z.string().max(65536).nullable()})).min(1);async send({id:t,body:e,request:n={},...o}){return this._client.send("/v1/models/"+encodeURIComponent(t)+"/response",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(e))},o).then(a=>new Z(a))}},Z=class{constructor(t){this.response=t}async result(){return this.response.json()}};var _=class s{constructor(t=s.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=ht;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var E=class{constructor(t){this._client=t}async send({id:t,request:e={},...n}){return this._client.send("/v1/sources/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new $(o))}},$=class{constructor(t){this.response=t}async result(){return this.response.json()}};var v=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/sources",{...t,method:"GET"},e).then(n=>new tt(n))}},tt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var q=class s{static DEFAULT_BASE_URL=xt;options;constructor(t,e={}){this.options={requestFilterables:[new _,t],baseURL:process.env.SUPPORT_BASE_URL??s.DEFAULT_BASE_URL,...e}}action={list:new c(this)};channel={list:new d(this)};contact={get:new l(this),list:new m(this)};conversation={get:new u(this),list:new g(this),update:new f(this),message:{list:new O(this)}};label={create:new y(this),get:new x(this),list:new h(this)};message={list:new C(this)};model={get:new w(this),list:new S(this),response:{create:new P(this)},correction:{create:new R(this)}};source={get:new E(this),list:new v(this)};async _filterRequest(t){for(let e of this.options.requestFilterables)t=await e.filter(t);return t}async send(t,e,{fetch:n=fetch}={}){return await n(new Request(new URL(t,this.options.baseURL),await this._filterRequest(e)))}};var et=require("commander"),Ot=require("ora");function nt({client:s,ora:t}){let e=new et.Command("actions").description("Actions");return e.addCommand(new et.Command("list").description("List actions").action(async()=>{let n=await(0,Ot.oraPromise)(()=>s.action.list.send(),{...t,text:"Finding actions"});console.log(await n.result())})),e}var st=require("commander"),Ct=require("ora");function ot({client:s,ora:t}){let e=new st.Command("channels").description("Channels");return e.addCommand(new st.Command("list").description("List channels").action(async()=>{let n=await(0,Ct.oraPromise)(()=>s.channel.list.send(),{...t,text:"Finding channels"});console.log(await n.result())})),e}var I=require("commander"),it=require("ora");function rt({client:s,ora:t}){let e=new I.Command("contacts").description("Contacts");return e.addCommand(new I.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async n=>{let o=await(0,it.oraPromise)(()=>s.contact.get.send({id:n}),{...t,text:"Finding contact"});console.log(await o.result())})),e.addCommand(new I.Command("list").description("List contacts").action(async()=>{let n=await(0,it.oraPromise)(()=>s.contact.list.send(),{...t,text:"Finding contacts"});console.log(await n.result())})),e}var T=require("commander"),at=require("ora");function pt({client:s,ora:t}){let e=new T.Command("conversations").description("Conversations");return e.addCommand(new T.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let o=await(0,at.oraPromise)(()=>s.conversation.get.send({id:n}),{...t,text:"Finding conversation"});console.log(await o.result())})),e.addCommand(new T.Command("list").description("List conversations").action(async()=>{let n=await(0,at.oraPromise)(()=>s.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await n.result())})),e}var L=require("commander"),ct=require("ora");function dt({client:s,ora:t}){let e=new L.Command("labels").description("Labels");return e.addCommand(new L.Command("get").description("Find label").argument("<label>","Label ID").action(async n=>{let o=await(0,ct.oraPromise)(()=>s.label.get.send({id:n}),{...t,text:"Finding label"});console.log(await o.result())})),e.addCommand(new L.Command("list").description("List labels").action(async()=>{let n=await(0,ct.oraPromise)(()=>s.label.list.send(),{...t,text:"Finding labels"});console.log(await n.result())})),e}var lt=require("commander"),bt=require("ora");function mt({client:s,ora:t}){let e=new lt.Command("messages").description("Messages");return e.addCommand(new lt.Command("list").description("List messages").action(async()=>{let n=await(0,bt.oraPromise)(()=>s.message.list.send(),{...t,text:"Finding messages"});console.log(await n.result())})),e}var j=require("commander"),ut=require("ora");function gt({client:s,ora:t}){let e=new j.Command("models").description("Models");return e.addCommand(new j.Command("get").description("Find model").argument("<model>","Model ID").action(async n=>{let o=await(0,ut.oraPromise)(()=>s.model.get.send({id:n}),{...t,text:"Finding model"});console.log(await o.result())})),e.addCommand(new j.Command("list").description("List models").action(async()=>{let n=await(0,ut.oraPromise)(()=>s.model.list.send(),{...t,text:"Finding models"});console.log(await n.result())})),e}var U=require("commander"),ft=require("ora");function yt({client:s,ora:t}){let e=new U.Command("sources").description("Sources");return e.addCommand(new U.Command("get").description("Find source").argument("<source>","Source ID").action(async n=>{let o=await(0,ft.oraPromise)(()=>s.source.get.send({id:n}),{...t,text:"Finding source"});console.log(await o.result())})),e.addCommand(new U.Command("list").description("List sources").action(async()=>{let n=await(0,ft.oraPromise)(()=>s.source.list.send(),{...t,text:"Finding sources"});console.log(await n.result())})),e}var i={ora:{spinner:"simpleDotsScrolling"},client:new q(new p)},St=new Rt.Command("gds").description("Great Detail Support System").addCommand(nt(i)).addCommand(ot(i)).addCommand(rt(i)).addCommand(pt(i)).addCommand(dt(i)).addCommand(mt(i)).addCommand(gt(i)).addCommand(yt(i)),wt=St;wt.parseAsync(process.argv);
package/dist/cli.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{a as r}from"./chunk-QYWS5WK5.js";import"./chunk-PWDTRAX2.js";r.parseAsync(process.argv);
2
+ import{a as r}from"./chunk-ABALSK3N.js";import"./chunk-3N2R6UO2.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,14 +185,14 @@ 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: {
@@ -219,13 +219,13 @@ declare class GetConversationResponse {
219
219
  * @see https://greatdetail.com
220
220
  */
221
221
 
222
- interface Options$b extends SendOptions {
222
+ interface Options$c extends SendOptions {
223
223
  request?: RequestInit;
224
224
  }
225
225
  declare class ListConversationsRequest {
226
226
  protected _client: Client;
227
227
  constructor(_client: Client);
228
- send({ request, ...options }?: Options$b): Promise<ListConversationsResponse>;
228
+ send({ request, ...options }?: Options$c): Promise<ListConversationsResponse>;
229
229
  }
230
230
  type ListConversationsResponsePayload = {
231
231
  conversations: {
@@ -252,7 +252,7 @@ declare class ListConversationsResponse {
252
252
  * @see https://greatdetail.com
253
253
  */
254
254
 
255
- interface Options$a extends SendOptions {
255
+ interface Options$b extends SendOptions {
256
256
  id: string;
257
257
  body: z.infer<typeof UpdateConversationRequest.SCHEMA>;
258
258
  request?: RequestInit;
@@ -267,7 +267,7 @@ declare class UpdateConversationRequest {
267
267
  hasEnded: boolean;
268
268
  }>;
269
269
  constructor(_client: Client);
270
- send({ id, body, request, ...options }: Options$a): Promise<UpdateConversationResponse>;
270
+ send({ id, body, request, ...options }: Options$b): Promise<UpdateConversationResponse>;
271
271
  }
272
272
  type UpdateConversationResponsePayload = {
273
273
  conversation: {
@@ -294,7 +294,7 @@ declare class UpdateConversationResponse {
294
294
  * @see https://greatdetail.com
295
295
  */
296
296
 
297
- interface Options$9 extends SendOptions {
297
+ interface Options$a extends SendOptions {
298
298
  body: z.infer<typeof CreateLabelRequest.SCHEMA>;
299
299
  request?: RequestInit;
300
300
  }
@@ -314,7 +314,7 @@ declare class CreateLabelRequest {
314
314
  description?: string | undefined;
315
315
  }>;
316
316
  constructor(_client: Client);
317
- send({ body, request, ...options }: Options$9): Promise<CreateLabelResponse>;
317
+ send({ body, request, ...options }: Options$a): Promise<CreateLabelResponse>;
318
318
  }
319
319
  type CreateLabelResponsePayload = {
320
320
  label: {
@@ -341,14 +341,14 @@ declare class CreateLabelResponse {
341
341
  * @see https://greatdetail.com
342
342
  */
343
343
 
344
- interface Options$8 extends SendOptions {
344
+ interface Options$9 extends SendOptions {
345
345
  id: string;
346
346
  request?: RequestInit;
347
347
  }
348
348
  declare class GetLabelRequest {
349
349
  protected _client: Client;
350
350
  constructor(_client: Client);
351
- send({ id, request, ...options }: Options$8): Promise<GetLabelResponse>;
351
+ send({ id, request, ...options }: Options$9): Promise<GetLabelResponse>;
352
352
  }
353
353
  type GetLabelResponsePayload = {
354
354
  label: {
@@ -375,13 +375,13 @@ declare class GetLabelResponse {
375
375
  * @see https://greatdetail.com
376
376
  */
377
377
 
378
- interface Options$7 extends SendOptions {
378
+ interface Options$8 extends SendOptions {
379
379
  request?: RequestInit;
380
380
  }
381
381
  declare class ListLabelsRequest {
382
382
  protected _client: Client;
383
383
  constructor(_client: Client);
384
- send({ request, ...options }?: Options$7): Promise<ListLabelsResponse>;
384
+ send({ request, ...options }?: Options$8): Promise<ListLabelsResponse>;
385
385
  }
386
386
  type ListLabelsResponsePayload = {
387
387
  labels: {
@@ -399,6 +399,49 @@ declare class ListLabelsResponse {
399
399
  result(): Promise<ListLabelsResponsePayload>;
400
400
  }
401
401
 
402
+ /**
403
+ * Great Detail Support System.
404
+ *
405
+ * @copyright 2024 Great Detail Ltd
406
+ * @author Great Detail Ltd <info@greatdetail.com>
407
+ * @author Dom Webber <dom.webber@greatdetail.com>
408
+ * @see https://greatdetail.com
409
+ */
410
+
411
+ interface Options$7 extends SendOptions {
412
+ id: string;
413
+ request?: RequestInit;
414
+ }
415
+ declare class ListConversationMessages {
416
+ protected _client: Client;
417
+ constructor(_client: Client);
418
+ send({ id, request, ...options }: Options$7): Promise<ListConversationMessagesResponse>;
419
+ }
420
+ type ListConversationMessagesResponsePayload = {
421
+ messages: {
422
+ id: string;
423
+ role: "user" | "assistant";
424
+ messageStatus: string;
425
+ externalIdentifier?: string;
426
+ conversation: string;
427
+ contact: string;
428
+ messageEvents: {
429
+ id: string;
430
+ messageEventType: string;
431
+ triggeredAt: string;
432
+ createdAt: string;
433
+ updatedAt?: string;
434
+ }[];
435
+ createdAt: string;
436
+ updatedAt: string;
437
+ }[];
438
+ };
439
+ declare class ListConversationMessagesResponse {
440
+ response: Response;
441
+ constructor(response: Response);
442
+ result(): Promise<ListConversationMessagesResponsePayload>;
443
+ }
444
+
402
445
  /**
403
446
  * Great Detail Support System.
404
447
  *
@@ -698,6 +741,9 @@ declare class Client {
698
741
  get: GetConversationRequest;
699
742
  list: ListConversationsRequest;
700
743
  update: UpdateConversationRequest;
744
+ message: {
745
+ list: ListConversationMessages;
746
+ };
701
747
  };
702
748
  label: {
703
749
  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,14 +185,14 @@ 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: {
@@ -219,13 +219,13 @@ declare class GetConversationResponse {
219
219
  * @see https://greatdetail.com
220
220
  */
221
221
 
222
- interface Options$b extends SendOptions {
222
+ interface Options$c extends SendOptions {
223
223
  request?: RequestInit;
224
224
  }
225
225
  declare class ListConversationsRequest {
226
226
  protected _client: Client;
227
227
  constructor(_client: Client);
228
- send({ request, ...options }?: Options$b): Promise<ListConversationsResponse>;
228
+ send({ request, ...options }?: Options$c): Promise<ListConversationsResponse>;
229
229
  }
230
230
  type ListConversationsResponsePayload = {
231
231
  conversations: {
@@ -252,7 +252,7 @@ declare class ListConversationsResponse {
252
252
  * @see https://greatdetail.com
253
253
  */
254
254
 
255
- interface Options$a extends SendOptions {
255
+ interface Options$b extends SendOptions {
256
256
  id: string;
257
257
  body: z.infer<typeof UpdateConversationRequest.SCHEMA>;
258
258
  request?: RequestInit;
@@ -267,7 +267,7 @@ declare class UpdateConversationRequest {
267
267
  hasEnded: boolean;
268
268
  }>;
269
269
  constructor(_client: Client);
270
- send({ id, body, request, ...options }: Options$a): Promise<UpdateConversationResponse>;
270
+ send({ id, body, request, ...options }: Options$b): Promise<UpdateConversationResponse>;
271
271
  }
272
272
  type UpdateConversationResponsePayload = {
273
273
  conversation: {
@@ -294,7 +294,7 @@ declare class UpdateConversationResponse {
294
294
  * @see https://greatdetail.com
295
295
  */
296
296
 
297
- interface Options$9 extends SendOptions {
297
+ interface Options$a extends SendOptions {
298
298
  body: z.infer<typeof CreateLabelRequest.SCHEMA>;
299
299
  request?: RequestInit;
300
300
  }
@@ -314,7 +314,7 @@ declare class CreateLabelRequest {
314
314
  description?: string | undefined;
315
315
  }>;
316
316
  constructor(_client: Client);
317
- send({ body, request, ...options }: Options$9): Promise<CreateLabelResponse>;
317
+ send({ body, request, ...options }: Options$a): Promise<CreateLabelResponse>;
318
318
  }
319
319
  type CreateLabelResponsePayload = {
320
320
  label: {
@@ -341,14 +341,14 @@ declare class CreateLabelResponse {
341
341
  * @see https://greatdetail.com
342
342
  */
343
343
 
344
- interface Options$8 extends SendOptions {
344
+ interface Options$9 extends SendOptions {
345
345
  id: string;
346
346
  request?: RequestInit;
347
347
  }
348
348
  declare class GetLabelRequest {
349
349
  protected _client: Client;
350
350
  constructor(_client: Client);
351
- send({ id, request, ...options }: Options$8): Promise<GetLabelResponse>;
351
+ send({ id, request, ...options }: Options$9): Promise<GetLabelResponse>;
352
352
  }
353
353
  type GetLabelResponsePayload = {
354
354
  label: {
@@ -375,13 +375,13 @@ declare class GetLabelResponse {
375
375
  * @see https://greatdetail.com
376
376
  */
377
377
 
378
- interface Options$7 extends SendOptions {
378
+ interface Options$8 extends SendOptions {
379
379
  request?: RequestInit;
380
380
  }
381
381
  declare class ListLabelsRequest {
382
382
  protected _client: Client;
383
383
  constructor(_client: Client);
384
- send({ request, ...options }?: Options$7): Promise<ListLabelsResponse>;
384
+ send({ request, ...options }?: Options$8): Promise<ListLabelsResponse>;
385
385
  }
386
386
  type ListLabelsResponsePayload = {
387
387
  labels: {
@@ -399,6 +399,49 @@ declare class ListLabelsResponse {
399
399
  result(): Promise<ListLabelsResponsePayload>;
400
400
  }
401
401
 
402
+ /**
403
+ * Great Detail Support System.
404
+ *
405
+ * @copyright 2024 Great Detail Ltd
406
+ * @author Great Detail Ltd <info@greatdetail.com>
407
+ * @author Dom Webber <dom.webber@greatdetail.com>
408
+ * @see https://greatdetail.com
409
+ */
410
+
411
+ interface Options$7 extends SendOptions {
412
+ id: string;
413
+ request?: RequestInit;
414
+ }
415
+ declare class ListConversationMessages {
416
+ protected _client: Client;
417
+ constructor(_client: Client);
418
+ send({ id, request, ...options }: Options$7): Promise<ListConversationMessagesResponse>;
419
+ }
420
+ type ListConversationMessagesResponsePayload = {
421
+ messages: {
422
+ id: string;
423
+ role: "user" | "assistant";
424
+ messageStatus: string;
425
+ externalIdentifier?: string;
426
+ conversation: string;
427
+ contact: string;
428
+ messageEvents: {
429
+ id: string;
430
+ messageEventType: string;
431
+ triggeredAt: string;
432
+ createdAt: string;
433
+ updatedAt?: string;
434
+ }[];
435
+ createdAt: string;
436
+ updatedAt: string;
437
+ }[];
438
+ };
439
+ declare class ListConversationMessagesResponse {
440
+ response: Response;
441
+ constructor(response: Response);
442
+ result(): Promise<ListConversationMessagesResponsePayload>;
443
+ }
444
+
402
445
  /**
403
446
  * Great Detail Support System.
404
447
  *
@@ -698,6 +741,9 @@ declare class Client {
698
741
  get: GetConversationRequest;
699
742
  list: ListConversationsRequest;
700
743
  update: UpdateConversationRequest;
744
+ message: {
745
+ list: ListConversationMessages;
746
+ };
701
747
  };
702
748
  label: {
703
749
  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 oe=Object.getOwnPropertyDescriptor;var re=Object.getOwnPropertyNames;var ie=Object.prototype.hasOwnProperty;var pe=(t,e)=>{for(var s in e)L(t,s,{get:e[s],enumerable:!0})},ae=(t,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of re(e))!ie.call(t,o)&&o!==s&&L(t,o,{get:()=>e[o],enumerable:!(n=oe(e,o))||n.enumerable});return t};var ce=t=>ae(L({},"__esModule",{value:!0}),t);var le={};pe(le,{Client:()=>i,DEFAULT_SUPPORT_BASE_URL:()=>v,KeyAuthentication:()=>a,PublicAuthentication:()=>l,TokenAuthentication:()=>c,default:()=>i});module.exports=ce(le);var v="https://api.support.greatdetail.com",Z={"X-Powered-By":"GDSupport/JavaScript"},ee="api-key",te="SUPPORT_ACCESS_TOKEN",se="SUPPORT_API_KEY",ne="SUPPORT_KEY_NAME";var a=class t{static DEFAULT_NAME=ee;name;#e;constructor({name:e=process.env[ne]??t.DEFAULT_NAME,key:s=process.env[se]}={}){if(!s)throw new Error("API Key option must be specified when using Key Authentication");this.name=e,this.#e=s}async filter(e){return{...e,headers:{...e.headers,Authorization:`Basic ${btoa(this.name+":"+this.#e)}`}}}};var c=class{#e;constructor({token:e=process.env[te]}={}){if(!e)throw new Error("Access Token option must be specified when using Token Authentication");this.#e=e}async filter(e){return{...e,headers:{...e.headers,Authorization:`Bearer ${this.#e}`}}}};var l=class{async filter(e){return e}};var d=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/actions",{...e,method:"GET"},s).then(n=>new U(n))}},U=class{constructor(e){this.response=e}async result(){return this.response.json()}};var u=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/channels",{...e,method:"GET"},s).then(n=>new N(n))}},N=class{constructor(e){this.response=e}async result(){return this.response.json()}};var m=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/contacts/"+encodeURIComponent(e),{...s,method:"GET"},n).then(o=>new D(o))}},D=class{constructor(e){this.response=e}async result(){return this.response.json()}};var g=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/contacts",{...e,method:"GET"},s).then(n=>new j(n))}},j=class{constructor(e){this.response=e}async result(){return this.response.json()}};var h=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/conversations/"+encodeURIComponent(e),{...s,method:"GET"},n).then(o=>new M(o))}},M=class{constructor(e){this.response=e}async result(){return this.response.json()}};var f=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/conversations",{...e,method:"GET"},s).then(n=>new G(n))}},G=class{constructor(e){this.response=e}async result(){return this.response.json()}};var H=require("zod"),y=class t{constructor(e){this._client=e}static SCHEMA=H.z.object({hasEnded:H.z.boolean()});async send({id:e,body:s,request:n={},...o}){return this._client.send("/v1/conversations/"+encodeURIComponent(e),{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(s))},o).then(p=>new F(p))}},F=class{constructor(e){this.response=e}async result(){return this.response.json()}};var r=require("zod"),R=class t{constructor(e){this._client=e}static SCHEMA=r.z.object({title:r.z.string(),description:r.z.optional(r.z.string()),account:r.z.string()});async send({body:e,request:s={},...n}){return this._client.send("/v1/labels",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(e))},n).then(o=>new K(o))}},K=class{constructor(e){this.response=e}async result(){return this.response.json()}};var b=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/labels/"+encodeURIComponent(e),{...s,method:"GET"},n).then(o=>new V(o))}},V=class{constructor(e){this.response=e}async result(){return this.response.json()}};var x=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/labels",{...e,method:"GET"},s).then(n=>new z(n))}},z=class{constructor(e){this.response=e}async result(){return this.response.json()}};var A=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/conversations/"+encodeURIComponent(e)+"/messages",{...s,method:"GET"},n).then(o=>new B(o))}},B=class{constructor(e){this.response=e}async result(){return this.response.json()}};var O=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/messages",{...e,method:"GET"},s).then(n=>new k(n))}},k=class{constructor(e){this.response=e}async result(){return this.response.json()}};var C=require("zod"),S=class t{constructor(e){this._client=e}static SCHEMA=C.z.object({input:C.z.string().max(65536),original:C.z.string().max(65536),correction:C.z.string().max(65536)});async send({id:e,body:s,request:n={},...o}){return this._client.send("/v1/models/"+encodeURIComponent(e)+"/correction",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(s))},o).then(p=>new Y(p))}},Y=class{constructor(e){this.response=e}async result(){return this.response.json()}};var P=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/models/"+encodeURIComponent(e),{...s,method:"GET"},n).then(o=>new J(o))}},J=class{constructor(e){this.response=e}async result(){return this.response.json()}};var E=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/models",{...e,method:"GET"},s).then(n=>new $(n))}},$=class{constructor(e){this.response=e}async result(){return this.response.json()}};var _=require("zod"),T=class t{constructor(e){this._client=e}static SCHEMA=_.z.array(_.z.object({role:_.z.enum(["user","assistant"]),content:_.z.string().max(65536).nullable()})).min(1);async send({id:e,body:s,request:n={},...o}){return this._client.send("/v1/models/"+encodeURIComponent(e)+"/response",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(s))},o).then(p=>new W(p))}},W=class{constructor(e){this.response=e}async result(){return this.response.json()}};var w=class t{constructor(e=t.STANDARD_HEADERS){this._standardHeaders=e}static STANDARD_HEADERS=Z;async filter(e){return{...e,headers:{...e.headers,...this._standardHeaders}}}};var q=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/sources/"+encodeURIComponent(e),{...s,method:"GET"},n).then(o=>new X(o))}},X=class{constructor(e){this.response=e}async result(){return this.response.json()}};var I=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/sources",{...e,method:"GET"},s).then(n=>new Q(n))}},Q=class{constructor(e){this.response=e}async result(){return this.response.json()}};var i=class t{static DEFAULT_BASE_URL=v;options;constructor(e,s={}){this.options={requestFilterables:[new w,e],baseURL:process.env.SUPPORT_BASE_URL??t.DEFAULT_BASE_URL,...s}}action={list:new d(this)};channel={list:new u(this)};contact={get:new m(this),list:new g(this)};conversation={get:new h(this),list:new f(this),update:new y(this),message:{list:new A(this)}};label={create:new R(this),get:new b(this),list:new x(this)};message={list:new O(this)};model={get:new P(this),list:new E(this),response:{create:new T(this)},correction:{create:new S(this)}};source={get:new q(this),list:new I(this)};async _filterRequest(e){for(let s of this.options.requestFilterables)e=await s.filter(e);return e}async send(e,s,{fetch:n=fetch}={}){return await n(new Request(new URL(e,this.options.baseURL),await this._filterRequest(s)))}};0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,KeyAuthentication,PublicAuthentication,TokenAuthentication});
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as Authentication } from './index-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-CNLZqmjo.cjs';
2
+ export { C as Client, h as CreateCorrectionResponsePayload, d as CreateLabelResponsePayload, i as CreateResponseResponsePayload, G as GetConversationResponsePayload, L as ListActionsResponsePayload, a as ListChannelsResponsePayload, b as ListContactsResponsePayload, c as ListConversationsResponsePayload, e as ListLabelsResponsePayload, f as ListMessagesResponsePayload, g as ListModelsResponsePayload, j as ListSourcesResponsePayload, R as RequestFilterable, C as default } from './index-CNLZqmjo.cjs';
3
3
  import 'zod';
4
4
 
5
5
  /**
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as Authentication } from './index-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-CNLZqmjo.js';
2
+ export { C as Client, h as CreateCorrectionResponsePayload, d as CreateLabelResponsePayload, i as CreateResponseResponsePayload, G as GetConversationResponsePayload, L as ListActionsResponsePayload, a as ListChannelsResponsePayload, b as ListContactsResponsePayload, c as ListConversationsResponsePayload, e as ListLabelsResponsePayload, f as ListMessagesResponsePayload, g as ListModelsResponsePayload, j as ListSourcesResponsePayload, R as RequestFilterable, C as default } from './index-CNLZqmjo.js';
3
3
  import 'zod';
4
4
 
5
5
  /**
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{a as l,b as i,c as n,d as a,e as p,f as m,g as f}from"./chunk-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-3N2R6UO2.js";var t=class s{static DEFAULT_NAME=i;name;#e;constructor({name:e=process.env[p]??s.DEFAULT_NAME,key:r=process.env[a]}={}){if(!r)throw new Error("API Key option must be specified when using Key Authentication");this.name=e,this.#e=r}async filter(e){return{...e,headers:{...e.headers,Authorization:`Basic ${btoa(this.name+":"+this.#e)}`}}}};var o=class{#e;constructor({token:e=process.env[n]}={}){if(!e)throw new Error("Access Token option must be specified when using Token Authentication");this.#e=e}async filter(e){return{...e,headers:{...e.headers,Authorization:`Bearer ${this.#e}`}}}};export{f as Client,l as DEFAULT_SUPPORT_BASE_URL,t as KeyAuthentication,m as PublicAuthentication,o as TokenAuthentication,f as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@great-detail/support-sdk",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "type": "module",
5
5
  "description": "JavaScript SDK for the Great Detail Support System",
6
6
  "author": "Great Detail Ltd <info@greatdetail.com>",
@@ -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 = {
@@ -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};