@great-detail/support-sdk 0.0.2 → 0.0.3

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 U="https://api.support.greatdetail.com",v={"X-Powered-By":"GDSupport/JavaScript"},D="api-key";var x=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 O(n))}},O=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/channels",{...e,method:"GET"},s).then(n=>new S(n))}},S=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/contacts",{...e,method:"GET"},s).then(n=>new A(n))}},A=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/conversations/"+encodeURIComponent(e),{...s,method:"GET"},n).then(r=>new C(r))}},C=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/conversations",{...e,method:"GET"},s).then(n=>new _(n))}},_=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/labels",{...e,method:"GET"},s).then(n=>new P(n))}},P=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/messages",{...e,method:"GET"},s).then(n=>new E(n))}},E=class{constructor(e){this.response=e}async result(){return this.response.json()}};import{z as g}from"zod";var d=class t{constructor(e){this._client=e}static SCHEMA=g.object({input:g.string().max(65536),original:g.string().max(65536),correction:g.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(y=>new q(y))}},q=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/models",{...e,method:"GET"},s).then(n=>new w(n))}},w=class{constructor(e){this.response=e}async result(){return this.response.json()}};import{z as R}from"zod";var h=class t{constructor(e){this._client=e}static SCHEMA=R.array(R.object({role:R.enum(["user","assistant"]),content:R.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(y=>new T(y))}},T=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 L(n))}},L=class{constructor(e){this.response=e}async result(){return this.response.json()}};var b=class t{constructor(e=t.STANDARD_HEADERS){this._standardHeaders=e}static STANDARD_HEADERS=v;async filter(e){return{...e,headers:{...e.headers,...this._standardHeaders}}}};var I=class t{static DEFAULT_BASE_URL=U;options;constructor(e,s={}){this.options={requestFilterables:[new b,e],baseURL:process.env.SUPPORT_BASE_URL??t.DEFAULT_BASE_URL,...s}}action={list:new o(this)};channel={list:new i(this)};contact={list:new p(this)};conversation={get:new c(this),list:new a(this)};label={list:new l(this)};message={list:new u(this)};model={list:new m(this),response:{create:new h(this)},correction:{create:new d(this)}};source={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{U as a,D as b,x as c,I as d};
package/dist/cli.cjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var rt=require("commander");var r=class{async filter(t){return t}};var p=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/actions",{...t,method:"GET"},e).then(s=>new S(s))}},S=class{constructor(t){this.response=t}async result(){return this.response.json()}};var a=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/channels",{...t,method:"GET"},e).then(s=>new A(s))}},A=class{constructor(t){this.response=t}async result(){return this.response.json()}};var W="https://api.support.greatdetail.com",Z={"X-Powered-By":"GDSupport/JavaScript"};var c=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/contacts",{...t,method:"GET"},e).then(s=>new _(s))}},_=class{constructor(t){this.response=t}async result(){return this.response.json()}};var d=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(i=>new E(i))}},E=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/conversations",{...t,method:"GET"},e).then(s=>new L(s))}},L=class{constructor(t){this.response=t}async result(){return this.response.json()}};var l=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/labels",{...t,method:"GET"},e).then(s=>new q(s))}},q=class{constructor(t){this.response=t}async result(){return this.response.json()}};var u=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/messages",{...t,method:"GET"},e).then(s=>new v(s))}},v=class{constructor(t){this.response=t}async result(){return this.response.json()}};var f=require("zod"),x=class n{constructor(t){this._client=t}static SCHEMA=f.z.object({input:f.z.string().max(65536),original:f.z.string().max(65536),correction:f.z.string().max(65536)});async send({id:t,body:e,request:s={},...i}){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))},i).then(y=>new P(y))}},P=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/models",{...t,method:"GET"},e).then(s=>new T(s))}},T=class{constructor(t){this.response=t}async result(){return this.response.json()}};var O=require("zod"),h=class n{constructor(t){this._client=t}static SCHEMA=O.z.array(O.z.object({role:O.z.enum(["user","assistant"]),content:O.z.string().max(65536).nullable()})).min(1);async send({id:t,body:e,request:s={},...i}){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))},i).then(y=>new I(y))}},I=class{constructor(t){this.response=t}async result(){return this.response.json()}};var b=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Z;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var C=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/sources",{...t,method:"GET"},e).then(s=>new j(s))}},j=class{constructor(t){this.response=t}async result(){return this.response.json()}};var R=class n{static DEFAULT_BASE_URL=W;options;constructor(t,e={}){this.options={requestFilterables:[new b,t],baseURL:process.env.SUPPORT_BASE_URL??n.DEFAULT_BASE_URL,...e}}action={list:new p(this)};channel={list:new a(this)};contact={list:new c(this)};conversation={get:new d(this),list:new m(this)};label={list:new l(this)};message={list:new u(this)};model={list:new g(this),response:{create:new h(this)},correction:{create:new x(this)}};source={list:new C(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 D=require("commander"),$=require("ora");function U({client:n,ora:t}){let e=new D.Command("actions").description("Actions");return e.addCommand(new D.Command("list").description("List actions").action(async()=>{let s=await(0,$.oraPromise)(()=>n.action.list.send(),{...t,text:"Finding actions"});console.log(await s.result())})),e}var F=require("commander"),tt=require("ora");function H({client:n,ora:t}){let e=new F.Command("channels").description("Channels");return e.addCommand(new F.Command("list").description("List channels").action(async()=>{let s=await(0,tt.oraPromise)(()=>n.channel.list.send(),{...t,text:"Finding channels"});console.log(await s.result())})),e}var G=require("commander"),et=require("ora");function N({client:n,ora:t}){let e=new G.Command("contacts").description("Contacts");return e.addCommand(new G.Command("list").description("List contacts").action(async()=>{let s=await(0,et.oraPromise)(()=>n.contact.list.send(),{...t,text:"Finding contacts"});console.log(await s.result())})),e}var w=require("commander"),M=require("ora");function B({client:n,ora:t}){let e=new w.Command("conversations").description("Conversations");return e.addCommand(new w.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async s=>{let i=await(0,M.oraPromise)(()=>n.conversation.get.send({id:s}),{...t,text:"Finding conversation"});console.log(await i.result())})),e.addCommand(new w.Command("list").description("List conversations").action(async()=>{let s=await(0,M.oraPromise)(()=>n.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await s.result())})),e}var k=require("commander"),nt=require("ora");function z({client:n,ora:t}){let e=new k.Command("labels").description("Labels");return e.addCommand(new k.Command("list").description("List labels").action(async()=>{let s=await(0,nt.oraPromise)(()=>n.label.list.send(),{...t,text:"Finding labels"});console.log(await s.result())})),e}var J=require("commander"),st=require("ora");function K({client:n,ora:t}){let e=new J.Command("messages").description("Messages");return e.addCommand(new J.Command("list").description("List messages").action(async()=>{let s=await(0,st.oraPromise)(()=>n.message.list.send(),{...t,text:"Finding messages"});console.log(await s.result())})),e}var X=require("commander"),ot=require("ora");function Y({client:n,ora:t}){let e=new X.Command("models").description("Models");return e.addCommand(new X.Command("list").description("List models").action(async()=>{let s=await(0,ot.oraPromise)(()=>n.model.list.send(),{...t,text:"Finding models"});console.log(await s.result())})),e}var Q=require("commander"),it=require("ora");function V({client:n,ora:t}){let e=new Q.Command("sources").description("Sources");return e.addCommand(new Q.Command("list").description("List sources").action(async()=>{let s=await(0,it.oraPromise)(()=>n.source.list.send(),{...t,text:"Finding sources"});console.log(await s.result())})),e}var o={ora:{spinner:"simpleDotsScrolling"},client:new R(new r)},at=new rt.Command("gds").description("Great Detail Support System").addCommand(U(o)).addCommand(H(o)).addCommand(N(o)).addCommand(B(o)).addCommand(z(o)).addCommand(K(o)).addCommand(Y(o)).addCommand(V(o)),pt=at;pt.parseAsync(process.argv);
2
+ "use strict";var rt=require("commander");var r=class{async filter(t){return t}};var a=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/actions",{...t,method:"GET"},e).then(s=>new S(s))}},S=class{constructor(t){this.response=t}async result(){return this.response.json()}};var p=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/channels",{...t,method:"GET"},e).then(s=>new A(s))}},A=class{constructor(t){this.response=t}async result(){return this.response.json()}};var W="https://api.support.greatdetail.com",Z={"X-Powered-By":"GDSupport/JavaScript"};var c=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/contacts",{...t,method:"GET"},e).then(s=>new P(s))}},P=class{constructor(t){this.response=t}async result(){return this.response.json()}};var d=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(i=>new _(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={},...e}={}){return this._client.send("/v1/conversations",{...t,method:"GET"},e).then(s=>new E(s))}},E=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/labels",{...t,method:"GET"},e).then(s=>new v(s))}},v=class{constructor(t){this.response=t}async result(){return this.response.json()}};var u=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/messages",{...t,method:"GET"},e).then(s=>new q(s))}},q=class{constructor(t){this.response=t}async result(){return this.response.json()}};var f=require("zod"),x=class n{constructor(t){this._client=t}static SCHEMA=f.z.object({input:f.z.string().max(65536),original:f.z.string().max(65536),correction:f.z.string().max(65536)});async send({id:t,body:e,request:s={},...i}){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))},i).then(w=>new L(w))}},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={},...e}={}){return this._client.send("/v1/models",{...t,method:"GET"},e).then(s=>new T(s))}},T=class{constructor(t){this.response=t}async result(){return this.response.json()}};var O=require("zod"),C=class n{constructor(t){this._client=t}static SCHEMA=O.z.array(O.z.object({role:O.z.enum(["user","assistant"]),content:O.z.string().max(65536).nullable()})).min(1);async send({id:t,body:e,request:s={},...i}){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))},i).then(w=>new I(w))}},I=class{constructor(t){this.response=t}async result(){return this.response.json()}};var h=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Z;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var y=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/sources",{...t,method:"GET"},e).then(s=>new j(s))}},j=class{constructor(t){this.response=t}async result(){return this.response.json()}};var b=class n{static DEFAULT_BASE_URL=W;options;constructor(t,e={}){this.options={requestFilterables:[new h,t],baseURL:process.env.SUPPORT_BASE_URL??n.DEFAULT_BASE_URL,...e}}action={list:new a(this)};channel={list:new p(this)};contact={list:new c(this)};conversation={get:new d(this),list:new l(this)};label={list:new m(this)};message={list:new u(this)};model={list:new g(this),response:{create:new C(this)},correction:{create:new x(this)}};source={list:new y(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 D=require("commander"),$=require("ora");function U({client:n,ora:t}){let e=new D.Command("actions").description("Actions");return e.addCommand(new D.Command("list").description("List actions").action(async()=>{let s=await(0,$.oraPromise)(()=>n.action.list.send(),{...t,text:"Finding actions"});console.log(await s.result())})),e}var F=require("commander"),tt=require("ora");function H({client:n,ora:t}){let e=new F.Command("channels").description("Channels");return e.addCommand(new F.Command("list").description("List channels").action(async()=>{let s=await(0,tt.oraPromise)(()=>n.channel.list.send(),{...t,text:"Finding channels"});console.log(await s.result())})),e}var G=require("commander"),et=require("ora");function M({client:n,ora:t}){let e=new G.Command("contacts").description("Contacts");return e.addCommand(new G.Command("list").description("List contacts").action(async()=>{let s=await(0,et.oraPromise)(()=>n.contact.list.send(),{...t,text:"Finding contacts"});console.log(await s.result())})),e}var R=require("commander"),N=require("ora");function B({client:n,ora:t}){let e=new R.Command("conversations").description("Conversations");return e.addCommand(new R.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async s=>{let i=await(0,N.oraPromise)(()=>n.conversation.get.send({id:s}),{...t,text:"Finding conversation"});console.log(await i.result())})),e.addCommand(new R.Command("list").description("List conversations").action(async()=>{let s=await(0,N.oraPromise)(()=>n.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await s.result())})),e}var k=require("commander"),nt=require("ora");function z({client:n,ora:t}){let e=new k.Command("labels").description("Labels");return e.addCommand(new k.Command("list").description("List labels").action(async()=>{let s=await(0,nt.oraPromise)(()=>n.label.list.send(),{...t,text:"Finding labels"});console.log(await s.result())})),e}var J=require("commander"),st=require("ora");function K({client:n,ora:t}){let e=new J.Command("messages").description("Messages");return e.addCommand(new J.Command("list").description("List messages").action(async()=>{let s=await(0,st.oraPromise)(()=>n.message.list.send(),{...t,text:"Finding messages"});console.log(await s.result())})),e}var X=require("commander"),ot=require("ora");function Y({client:n,ora:t}){let e=new X.Command("models").description("Models");return e.addCommand(new X.Command("list").description("List models").action(async()=>{let s=await(0,ot.oraPromise)(()=>n.model.list.send(),{...t,text:"Finding models"});console.log(await s.result())})),e}var Q=require("commander"),it=require("ora");function V({client:n,ora:t}){let e=new Q.Command("sources").description("Sources");return e.addCommand(new Q.Command("list").description("List sources").action(async()=>{let s=await(0,it.oraPromise)(()=>n.source.list.send(),{...t,text:"Finding sources"});console.log(await s.result())})),e}var o={ora:{spinner:"simpleDotsScrolling"},client:new b(new r)},pt=new rt.Command("gds").description("Great Detail Support System").addCommand(U(o)).addCommand(H(o)).addCommand(M(o)).addCommand(B(o)).addCommand(z(o)).addCommand(K(o)).addCommand(Y(o)).addCommand(V(o)),at=pt;at.parseAsync(process.argv);
package/dist/cli.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{c as u,d as C}from"./chunk-ZLBEVMCE.js";import{Command as I}from"commander";import{Command as O}from"commander";import{oraPromise as h}from"ora";function e({client:n,ora:s}){let o=new O("actions").description("Actions");return o.addCommand(new O("list").description("List actions").action(async()=>{let t=await h(()=>n.action.list.send(),{...s,text:"Finding actions"});console.log(await t.result())})),o}import{Command as x}from"commander";import{oraPromise as j}from"ora";function a({client:n,ora:s}){let o=new x("channels").description("Channels");return o.addCommand(new x("list").description("List channels").action(async()=>{let t=await j(()=>n.channel.list.send(),{...s,text:"Finding channels"});console.log(await t.result())})),o}import{Command as w}from"commander";import{oraPromise as S}from"ora";function r({client:n,ora:s}){let o=new w("contacts").description("Contacts");return o.addCommand(new w("list").description("List contacts").action(async()=>{let t=await S(()=>n.contact.list.send(),{...s,text:"Finding contacts"});console.log(await t.result())})),o}import{Command as m}from"commander";import{oraPromise as g}from"ora";function d({client:n,ora:s}){let o=new m("conversations").description("Conversations");return o.addCommand(new m("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async t=>{let P=await g(()=>n.conversation.get.send({id:t}),{...s,text:"Finding conversation"});console.log(await P.result())})),o.addCommand(new m("list").description("List conversations").action(async()=>{let t=await g(()=>n.conversation.list.send(),{...s,text:"Finding conversations"});console.log(await t.result())})),o}import{Command as y}from"commander";import{oraPromise as A}from"ora";function c({client:n,ora:s}){let o=new y("labels").description("Labels");return o.addCommand(new y("list").description("List labels").action(async()=>{let t=await A(()=>n.label.list.send(),{...s,text:"Finding labels"});console.log(await t.result())})),o}import{Command as v}from"commander";import{oraPromise as D}from"ora";function p({client:n,ora:s}){let o=new v("messages").description("Messages");return o.addCommand(new v("list").description("List messages").action(async()=>{let t=await D(()=>n.message.list.send(),{...s,text:"Finding messages"});console.log(await t.result())})),o}import{Command as F}from"commander";import{oraPromise as M}from"ora";function l({client:n,ora:s}){let o=new F("models").description("Models");return o.addCommand(new F("list").description("List models").action(async()=>{let t=await M(()=>n.model.list.send(),{...s,text:"Finding models"});console.log(await t.result())})),o}import{Command as b}from"commander";import{oraPromise as G}from"ora";function f({client:n,ora:s}){let o=new b("sources").description("Sources");return o.addCommand(new b("list").description("List sources").action(async()=>{let t=await G(()=>n.source.list.send(),{...s,text:"Finding sources"});console.log(await t.result())})),o}var i={ora:{spinner:"simpleDotsScrolling"},client:new C(new u)},k=new I("gds").description("Great Detail Support System").addCommand(e(i)).addCommand(a(i)).addCommand(r(i)).addCommand(d(i)).addCommand(c(i)).addCommand(p(i)).addCommand(l(i)).addCommand(f(i)),L=k;L.parseAsync(process.argv);
2
+ import{c as u,d as C}from"./chunk-LS7DRWDS.js";import{Command as I}from"commander";import{Command as O}from"commander";import{oraPromise as h}from"ora";function e({client:n,ora:s}){let o=new O("actions").description("Actions");return o.addCommand(new O("list").description("List actions").action(async()=>{let t=await h(()=>n.action.list.send(),{...s,text:"Finding actions"});console.log(await t.result())})),o}import{Command as x}from"commander";import{oraPromise as j}from"ora";function a({client:n,ora:s}){let o=new x("channels").description("Channels");return o.addCommand(new x("list").description("List channels").action(async()=>{let t=await j(()=>n.channel.list.send(),{...s,text:"Finding channels"});console.log(await t.result())})),o}import{Command as w}from"commander";import{oraPromise as S}from"ora";function r({client:n,ora:s}){let o=new w("contacts").description("Contacts");return o.addCommand(new w("list").description("List contacts").action(async()=>{let t=await S(()=>n.contact.list.send(),{...s,text:"Finding contacts"});console.log(await t.result())})),o}import{Command as m}from"commander";import{oraPromise as g}from"ora";function d({client:n,ora:s}){let o=new m("conversations").description("Conversations");return o.addCommand(new m("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async t=>{let P=await g(()=>n.conversation.get.send({id:t}),{...s,text:"Finding conversation"});console.log(await P.result())})),o.addCommand(new m("list").description("List conversations").action(async()=>{let t=await g(()=>n.conversation.list.send(),{...s,text:"Finding conversations"});console.log(await t.result())})),o}import{Command as y}from"commander";import{oraPromise as A}from"ora";function c({client:n,ora:s}){let o=new y("labels").description("Labels");return o.addCommand(new y("list").description("List labels").action(async()=>{let t=await A(()=>n.label.list.send(),{...s,text:"Finding labels"});console.log(await t.result())})),o}import{Command as v}from"commander";import{oraPromise as D}from"ora";function p({client:n,ora:s}){let o=new v("messages").description("Messages");return o.addCommand(new v("list").description("List messages").action(async()=>{let t=await D(()=>n.message.list.send(),{...s,text:"Finding messages"});console.log(await t.result())})),o}import{Command as F}from"commander";import{oraPromise as M}from"ora";function l({client:n,ora:s}){let o=new F("models").description("Models");return o.addCommand(new F("list").description("List models").action(async()=>{let t=await M(()=>n.model.list.send(),{...s,text:"Finding models"});console.log(await t.result())})),o}import{Command as b}from"commander";import{oraPromise as G}from"ora";function f({client:n,ora:s}){let o=new b("sources").description("Sources");return o.addCommand(new b("list").description("List sources").action(async()=>{let t=await G(()=>n.source.list.send(),{...s,text:"Finding sources"});console.log(await t.result())})),o}var i={ora:{spinner:"simpleDotsScrolling"},client:new C(new u)},k=new I("gds").description("Great Detail Support System").addCommand(e(i)).addCommand(a(i)).addCommand(r(i)).addCommand(d(i)).addCommand(c(i)).addCommand(p(i)).addCommand(l(i)).addCommand(f(i)),L=k;L.parseAsync(process.argv);
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var E=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var B=Object.prototype.hasOwnProperty;var M=(e,t)=>{for(var s in t)E(e,s,{get:t[s],enumerable:!0})},k=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of G(t))!B.call(e,i)&&i!==s&&E(e,i,{get:()=>t[i],enumerable:!(n=H(t,i))||n.enumerable});return e};var K=e=>k(E({},"__esModule",{value:!0}),e);var z={};M(z,{Client:()=>r,DEFAULT_SUPPORT_BASE_URL:()=>y,KeyAuthentication:()=>o,PublicAuthentication:()=>c,TokenAuthentication:()=>p,default:()=>r});module.exports=K(z);var y="https://api.support.greatdetail.com",N={"X-Powered-By":"GDSupport/JavaScript"},j="api-key";var o=class e{static DEFAULT_NAME=j;name;#t;constructor({name:t=process.env.SUPPORT_KEY_NAME??e.DEFAULT_NAME,key:s=process.env.SUPPORT_API_KEY}={}){if(!s)throw new Error("API Key option must be specified when using Key Authentication");this.name=t,this.#t=s}async filter(t){return{...t,headers:{...t.headers,Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}}};var p=class{#t;constructor({token:t=process.env.SUPPORT_ACCESS_TOKEN}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}async filter(t){return{...t,headers:{...t.headers,Authorization:`Bearer ${this.#t}`}}}};var c=class{async filter(t){return t}};var a=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/actions",{...t,method:"GET"},s).then(n=>new T(n))}},T=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/channels",{...t,method:"GET"},s).then(n=>new C(n))}},C=class{constructor(t){this.response=t}async result(){return this.response.json()}};var u=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/contacts",{...t,method:"GET"},s).then(n=>new w(n))}},w=class{constructor(t){this.response=t}async result(){return this.response.json()}};var d=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(i=>new q(i))}},q=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/conversations",{...t,method:"GET"},s).then(n=>new P(n))}},P=class{constructor(t){this.response=t}async result(){return this.response.json()}};var h=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/labels",{...t,method:"GET"},s).then(n=>new U(n))}},U=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/messages",{...t,method:"GET"},s).then(n=>new I(n))}},I=class{constructor(t){this.response=t}async result(){return this.response.json()}};var b=require("zod"),g=class e{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:s,request:n={},...i}){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))},i).then(_=>new L(_))}},L=class{constructor(t){this.response=t}async result(){return this.response.json()}};var R=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/models",{...t,method:"GET"},s).then(n=>new D(n))}},D=class{constructor(t){this.response=t}async result(){return this.response.json()}};var x=require("zod"),A=class e{constructor(t){this._client=t}static SCHEMA=x.z.array(x.z.object({role:x.z.enum(["user","assistant"]),content:x.z.string().max(65536).nullable()})).min(1);async send({id:t,body:s,request:n={},...i}){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))},i).then(_=>new v(_))}},v=class{constructor(t){this.response=t}async result(){return this.response.json()}};var O=class e{constructor(t=e.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=N;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var S=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/sources",{...t,method:"GET"},s).then(n=>new F(n))}},F=class{constructor(t){this.response=t}async result(){return this.response.json()}};var r=class e{static DEFAULT_BASE_URL=y;options;constructor(t,s={}){this.options={requestFilterables:[new O,t],baseURL:process.env.SUPPORT_BASE_URL??e.DEFAULT_BASE_URL,...s}}action={list:new a(this)};channel={list:new l(this)};contact={list:new u(this)};conversation={get:new d(this),list:new m(this)};label={list:new h(this)};message={list:new f(this)};model={list:new R(this),response:{create:new A(this)},correction:{create:new g(this)}};source={list:new S(this)};async _filterRequest(t){for(let s of this.options.requestFilterables)t=await s.filter(t);return t}async send(t,s,{fetch:n=fetch}={}){return await n(new Request(new URL(t,this.options.baseURL),await this._filterRequest(s)))}};0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,KeyAuthentication,PublicAuthentication,TokenAuthentication});
1
+ "use strict";var C=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var G=Object.prototype.hasOwnProperty;var B=(t,e)=>{for(var s in e)C(t,s,{get:e[s],enumerable:!0})},k=(t,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of H(e))!G.call(t,o)&&o!==s&&C(t,o,{get:()=>e[o],enumerable:!(n=M(e,o))||n.enumerable});return t};var K=t=>k(C({},"__esModule",{value:!0}),t);var z={};B(z,{Client:()=>r,DEFAULT_SUPPORT_BASE_URL:()=>P,KeyAuthentication:()=>i,PublicAuthentication:()=>a,TokenAuthentication:()=>p,default:()=>r});module.exports=K(z);var P="https://api.support.greatdetail.com",N={"X-Powered-By":"GDSupport/JavaScript"},j="api-key";var i=class t{static DEFAULT_NAME=j;name;#e;constructor({name:e=process.env.SUPPORT_KEY_NAME??t.DEFAULT_NAME,key:s=process.env.SUPPORT_API_KEY}={}){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 p=class{#e;constructor({token:e=process.env.SUPPORT_ACCESS_TOKEN}={}){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 a=class{async filter(e){return e}};var c=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/actions",{...e,method:"GET"},s).then(n=>new _(n))}},_=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/channels",{...e,method:"GET"},s).then(n=>new E(n))}},E=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/contacts",{...e,method:"GET"},s).then(n=>new T(n))}},T=class{constructor(e){this.response=e}async result(){return this.response.json()}};var d=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 w(o))}},w=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/conversations",{...e,method:"GET"},s).then(n=>new L(n))}},L=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/labels",{...e,method:"GET"},s).then(n=>new q(n))}},q=class{constructor(e){this.response=e}async result(){return this.response.json()}};var h=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/messages",{...e,method:"GET"},s).then(n=>new U(n))}},U=class{constructor(e){this.response=e}async result(){return this.response.json()}};var y=require("zod"),R=class t{constructor(e){this._client=e}static SCHEMA=y.z.object({input:y.z.string().max(65536),original:y.z.string().max(65536),correction:y.z.string().max(65536)});async send({id: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(S=>new I(S))}},I=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/models",{...e,method:"GET"},s).then(n=>new v(n))}},v=class{constructor(e){this.response=e}async result(){return this.response.json()}};var b=require("zod"),g=class t{constructor(e){this._client=e}static SCHEMA=b.z.array(b.z.object({role:b.z.enum(["user","assistant"]),content:b.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(S=>new D(S))}},D=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=N;async filter(e){return{...e,headers:{...e.headers,...this._standardHeaders}}}};var O=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/sources",{...e,method:"GET"},s).then(n=>new F(n))}},F=class{constructor(e){this.response=e}async result(){return this.response.json()}};var r=class t{static DEFAULT_BASE_URL=P;options;constructor(e,s={}){this.options={requestFilterables:[new A,e],baseURL:process.env.SUPPORT_BASE_URL??t.DEFAULT_BASE_URL,...s}}action={list:new c(this)};channel={list:new l(this)};contact={list:new u(this)};conversation={get:new d(this),list:new m(this)};label={list:new f(this)};message={list:new h(this)};model={list:new x(this),response:{create:new g(this)},correction:{create:new R(this)}};source={list:new O(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
@@ -114,7 +114,7 @@ declare class ListActionsRequest {
114
114
  constructor(_client: Client);
115
115
  send({ request, ...options }?: Options$a): Promise<ListActionsResponse>;
116
116
  }
117
- type ListResponse$9 = {
117
+ type ListActionsResponsePayload = {
118
118
  actions: {
119
119
  id: string;
120
120
  actionStatus: string;
@@ -127,7 +127,7 @@ type ListResponse$9 = {
127
127
  declare class ListActionsResponse {
128
128
  response: Response;
129
129
  constructor(response: Response);
130
- result(): Promise<ListResponse$9>;
130
+ result(): Promise<ListActionsResponsePayload>;
131
131
  }
132
132
 
133
133
  /**
@@ -147,7 +147,7 @@ declare class ListChannelsRequest {
147
147
  constructor(_client: Client);
148
148
  send({ request, ...options }?: Options$9): Promise<ListChannelsResponse>;
149
149
  }
150
- type ListResponse$8 = {
150
+ type ListChannelsResponsePayload = {
151
151
  channels: {
152
152
  id: string;
153
153
  name?: string;
@@ -160,7 +160,7 @@ type ListResponse$8 = {
160
160
  declare class ListChannelsResponse {
161
161
  response: Response;
162
162
  constructor(response: Response);
163
- result(): Promise<ListResponse$8>;
163
+ result(): Promise<ListChannelsResponsePayload>;
164
164
  }
165
165
 
166
166
  /**
@@ -180,7 +180,7 @@ declare class ListContactsRequest {
180
180
  constructor(_client: Client);
181
181
  send({ request, ...options }?: Options$8): Promise<ListContactsResponse>;
182
182
  }
183
- type ListResponse$7 = {
183
+ type ListContactsResponsePayload = {
184
184
  contacts: {
185
185
  id: string;
186
186
  name?: string;
@@ -193,7 +193,7 @@ type ListResponse$7 = {
193
193
  declare class ListContactsResponse {
194
194
  response: Response;
195
195
  constructor(response: Response);
196
- result(): Promise<ListResponse$7>;
196
+ result(): Promise<ListContactsResponsePayload>;
197
197
  }
198
198
 
199
199
  /**
@@ -214,7 +214,7 @@ declare class GetConversationRequest {
214
214
  constructor(_client: Client);
215
215
  send({ id, request, ...options }: Options$7): Promise<GetConversationResponse>;
216
216
  }
217
- type GetResponse = {
217
+ type GetConversationResponsePayload = {
218
218
  conversation: {
219
219
  id: string;
220
220
  hasEnded: boolean;
@@ -226,7 +226,7 @@ type GetResponse = {
226
226
  declare class GetConversationResponse {
227
227
  response: Response;
228
228
  constructor(response: Response);
229
- result(): Promise<GetResponse>;
229
+ result(): Promise<GetConversationResponsePayload>;
230
230
  }
231
231
 
232
232
  /**
@@ -246,7 +246,7 @@ declare class ListConversationsRequest {
246
246
  constructor(_client: Client);
247
247
  send({ request, ...options }?: Options$6): Promise<ListConversationsResponse>;
248
248
  }
249
- type ListResponse$6 = {
249
+ type ListConversationsResponsePayload = {
250
250
  conversations: {
251
251
  id: string;
252
252
  hasEnded: boolean;
@@ -258,7 +258,7 @@ type ListResponse$6 = {
258
258
  declare class ListConversationsResponse {
259
259
  response: Response;
260
260
  constructor(response: Response);
261
- result(): Promise<ListResponse$6>;
261
+ result(): Promise<ListConversationsResponsePayload>;
262
262
  }
263
263
 
264
264
  /**
@@ -278,7 +278,7 @@ declare class ListLabelsRequest {
278
278
  constructor(_client: Client);
279
279
  send({ request, ...options }?: Options$5): Promise<ListLabelsResponse>;
280
280
  }
281
- type ListResponse$5 = {
281
+ type ListLabelsResponsePayload = {
282
282
  labels: {
283
283
  id: string;
284
284
  title: string;
@@ -290,7 +290,7 @@ type ListResponse$5 = {
290
290
  declare class ListLabelsResponse {
291
291
  response: Response;
292
292
  constructor(response: Response);
293
- result(): Promise<ListResponse$5>;
293
+ result(): Promise<ListLabelsResponsePayload>;
294
294
  }
295
295
 
296
296
  /**
@@ -310,7 +310,7 @@ declare class ListMessagesRequest {
310
310
  constructor(_client: Client);
311
311
  send({ request, ...options }?: Options$4): Promise<ListMessagesResponse>;
312
312
  }
313
- type ListResponse$4 = {
313
+ type ListMessagesResponsePayload = {
314
314
  messages: {
315
315
  id: string;
316
316
  role: "user" | "assistant";
@@ -325,7 +325,7 @@ type ListResponse$4 = {
325
325
  declare class ListMessagesResponse {
326
326
  response: Response;
327
327
  constructor(response: Response);
328
- result(): Promise<ListResponse$4>;
328
+ result(): Promise<ListMessagesResponsePayload>;
329
329
  }
330
330
 
331
331
  /**
@@ -360,11 +360,11 @@ declare class CreateCorrectionModelRequest {
360
360
  constructor(_client: Client);
361
361
  send({ id, body, request, ...options }: Options$3): Promise<CreateCorrectionModelResponse>;
362
362
  }
363
- type ListResponse$3 = unknown;
363
+ type CreateCorrectionResponsePayload = unknown;
364
364
  declare class CreateCorrectionModelResponse {
365
365
  response: Response;
366
366
  constructor(response: Response);
367
- result(): Promise<ListResponse$3>;
367
+ result(): Promise<CreateCorrectionResponsePayload>;
368
368
  }
369
369
 
370
370
  /**
@@ -384,7 +384,7 @@ declare class ListModelsRequest {
384
384
  constructor(_client: Client);
385
385
  send({ request, ...options }?: Options$2): Promise<ListModelsResponse>;
386
386
  }
387
- type ListResponse$2 = {
387
+ type ListModelsResponsePayload = {
388
388
  models: {
389
389
  id: string;
390
390
  name: string;
@@ -396,7 +396,7 @@ type ListResponse$2 = {
396
396
  declare class ListModelsResponse {
397
397
  response: Response;
398
398
  constructor(response: Response);
399
- result(): Promise<ListResponse$2>;
399
+ result(): Promise<ListModelsResponsePayload>;
400
400
  }
401
401
 
402
402
  /**
@@ -428,7 +428,7 @@ declare class CreateResponseModelRequest {
428
428
  constructor(_client: Client);
429
429
  send({ id, body, request, ...options }: Options$1): Promise<CreateResponseModelResponse>;
430
430
  }
431
- type ListResponse$1 = {
431
+ type CreateResponseResponsePayload = {
432
432
  message: string | null;
433
433
  debug: {
434
434
  duration: string;
@@ -438,7 +438,7 @@ type ListResponse$1 = {
438
438
  declare class CreateResponseModelResponse {
439
439
  response: Response;
440
440
  constructor(response: Response);
441
- result(): Promise<ListResponse$1>;
441
+ result(): Promise<CreateResponseResponsePayload>;
442
442
  }
443
443
 
444
444
  /**
@@ -458,7 +458,7 @@ declare class ListSourcesRequest {
458
458
  constructor(_client: Client);
459
459
  send({ request, ...options }?: Options): Promise<ListSourcesResponse>;
460
460
  }
461
- type ListResponse = {
461
+ type ListSourcesResponsePayload = {
462
462
  sources: {
463
463
  id: string;
464
464
  name: string;
@@ -470,7 +470,7 @@ type ListResponse = {
470
470
  declare class ListSourcesResponse {
471
471
  response: Response;
472
472
  constructor(response: Response);
473
- result(): Promise<ListResponse>;
473
+ result(): Promise<ListSourcesResponsePayload>;
474
474
  }
475
475
 
476
476
  /**
@@ -538,4 +538,4 @@ declare class Client {
538
538
  send(url: string | URL, request: RequestInit, { fetch: fetchAlternative }?: SendOptions): Promise<Response>;
539
539
  }
540
540
 
541
- export { Client, DEFAULT_SUPPORT_BASE_URL, KeyAuthentication, PublicAuthentication, type RequestFilterable, TokenAuthentication, Client as default };
541
+ export { Client, type CreateCorrectionResponsePayload, type CreateResponseResponsePayload, DEFAULT_SUPPORT_BASE_URL, type GetConversationResponsePayload, KeyAuthentication, type ListActionsResponsePayload, type ListChannelsResponsePayload, type ListContactsResponsePayload, type ListConversationsResponsePayload, type ListLabelsResponsePayload, type ListMessagesResponsePayload, type ListModelsResponsePayload, type ListSourcesResponsePayload, PublicAuthentication, type RequestFilterable, TokenAuthentication, Client as default };
package/dist/index.d.ts CHANGED
@@ -114,7 +114,7 @@ declare class ListActionsRequest {
114
114
  constructor(_client: Client);
115
115
  send({ request, ...options }?: Options$a): Promise<ListActionsResponse>;
116
116
  }
117
- type ListResponse$9 = {
117
+ type ListActionsResponsePayload = {
118
118
  actions: {
119
119
  id: string;
120
120
  actionStatus: string;
@@ -127,7 +127,7 @@ type ListResponse$9 = {
127
127
  declare class ListActionsResponse {
128
128
  response: Response;
129
129
  constructor(response: Response);
130
- result(): Promise<ListResponse$9>;
130
+ result(): Promise<ListActionsResponsePayload>;
131
131
  }
132
132
 
133
133
  /**
@@ -147,7 +147,7 @@ declare class ListChannelsRequest {
147
147
  constructor(_client: Client);
148
148
  send({ request, ...options }?: Options$9): Promise<ListChannelsResponse>;
149
149
  }
150
- type ListResponse$8 = {
150
+ type ListChannelsResponsePayload = {
151
151
  channels: {
152
152
  id: string;
153
153
  name?: string;
@@ -160,7 +160,7 @@ type ListResponse$8 = {
160
160
  declare class ListChannelsResponse {
161
161
  response: Response;
162
162
  constructor(response: Response);
163
- result(): Promise<ListResponse$8>;
163
+ result(): Promise<ListChannelsResponsePayload>;
164
164
  }
165
165
 
166
166
  /**
@@ -180,7 +180,7 @@ declare class ListContactsRequest {
180
180
  constructor(_client: Client);
181
181
  send({ request, ...options }?: Options$8): Promise<ListContactsResponse>;
182
182
  }
183
- type ListResponse$7 = {
183
+ type ListContactsResponsePayload = {
184
184
  contacts: {
185
185
  id: string;
186
186
  name?: string;
@@ -193,7 +193,7 @@ type ListResponse$7 = {
193
193
  declare class ListContactsResponse {
194
194
  response: Response;
195
195
  constructor(response: Response);
196
- result(): Promise<ListResponse$7>;
196
+ result(): Promise<ListContactsResponsePayload>;
197
197
  }
198
198
 
199
199
  /**
@@ -214,7 +214,7 @@ declare class GetConversationRequest {
214
214
  constructor(_client: Client);
215
215
  send({ id, request, ...options }: Options$7): Promise<GetConversationResponse>;
216
216
  }
217
- type GetResponse = {
217
+ type GetConversationResponsePayload = {
218
218
  conversation: {
219
219
  id: string;
220
220
  hasEnded: boolean;
@@ -226,7 +226,7 @@ type GetResponse = {
226
226
  declare class GetConversationResponse {
227
227
  response: Response;
228
228
  constructor(response: Response);
229
- result(): Promise<GetResponse>;
229
+ result(): Promise<GetConversationResponsePayload>;
230
230
  }
231
231
 
232
232
  /**
@@ -246,7 +246,7 @@ declare class ListConversationsRequest {
246
246
  constructor(_client: Client);
247
247
  send({ request, ...options }?: Options$6): Promise<ListConversationsResponse>;
248
248
  }
249
- type ListResponse$6 = {
249
+ type ListConversationsResponsePayload = {
250
250
  conversations: {
251
251
  id: string;
252
252
  hasEnded: boolean;
@@ -258,7 +258,7 @@ type ListResponse$6 = {
258
258
  declare class ListConversationsResponse {
259
259
  response: Response;
260
260
  constructor(response: Response);
261
- result(): Promise<ListResponse$6>;
261
+ result(): Promise<ListConversationsResponsePayload>;
262
262
  }
263
263
 
264
264
  /**
@@ -278,7 +278,7 @@ declare class ListLabelsRequest {
278
278
  constructor(_client: Client);
279
279
  send({ request, ...options }?: Options$5): Promise<ListLabelsResponse>;
280
280
  }
281
- type ListResponse$5 = {
281
+ type ListLabelsResponsePayload = {
282
282
  labels: {
283
283
  id: string;
284
284
  title: string;
@@ -290,7 +290,7 @@ type ListResponse$5 = {
290
290
  declare class ListLabelsResponse {
291
291
  response: Response;
292
292
  constructor(response: Response);
293
- result(): Promise<ListResponse$5>;
293
+ result(): Promise<ListLabelsResponsePayload>;
294
294
  }
295
295
 
296
296
  /**
@@ -310,7 +310,7 @@ declare class ListMessagesRequest {
310
310
  constructor(_client: Client);
311
311
  send({ request, ...options }?: Options$4): Promise<ListMessagesResponse>;
312
312
  }
313
- type ListResponse$4 = {
313
+ type ListMessagesResponsePayload = {
314
314
  messages: {
315
315
  id: string;
316
316
  role: "user" | "assistant";
@@ -325,7 +325,7 @@ type ListResponse$4 = {
325
325
  declare class ListMessagesResponse {
326
326
  response: Response;
327
327
  constructor(response: Response);
328
- result(): Promise<ListResponse$4>;
328
+ result(): Promise<ListMessagesResponsePayload>;
329
329
  }
330
330
 
331
331
  /**
@@ -360,11 +360,11 @@ declare class CreateCorrectionModelRequest {
360
360
  constructor(_client: Client);
361
361
  send({ id, body, request, ...options }: Options$3): Promise<CreateCorrectionModelResponse>;
362
362
  }
363
- type ListResponse$3 = unknown;
363
+ type CreateCorrectionResponsePayload = unknown;
364
364
  declare class CreateCorrectionModelResponse {
365
365
  response: Response;
366
366
  constructor(response: Response);
367
- result(): Promise<ListResponse$3>;
367
+ result(): Promise<CreateCorrectionResponsePayload>;
368
368
  }
369
369
 
370
370
  /**
@@ -384,7 +384,7 @@ declare class ListModelsRequest {
384
384
  constructor(_client: Client);
385
385
  send({ request, ...options }?: Options$2): Promise<ListModelsResponse>;
386
386
  }
387
- type ListResponse$2 = {
387
+ type ListModelsResponsePayload = {
388
388
  models: {
389
389
  id: string;
390
390
  name: string;
@@ -396,7 +396,7 @@ type ListResponse$2 = {
396
396
  declare class ListModelsResponse {
397
397
  response: Response;
398
398
  constructor(response: Response);
399
- result(): Promise<ListResponse$2>;
399
+ result(): Promise<ListModelsResponsePayload>;
400
400
  }
401
401
 
402
402
  /**
@@ -428,7 +428,7 @@ declare class CreateResponseModelRequest {
428
428
  constructor(_client: Client);
429
429
  send({ id, body, request, ...options }: Options$1): Promise<CreateResponseModelResponse>;
430
430
  }
431
- type ListResponse$1 = {
431
+ type CreateResponseResponsePayload = {
432
432
  message: string | null;
433
433
  debug: {
434
434
  duration: string;
@@ -438,7 +438,7 @@ type ListResponse$1 = {
438
438
  declare class CreateResponseModelResponse {
439
439
  response: Response;
440
440
  constructor(response: Response);
441
- result(): Promise<ListResponse$1>;
441
+ result(): Promise<CreateResponseResponsePayload>;
442
442
  }
443
443
 
444
444
  /**
@@ -458,7 +458,7 @@ declare class ListSourcesRequest {
458
458
  constructor(_client: Client);
459
459
  send({ request, ...options }?: Options): Promise<ListSourcesResponse>;
460
460
  }
461
- type ListResponse = {
461
+ type ListSourcesResponsePayload = {
462
462
  sources: {
463
463
  id: string;
464
464
  name: string;
@@ -470,7 +470,7 @@ type ListResponse = {
470
470
  declare class ListSourcesResponse {
471
471
  response: Response;
472
472
  constructor(response: Response);
473
- result(): Promise<ListResponse>;
473
+ result(): Promise<ListSourcesResponsePayload>;
474
474
  }
475
475
 
476
476
  /**
@@ -538,4 +538,4 @@ declare class Client {
538
538
  send(url: string | URL, request: RequestInit, { fetch: fetchAlternative }?: SendOptions): Promise<Response>;
539
539
  }
540
540
 
541
- export { Client, DEFAULT_SUPPORT_BASE_URL, KeyAuthentication, PublicAuthentication, type RequestFilterable, TokenAuthentication, Client as default };
541
+ export { Client, type CreateCorrectionResponsePayload, type CreateResponseResponsePayload, DEFAULT_SUPPORT_BASE_URL, type GetConversationResponsePayload, KeyAuthentication, type ListActionsResponsePayload, type ListChannelsResponsePayload, type ListContactsResponsePayload, type ListConversationsResponsePayload, type ListLabelsResponsePayload, type ListMessagesResponsePayload, type ListModelsResponsePayload, type ListSourcesResponsePayload, PublicAuthentication, type RequestFilterable, TokenAuthentication, Client as default };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{a,b as o,c as u,d as s}from"./chunk-ZLBEVMCE.js";var e=class r{static DEFAULT_NAME=o;name;#t;constructor({name:t=process.env.SUPPORT_KEY_NAME??r.DEFAULT_NAME,key:n=process.env.SUPPORT_API_KEY}={}){if(!n)throw new Error("API Key option must be specified when using Key Authentication");this.name=t,this.#t=n}async filter(t){return{...t,headers:{...t.headers,Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}}};var i=class{#t;constructor({token:t=process.env.SUPPORT_ACCESS_TOKEN}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}async filter(t){return{...t,headers:{...t.headers,Authorization:`Bearer ${this.#t}`}}}};export{s as Client,a as DEFAULT_SUPPORT_BASE_URL,e as KeyAuthentication,u as PublicAuthentication,i as TokenAuthentication,s as default};
1
+ import{a,b as i,c as p,d as n}from"./chunk-LS7DRWDS.js";var t=class s{static DEFAULT_NAME=i;name;#e;constructor({name:e=process.env.SUPPORT_KEY_NAME??s.DEFAULT_NAME,key:r=process.env.SUPPORT_API_KEY}={}){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.SUPPORT_ACCESS_TOKEN}={}){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{n as Client,a as DEFAULT_SUPPORT_BASE_URL,t as KeyAuthentication,p as PublicAuthentication,o as TokenAuthentication,n as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@great-detail/support-sdk",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "type": "module",
5
5
  "description": "JavaScript SDK for the Great Detail Support System",
6
6
  "author": "Great Detail Ltd <info@greatdetail.com>",
@@ -30,7 +30,7 @@ export default class ListActionsRequest {
30
30
  }
31
31
  }
32
32
 
33
- export type ListResponse = {
33
+ export type ListActionsResponsePayload = {
34
34
  actions: {
35
35
  id: string;
36
36
  actionStatus: string;
@@ -44,7 +44,7 @@ export type ListResponse = {
44
44
  export class ListActionsResponse {
45
45
  constructor(public response: Response) {}
46
46
 
47
- public async result(): Promise<ListResponse> {
47
+ public async result(): Promise<ListActionsResponsePayload> {
48
48
  return this.response.json();
49
49
  }
50
50
  }
@@ -30,7 +30,7 @@ export default class ListChannelsRequest {
30
30
  }
31
31
  }
32
32
 
33
- export type ListResponse = {
33
+ export type ListChannelsResponsePayload = {
34
34
  channels: {
35
35
  id: string;
36
36
  name?: string;
@@ -44,7 +44,7 @@ export type ListResponse = {
44
44
  export class ListChannelsResponse {
45
45
  constructor(public response: Response) {}
46
46
 
47
- public async result(): Promise<ListResponse> {
47
+ public async result(): Promise<ListChannelsResponsePayload> {
48
48
  return this.response.json();
49
49
  }
50
50
  }
@@ -30,7 +30,7 @@ export default class ListContactsRequest {
30
30
  }
31
31
  }
32
32
 
33
- export type ListResponse = {
33
+ export type ListContactsResponsePayload = {
34
34
  contacts: {
35
35
  id: string;
36
36
  name?: string;
@@ -44,7 +44,7 @@ export type ListResponse = {
44
44
  export class ListContactsResponse {
45
45
  constructor(public response: Response) {}
46
46
 
47
- public async result(): Promise<ListResponse> {
47
+ public async result(): Promise<ListContactsResponsePayload> {
48
48
  return this.response.json();
49
49
  }
50
50
  }
@@ -31,7 +31,7 @@ export default class GetConversationRequest {
31
31
  }
32
32
  }
33
33
 
34
- export type GetResponse = {
34
+ export type GetConversationResponsePayload = {
35
35
  conversation: {
36
36
  id: string;
37
37
  hasEnded: boolean;
@@ -44,7 +44,7 @@ export type GetResponse = {
44
44
  export class GetConversationResponse {
45
45
  constructor(public response: Response) {}
46
46
 
47
- public async result(): Promise<GetResponse> {
47
+ public async result(): Promise<GetConversationResponsePayload> {
48
48
  return this.response.json();
49
49
  }
50
50
  }
@@ -30,7 +30,7 @@ export default class ListConversationsRequest {
30
30
  }
31
31
  }
32
32
 
33
- export type ListResponse = {
33
+ export type ListConversationsResponsePayload = {
34
34
  conversations: {
35
35
  id: string;
36
36
  hasEnded: boolean;
@@ -43,7 +43,7 @@ export type ListResponse = {
43
43
  export class ListConversationsResponse {
44
44
  constructor(public response: Response) {}
45
45
 
46
- public async result(): Promise<ListResponse> {
46
+ public async result(): Promise<ListConversationsResponsePayload> {
47
47
  return this.response.json();
48
48
  }
49
49
  }
@@ -30,7 +30,7 @@ export default class ListLabelsRequest {
30
30
  }
31
31
  }
32
32
 
33
- export type ListResponse = {
33
+ export type ListLabelsResponsePayload = {
34
34
  labels: {
35
35
  id: string;
36
36
  title: string;
@@ -43,7 +43,7 @@ export type ListResponse = {
43
43
  export class ListLabelsResponse {
44
44
  constructor(public response: Response) {}
45
45
 
46
- public async result(): Promise<ListResponse> {
46
+ public async result(): Promise<ListLabelsResponsePayload> {
47
47
  return this.response.json();
48
48
  }
49
49
  }
@@ -30,7 +30,7 @@ export default class ListMessagesRequest {
30
30
  }
31
31
  }
32
32
 
33
- export type ListResponse = {
33
+ export type ListMessagesResponsePayload = {
34
34
  messages: {
35
35
  id: string;
36
36
  role: "user" | "assistant";
@@ -46,7 +46,7 @@ export type ListResponse = {
46
46
  export class ListMessagesResponse {
47
47
  constructor(public response: Response) {}
48
48
 
49
- public async result(): Promise<ListResponse> {
49
+ public async result(): Promise<ListMessagesResponsePayload> {
50
50
  return this.response.json();
51
51
  }
52
52
  }
@@ -44,12 +44,12 @@ export default class CreateCorrectionModelRequest {
44
44
  }
45
45
  }
46
46
 
47
- export type ListResponse = unknown;
47
+ export type CreateCorrectionResponsePayload = unknown;
48
48
 
49
49
  export class CreateCorrectionModelResponse {
50
50
  constructor(public response: Response) {}
51
51
 
52
- public async result(): Promise<ListResponse> {
52
+ public async result(): Promise<CreateCorrectionResponsePayload> {
53
53
  return this.response.json();
54
54
  }
55
55
  }
@@ -30,7 +30,7 @@ export default class ListModelsRequest {
30
30
  }
31
31
  }
32
32
 
33
- export type ListResponse = {
33
+ export type ListModelsResponsePayload = {
34
34
  models: {
35
35
  id: string;
36
36
  name: string;
@@ -43,7 +43,7 @@ export type ListResponse = {
43
43
  export class ListModelsResponse {
44
44
  constructor(public response: Response) {}
45
45
 
46
- public async result(): Promise<ListResponse> {
46
+ public async result(): Promise<ListModelsResponsePayload> {
47
47
  return this.response.json();
48
48
  }
49
49
  }
@@ -47,7 +47,7 @@ export default class CreateResponseModelRequest {
47
47
  }
48
48
  }
49
49
 
50
- export type ListResponse = {
50
+ export type CreateResponseResponsePayload = {
51
51
  message: string | null;
52
52
  debug: {
53
53
  duration: string;
@@ -58,7 +58,7 @@ export type ListResponse = {
58
58
  export class CreateResponseModelResponse {
59
59
  constructor(public response: Response) {}
60
60
 
61
- public async result(): Promise<ListResponse> {
61
+ public async result(): Promise<CreateResponseResponsePayload> {
62
62
  return this.response.json();
63
63
  }
64
64
  }
@@ -30,7 +30,7 @@ export default class ListSourcesRequest {
30
30
  }
31
31
  }
32
32
 
33
- export type ListResponse = {
33
+ export type ListSourcesResponsePayload = {
34
34
  sources: {
35
35
  id: string;
36
36
  name: string;
@@ -43,7 +43,7 @@ export type ListResponse = {
43
43
  export class ListSourcesResponse {
44
44
  constructor(public response: Response) {}
45
45
 
46
- public async result(): Promise<ListResponse> {
46
+ public async result(): Promise<ListSourcesResponsePayload> {
47
47
  return this.response.json();
48
48
  }
49
49
  }
package/src/index.ts CHANGED
@@ -13,3 +13,14 @@ export { default as TokenAuthentication } from "./Authentication/TokenAuthentica
13
13
  export { default as PublicAuthentication } from "./Authentication/PublicAuthentication.js";
14
14
  export { type default as RequestFilterable } from "./Request/RequestFilterable.js";
15
15
  export { default, default as Client } from "./Client/index.js";
16
+ export { type ListActionsResponsePayload } from "./Action/ListActions.js";
17
+ export { type ListChannelsResponsePayload } from "./Channel/ListChannels.js";
18
+ export { type ListContactsResponsePayload } from "./Contact/ListContacts.js";
19
+ export { type ListConversationsResponsePayload } from "./Conversation/ListConversations.js";
20
+ export { type GetConversationResponsePayload } from "./Conversation/GetConversation.js";
21
+ export { type ListLabelsResponsePayload } from "./Label/ListLabels.js";
22
+ export { type ListMessagesResponsePayload } from "./Message/ListMessages.js";
23
+ export { type ListModelsResponsePayload } from "./Model/ListModels.js";
24
+ export { type CreateCorrectionResponsePayload } from "./Model/Correction/CreateCorrectionModel.js";
25
+ export { type CreateResponseResponsePayload } from "./Model/Response/CreateResponseModel.js";
26
+ export { type ListSourcesResponsePayload } from "./Source/ListSources.js";
@@ -1 +0,0 @@
1
- var P="https://api.support.greatdetail.com",D={"X-Powered-By":"GDSupport/JavaScript"},v="api-key";var O=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 S(n))}},S=class{constructor(t){this.response=t}async result(){return this.response.json()}};var o=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/channels",{...t,method:"GET"},s).then(n=>new y(n))}},y=class{constructor(t){this.response=t}async result(){return this.response.json()}};var p=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/contacts",{...t,method:"GET"},s).then(n=>new A(n))}},A=class{constructor(t){this.response=t}async result(){return this.response.json()}};var c=class{constructor(t){this._client=t}async send({id:t,request:s={},...n}){return this._client.send("/v1/conversations/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new _(r))}},_=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 E(n))}},E=class{constructor(t){this.response=t}async result(){return this.response.json()}};var a=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/labels",{...t,method:"GET"},s).then(n=>new C(n))}},C=class{constructor(t){this.response=t}async result(){return this.response.json()}};var u=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/messages",{...t,method:"GET"},s).then(n=>new q(n))}},q=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as g}from"zod";var d=class e{constructor(t){this._client=t}static SCHEMA=g.object({input:g.string().max(65536),original:g.string().max(65536),correction:g.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(x=>new w(x))}},w=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/models",{...t,method:"GET"},s).then(n=>new T(n))}},T=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as R}from"zod";var h=class e{constructor(t){this._client=t}static SCHEMA=R.array(R.object({role:R.enum(["user","assistant"]),content:R.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(x=>new L(x))}},L=class{constructor(t){this.response=t}async result(){return this.response.json()}};var f=class e{constructor(t=e.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=D;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var b=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/sources",{...t,method:"GET"},s).then(n=>new I(n))}},I=class{constructor(t){this.response=t}async result(){return this.response.json()}};var U=class e{static DEFAULT_BASE_URL=P;options;constructor(t,s={}){this.options={requestFilterables:[new f,t],baseURL:process.env.SUPPORT_BASE_URL??e.DEFAULT_BASE_URL,...s}}action={list:new i(this)};channel={list:new o(this)};contact={list:new p(this)};conversation={get:new c(this),list:new l(this)};label={list:new a(this)};message={list:new u(this)};model={list:new m(this),response:{create:new h(this)},correction:{create:new d(this)}};source={list:new b(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{P as a,v as b,O as c,U as d};