@great-detail/support-sdk 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ var P="https://api.support.greatdetail.com",D={"X-Powered-By":"GDSupport/JavaScript"},v="api-key";var O=class{async filter(t){return t}};var i=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/actions",{...t,method:"GET"},s).then(n=>new S(n))}},S=class{constructor(t){this.response=t}async result(){return this.response.json()}};var o=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/channels",{...t,method:"GET"},s).then(n=>new y(n))}},y=class{constructor(t){this.response=t}async result(){return this.response.json()}};var p=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/contacts",{...t,method:"GET"},s).then(n=>new A(n))}},A=class{constructor(t){this.response=t}async result(){return this.response.json()}};var c=class{constructor(t){this._client=t}async send({id:t,request:s={},...n}){return this._client.send("/v1/conversations/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new _(r))}},_=class{constructor(t){this.response=t}async result(){return this.response.json()}};var l=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/conversations",{...t,method:"GET"},s).then(n=>new E(n))}},E=class{constructor(t){this.response=t}async result(){return this.response.json()}};var a=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/labels",{...t,method:"GET"},s).then(n=>new C(n))}},C=class{constructor(t){this.response=t}async result(){return this.response.json()}};var u=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/messages",{...t,method:"GET"},s).then(n=>new q(n))}},q=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as g}from"zod";var d=class e{constructor(t){this._client=t}static SCHEMA=g.object({input:g.string().max(65536),original:g.string().max(65536),correction:g.string().max(65536)});async send({id:t,body:s,request:n={},...r}){return this._client.send("/v1/models/"+encodeURIComponent(t)+"/correction",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))},r).then(x=>new w(x))}},w=class{constructor(t){this.response=t}async result(){return this.response.json()}};var m=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/models",{...t,method:"GET"},s).then(n=>new T(n))}},T=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as R}from"zod";var h=class e{constructor(t){this._client=t}static SCHEMA=R.array(R.object({role:R.enum(["user","assistant"]),content:R.string().max(65536).nullable()})).min(1);async send({id:t,body:s,request:n={},...r}){return this._client.send("/v1/models/"+encodeURIComponent(t)+"/response",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))},r).then(x=>new L(x))}},L=class{constructor(t){this.response=t}async result(){return this.response.json()}};var f=class e{constructor(t=e.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=D;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var b=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/sources",{...t,method:"GET"},s).then(n=>new I(n))}},I=class{constructor(t){this.response=t}async result(){return this.response.json()}};var U=class e{static DEFAULT_BASE_URL=P;options;constructor(t,s={}){this.options={requestFilterables:[new f,t],baseURL:process.env.SUPPORT_BASE_URL??e.DEFAULT_BASE_URL,...s}}action={list:new i(this)};channel={list:new o(this)};contact={list:new p(this)};conversation={get:new c(this),list:new l(this)};label={list:new a(this)};message={list:new u(this)};model={list:new m(this),response:{create:new h(this)},correction:{create:new d(this)}};source={list:new b(this)};async _filterRequest(t){for(let s of this.options.requestFilterables)t=await s.filter(t);return t}async send(t,s,{fetch:n=fetch}={}){return await n(new Request(new URL(t,this.options.baseURL),await this._filterRequest(s)))}};export{P as a,v as b,O as c,U as d};
package/dist/cli.cjs ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ "use strict";var rt=require("commander");var r=class{async filter(t){return t}};var p=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/actions",{...t,method:"GET"},e).then(s=>new S(s))}},S=class{constructor(t){this.response=t}async result(){return this.response.json()}};var a=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/channels",{...t,method:"GET"},e).then(s=>new A(s))}},A=class{constructor(t){this.response=t}async result(){return this.response.json()}};var W="https://api.support.greatdetail.com",Z={"X-Powered-By":"GDSupport/JavaScript"};var c=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/contacts",{...t,method:"GET"},e).then(s=>new _(s))}},_=class{constructor(t){this.response=t}async result(){return this.response.json()}};var d=class{constructor(t){this._client=t}async send({id:t,request:e={},...s}){return this._client.send("/v1/conversations/"+encodeURIComponent(t),{...e,method:"GET"},s).then(i=>new E(i))}},E=class{constructor(t){this.response=t}async result(){return this.response.json()}};var m=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/conversations",{...t,method:"GET"},e).then(s=>new L(s))}},L=class{constructor(t){this.response=t}async result(){return this.response.json()}};var l=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/labels",{...t,method:"GET"},e).then(s=>new q(s))}},q=class{constructor(t){this.response=t}async result(){return this.response.json()}};var u=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/messages",{...t,method:"GET"},e).then(s=>new v(s))}},v=class{constructor(t){this.response=t}async result(){return this.response.json()}};var f=require("zod"),x=class n{constructor(t){this._client=t}static SCHEMA=f.z.object({input:f.z.string().max(65536),original:f.z.string().max(65536),correction:f.z.string().max(65536)});async send({id:t,body:e,request:s={},...i}){return this._client.send("/v1/models/"+encodeURIComponent(t)+"/correction",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))},i).then(y=>new P(y))}},P=class{constructor(t){this.response=t}async result(){return this.response.json()}};var g=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/models",{...t,method:"GET"},e).then(s=>new T(s))}},T=class{constructor(t){this.response=t}async result(){return this.response.json()}};var O=require("zod"),h=class n{constructor(t){this._client=t}static SCHEMA=O.z.array(O.z.object({role:O.z.enum(["user","assistant"]),content:O.z.string().max(65536).nullable()})).min(1);async send({id:t,body:e,request:s={},...i}){return this._client.send("/v1/models/"+encodeURIComponent(t)+"/response",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))},i).then(y=>new I(y))}},I=class{constructor(t){this.response=t}async result(){return this.response.json()}};var b=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Z;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var C=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/sources",{...t,method:"GET"},e).then(s=>new j(s))}},j=class{constructor(t){this.response=t}async result(){return this.response.json()}};var R=class n{static DEFAULT_BASE_URL=W;options;constructor(t,e={}){this.options={requestFilterables:[new b,t],baseURL:process.env.SUPPORT_BASE_URL??n.DEFAULT_BASE_URL,...e}}action={list:new p(this)};channel={list:new a(this)};contact={list:new c(this)};conversation={get:new d(this),list:new m(this)};label={list:new l(this)};message={list:new u(this)};model={list:new g(this),response:{create:new h(this)},correction:{create:new x(this)}};source={list:new C(this)};async _filterRequest(t){for(let e of this.options.requestFilterables)t=await e.filter(t);return t}async send(t,e,{fetch:s=fetch}={}){return await s(new Request(new URL(t,this.options.baseURL),await this._filterRequest(e)))}};var D=require("commander"),$=require("ora");function U({client:n,ora:t}){let e=new D.Command("actions").description("Actions");return e.addCommand(new D.Command("list").description("List actions").action(async()=>{let s=await(0,$.oraPromise)(()=>n.action.list.send(),{...t,text:"Finding actions"});console.log(await s.result())})),e}var F=require("commander"),tt=require("ora");function H({client:n,ora:t}){let e=new F.Command("channels").description("Channels");return e.addCommand(new F.Command("list").description("List channels").action(async()=>{let s=await(0,tt.oraPromise)(()=>n.channel.list.send(),{...t,text:"Finding channels"});console.log(await s.result())})),e}var G=require("commander"),et=require("ora");function N({client:n,ora:t}){let e=new G.Command("contacts").description("Contacts");return e.addCommand(new G.Command("list").description("List contacts").action(async()=>{let s=await(0,et.oraPromise)(()=>n.contact.list.send(),{...t,text:"Finding contacts"});console.log(await s.result())})),e}var w=require("commander"),M=require("ora");function B({client:n,ora:t}){let e=new w.Command("conversations").description("Conversations");return e.addCommand(new w.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async s=>{let i=await(0,M.oraPromise)(()=>n.conversation.get.send({id:s}),{...t,text:"Finding conversation"});console.log(await i.result())})),e.addCommand(new w.Command("list").description("List conversations").action(async()=>{let s=await(0,M.oraPromise)(()=>n.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await s.result())})),e}var k=require("commander"),nt=require("ora");function z({client:n,ora:t}){let e=new k.Command("labels").description("Labels");return e.addCommand(new k.Command("list").description("List labels").action(async()=>{let s=await(0,nt.oraPromise)(()=>n.label.list.send(),{...t,text:"Finding labels"});console.log(await s.result())})),e}var J=require("commander"),st=require("ora");function K({client:n,ora:t}){let e=new J.Command("messages").description("Messages");return e.addCommand(new J.Command("list").description("List messages").action(async()=>{let s=await(0,st.oraPromise)(()=>n.message.list.send(),{...t,text:"Finding messages"});console.log(await s.result())})),e}var X=require("commander"),ot=require("ora");function Y({client:n,ora:t}){let e=new X.Command("models").description("Models");return e.addCommand(new X.Command("list").description("List models").action(async()=>{let s=await(0,ot.oraPromise)(()=>n.model.list.send(),{...t,text:"Finding models"});console.log(await s.result())})),e}var Q=require("commander"),it=require("ora");function V({client:n,ora:t}){let e=new Q.Command("sources").description("Sources");return e.addCommand(new Q.Command("list").description("List sources").action(async()=>{let s=await(0,it.oraPromise)(()=>n.source.list.send(),{...t,text:"Finding sources"});console.log(await s.result())})),e}var o={ora:{spinner:"simpleDotsScrolling"},client:new R(new r)},at=new rt.Command("gds").description("Great Detail Support System").addCommand(U(o)).addCommand(H(o)).addCommand(N(o)).addCommand(B(o)).addCommand(z(o)).addCommand(K(o)).addCommand(Y(o)).addCommand(V(o)),pt=at;pt.parseAsync(process.argv);
package/dist/cli.d.cts ADDED
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
package/dist/cli.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{c as u,d as C}from"./chunk-ZLBEVMCE.js";import{Command as I}from"commander";import{Command as O}from"commander";import{oraPromise as h}from"ora";function e({client:n,ora:s}){let o=new O("actions").description("Actions");return o.addCommand(new O("list").description("List actions").action(async()=>{let t=await h(()=>n.action.list.send(),{...s,text:"Finding actions"});console.log(await t.result())})),o}import{Command as x}from"commander";import{oraPromise as j}from"ora";function a({client:n,ora:s}){let o=new x("channels").description("Channels");return o.addCommand(new x("list").description("List channels").action(async()=>{let t=await j(()=>n.channel.list.send(),{...s,text:"Finding channels"});console.log(await t.result())})),o}import{Command as w}from"commander";import{oraPromise as S}from"ora";function r({client:n,ora:s}){let o=new w("contacts").description("Contacts");return o.addCommand(new w("list").description("List contacts").action(async()=>{let t=await S(()=>n.contact.list.send(),{...s,text:"Finding contacts"});console.log(await t.result())})),o}import{Command as m}from"commander";import{oraPromise as g}from"ora";function d({client:n,ora:s}){let o=new m("conversations").description("Conversations");return o.addCommand(new m("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async t=>{let P=await g(()=>n.conversation.get.send({id:t}),{...s,text:"Finding conversation"});console.log(await P.result())})),o.addCommand(new m("list").description("List conversations").action(async()=>{let t=await g(()=>n.conversation.list.send(),{...s,text:"Finding conversations"});console.log(await t.result())})),o}import{Command as y}from"commander";import{oraPromise as A}from"ora";function c({client:n,ora:s}){let o=new y("labels").description("Labels");return o.addCommand(new y("list").description("List labels").action(async()=>{let t=await A(()=>n.label.list.send(),{...s,text:"Finding labels"});console.log(await t.result())})),o}import{Command as v}from"commander";import{oraPromise as D}from"ora";function p({client:n,ora:s}){let o=new v("messages").description("Messages");return o.addCommand(new v("list").description("List messages").action(async()=>{let t=await D(()=>n.message.list.send(),{...s,text:"Finding messages"});console.log(await t.result())})),o}import{Command as F}from"commander";import{oraPromise as M}from"ora";function l({client:n,ora:s}){let o=new F("models").description("Models");return o.addCommand(new F("list").description("List models").action(async()=>{let t=await M(()=>n.model.list.send(),{...s,text:"Finding models"});console.log(await t.result())})),o}import{Command as b}from"commander";import{oraPromise as G}from"ora";function f({client:n,ora:s}){let o=new b("sources").description("Sources");return o.addCommand(new b("list").description("List sources").action(async()=>{let t=await G(()=>n.source.list.send(),{...s,text:"Finding sources"});console.log(await t.result())})),o}var i={ora:{spinner:"simpleDotsScrolling"},client:new C(new u)},k=new I("gds").description("Great Detail Support System").addCommand(e(i)).addCommand(a(i)).addCommand(r(i)).addCommand(d(i)).addCommand(c(i)).addCommand(p(i)).addCommand(l(i)).addCommand(f(i)),L=k;L.parseAsync(process.argv);
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";var E=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var B=Object.prototype.hasOwnProperty;var M=(e,t)=>{for(var s in t)E(e,s,{get:t[s],enumerable:!0})},k=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of G(t))!B.call(e,i)&&i!==s&&E(e,i,{get:()=>t[i],enumerable:!(n=H(t,i))||n.enumerable});return e};var K=e=>k(E({},"__esModule",{value:!0}),e);var z={};M(z,{Client:()=>r,DEFAULT_SUPPORT_BASE_URL:()=>y,KeyAuthentication:()=>o,PublicAuthentication:()=>c,TokenAuthentication:()=>p,default:()=>r});module.exports=K(z);var y="https://api.support.greatdetail.com",N={"X-Powered-By":"GDSupport/JavaScript"},j="api-key";var o=class e{static DEFAULT_NAME=j;name;#t;constructor({name:t=process.env.SUPPORT_KEY_NAME??e.DEFAULT_NAME,key:s=process.env.SUPPORT_API_KEY}={}){if(!s)throw new Error("API Key option must be specified when using Key Authentication");this.name=t,this.#t=s}async filter(t){return{...t,headers:{...t.headers,Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}}};var p=class{#t;constructor({token:t=process.env.SUPPORT_ACCESS_TOKEN}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}async filter(t){return{...t,headers:{...t.headers,Authorization:`Bearer ${this.#t}`}}}};var c=class{async filter(t){return t}};var a=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/actions",{...t,method:"GET"},s).then(n=>new T(n))}},T=class{constructor(t){this.response=t}async result(){return this.response.json()}};var l=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/channels",{...t,method:"GET"},s).then(n=>new C(n))}},C=class{constructor(t){this.response=t}async result(){return this.response.json()}};var u=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/contacts",{...t,method:"GET"},s).then(n=>new w(n))}},w=class{constructor(t){this.response=t}async result(){return this.response.json()}};var d=class{constructor(t){this._client=t}async send({id:t,request:s={},...n}){return this._client.send("/v1/conversations/"+encodeURIComponent(t),{...s,method:"GET"},n).then(i=>new q(i))}},q=class{constructor(t){this.response=t}async result(){return this.response.json()}};var m=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/conversations",{...t,method:"GET"},s).then(n=>new P(n))}},P=class{constructor(t){this.response=t}async result(){return this.response.json()}};var h=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/labels",{...t,method:"GET"},s).then(n=>new U(n))}},U=class{constructor(t){this.response=t}async result(){return this.response.json()}};var f=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/messages",{...t,method:"GET"},s).then(n=>new I(n))}},I=class{constructor(t){this.response=t}async result(){return this.response.json()}};var b=require("zod"),g=class e{constructor(t){this._client=t}static SCHEMA=b.z.object({input:b.z.string().max(65536),original:b.z.string().max(65536),correction:b.z.string().max(65536)});async send({id:t,body:s,request:n={},...i}){return this._client.send("/v1/models/"+encodeURIComponent(t)+"/correction",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))},i).then(_=>new L(_))}},L=class{constructor(t){this.response=t}async result(){return this.response.json()}};var R=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/models",{...t,method:"GET"},s).then(n=>new D(n))}},D=class{constructor(t){this.response=t}async result(){return this.response.json()}};var x=require("zod"),A=class e{constructor(t){this._client=t}static SCHEMA=x.z.array(x.z.object({role:x.z.enum(["user","assistant"]),content:x.z.string().max(65536).nullable()})).min(1);async send({id:t,body:s,request:n={},...i}){return this._client.send("/v1/models/"+encodeURIComponent(t)+"/response",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))},i).then(_=>new v(_))}},v=class{constructor(t){this.response=t}async result(){return this.response.json()}};var O=class e{constructor(t=e.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=N;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var S=class{constructor(t){this._client=t}async send({request:t={},...s}={}){return this._client.send("/v1/sources",{...t,method:"GET"},s).then(n=>new F(n))}},F=class{constructor(t){this.response=t}async result(){return this.response.json()}};var r=class e{static DEFAULT_BASE_URL=y;options;constructor(t,s={}){this.options={requestFilterables:[new O,t],baseURL:process.env.SUPPORT_BASE_URL??e.DEFAULT_BASE_URL,...s}}action={list:new a(this)};channel={list:new l(this)};contact={list:new u(this)};conversation={get:new d(this),list:new m(this)};label={list:new h(this)};message={list:new f(this)};model={list:new R(this),response:{create:new A(this)},correction:{create:new g(this)}};source={list:new S(this)};async _filterRequest(t){for(let s of this.options.requestFilterables)t=await s.filter(t);return t}async send(t,s,{fetch:n=fetch}={}){return await n(new Request(new URL(t,this.options.baseURL),await this._filterRequest(s)))}};0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,KeyAuthentication,PublicAuthentication,TokenAuthentication});
@@ -0,0 +1,541 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * Great Detail Support System.
5
+ *
6
+ * @copyright 2024 Great Detail Ltd
7
+ * @author Great Detail Ltd <info@greatdetail.com>
8
+ * @author Dom Webber <dom.webber@greatdetail.com>
9
+ * @see https://greatdetail.com
10
+ */
11
+ /**
12
+ * Support System API Base URL.
13
+ *
14
+ * @since 1.0.0
15
+ */
16
+ declare const DEFAULT_SUPPORT_BASE_URL = "https://api.support.greatdetail.com";
17
+
18
+ /**
19
+ * Great Detail Support System.
20
+ *
21
+ * @copyright 2024 Great Detail Ltd
22
+ * @author Great Detail Ltd <info@greatdetail.com>
23
+ * @author Dom Webber <dom.webber@greatdetail.com>
24
+ * @see https://greatdetail.com
25
+ */
26
+ interface RequestFilterable {
27
+ filter(request: RequestInit): Promise<RequestInit>;
28
+ }
29
+
30
+ /**
31
+ * Great Detail Support System.
32
+ *
33
+ * @copyright 2024 Great Detail Ltd
34
+ * @author Great Detail Ltd <info@greatdetail.com>
35
+ * @author Dom Webber <dom.webber@greatdetail.com>
36
+ * @see https://greatdetail.com
37
+ */
38
+
39
+ interface Authentication extends RequestFilterable {
40
+ }
41
+
42
+ /**
43
+ * Great Detail Support System.
44
+ *
45
+ * @copyright 2024 Great Detail Ltd
46
+ * @author Great Detail Ltd <info@greatdetail.com>
47
+ * @author Dom Webber <dom.webber@greatdetail.com>
48
+ * @see https://greatdetail.com
49
+ */
50
+
51
+ interface Options$c {
52
+ name?: string;
53
+ key?: string;
54
+ }
55
+ declare class KeyAuthentication implements Authentication {
56
+ #private;
57
+ static DEFAULT_NAME: string;
58
+ name: string;
59
+ constructor({ name, key, }?: Options$c);
60
+ filter(request: RequestInit): Promise<RequestInit>;
61
+ }
62
+
63
+ /**
64
+ * Great Detail Support System.
65
+ *
66
+ * @copyright 2024 Great Detail Ltd
67
+ * @author Great Detail Ltd <info@greatdetail.com>
68
+ * @author Dom Webber <dom.webber@greatdetail.com>
69
+ * @see https://greatdetail.com
70
+ */
71
+
72
+ interface Options$b {
73
+ token?: string;
74
+ }
75
+ declare class TokenAuthentication implements Authentication {
76
+ #private;
77
+ constructor({ token }?: Options$b);
78
+ filter(request: RequestInit): Promise<RequestInit>;
79
+ }
80
+
81
+ /**
82
+ * Great Detail Support System.
83
+ *
84
+ * @copyright 2024 Great Detail Ltd
85
+ * @author Great Detail Ltd <info@greatdetail.com>
86
+ * @author Dom Webber <dom.webber@greatdetail.com>
87
+ * @see https://greatdetail.com
88
+ */
89
+
90
+ /**
91
+ * Public Authentication Configuration.
92
+ * Note: Not all APIs and endpoints will work with this authentication type.
93
+ *
94
+ * @since 1.0.l0
95
+ */
96
+ declare class PublicAuthentication implements Authentication {
97
+ filter(request: RequestInit): Promise<RequestInit>;
98
+ }
99
+
100
+ /**
101
+ * Great Detail Support System.
102
+ *
103
+ * @copyright 2024 Great Detail Ltd
104
+ * @author Great Detail Ltd <info@greatdetail.com>
105
+ * @author Dom Webber <dom.webber@greatdetail.com>
106
+ * @see https://greatdetail.com
107
+ */
108
+
109
+ interface Options$a extends SendOptions {
110
+ request?: RequestInit;
111
+ }
112
+ declare class ListActionsRequest {
113
+ protected _client: Client;
114
+ constructor(_client: Client);
115
+ send({ request, ...options }?: Options$a): Promise<ListActionsResponse>;
116
+ }
117
+ type ListResponse$9 = {
118
+ actions: {
119
+ id: string;
120
+ actionStatus: string;
121
+ object?: unknown;
122
+ result?: unknown;
123
+ startedAt?: string;
124
+ endedAt?: string;
125
+ }[];
126
+ };
127
+ declare class ListActionsResponse {
128
+ response: Response;
129
+ constructor(response: Response);
130
+ result(): Promise<ListResponse$9>;
131
+ }
132
+
133
+ /**
134
+ * Great Detail Support System.
135
+ *
136
+ * @copyright 2024 Great Detail Ltd
137
+ * @author Great Detail Ltd <info@greatdetail.com>
138
+ * @author Dom Webber <dom.webber@greatdetail.com>
139
+ * @see https://greatdetail.com
140
+ */
141
+
142
+ interface Options$9 extends SendOptions {
143
+ request?: RequestInit;
144
+ }
145
+ declare class ListChannelsRequest {
146
+ protected _client: Client;
147
+ constructor(_client: Client);
148
+ send({ request, ...options }?: Options$9): Promise<ListChannelsResponse>;
149
+ }
150
+ type ListResponse$8 = {
151
+ channels: {
152
+ id: string;
153
+ name?: string;
154
+ channelStatus: "ActiveChannelStatus" | "PotentialChannelStatus";
155
+ source: "twilio-sendgrid" | "meta-whatsapp";
156
+ createdAt: string;
157
+ updatedAt?: string;
158
+ }[];
159
+ };
160
+ declare class ListChannelsResponse {
161
+ response: Response;
162
+ constructor(response: Response);
163
+ result(): Promise<ListResponse$8>;
164
+ }
165
+
166
+ /**
167
+ * Great Detail Support System.
168
+ *
169
+ * @copyright 2024 Great Detail Ltd
170
+ * @author Great Detail Ltd <info@greatdetail.com>
171
+ * @author Dom Webber <dom.webber@greatdetail.com>
172
+ * @see https://greatdetail.com
173
+ */
174
+
175
+ interface Options$8 extends SendOptions {
176
+ request?: RequestInit;
177
+ }
178
+ declare class ListContactsRequest {
179
+ protected _client: Client;
180
+ constructor(_client: Client);
181
+ send({ request, ...options }?: Options$8): Promise<ListContactsResponse>;
182
+ }
183
+ type ListResponse$7 = {
184
+ contacts: {
185
+ id: string;
186
+ name?: string;
187
+ emailAddress?: string;
188
+ telephoneNumber?: string;
189
+ createdAt: string;
190
+ updatedAt?: string;
191
+ }[];
192
+ };
193
+ declare class ListContactsResponse {
194
+ response: Response;
195
+ constructor(response: Response);
196
+ result(): Promise<ListResponse$7>;
197
+ }
198
+
199
+ /**
200
+ * Great Detail Support System.
201
+ *
202
+ * @copyright 2024 Great Detail Ltd
203
+ * @author Great Detail Ltd <info@greatdetail.com>
204
+ * @author Dom Webber <dom.webber@greatdetail.com>
205
+ * @see https://greatdetail.com
206
+ */
207
+
208
+ interface Options$7 extends SendOptions {
209
+ id: string;
210
+ request?: RequestInit;
211
+ }
212
+ declare class GetConversationRequest {
213
+ protected _client: Client;
214
+ constructor(_client: Client);
215
+ send({ id, request, ...options }: Options$7): Promise<GetConversationResponse>;
216
+ }
217
+ type GetResponse = {
218
+ conversation: {
219
+ id: string;
220
+ hasEnded: boolean;
221
+ accountChannel: string;
222
+ createdAt: string;
223
+ updatedAt: string;
224
+ };
225
+ };
226
+ declare class GetConversationResponse {
227
+ response: Response;
228
+ constructor(response: Response);
229
+ result(): Promise<GetResponse>;
230
+ }
231
+
232
+ /**
233
+ * Great Detail Support System.
234
+ *
235
+ * @copyright 2024 Great Detail Ltd
236
+ * @author Great Detail Ltd <info@greatdetail.com>
237
+ * @author Dom Webber <dom.webber@greatdetail.com>
238
+ * @see https://greatdetail.com
239
+ */
240
+
241
+ interface Options$6 extends SendOptions {
242
+ request?: RequestInit;
243
+ }
244
+ declare class ListConversationsRequest {
245
+ protected _client: Client;
246
+ constructor(_client: Client);
247
+ send({ request, ...options }?: Options$6): Promise<ListConversationsResponse>;
248
+ }
249
+ type ListResponse$6 = {
250
+ conversations: {
251
+ id: string;
252
+ hasEnded: boolean;
253
+ accountChannel: string;
254
+ createdAt: string;
255
+ updatedAt: string;
256
+ }[];
257
+ };
258
+ declare class ListConversationsResponse {
259
+ response: Response;
260
+ constructor(response: Response);
261
+ result(): Promise<ListResponse$6>;
262
+ }
263
+
264
+ /**
265
+ * Great Detail Support System.
266
+ *
267
+ * @copyright 2024 Great Detail Ltd
268
+ * @author Great Detail Ltd <info@greatdetail.com>
269
+ * @author Dom Webber <dom.webber@greatdetail.com>
270
+ * @see https://greatdetail.com
271
+ */
272
+
273
+ interface Options$5 extends SendOptions {
274
+ request?: RequestInit;
275
+ }
276
+ declare class ListLabelsRequest {
277
+ protected _client: Client;
278
+ constructor(_client: Client);
279
+ send({ request, ...options }?: Options$5): Promise<ListLabelsResponse>;
280
+ }
281
+ type ListResponse$5 = {
282
+ labels: {
283
+ id: string;
284
+ title: string;
285
+ description?: string;
286
+ createdAt: string;
287
+ updatedAt?: string;
288
+ }[];
289
+ };
290
+ declare class ListLabelsResponse {
291
+ response: Response;
292
+ constructor(response: Response);
293
+ result(): Promise<ListResponse$5>;
294
+ }
295
+
296
+ /**
297
+ * Great Detail Support System.
298
+ *
299
+ * @copyright 2024 Great Detail Ltd
300
+ * @author Great Detail Ltd <info@greatdetail.com>
301
+ * @author Dom Webber <dom.webber@greatdetail.com>
302
+ * @see https://greatdetail.com
303
+ */
304
+
305
+ interface Options$4 extends SendOptions {
306
+ request?: RequestInit;
307
+ }
308
+ declare class ListMessagesRequest {
309
+ protected _client: Client;
310
+ constructor(_client: Client);
311
+ send({ request, ...options }?: Options$4): Promise<ListMessagesResponse>;
312
+ }
313
+ type ListResponse$4 = {
314
+ messages: {
315
+ id: string;
316
+ role: "user" | "assistant";
317
+ messageStatus: string;
318
+ externalIdentifier?: string;
319
+ conversation: string;
320
+ contact: string;
321
+ createdAt: string;
322
+ updatedAt: string;
323
+ }[];
324
+ };
325
+ declare class ListMessagesResponse {
326
+ response: Response;
327
+ constructor(response: Response);
328
+ result(): Promise<ListResponse$4>;
329
+ }
330
+
331
+ /**
332
+ * Great Detail Support System.
333
+ *
334
+ * @copyright 2024 Great Detail Ltd
335
+ * @author Great Detail Ltd <info@greatdetail.com>
336
+ * @author Dom Webber <dom.webber@greatdetail.com>
337
+ * @see https://greatdetail.com
338
+ */
339
+
340
+ interface Options$3 extends SendOptions {
341
+ id: string;
342
+ body: z.infer<typeof CreateCorrectionModelRequest.SCHEMA>;
343
+ request?: RequestInit;
344
+ }
345
+ declare class CreateCorrectionModelRequest {
346
+ protected _client: Client;
347
+ static SCHEMA: z.ZodObject<{
348
+ input: z.ZodString;
349
+ original: z.ZodString;
350
+ correction: z.ZodString;
351
+ }, "strip", z.ZodTypeAny, {
352
+ input: string;
353
+ original: string;
354
+ correction: string;
355
+ }, {
356
+ input: string;
357
+ original: string;
358
+ correction: string;
359
+ }>;
360
+ constructor(_client: Client);
361
+ send({ id, body, request, ...options }: Options$3): Promise<CreateCorrectionModelResponse>;
362
+ }
363
+ type ListResponse$3 = unknown;
364
+ declare class CreateCorrectionModelResponse {
365
+ response: Response;
366
+ constructor(response: Response);
367
+ result(): Promise<ListResponse$3>;
368
+ }
369
+
370
+ /**
371
+ * Great Detail Support System.
372
+ *
373
+ * @copyright 2024 Great Detail Ltd
374
+ * @author Great Detail Ltd <info@greatdetail.com>
375
+ * @author Dom Webber <dom.webber@greatdetail.com>
376
+ * @see https://greatdetail.com
377
+ */
378
+
379
+ interface Options$2 extends SendOptions {
380
+ request?: RequestInit;
381
+ }
382
+ declare class ListModelsRequest {
383
+ protected _client: Client;
384
+ constructor(_client: Client);
385
+ send({ request, ...options }?: Options$2): Promise<ListModelsResponse>;
386
+ }
387
+ type ListResponse$2 = {
388
+ models: {
389
+ id: string;
390
+ name: string;
391
+ url: string;
392
+ icon: string;
393
+ disambiguatingDescription: string;
394
+ }[];
395
+ };
396
+ declare class ListModelsResponse {
397
+ response: Response;
398
+ constructor(response: Response);
399
+ result(): Promise<ListResponse$2>;
400
+ }
401
+
402
+ /**
403
+ * Great Detail Support System.
404
+ *
405
+ * @copyright 2024 Great Detail Ltd
406
+ * @author Great Detail Ltd <info@greatdetail.com>
407
+ * @author Dom Webber <dom.webber@greatdetail.com>
408
+ * @see https://greatdetail.com
409
+ */
410
+
411
+ interface Options$1 extends SendOptions {
412
+ id: string;
413
+ body: z.infer<typeof CreateResponseModelRequest.SCHEMA>;
414
+ request?: RequestInit;
415
+ }
416
+ declare class CreateResponseModelRequest {
417
+ protected _client: Client;
418
+ static SCHEMA: z.ZodArray<z.ZodObject<{
419
+ role: z.ZodEnum<["user", "assistant"]>;
420
+ content: z.ZodNullable<z.ZodString>;
421
+ }, "strip", z.ZodTypeAny, {
422
+ role: "user" | "assistant";
423
+ content: string | null;
424
+ }, {
425
+ role: "user" | "assistant";
426
+ content: string | null;
427
+ }>, "many">;
428
+ constructor(_client: Client);
429
+ send({ id, body, request, ...options }: Options$1): Promise<CreateResponseModelResponse>;
430
+ }
431
+ type ListResponse$1 = {
432
+ message: string | null;
433
+ debug: {
434
+ duration: string;
435
+ sources: (string | undefined)[];
436
+ };
437
+ };
438
+ declare class CreateResponseModelResponse {
439
+ response: Response;
440
+ constructor(response: Response);
441
+ result(): Promise<ListResponse$1>;
442
+ }
443
+
444
+ /**
445
+ * Great Detail Support System.
446
+ *
447
+ * @copyright 2024 Great Detail Ltd
448
+ * @author Great Detail Ltd <info@greatdetail.com>
449
+ * @author Dom Webber <dom.webber@greatdetail.com>
450
+ * @see https://greatdetail.com
451
+ */
452
+
453
+ interface Options extends SendOptions {
454
+ request?: RequestInit;
455
+ }
456
+ declare class ListSourcesRequest {
457
+ protected _client: Client;
458
+ constructor(_client: Client);
459
+ send({ request, ...options }?: Options): Promise<ListSourcesResponse>;
460
+ }
461
+ type ListResponse = {
462
+ sources: {
463
+ id: string;
464
+ name: string;
465
+ category: string;
466
+ url: string;
467
+ disambiguatingDescription: string;
468
+ }[];
469
+ };
470
+ declare class ListSourcesResponse {
471
+ response: Response;
472
+ constructor(response: Response);
473
+ result(): Promise<ListResponse>;
474
+ }
475
+
476
+ /**
477
+ * Great Detail Support System.
478
+ *
479
+ * @copyright 2024 Great Detail Ltd
480
+ * @author Great Detail Ltd <info@greatdetail.com>
481
+ * @author Dom Webber <dom.webber@greatdetail.com>
482
+ * @see https://greatdetail.com
483
+ */
484
+
485
+ interface ClientOptions {
486
+ requestFilterables: RequestFilterable[];
487
+ baseURL: string;
488
+ }
489
+ interface InputClientOptions {
490
+ baseURL?: string;
491
+ }
492
+ interface SendOptions {
493
+ /**
494
+ * Alternative Fetch Provider.
495
+ * Used to override the default fetch provider and use polyfills or other
496
+ * libraries.
497
+ *
498
+ * @since 1.0.0
499
+ */
500
+ fetch?: typeof fetch;
501
+ }
502
+ declare class Client {
503
+ static DEFAULT_BASE_URL: string;
504
+ options: ClientOptions;
505
+ constructor(authentication: Authentication, options?: InputClientOptions);
506
+ action: {
507
+ list: ListActionsRequest;
508
+ };
509
+ channel: {
510
+ list: ListChannelsRequest;
511
+ };
512
+ contact: {
513
+ list: ListContactsRequest;
514
+ };
515
+ conversation: {
516
+ get: GetConversationRequest;
517
+ list: ListConversationsRequest;
518
+ };
519
+ label: {
520
+ list: ListLabelsRequest;
521
+ };
522
+ message: {
523
+ list: ListMessagesRequest;
524
+ };
525
+ model: {
526
+ list: ListModelsRequest;
527
+ response: {
528
+ create: CreateResponseModelRequest;
529
+ };
530
+ correction: {
531
+ create: CreateCorrectionModelRequest;
532
+ };
533
+ };
534
+ source: {
535
+ list: ListSourcesRequest;
536
+ };
537
+ protected _filterRequest(request: RequestInit): Promise<RequestInit>;
538
+ send(url: string | URL, request: RequestInit, { fetch: fetchAlternative }?: SendOptions): Promise<Response>;
539
+ }
540
+
541
+ export { Client, DEFAULT_SUPPORT_BASE_URL, KeyAuthentication, PublicAuthentication, type RequestFilterable, TokenAuthentication, Client as default };
@@ -0,0 +1,541 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * Great Detail Support System.
5
+ *
6
+ * @copyright 2024 Great Detail Ltd
7
+ * @author Great Detail Ltd <info@greatdetail.com>
8
+ * @author Dom Webber <dom.webber@greatdetail.com>
9
+ * @see https://greatdetail.com
10
+ */
11
+ /**
12
+ * Support System API Base URL.
13
+ *
14
+ * @since 1.0.0
15
+ */
16
+ declare const DEFAULT_SUPPORT_BASE_URL = "https://api.support.greatdetail.com";
17
+
18
+ /**
19
+ * Great Detail Support System.
20
+ *
21
+ * @copyright 2024 Great Detail Ltd
22
+ * @author Great Detail Ltd <info@greatdetail.com>
23
+ * @author Dom Webber <dom.webber@greatdetail.com>
24
+ * @see https://greatdetail.com
25
+ */
26
+ interface RequestFilterable {
27
+ filter(request: RequestInit): Promise<RequestInit>;
28
+ }
29
+
30
+ /**
31
+ * Great Detail Support System.
32
+ *
33
+ * @copyright 2024 Great Detail Ltd
34
+ * @author Great Detail Ltd <info@greatdetail.com>
35
+ * @author Dom Webber <dom.webber@greatdetail.com>
36
+ * @see https://greatdetail.com
37
+ */
38
+
39
+ interface Authentication extends RequestFilterable {
40
+ }
41
+
42
+ /**
43
+ * Great Detail Support System.
44
+ *
45
+ * @copyright 2024 Great Detail Ltd
46
+ * @author Great Detail Ltd <info@greatdetail.com>
47
+ * @author Dom Webber <dom.webber@greatdetail.com>
48
+ * @see https://greatdetail.com
49
+ */
50
+
51
+ interface Options$c {
52
+ name?: string;
53
+ key?: string;
54
+ }
55
+ declare class KeyAuthentication implements Authentication {
56
+ #private;
57
+ static DEFAULT_NAME: string;
58
+ name: string;
59
+ constructor({ name, key, }?: Options$c);
60
+ filter(request: RequestInit): Promise<RequestInit>;
61
+ }
62
+
63
+ /**
64
+ * Great Detail Support System.
65
+ *
66
+ * @copyright 2024 Great Detail Ltd
67
+ * @author Great Detail Ltd <info@greatdetail.com>
68
+ * @author Dom Webber <dom.webber@greatdetail.com>
69
+ * @see https://greatdetail.com
70
+ */
71
+
72
+ interface Options$b {
73
+ token?: string;
74
+ }
75
+ declare class TokenAuthentication implements Authentication {
76
+ #private;
77
+ constructor({ token }?: Options$b);
78
+ filter(request: RequestInit): Promise<RequestInit>;
79
+ }
80
+
81
+ /**
82
+ * Great Detail Support System.
83
+ *
84
+ * @copyright 2024 Great Detail Ltd
85
+ * @author Great Detail Ltd <info@greatdetail.com>
86
+ * @author Dom Webber <dom.webber@greatdetail.com>
87
+ * @see https://greatdetail.com
88
+ */
89
+
90
+ /**
91
+ * Public Authentication Configuration.
92
+ * Note: Not all APIs and endpoints will work with this authentication type.
93
+ *
94
+ * @since 1.0.l0
95
+ */
96
+ declare class PublicAuthentication implements Authentication {
97
+ filter(request: RequestInit): Promise<RequestInit>;
98
+ }
99
+
100
+ /**
101
+ * Great Detail Support System.
102
+ *
103
+ * @copyright 2024 Great Detail Ltd
104
+ * @author Great Detail Ltd <info@greatdetail.com>
105
+ * @author Dom Webber <dom.webber@greatdetail.com>
106
+ * @see https://greatdetail.com
107
+ */
108
+
109
+ interface Options$a extends SendOptions {
110
+ request?: RequestInit;
111
+ }
112
+ declare class ListActionsRequest {
113
+ protected _client: Client;
114
+ constructor(_client: Client);
115
+ send({ request, ...options }?: Options$a): Promise<ListActionsResponse>;
116
+ }
117
+ type ListResponse$9 = {
118
+ actions: {
119
+ id: string;
120
+ actionStatus: string;
121
+ object?: unknown;
122
+ result?: unknown;
123
+ startedAt?: string;
124
+ endedAt?: string;
125
+ }[];
126
+ };
127
+ declare class ListActionsResponse {
128
+ response: Response;
129
+ constructor(response: Response);
130
+ result(): Promise<ListResponse$9>;
131
+ }
132
+
133
+ /**
134
+ * Great Detail Support System.
135
+ *
136
+ * @copyright 2024 Great Detail Ltd
137
+ * @author Great Detail Ltd <info@greatdetail.com>
138
+ * @author Dom Webber <dom.webber@greatdetail.com>
139
+ * @see https://greatdetail.com
140
+ */
141
+
142
+ interface Options$9 extends SendOptions {
143
+ request?: RequestInit;
144
+ }
145
+ declare class ListChannelsRequest {
146
+ protected _client: Client;
147
+ constructor(_client: Client);
148
+ send({ request, ...options }?: Options$9): Promise<ListChannelsResponse>;
149
+ }
150
+ type ListResponse$8 = {
151
+ channels: {
152
+ id: string;
153
+ name?: string;
154
+ channelStatus: "ActiveChannelStatus" | "PotentialChannelStatus";
155
+ source: "twilio-sendgrid" | "meta-whatsapp";
156
+ createdAt: string;
157
+ updatedAt?: string;
158
+ }[];
159
+ };
160
+ declare class ListChannelsResponse {
161
+ response: Response;
162
+ constructor(response: Response);
163
+ result(): Promise<ListResponse$8>;
164
+ }
165
+
166
+ /**
167
+ * Great Detail Support System.
168
+ *
169
+ * @copyright 2024 Great Detail Ltd
170
+ * @author Great Detail Ltd <info@greatdetail.com>
171
+ * @author Dom Webber <dom.webber@greatdetail.com>
172
+ * @see https://greatdetail.com
173
+ */
174
+
175
+ interface Options$8 extends SendOptions {
176
+ request?: RequestInit;
177
+ }
178
+ declare class ListContactsRequest {
179
+ protected _client: Client;
180
+ constructor(_client: Client);
181
+ send({ request, ...options }?: Options$8): Promise<ListContactsResponse>;
182
+ }
183
+ type ListResponse$7 = {
184
+ contacts: {
185
+ id: string;
186
+ name?: string;
187
+ emailAddress?: string;
188
+ telephoneNumber?: string;
189
+ createdAt: string;
190
+ updatedAt?: string;
191
+ }[];
192
+ };
193
+ declare class ListContactsResponse {
194
+ response: Response;
195
+ constructor(response: Response);
196
+ result(): Promise<ListResponse$7>;
197
+ }
198
+
199
+ /**
200
+ * Great Detail Support System.
201
+ *
202
+ * @copyright 2024 Great Detail Ltd
203
+ * @author Great Detail Ltd <info@greatdetail.com>
204
+ * @author Dom Webber <dom.webber@greatdetail.com>
205
+ * @see https://greatdetail.com
206
+ */
207
+
208
+ interface Options$7 extends SendOptions {
209
+ id: string;
210
+ request?: RequestInit;
211
+ }
212
+ declare class GetConversationRequest {
213
+ protected _client: Client;
214
+ constructor(_client: Client);
215
+ send({ id, request, ...options }: Options$7): Promise<GetConversationResponse>;
216
+ }
217
+ type GetResponse = {
218
+ conversation: {
219
+ id: string;
220
+ hasEnded: boolean;
221
+ accountChannel: string;
222
+ createdAt: string;
223
+ updatedAt: string;
224
+ };
225
+ };
226
+ declare class GetConversationResponse {
227
+ response: Response;
228
+ constructor(response: Response);
229
+ result(): Promise<GetResponse>;
230
+ }
231
+
232
+ /**
233
+ * Great Detail Support System.
234
+ *
235
+ * @copyright 2024 Great Detail Ltd
236
+ * @author Great Detail Ltd <info@greatdetail.com>
237
+ * @author Dom Webber <dom.webber@greatdetail.com>
238
+ * @see https://greatdetail.com
239
+ */
240
+
241
+ interface Options$6 extends SendOptions {
242
+ request?: RequestInit;
243
+ }
244
+ declare class ListConversationsRequest {
245
+ protected _client: Client;
246
+ constructor(_client: Client);
247
+ send({ request, ...options }?: Options$6): Promise<ListConversationsResponse>;
248
+ }
249
+ type ListResponse$6 = {
250
+ conversations: {
251
+ id: string;
252
+ hasEnded: boolean;
253
+ accountChannel: string;
254
+ createdAt: string;
255
+ updatedAt: string;
256
+ }[];
257
+ };
258
+ declare class ListConversationsResponse {
259
+ response: Response;
260
+ constructor(response: Response);
261
+ result(): Promise<ListResponse$6>;
262
+ }
263
+
264
+ /**
265
+ * Great Detail Support System.
266
+ *
267
+ * @copyright 2024 Great Detail Ltd
268
+ * @author Great Detail Ltd <info@greatdetail.com>
269
+ * @author Dom Webber <dom.webber@greatdetail.com>
270
+ * @see https://greatdetail.com
271
+ */
272
+
273
+ interface Options$5 extends SendOptions {
274
+ request?: RequestInit;
275
+ }
276
+ declare class ListLabelsRequest {
277
+ protected _client: Client;
278
+ constructor(_client: Client);
279
+ send({ request, ...options }?: Options$5): Promise<ListLabelsResponse>;
280
+ }
281
+ type ListResponse$5 = {
282
+ labels: {
283
+ id: string;
284
+ title: string;
285
+ description?: string;
286
+ createdAt: string;
287
+ updatedAt?: string;
288
+ }[];
289
+ };
290
+ declare class ListLabelsResponse {
291
+ response: Response;
292
+ constructor(response: Response);
293
+ result(): Promise<ListResponse$5>;
294
+ }
295
+
296
+ /**
297
+ * Great Detail Support System.
298
+ *
299
+ * @copyright 2024 Great Detail Ltd
300
+ * @author Great Detail Ltd <info@greatdetail.com>
301
+ * @author Dom Webber <dom.webber@greatdetail.com>
302
+ * @see https://greatdetail.com
303
+ */
304
+
305
+ interface Options$4 extends SendOptions {
306
+ request?: RequestInit;
307
+ }
308
+ declare class ListMessagesRequest {
309
+ protected _client: Client;
310
+ constructor(_client: Client);
311
+ send({ request, ...options }?: Options$4): Promise<ListMessagesResponse>;
312
+ }
313
+ type ListResponse$4 = {
314
+ messages: {
315
+ id: string;
316
+ role: "user" | "assistant";
317
+ messageStatus: string;
318
+ externalIdentifier?: string;
319
+ conversation: string;
320
+ contact: string;
321
+ createdAt: string;
322
+ updatedAt: string;
323
+ }[];
324
+ };
325
+ declare class ListMessagesResponse {
326
+ response: Response;
327
+ constructor(response: Response);
328
+ result(): Promise<ListResponse$4>;
329
+ }
330
+
331
+ /**
332
+ * Great Detail Support System.
333
+ *
334
+ * @copyright 2024 Great Detail Ltd
335
+ * @author Great Detail Ltd <info@greatdetail.com>
336
+ * @author Dom Webber <dom.webber@greatdetail.com>
337
+ * @see https://greatdetail.com
338
+ */
339
+
340
+ interface Options$3 extends SendOptions {
341
+ id: string;
342
+ body: z.infer<typeof CreateCorrectionModelRequest.SCHEMA>;
343
+ request?: RequestInit;
344
+ }
345
+ declare class CreateCorrectionModelRequest {
346
+ protected _client: Client;
347
+ static SCHEMA: z.ZodObject<{
348
+ input: z.ZodString;
349
+ original: z.ZodString;
350
+ correction: z.ZodString;
351
+ }, "strip", z.ZodTypeAny, {
352
+ input: string;
353
+ original: string;
354
+ correction: string;
355
+ }, {
356
+ input: string;
357
+ original: string;
358
+ correction: string;
359
+ }>;
360
+ constructor(_client: Client);
361
+ send({ id, body, request, ...options }: Options$3): Promise<CreateCorrectionModelResponse>;
362
+ }
363
+ type ListResponse$3 = unknown;
364
+ declare class CreateCorrectionModelResponse {
365
+ response: Response;
366
+ constructor(response: Response);
367
+ result(): Promise<ListResponse$3>;
368
+ }
369
+
370
+ /**
371
+ * Great Detail Support System.
372
+ *
373
+ * @copyright 2024 Great Detail Ltd
374
+ * @author Great Detail Ltd <info@greatdetail.com>
375
+ * @author Dom Webber <dom.webber@greatdetail.com>
376
+ * @see https://greatdetail.com
377
+ */
378
+
379
+ interface Options$2 extends SendOptions {
380
+ request?: RequestInit;
381
+ }
382
+ declare class ListModelsRequest {
383
+ protected _client: Client;
384
+ constructor(_client: Client);
385
+ send({ request, ...options }?: Options$2): Promise<ListModelsResponse>;
386
+ }
387
+ type ListResponse$2 = {
388
+ models: {
389
+ id: string;
390
+ name: string;
391
+ url: string;
392
+ icon: string;
393
+ disambiguatingDescription: string;
394
+ }[];
395
+ };
396
+ declare class ListModelsResponse {
397
+ response: Response;
398
+ constructor(response: Response);
399
+ result(): Promise<ListResponse$2>;
400
+ }
401
+
402
+ /**
403
+ * Great Detail Support System.
404
+ *
405
+ * @copyright 2024 Great Detail Ltd
406
+ * @author Great Detail Ltd <info@greatdetail.com>
407
+ * @author Dom Webber <dom.webber@greatdetail.com>
408
+ * @see https://greatdetail.com
409
+ */
410
+
411
+ interface Options$1 extends SendOptions {
412
+ id: string;
413
+ body: z.infer<typeof CreateResponseModelRequest.SCHEMA>;
414
+ request?: RequestInit;
415
+ }
416
+ declare class CreateResponseModelRequest {
417
+ protected _client: Client;
418
+ static SCHEMA: z.ZodArray<z.ZodObject<{
419
+ role: z.ZodEnum<["user", "assistant"]>;
420
+ content: z.ZodNullable<z.ZodString>;
421
+ }, "strip", z.ZodTypeAny, {
422
+ role: "user" | "assistant";
423
+ content: string | null;
424
+ }, {
425
+ role: "user" | "assistant";
426
+ content: string | null;
427
+ }>, "many">;
428
+ constructor(_client: Client);
429
+ send({ id, body, request, ...options }: Options$1): Promise<CreateResponseModelResponse>;
430
+ }
431
+ type ListResponse$1 = {
432
+ message: string | null;
433
+ debug: {
434
+ duration: string;
435
+ sources: (string | undefined)[];
436
+ };
437
+ };
438
+ declare class CreateResponseModelResponse {
439
+ response: Response;
440
+ constructor(response: Response);
441
+ result(): Promise<ListResponse$1>;
442
+ }
443
+
444
+ /**
445
+ * Great Detail Support System.
446
+ *
447
+ * @copyright 2024 Great Detail Ltd
448
+ * @author Great Detail Ltd <info@greatdetail.com>
449
+ * @author Dom Webber <dom.webber@greatdetail.com>
450
+ * @see https://greatdetail.com
451
+ */
452
+
453
+ interface Options extends SendOptions {
454
+ request?: RequestInit;
455
+ }
456
+ declare class ListSourcesRequest {
457
+ protected _client: Client;
458
+ constructor(_client: Client);
459
+ send({ request, ...options }?: Options): Promise<ListSourcesResponse>;
460
+ }
461
+ type ListResponse = {
462
+ sources: {
463
+ id: string;
464
+ name: string;
465
+ category: string;
466
+ url: string;
467
+ disambiguatingDescription: string;
468
+ }[];
469
+ };
470
+ declare class ListSourcesResponse {
471
+ response: Response;
472
+ constructor(response: Response);
473
+ result(): Promise<ListResponse>;
474
+ }
475
+
476
+ /**
477
+ * Great Detail Support System.
478
+ *
479
+ * @copyright 2024 Great Detail Ltd
480
+ * @author Great Detail Ltd <info@greatdetail.com>
481
+ * @author Dom Webber <dom.webber@greatdetail.com>
482
+ * @see https://greatdetail.com
483
+ */
484
+
485
+ interface ClientOptions {
486
+ requestFilterables: RequestFilterable[];
487
+ baseURL: string;
488
+ }
489
+ interface InputClientOptions {
490
+ baseURL?: string;
491
+ }
492
+ interface SendOptions {
493
+ /**
494
+ * Alternative Fetch Provider.
495
+ * Used to override the default fetch provider and use polyfills or other
496
+ * libraries.
497
+ *
498
+ * @since 1.0.0
499
+ */
500
+ fetch?: typeof fetch;
501
+ }
502
+ declare class Client {
503
+ static DEFAULT_BASE_URL: string;
504
+ options: ClientOptions;
505
+ constructor(authentication: Authentication, options?: InputClientOptions);
506
+ action: {
507
+ list: ListActionsRequest;
508
+ };
509
+ channel: {
510
+ list: ListChannelsRequest;
511
+ };
512
+ contact: {
513
+ list: ListContactsRequest;
514
+ };
515
+ conversation: {
516
+ get: GetConversationRequest;
517
+ list: ListConversationsRequest;
518
+ };
519
+ label: {
520
+ list: ListLabelsRequest;
521
+ };
522
+ message: {
523
+ list: ListMessagesRequest;
524
+ };
525
+ model: {
526
+ list: ListModelsRequest;
527
+ response: {
528
+ create: CreateResponseModelRequest;
529
+ };
530
+ correction: {
531
+ create: CreateCorrectionModelRequest;
532
+ };
533
+ };
534
+ source: {
535
+ list: ListSourcesRequest;
536
+ };
537
+ protected _filterRequest(request: RequestInit): Promise<RequestInit>;
538
+ send(url: string | URL, request: RequestInit, { fetch: fetchAlternative }?: SendOptions): Promise<Response>;
539
+ }
540
+
541
+ export { Client, DEFAULT_SUPPORT_BASE_URL, KeyAuthentication, PublicAuthentication, type RequestFilterable, TokenAuthentication, Client as default };
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ import{a,b as o,c as u,d as s}from"./chunk-ZLBEVMCE.js";var e=class r{static DEFAULT_NAME=o;name;#t;constructor({name:t=process.env.SUPPORT_KEY_NAME??r.DEFAULT_NAME,key:n=process.env.SUPPORT_API_KEY}={}){if(!n)throw new Error("API Key option must be specified when using Key Authentication");this.name=t,this.#t=n}async filter(t){return{...t,headers:{...t.headers,Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}}};var i=class{#t;constructor({token:t=process.env.SUPPORT_ACCESS_TOKEN}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}async filter(t){return{...t,headers:{...t.headers,Authorization:`Bearer ${this.#t}`}}}};export{s as Client,a as DEFAULT_SUPPORT_BASE_URL,e as KeyAuthentication,u as PublicAuthentication,i as TokenAuthentication,s as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@great-detail/support-sdk",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "type": "module",
5
5
  "description": "JavaScript SDK for the Great Detail Support System",
6
6
  "author": "Great Detail Ltd <info@greatdetail.com>",
@@ -49,6 +49,7 @@
49
49
  "eslint:dev": "eslint . --fix",
50
50
  "lint": "npm-run-all eslint typecheck publint prettier",
51
51
  "lint:dev": "npm-run-all eslint:dev typecheck publint prettier:dev",
52
+ "prerelease": "npm-run-all build",
52
53
  "prettier": "prettier --check .",
53
54
  "prettier:dev": "prettier --write .",
54
55
  "publint": "publint",