@great-detail/support-sdk 0.0.6 → 0.0.7
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.
- package/dist/chunk-PWDTRAX2.js +1 -0
- package/dist/{chunk-CQGIX6CO.js → chunk-QYWS5WK5.js} +1 -1
- package/dist/cli/index.cjs +1 -1
- package/dist/cli/index.d.cts +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/{index-zrmJVCfU.d.cts → index-ByUz_hOL.d.cts} +58 -14
- package/dist/{index-zrmJVCfU.d.ts → index-ByUz_hOL.d.ts} +58 -14
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/package.json +9 -8
- package/src/Authentication/index.ts +2 -1
- package/src/Client/index.ts +2 -0
- package/src/Conversation/GetConversation.ts +1 -0
- package/src/Conversation/ListConversations.ts +1 -0
- package/src/Conversation/UpdateConversation.ts +62 -0
- package/src/cli/actions.ts +1 -1
- package/src/cli/channels.ts +1 -1
- package/src/cli/contacts.ts +1 -1
- package/src/cli/conversations.ts +1 -1
- package/src/cli/labels.ts +1 -1
- package/src/cli/messages.ts +1 -1
- package/src/cli/models.ts +1 -1
- package/src/cli/sources.ts +1 -1
- package/dist/chunk-OVSCTY74.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as
|
|
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};
|
package/dist/cli/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var j=Object.defineProperty;var ht=Object.getOwnPropertyDescriptor;var Ct=Object.getOwnPropertyNames;var bt=Object.prototype.hasOwnProperty;var Rt=(n,t)=>{for(var e in t)j(n,e,{get:t[e],enumerable:!0})},wt=(n,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ct(t))!bt.call(n,o)&&o!==e&&j(n,o,{get:()=>t[o],enumerable:!(s=ht(t,o))||s.enumerable});return n};var St=n=>wt(j({},"__esModule",{value:!0}),n);var _t={};Rt(_t,{default:()=>At});module.exports=St(_t);var yt=require("commander");var a=class{async filter(t){return t}};var c=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/actions",{...t,method:"GET"},e).then(s=>new D(s))}},D=class{constructor(t){this.response=t}async result(){return this.response.json()}};var p=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/channels",{...t,method:"GET"},e).then(s=>new U(s))}},U=class{constructor(t){this.response=t}async result(){return this.response.json()}};var ut="https://api.support.greatdetail.com",gt={"X-Powered-By":"GDSupport/JavaScript"};var d=class{constructor(t){this._client=t}async send({id:t,request:e={},...s}){return this._client.send("/v1/contacts/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new F(o))}},F=class{constructor(t){this.response=t}async result(){return this.response.json()}};var l=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/contacts",{...t,method:"GET"},e).then(s=>new G(s))}},G=class{constructor(t){this.response=t}async result(){return this.response.json()}};var m=class{constructor(t){this._client=t}async send({id:t,request:e={},...s}){return this._client.send("/v1/conversations/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new N(o))}},N=class{constructor(t){this.response=t}async result(){return this.response.json()}};var u=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/conversations",{...t,method:"GET"},e).then(s=>new M(s))}},M=class{constructor(t){this.response=t}async result(){return this.response.json()}};var r=require("zod"),g=class n{constructor(t){this._client=t}static SCHEMA=r.z.object({title:r.z.string(),description:r.z.optional(r.z.string()),account:r.z.string()});async send({body:t,request:e={},...s}){return this._client.send("/v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(t))},s).then(o=>new H(o))}},H=class{constructor(t){this.response=t}async result(){return this.response.json()}};var f=class{constructor(t){this._client=t}async send({id:t,request:e={},...s}){return this._client.send("/v1/labels/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new K(o))}},K=class{constructor(t){this.response=t}async result(){return this.response.json()}};var x=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/labels",{...t,method:"GET"},e).then(s=>new z(s))}},z=class{constructor(t){this.response=t}async result(){return this.response.json()}};var O=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/messages",{...t,method:"GET"},e).then(s=>new B(s))}},B=class{constructor(t){this.response=t}async result(){return this.response.json()}};var y=require("zod"),h=class n{constructor(t){this._client=t}static SCHEMA=y.z.object({input:y.z.string().max(65536),original:y.z.string().max(65536),correction:y.z.string().max(65536)});async send({id:t,body:e,request:s={},...o}){return this._client.send("/v1/models/"+encodeURIComponent(t)+"/correction",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))},o).then(L=>new V(L))}},V=class{constructor(t){this.response=t}async result(){return this.response.json()}};var C=class{constructor(t){this._client=t}async send({id:t,request:e={},...s}){return this._client.send("/v1/models/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new J(o))}},J=class{constructor(t){this.response=t}async result(){return this.response.json()}};var b=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/models",{...t,method:"GET"},e).then(s=>new Y(s))}},Y=class{constructor(t){this.response=t}async result(){return this.response.json()}};var R=require("zod"),w=class n{constructor(t){this._client=t}static SCHEMA=R.z.array(R.z.object({role:R.z.enum(["user","assistant"]),content:R.z.string().max(65536).nullable()})).min(1);async send({id:t,body:e,request:s={},...o}){return this._client.send("/v1/models/"+encodeURIComponent(t)+"/response",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))},o).then(L=>new k(L))}},k=class{constructor(t){this.response=t}async result(){return this.response.json()}};var S=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=gt;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var P=class{constructor(t){this._client=t}async send({id:t,request:e={},...s}){return this._client.send("/v1/sources/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new W(o))}},W=class{constructor(t){this.response=t}async result(){return this.response.json()}};var A=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/sources",{...t,method:"GET"},e).then(s=>new X(s))}},X=class{constructor(t){this.response=t}async result(){return this.response.json()}};var _=class n{static DEFAULT_BASE_URL=ut;options;constructor(t,e={}){this.options={requestFilterables:[new S,t],baseURL:process.env.SUPPORT_BASE_URL??n.DEFAULT_BASE_URL,...e}}action={list:new c(this)};channel={list:new p(this)};contact={get:new d(this),list:new l(this)};conversation={get:new m(this),list:new u(this)};label={create:new g(this),get:new f(this),list:new x(this)};message={list:new O(this)};model={get:new C(this),list:new b(this),response:{create:new w(this)},correction:{create:new h(this)}};source={get:new P(this),list:new A(this)};async _filterRequest(t){for(let e of this.options.requestFilterables)t=await e.filter(t);return t}async send(t,e,{fetch:s=fetch}={}){return await s(new Request(new URL(t,this.options.baseURL),await this._filterRequest(e)))}};var Q=require("commander"),ft=require("ora");function Z({client:n,ora:t}){let e=new Q.Command("actions").description("Actions");return e.addCommand(new Q.Command("list").description("List actions").action(async()=>{let s=await(0,ft.oraPromise)(()=>n.action.list.send(),{...t,text:"Finding actions"});console.log(await s.result())})),e}var $=require("commander"),xt=require("ora");function tt({client:n,ora:t}){let e=new $.Command("channels").description("Channels");return e.addCommand(new $.Command("list").description("List channels").action(async()=>{let s=await(0,xt.oraPromise)(()=>n.channel.list.send(),{...t,text:"Finding channels"});console.log(await s.result())})),e}var E=require("commander"),et=require("ora");function nt({client:n,ora:t}){let e=new E.Command("contacts").description("Contacts");return e.addCommand(new E.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async s=>{let o=await(0,et.oraPromise)(()=>n.contact.get.send({id:s}),{...t,text:"Finding contact"});console.log(await o.result())})),e.addCommand(new E.Command("list").description("List contacts").action(async()=>{let s=await(0,et.oraPromise)(()=>n.contact.list.send(),{...t,text:"Finding contacts"});console.log(await s.result())})),e}var q=require("commander"),st=require("ora");function ot({client:n,ora:t}){let e=new q.Command("conversations").description("Conversations");return e.addCommand(new q.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async s=>{let o=await(0,st.oraPromise)(()=>n.conversation.get.send({id:s}),{...t,text:"Finding conversation"});console.log(await o.result())})),e.addCommand(new q.Command("list").description("List conversations").action(async()=>{let s=await(0,st.oraPromise)(()=>n.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await s.result())})),e}var v=require("commander"),it=require("ora");function rt({client:n,ora:t}){let e=new v.Command("labels").description("Labels");return e.addCommand(new v.Command("get").description("Find label").argument("<label>","Label ID").action(async s=>{let o=await(0,it.oraPromise)(()=>n.label.get.send({id:s}),{...t,text:"Finding label"});console.log(await o.result())})),e.addCommand(new v.Command("list").description("List labels").action(async()=>{let s=await(0,it.oraPromise)(()=>n.label.list.send(),{...t,text:"Finding labels"});console.log(await s.result())})),e}var at=require("commander"),Ot=require("ora");function ct({client:n,ora:t}){let e=new at.Command("messages").description("Messages");return e.addCommand(new at.Command("list").description("List messages").action(async()=>{let s=await(0,Ot.oraPromise)(()=>n.message.list.send(),{...t,text:"Finding messages"});console.log(await s.result())})),e}var I=require("commander"),pt=require("ora");function dt({client:n,ora:t}){let e=new I.Command("models").description("Models");return e.addCommand(new I.Command("get").description("Find model").argument("<model>","Model ID").action(async s=>{let o=await(0,pt.oraPromise)(()=>n.model.get.send({id:s}),{...t,text:"Finding model"});console.log(await o.result())})),e.addCommand(new I.Command("list").description("List models").action(async()=>{let s=await(0,pt.oraPromise)(()=>n.model.list.send(),{...t,text:"Finding models"});console.log(await s.result())})),e}var T=require("commander"),lt=require("ora");function mt({client:n,ora:t}){let e=new T.Command("sources").description("Sources");return e.addCommand(new T.Command("get").description("Find source").argument("<source>","Source ID").action(async s=>{let o=await(0,lt.oraPromise)(()=>n.source.get.send({id:s}),{...t,text:"Finding source"});console.log(await o.result())})),e.addCommand(new T.Command("list").description("List sources").action(async()=>{let s=await(0,lt.oraPromise)(()=>n.source.list.send(),{...t,text:"Finding sources"});console.log(await s.result())})),e}var i={ora:{spinner:"simpleDotsScrolling"},client:new _(new a)},Pt=new yt.Command("gds").description("Great Detail Support System").addCommand(Z(i)).addCommand(tt(i)).addCommand(nt(i)).addCommand(ot(i)).addCommand(rt(i)).addCommand(ct(i)).addCommand(dt(i)).addCommand(mt(i)),At=Pt;
|
|
1
|
+
"use strict";var 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;
|
package/dist/cli/index.d.cts
CHANGED
package/dist/cli/index.d.ts
CHANGED
package/dist/cli/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-QYWS5WK5.js";import"../chunk-PWDTRAX2.js";export{a as default};
|
package/dist/cli.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var Ot=require("commander");var a=class{async filter(t){return t}};var c=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/actions",{...t,method:"GET"},e).then(n=>new j(n))}},j=class{constructor(t){this.response=t}async result(){return this.response.json()}};var p=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/channels",{...t,method:"GET"},e).then(n=>new D(n))}},D=class{constructor(t){this.response=t}async result(){return this.response.json()}};var mt="https://api.support.greatdetail.com",ut={"X-Powered-By":"GDSupport/JavaScript"};var d=class{constructor(t){this._client=t}async send({id:t,request:e={},...n}){return this._client.send("/v1/contacts/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new U(o))}},U=class{constructor(t){this.response=t}async result(){return this.response.json()}};var l=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/contacts",{...t,method:"GET"},e).then(n=>new F(n))}},F=class{constructor(t){this.response=t}async result(){return this.response.json()}};var m=class{constructor(t){this._client=t}async send({id:t,request:e={},...n}){return this._client.send("/v1/conversations/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new G(o))}},G=class{constructor(t){this.response=t}async result(){return this.response.json()}};var u=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/conversations",{...t,method:"GET"},e).then(n=>new N(n))}},N=class{constructor(t){this.response=t}async result(){return this.response.json()}};var r=require("zod"),g=class s{constructor(t){this._client=t}static SCHEMA=r.z.object({title:r.z.string(),description:r.z.optional(r.z.string()),account:r.z.string()});async send({body:t,request:e={},...n}){return this._client.send("/v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(t))},n).then(o=>new M(o))}},M=class{constructor(t){this.response=t}async result(){return this.response.json()}};var f=class{constructor(t){this._client=t}async send({id:t,request:e={},...n}){return this._client.send("/v1/labels/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new H(o))}},H=class{constructor(t){this.response=t}async result(){return this.response.json()}};var x=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/labels",{...t,method:"GET"},e).then(n=>new K(n))}},K=class{constructor(t){this.response=t}async result(){return this.response.json()}};var O=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/messages",{...t,method:"GET"},e).then(n=>new z(n))}},z=class{constructor(t){this.response=t}async result(){return this.response.json()}};var y=require("zod"),h=class s{constructor(t){this._client=t}static SCHEMA=y.z.object({input:y.z.string().max(65536),original:y.z.string().max(65536),correction:y.z.string().max(65536)});async send({id:t,body:e,request:n={},...o}){return this._client.send("/v1/models/"+encodeURIComponent(t)+"/correction",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(e))},o).then(L=>new B(L))}},B=class{constructor(t){this.response=t}async result(){return this.response.json()}};var C=class{constructor(t){this._client=t}async send({id:t,request:e={},...n}){return this._client.send("/v1/models/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new V(o))}},V=class{constructor(t){this.response=t}async result(){return this.response.json()}};var b=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/models",{...t,method:"GET"},e).then(n=>new J(n))}},J=class{constructor(t){this.response=t}async result(){return this.response.json()}};var R=require("zod"),w=class s{constructor(t){this._client=t}static SCHEMA=R.z.array(R.z.object({role:R.z.enum(["user","assistant"]),content:R.z.string().max(65536).nullable()})).min(1);async send({id:t,body:e,request:n={},...o}){return this._client.send("/v1/models/"+encodeURIComponent(t)+"/response",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(e))},o).then(L=>new Y(L))}},Y=class{constructor(t){this.response=t}async result(){return this.response.json()}};var S=class s{constructor(t=s.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=ut;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var A=class{constructor(t){this._client=t}async send({id:t,request:e={},...n}){return this._client.send("/v1/sources/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new k(o))}},k=class{constructor(t){this.response=t}async result(){return this.response.json()}};var P=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/sources",{...t,method:"GET"},e).then(n=>new W(n))}},W=class{constructor(t){this.response=t}async result(){return this.response.json()}};var _=class s{static DEFAULT_BASE_URL=mt;options;constructor(t,e={}){this.options={requestFilterables:[new S,t],baseURL:process.env.SUPPORT_BASE_URL??s.DEFAULT_BASE_URL,...e}}action={list:new c(this)};channel={list:new p(this)};contact={get:new d(this),list:new l(this)};conversation={get:new m(this),list:new u(this)};label={create:new g(this),get:new f(this),list:new x(this)};message={list:new O(this)};model={get:new C(this),list:new b(this),response:{create:new w(this)},correction:{create:new h(this)}};source={get:new A(this),list:new P(this)};async _filterRequest(t){for(let e of this.options.requestFilterables)t=await e.filter(t);return t}async send(t,e,{fetch:n=fetch}={}){return await n(new Request(new URL(t,this.options.baseURL),await this._filterRequest(e)))}};var X=require("commander"),gt=require("ora");function Q({client:s,ora:t}){let e=new X.Command("actions").description("Actions");return e.addCommand(new X.Command("list").description("List actions").action(async()=>{let n=await(0,gt.oraPromise)(()=>s.action.list.send(),{...t,text:"Finding actions"});console.log(await n.result())})),e}var Z=require("commander"),ft=require("ora");function $({client:s,ora:t}){let e=new Z.Command("channels").description("Channels");return e.addCommand(new Z.Command("list").description("List channels").action(async()=>{let n=await(0,ft.oraPromise)(()=>s.channel.list.send(),{...t,text:"Finding channels"});console.log(await n.result())})),e}var E=require("commander"),tt=require("ora");function et({client:s,ora:t}){let e=new E.Command("contacts").description("Contacts");return e.addCommand(new E.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async n=>{let o=await(0,tt.oraPromise)(()=>s.contact.get.send({id:n}),{...t,text:"Finding contact"});console.log(await o.result())})),e.addCommand(new E.Command("list").description("List contacts").action(async()=>{let n=await(0,tt.oraPromise)(()=>s.contact.list.send(),{...t,text:"Finding contacts"});console.log(await n.result())})),e}var q=require("commander"),nt=require("ora");function st({client:s,ora:t}){let e=new q.Command("conversations").description("Conversations");return e.addCommand(new q.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let o=await(0,nt.oraPromise)(()=>s.conversation.get.send({id:n}),{...t,text:"Finding conversation"});console.log(await o.result())})),e.addCommand(new q.Command("list").description("List conversations").action(async()=>{let n=await(0,nt.oraPromise)(()=>s.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await n.result())})),e}var v=require("commander"),ot=require("ora");function it({client:s,ora:t}){let e=new v.Command("labels").description("Labels");return e.addCommand(new v.Command("get").description("Find label").argument("<label>","Label ID").action(async n=>{let o=await(0,ot.oraPromise)(()=>s.label.get.send({id:n}),{...t,text:"Finding label"});console.log(await o.result())})),e.addCommand(new v.Command("list").description("List labels").action(async()=>{let n=await(0,ot.oraPromise)(()=>s.label.list.send(),{...t,text:"Finding labels"});console.log(await n.result())})),e}var rt=require("commander"),xt=require("ora");function at({client:s,ora:t}){let e=new rt.Command("messages").description("Messages");return e.addCommand(new rt.Command("list").description("List messages").action(async()=>{let n=await(0,xt.oraPromise)(()=>s.message.list.send(),{...t,text:"Finding messages"});console.log(await n.result())})),e}var I=require("commander"),ct=require("ora");function pt({client:s,ora:t}){let e=new I.Command("models").description("Models");return e.addCommand(new I.Command("get").description("Find model").argument("<model>","Model ID").action(async n=>{let o=await(0,ct.oraPromise)(()=>s.model.get.send({id:n}),{...t,text:"Finding model"});console.log(await o.result())})),e.addCommand(new I.Command("list").description("List models").action(async()=>{let n=await(0,ct.oraPromise)(()=>s.model.list.send(),{...t,text:"Finding models"});console.log(await n.result())})),e}var T=require("commander"),dt=require("ora");function lt({client:s,ora:t}){let e=new T.Command("sources").description("Sources");return e.addCommand(new T.Command("get").description("Find source").argument("<source>","Source ID").action(async n=>{let o=await(0,dt.oraPromise)(()=>s.source.get.send({id:n}),{...t,text:"Finding source"});console.log(await o.result())})),e.addCommand(new T.Command("list").description("List sources").action(async()=>{let n=await(0,dt.oraPromise)(()=>s.source.list.send(),{...t,text:"Finding sources"});console.log(await n.result())})),e}var i={ora:{spinner:"simpleDotsScrolling"},client:new _(new a)},ht=new Ot.Command("gds").description("Great Detail Support System").addCommand(Q(i)).addCommand($(i)).addCommand(et(i)).addCommand(st(i)).addCommand(it(i)).addCommand(at(i)).addCommand(pt(i)).addCommand(lt(i)),yt=ht;yt.parseAsync(process.argv);
|
|
2
|
+
"use strict";var 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);
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as r}from"./chunk-
|
|
2
|
+
import{a as r}from"./chunk-QYWS5WK5.js";import"./chunk-PWDTRAX2.js";r.parseAsync(process.argv);
|
|
@@ -21,8 +21,7 @@ interface RequestFilterable {
|
|
|
21
21
|
* @see https://greatdetail.com
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
}
|
|
24
|
+
type Authentication = RequestFilterable;
|
|
26
25
|
|
|
27
26
|
/**
|
|
28
27
|
* Great Detail Support System.
|
|
@@ -33,13 +32,13 @@ interface Authentication extends RequestFilterable {
|
|
|
33
32
|
* @see https://greatdetail.com
|
|
34
33
|
*/
|
|
35
34
|
|
|
36
|
-
interface Options$
|
|
35
|
+
interface Options$g extends SendOptions {
|
|
37
36
|
request?: RequestInit;
|
|
38
37
|
}
|
|
39
38
|
declare class ListActionsRequest {
|
|
40
39
|
protected _client: Client;
|
|
41
40
|
constructor(_client: Client);
|
|
42
|
-
send({ request, ...options }?: Options$
|
|
41
|
+
send({ request, ...options }?: Options$g): Promise<ListActionsResponse>;
|
|
43
42
|
}
|
|
44
43
|
type ListActionsResponsePayload = {
|
|
45
44
|
actions: {
|
|
@@ -70,13 +69,13 @@ declare class ListActionsResponse {
|
|
|
70
69
|
* @see https://greatdetail.com
|
|
71
70
|
*/
|
|
72
71
|
|
|
73
|
-
interface Options$
|
|
72
|
+
interface Options$f extends SendOptions {
|
|
74
73
|
request?: RequestInit;
|
|
75
74
|
}
|
|
76
75
|
declare class ListChannelsRequest {
|
|
77
76
|
protected _client: Client;
|
|
78
77
|
constructor(_client: Client);
|
|
79
|
-
send({ request, ...options }?: Options$
|
|
78
|
+
send({ request, ...options }?: Options$f): Promise<ListChannelsResponse>;
|
|
80
79
|
}
|
|
81
80
|
type ListChannelsResponsePayload = {
|
|
82
81
|
channels: ({
|
|
@@ -117,14 +116,14 @@ declare class ListChannelsResponse {
|
|
|
117
116
|
* @see https://greatdetail.com
|
|
118
117
|
*/
|
|
119
118
|
|
|
120
|
-
interface Options$
|
|
119
|
+
interface Options$e extends SendOptions {
|
|
121
120
|
id: string;
|
|
122
121
|
request?: RequestInit;
|
|
123
122
|
}
|
|
124
123
|
declare class GetContactRequest {
|
|
125
124
|
protected _client: Client;
|
|
126
125
|
constructor(_client: Client);
|
|
127
|
-
send({ id, request, ...options }: Options$
|
|
126
|
+
send({ id, request, ...options }: Options$e): Promise<GetContactResponse>;
|
|
128
127
|
}
|
|
129
128
|
type GetContactResponsePayload = {
|
|
130
129
|
contact: {
|
|
@@ -152,13 +151,13 @@ declare class GetContactResponse {
|
|
|
152
151
|
* @see https://greatdetail.com
|
|
153
152
|
*/
|
|
154
153
|
|
|
155
|
-
interface Options$
|
|
154
|
+
interface Options$d extends SendOptions {
|
|
156
155
|
request?: RequestInit;
|
|
157
156
|
}
|
|
158
157
|
declare class ListContactsRequest {
|
|
159
158
|
protected _client: Client;
|
|
160
159
|
constructor(_client: Client);
|
|
161
|
-
send({ request, ...options }?: Options$
|
|
160
|
+
send({ request, ...options }?: Options$d): Promise<ListContactsResponse>;
|
|
162
161
|
}
|
|
163
162
|
type ListContactsResponsePayload = {
|
|
164
163
|
contacts: {
|
|
@@ -186,18 +185,19 @@ declare class ListContactsResponse {
|
|
|
186
185
|
* @see https://greatdetail.com
|
|
187
186
|
*/
|
|
188
187
|
|
|
189
|
-
interface Options$
|
|
188
|
+
interface Options$c extends SendOptions {
|
|
190
189
|
id: string;
|
|
191
190
|
request?: RequestInit;
|
|
192
191
|
}
|
|
193
192
|
declare class GetConversationRequest {
|
|
194
193
|
protected _client: Client;
|
|
195
194
|
constructor(_client: Client);
|
|
196
|
-
send({ id, request, ...options }: Options$
|
|
195
|
+
send({ id, request, ...options }: Options$c): Promise<GetConversationResponse>;
|
|
197
196
|
}
|
|
198
197
|
type GetConversationResponsePayload = {
|
|
199
198
|
conversation: {
|
|
200
199
|
id: string;
|
|
200
|
+
name?: string;
|
|
201
201
|
hasEnded: boolean;
|
|
202
202
|
accountChannel: string;
|
|
203
203
|
createdAt: string;
|
|
@@ -219,17 +219,18 @@ declare class GetConversationResponse {
|
|
|
219
219
|
* @see https://greatdetail.com
|
|
220
220
|
*/
|
|
221
221
|
|
|
222
|
-
interface Options$
|
|
222
|
+
interface Options$b 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$
|
|
228
|
+
send({ request, ...options }?: Options$b): Promise<ListConversationsResponse>;
|
|
229
229
|
}
|
|
230
230
|
type ListConversationsResponsePayload = {
|
|
231
231
|
conversations: {
|
|
232
232
|
id: string;
|
|
233
|
+
name?: string;
|
|
233
234
|
hasEnded: boolean;
|
|
234
235
|
accountChannel: string;
|
|
235
236
|
createdAt: string;
|
|
@@ -242,6 +243,48 @@ declare class ListConversationsResponse {
|
|
|
242
243
|
result(): Promise<ListConversationsResponsePayload>;
|
|
243
244
|
}
|
|
244
245
|
|
|
246
|
+
/**
|
|
247
|
+
* Great Detail Support System.
|
|
248
|
+
*
|
|
249
|
+
* @copyright 2024 Great Detail Ltd
|
|
250
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
251
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
252
|
+
* @see https://greatdetail.com
|
|
253
|
+
*/
|
|
254
|
+
|
|
255
|
+
interface Options$a extends SendOptions {
|
|
256
|
+
id: string;
|
|
257
|
+
body: z.infer<typeof UpdateConversationRequest.SCHEMA>;
|
|
258
|
+
request?: RequestInit;
|
|
259
|
+
}
|
|
260
|
+
declare class UpdateConversationRequest {
|
|
261
|
+
protected _client: Client;
|
|
262
|
+
static SCHEMA: z.ZodObject<{
|
|
263
|
+
hasEnded: z.ZodBoolean;
|
|
264
|
+
}, "strip", z.ZodTypeAny, {
|
|
265
|
+
hasEnded: boolean;
|
|
266
|
+
}, {
|
|
267
|
+
hasEnded: boolean;
|
|
268
|
+
}>;
|
|
269
|
+
constructor(_client: Client);
|
|
270
|
+
send({ id, body, request, ...options }: Options$a): Promise<UpdateConversationResponse>;
|
|
271
|
+
}
|
|
272
|
+
type UpdateConversationResponsePayload = {
|
|
273
|
+
conversation: {
|
|
274
|
+
id: string;
|
|
275
|
+
name?: string;
|
|
276
|
+
hasEnded: boolean;
|
|
277
|
+
accountChannel: string;
|
|
278
|
+
createdAt: string;
|
|
279
|
+
updatedAt: string;
|
|
280
|
+
};
|
|
281
|
+
};
|
|
282
|
+
declare class UpdateConversationResponse {
|
|
283
|
+
response: Response;
|
|
284
|
+
constructor(response: Response);
|
|
285
|
+
result(): Promise<UpdateConversationResponsePayload>;
|
|
286
|
+
}
|
|
287
|
+
|
|
245
288
|
/**
|
|
246
289
|
* Great Detail Support System.
|
|
247
290
|
*
|
|
@@ -654,6 +697,7 @@ declare class Client {
|
|
|
654
697
|
conversation: {
|
|
655
698
|
get: GetConversationRequest;
|
|
656
699
|
list: ListConversationsRequest;
|
|
700
|
+
update: UpdateConversationRequest;
|
|
657
701
|
};
|
|
658
702
|
label: {
|
|
659
703
|
create: CreateLabelRequest;
|
|
@@ -21,8 +21,7 @@ interface RequestFilterable {
|
|
|
21
21
|
* @see https://greatdetail.com
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
}
|
|
24
|
+
type Authentication = RequestFilterable;
|
|
26
25
|
|
|
27
26
|
/**
|
|
28
27
|
* Great Detail Support System.
|
|
@@ -33,13 +32,13 @@ interface Authentication extends RequestFilterable {
|
|
|
33
32
|
* @see https://greatdetail.com
|
|
34
33
|
*/
|
|
35
34
|
|
|
36
|
-
interface Options$
|
|
35
|
+
interface Options$g extends SendOptions {
|
|
37
36
|
request?: RequestInit;
|
|
38
37
|
}
|
|
39
38
|
declare class ListActionsRequest {
|
|
40
39
|
protected _client: Client;
|
|
41
40
|
constructor(_client: Client);
|
|
42
|
-
send({ request, ...options }?: Options$
|
|
41
|
+
send({ request, ...options }?: Options$g): Promise<ListActionsResponse>;
|
|
43
42
|
}
|
|
44
43
|
type ListActionsResponsePayload = {
|
|
45
44
|
actions: {
|
|
@@ -70,13 +69,13 @@ declare class ListActionsResponse {
|
|
|
70
69
|
* @see https://greatdetail.com
|
|
71
70
|
*/
|
|
72
71
|
|
|
73
|
-
interface Options$
|
|
72
|
+
interface Options$f extends SendOptions {
|
|
74
73
|
request?: RequestInit;
|
|
75
74
|
}
|
|
76
75
|
declare class ListChannelsRequest {
|
|
77
76
|
protected _client: Client;
|
|
78
77
|
constructor(_client: Client);
|
|
79
|
-
send({ request, ...options }?: Options$
|
|
78
|
+
send({ request, ...options }?: Options$f): Promise<ListChannelsResponse>;
|
|
80
79
|
}
|
|
81
80
|
type ListChannelsResponsePayload = {
|
|
82
81
|
channels: ({
|
|
@@ -117,14 +116,14 @@ declare class ListChannelsResponse {
|
|
|
117
116
|
* @see https://greatdetail.com
|
|
118
117
|
*/
|
|
119
118
|
|
|
120
|
-
interface Options$
|
|
119
|
+
interface Options$e extends SendOptions {
|
|
121
120
|
id: string;
|
|
122
121
|
request?: RequestInit;
|
|
123
122
|
}
|
|
124
123
|
declare class GetContactRequest {
|
|
125
124
|
protected _client: Client;
|
|
126
125
|
constructor(_client: Client);
|
|
127
|
-
send({ id, request, ...options }: Options$
|
|
126
|
+
send({ id, request, ...options }: Options$e): Promise<GetContactResponse>;
|
|
128
127
|
}
|
|
129
128
|
type GetContactResponsePayload = {
|
|
130
129
|
contact: {
|
|
@@ -152,13 +151,13 @@ declare class GetContactResponse {
|
|
|
152
151
|
* @see https://greatdetail.com
|
|
153
152
|
*/
|
|
154
153
|
|
|
155
|
-
interface Options$
|
|
154
|
+
interface Options$d extends SendOptions {
|
|
156
155
|
request?: RequestInit;
|
|
157
156
|
}
|
|
158
157
|
declare class ListContactsRequest {
|
|
159
158
|
protected _client: Client;
|
|
160
159
|
constructor(_client: Client);
|
|
161
|
-
send({ request, ...options }?: Options$
|
|
160
|
+
send({ request, ...options }?: Options$d): Promise<ListContactsResponse>;
|
|
162
161
|
}
|
|
163
162
|
type ListContactsResponsePayload = {
|
|
164
163
|
contacts: {
|
|
@@ -186,18 +185,19 @@ declare class ListContactsResponse {
|
|
|
186
185
|
* @see https://greatdetail.com
|
|
187
186
|
*/
|
|
188
187
|
|
|
189
|
-
interface Options$
|
|
188
|
+
interface Options$c extends SendOptions {
|
|
190
189
|
id: string;
|
|
191
190
|
request?: RequestInit;
|
|
192
191
|
}
|
|
193
192
|
declare class GetConversationRequest {
|
|
194
193
|
protected _client: Client;
|
|
195
194
|
constructor(_client: Client);
|
|
196
|
-
send({ id, request, ...options }: Options$
|
|
195
|
+
send({ id, request, ...options }: Options$c): Promise<GetConversationResponse>;
|
|
197
196
|
}
|
|
198
197
|
type GetConversationResponsePayload = {
|
|
199
198
|
conversation: {
|
|
200
199
|
id: string;
|
|
200
|
+
name?: string;
|
|
201
201
|
hasEnded: boolean;
|
|
202
202
|
accountChannel: string;
|
|
203
203
|
createdAt: string;
|
|
@@ -219,17 +219,18 @@ declare class GetConversationResponse {
|
|
|
219
219
|
* @see https://greatdetail.com
|
|
220
220
|
*/
|
|
221
221
|
|
|
222
|
-
interface Options$
|
|
222
|
+
interface Options$b 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$
|
|
228
|
+
send({ request, ...options }?: Options$b): Promise<ListConversationsResponse>;
|
|
229
229
|
}
|
|
230
230
|
type ListConversationsResponsePayload = {
|
|
231
231
|
conversations: {
|
|
232
232
|
id: string;
|
|
233
|
+
name?: string;
|
|
233
234
|
hasEnded: boolean;
|
|
234
235
|
accountChannel: string;
|
|
235
236
|
createdAt: string;
|
|
@@ -242,6 +243,48 @@ declare class ListConversationsResponse {
|
|
|
242
243
|
result(): Promise<ListConversationsResponsePayload>;
|
|
243
244
|
}
|
|
244
245
|
|
|
246
|
+
/**
|
|
247
|
+
* Great Detail Support System.
|
|
248
|
+
*
|
|
249
|
+
* @copyright 2024 Great Detail Ltd
|
|
250
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
251
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
252
|
+
* @see https://greatdetail.com
|
|
253
|
+
*/
|
|
254
|
+
|
|
255
|
+
interface Options$a extends SendOptions {
|
|
256
|
+
id: string;
|
|
257
|
+
body: z.infer<typeof UpdateConversationRequest.SCHEMA>;
|
|
258
|
+
request?: RequestInit;
|
|
259
|
+
}
|
|
260
|
+
declare class UpdateConversationRequest {
|
|
261
|
+
protected _client: Client;
|
|
262
|
+
static SCHEMA: z.ZodObject<{
|
|
263
|
+
hasEnded: z.ZodBoolean;
|
|
264
|
+
}, "strip", z.ZodTypeAny, {
|
|
265
|
+
hasEnded: boolean;
|
|
266
|
+
}, {
|
|
267
|
+
hasEnded: boolean;
|
|
268
|
+
}>;
|
|
269
|
+
constructor(_client: Client);
|
|
270
|
+
send({ id, body, request, ...options }: Options$a): Promise<UpdateConversationResponse>;
|
|
271
|
+
}
|
|
272
|
+
type UpdateConversationResponsePayload = {
|
|
273
|
+
conversation: {
|
|
274
|
+
id: string;
|
|
275
|
+
name?: string;
|
|
276
|
+
hasEnded: boolean;
|
|
277
|
+
accountChannel: string;
|
|
278
|
+
createdAt: string;
|
|
279
|
+
updatedAt: string;
|
|
280
|
+
};
|
|
281
|
+
};
|
|
282
|
+
declare class UpdateConversationResponse {
|
|
283
|
+
response: Response;
|
|
284
|
+
constructor(response: Response);
|
|
285
|
+
result(): Promise<UpdateConversationResponsePayload>;
|
|
286
|
+
}
|
|
287
|
+
|
|
245
288
|
/**
|
|
246
289
|
* Great Detail Support System.
|
|
247
290
|
*
|
|
@@ -654,6 +697,7 @@ declare class Client {
|
|
|
654
697
|
conversation: {
|
|
655
698
|
get: GetConversationRequest;
|
|
656
699
|
list: ListConversationsRequest;
|
|
700
|
+
update: UpdateConversationRequest;
|
|
657
701
|
};
|
|
658
702
|
label: {
|
|
659
703
|
create: CreateLabelRequest;
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
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});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as Authentication } from './index-
|
|
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-
|
|
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';
|
|
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-
|
|
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-
|
|
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';
|
|
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-
|
|
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};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@great-detail/support-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "JavaScript SDK for the Great Detail Support System",
|
|
6
6
|
"author": "Great Detail Ltd <info@greatdetail.com>",
|
|
@@ -67,19 +67,20 @@
|
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@changesets/cli": "^2.27.7",
|
|
70
|
-
"@great-detail/eslint-config": "^1.0.
|
|
71
|
-
"@great-detail/prettier-config": "^0.
|
|
70
|
+
"@great-detail/eslint-config": "^1.0.5",
|
|
71
|
+
"@great-detail/prettier-config": "^0.3.0",
|
|
72
72
|
"@jest/globals": "^29.7.0",
|
|
73
|
-
"@types/node": "^
|
|
73
|
+
"@types/node": "^22.4.1",
|
|
74
74
|
"cross-env": "^7.0.3",
|
|
75
|
-
"eslint": "^
|
|
75
|
+
"eslint": "^9.9.0",
|
|
76
76
|
"jest": "^29.7.0",
|
|
77
77
|
"npm-run-all": "^4.1.5",
|
|
78
|
+
"openapi-typescript": "^7.3.0",
|
|
78
79
|
"prettier": "^3.3.3",
|
|
79
|
-
"publint": "^0.2.
|
|
80
|
-
"ts-jest": "^29.2.
|
|
80
|
+
"publint": "^0.2.10",
|
|
81
|
+
"ts-jest": "^29.2.4",
|
|
81
82
|
"ts-node": "^10.9.2",
|
|
82
|
-
"tsup": "^8.2.
|
|
83
|
+
"tsup": "^8.2.4",
|
|
83
84
|
"typescript": "^5.5.4"
|
|
84
85
|
},
|
|
85
86
|
"publishConfig": {
|
package/src/Client/index.ts
CHANGED
|
@@ -15,6 +15,7 @@ import GetContactRequest from "../Contact/GetContact.js";
|
|
|
15
15
|
import ListContactsRequest from "../Contact/ListContacts.js";
|
|
16
16
|
import GetConversationRequest from "../Conversation/GetConversation.js";
|
|
17
17
|
import ListConversationsRequest from "../Conversation/ListConversations.js";
|
|
18
|
+
import UpdateConversationRequest from "../Conversation/UpdateConversation.js";
|
|
18
19
|
import CreateLabelRequest from "../Label/CreateLabel.js";
|
|
19
20
|
import GetLabelRequest from "../Label/GetLabel.js";
|
|
20
21
|
import ListLabelsRequest from "../Label/ListLabels.js";
|
|
@@ -80,6 +81,7 @@ export default class Client {
|
|
|
80
81
|
public conversation = {
|
|
81
82
|
get: new GetConversationRequest(this),
|
|
82
83
|
list: new ListConversationsRequest(this),
|
|
84
|
+
update: new UpdateConversationRequest(this),
|
|
83
85
|
};
|
|
84
86
|
|
|
85
87
|
public label = {
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Great Detail Support System.
|
|
3
|
+
*
|
|
4
|
+
* @copyright 2024 Great Detail Ltd
|
|
5
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
6
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
7
|
+
* @see https://greatdetail.com
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
import Client, { SendOptions } from "../Client/index.js";
|
|
12
|
+
|
|
13
|
+
export interface Options extends SendOptions {
|
|
14
|
+
id: string;
|
|
15
|
+
body: z.infer<typeof UpdateConversationRequest.SCHEMA>;
|
|
16
|
+
request?: RequestInit;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default class UpdateConversationRequest {
|
|
20
|
+
public static SCHEMA = z.object({
|
|
21
|
+
hasEnded: z.boolean(),
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
constructor(protected _client: Client) {}
|
|
25
|
+
|
|
26
|
+
public async send({ id, body, request = {}, ...options }: Options) {
|
|
27
|
+
return this._client
|
|
28
|
+
.send(
|
|
29
|
+
"/v1/conversations/" + encodeURIComponent(id),
|
|
30
|
+
{
|
|
31
|
+
...request,
|
|
32
|
+
method: "POST",
|
|
33
|
+
headers: {
|
|
34
|
+
...request.headers,
|
|
35
|
+
"Content-Type": "application/json",
|
|
36
|
+
},
|
|
37
|
+
body: JSON.stringify(UpdateConversationRequest.SCHEMA.parse(body)),
|
|
38
|
+
},
|
|
39
|
+
options,
|
|
40
|
+
)
|
|
41
|
+
.then((response) => new UpdateConversationResponse(response));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type UpdateConversationResponsePayload = {
|
|
46
|
+
conversation: {
|
|
47
|
+
id: string;
|
|
48
|
+
name?: string;
|
|
49
|
+
hasEnded: boolean;
|
|
50
|
+
accountChannel: string;
|
|
51
|
+
createdAt: string;
|
|
52
|
+
updatedAt: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export class UpdateConversationResponse {
|
|
57
|
+
constructor(public response: Response) {}
|
|
58
|
+
|
|
59
|
+
public async result(): Promise<UpdateConversationResponsePayload> {
|
|
60
|
+
return this.response.json();
|
|
61
|
+
}
|
|
62
|
+
}
|
package/src/cli/actions.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { Command } from "commander";
|
|
|
11
11
|
import { oraPromise } from "ora";
|
|
12
12
|
import type { Options as CommandOptions } from "./index.js";
|
|
13
13
|
|
|
14
|
-
export
|
|
14
|
+
export type Options = CommandOptions;
|
|
15
15
|
|
|
16
16
|
export default function actions({ client, ora }: Options) {
|
|
17
17
|
const command = new Command("actions").description("Actions");
|
package/src/cli/channels.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { Command } from "commander";
|
|
|
11
11
|
import { oraPromise } from "ora";
|
|
12
12
|
import type { Options as CommandOptions } from "./index.js";
|
|
13
13
|
|
|
14
|
-
export
|
|
14
|
+
export type Options = CommandOptions;
|
|
15
15
|
|
|
16
16
|
export default function channels({ client, ora }: Options) {
|
|
17
17
|
const command = new Command("channels").description("Channels");
|
package/src/cli/contacts.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { Command } from "commander";
|
|
|
11
11
|
import { oraPromise } from "ora";
|
|
12
12
|
import type { Options as CommandOptions } from "./index.js";
|
|
13
13
|
|
|
14
|
-
export
|
|
14
|
+
export type Options = CommandOptions;
|
|
15
15
|
|
|
16
16
|
export default function contacts({ client, ora }: Options) {
|
|
17
17
|
const command = new Command("contacts").description("Contacts");
|
package/src/cli/conversations.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { Command } from "commander";
|
|
|
11
11
|
import { oraPromise } from "ora";
|
|
12
12
|
import type { Options as CommandOptions } from "./index.js";
|
|
13
13
|
|
|
14
|
-
export
|
|
14
|
+
export type Options = CommandOptions;
|
|
15
15
|
|
|
16
16
|
export default function conversations({ client, ora }: Options) {
|
|
17
17
|
const command = new Command("conversations").description("Conversations");
|
package/src/cli/labels.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { Command } from "commander";
|
|
|
11
11
|
import { oraPromise } from "ora";
|
|
12
12
|
import type { Options as CommandOptions } from "./index.js";
|
|
13
13
|
|
|
14
|
-
export
|
|
14
|
+
export type Options = CommandOptions;
|
|
15
15
|
|
|
16
16
|
export default function labels({ client, ora }: Options) {
|
|
17
17
|
const command = new Command("labels").description("Labels");
|
package/src/cli/messages.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { Command } from "commander";
|
|
|
11
11
|
import { oraPromise } from "ora";
|
|
12
12
|
import type { Options as CommandOptions } from "./index.js";
|
|
13
13
|
|
|
14
|
-
export
|
|
14
|
+
export type Options = CommandOptions;
|
|
15
15
|
|
|
16
16
|
export default function messages({ client, ora }: Options) {
|
|
17
17
|
const command = new Command("messages").description("Messages");
|
package/src/cli/models.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { Command } from "commander";
|
|
|
11
11
|
import { oraPromise } from "ora";
|
|
12
12
|
import type { Options as CommandOptions } from "./index.js";
|
|
13
13
|
|
|
14
|
-
export
|
|
14
|
+
export type Options = CommandOptions;
|
|
15
15
|
|
|
16
16
|
export default function models({ client, ora }: Options) {
|
|
17
17
|
const command = new Command("models").description("Models");
|
package/src/cli/sources.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { Command } from "commander";
|
|
|
11
11
|
import { oraPromise } from "ora";
|
|
12
12
|
import type { Options as CommandOptions } from "./index.js";
|
|
13
13
|
|
|
14
|
-
export
|
|
14
|
+
export type Options = CommandOptions;
|
|
15
15
|
|
|
16
16
|
export default function sources({ client, ora }: Options) {
|
|
17
17
|
const command = new Command("sources").description("Sources");
|
package/dist/chunk-OVSCTY74.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var B="https://api.support.greatdetail.com",V={"X-Powered-By":"GDSupport/JavaScript"},J="api-key",Y="SUPPORT_ACCESS_TOKEN",k="SUPPORT_API_KEY",W="SUPPORT_KEY_NAME";var _=class{async filter(t){return t}};var i=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/actions",{...t,method:"GET"},s).then(n=>new E(n))}},E=class{constructor(t){this.response=t}async result(){return this.response.json()}};var o=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/channels",{...t,method:"GET"},s).then(n=>new w(n))}},w=class{constructor(t){this.response=t}async result(){return this.response.json()}};var p=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/contacts",{...t,method:"GET"},s).then(n=>new q(n))}},q=class{constructor(t){this.response=t}async result(){return this.response.json()}};var c=class{constructor(t){this._client=t}async send({id:t,request:s={},...n}){return this._client.send("/v1/conversations/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new T(r))}},T=class{constructor(t){this.response=t}async result(){return this.response.json()}};var a=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/conversations",{...t,method:"GET"},s).then(n=>new I(n))}},I=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as l}from"zod";var d=class e{constructor(t){this._client=t}static SCHEMA=l.object({title:l.string(),description:l.optional(l.string()),account:l.string()});async send({body:t,request:s={},...n}){return this._client.send("/v1/labels",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))},n).then(r=>new U(r))}},U=class{constructor(t){this.response=t}async result(){return this.response.json()}};var u=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/labels",{...t,method:"GET"},s).then(n=>new v(n))}},v=class{constructor(t){this.response=t}async result(){return this.response.json()}};var m=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/messages",{...t,method:"GET"},s).then(n=>new L(n))}},L=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as C}from"zod";var g=class e{constructor(t){this._client=t}static SCHEMA=C.object({input:C.string().max(65536),original:C.string().max(65536),correction:C.string().max(65536)});async send({id:t,body:s,request:n={},...r}){return this._client.send("/v1/models/"+encodeURIComponent(t)+"/correction",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))},r).then(P=>new D(P))}},D=class{constructor(t){this.response=t}async result(){return this.response.json()}};var h=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/models",{...t,method:"GET"},s).then(n=>new j(n))}},j=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as A}from"zod";var b=class e{constructor(t){this._client=t}static SCHEMA=A.array(A.object({role:A.enum(["user","assistant"]),content:A.string().max(65536).nullable()})).min(1);async send({id:t,body:s,request:n={},...r}){return this._client.send("/v1/models/"+encodeURIComponent(t)+"/response",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))},r).then(P=>new G(P))}},G=class{constructor(t){this.response=t}async result(){return this.response.json()}};var y=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/sources",{...t,method:"GET"},s).then(n=>new N(n))}},N=class{constructor(t){this.response=t}async result(){return this.response.json()}};var f=class{constructor(t){this._client=t}async send({id:t,request:s={},...n}){return this._client.send("/v1/contacts/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new H(r))}},H=class{constructor(t){this.response=t}async result(){return this.response.json()}};var R=class{constructor(t){this._client=t}async send({id:t,request:s={},...n}){return this._client.send("/v1/labels/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new M(r))}},M=class{constructor(t){this.response=t}async result(){return this.response.json()}};var x=class{constructor(t){this._client=t}async send({id:t,request:s={},...n}){return this._client.send("/v1/models/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new F(r))}},F=class{constructor(t){this.response=t}async result(){return this.response.json()}};var O=class e{constructor(t=e.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=V;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var S=class{constructor(t){this._client=t}async send({id:t,request:s={},...n}){return this._client.send("/v1/sources/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new K(r))}},K=class{constructor(t){this.response=t}async result(){return this.response.json()}};var z=class e{static DEFAULT_BASE_URL=B;options;constructor(t,s={}){this.options={requestFilterables:[new O,t],baseURL:process.env.SUPPORT_BASE_URL??e.DEFAULT_BASE_URL,...s}}action={list:new i(this)};channel={list:new o(this)};contact={get:new f(this),list:new p(this)};conversation={get:new c(this),list:new a(this)};label={create:new d(this),get:new R(this),list:new u(this)};message={list:new m(this)};model={get:new x(this),list:new h(this),response:{create:new b(this)},correction:{create:new g(this)}};source={get:new S(this),list:new y(this)};async _filterRequest(t){for(let s of this.options.requestFilterables)t=await s.filter(t);return t}async send(t,s,{fetch:n=fetch}={}){return await n(new Request(new URL(t,this.options.baseURL),await this._filterRequest(s)))}};export{B as a,J as b,Y as c,k as d,W as e,_ as f,z as g};
|