@great-detail/support-sdk 0.0.3 → 0.0.4
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/README.md +17 -0
- package/dist/chunk-WCSPJBPY.js +1 -0
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +62 -15
- package/dist/index.d.ts +62 -15
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/Client/index.ts +2 -0
- package/src/Label/CreateLabel.ts +62 -0
- package/src/index.ts +1 -0
- package/dist/chunk-LS7DRWDS.js +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Great Detail Support System SDK - JS
|
|
2
|
+
|
|
3
|
+
## Getting Started
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install @great-detail/support-sdk
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## License
|
|
10
|
+
|
|
11
|
+
Proprietary © 2024 Great Detail Ltd
|
|
12
|
+
|
|
13
|
+
### Contact
|
|
14
|
+
|
|
15
|
+
**Great Detail Ltd**: <<info@greatdetail.com>>
|
|
16
|
+
|
|
17
|
+
**Dom Webber**: <https://domwebber.dev> <<dom.webber@greatdetail.com>>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var j="https://api.support.greatdetail.com",H={"X-Powered-By":"GDSupport/JavaScript"},F="api-key";var O=class{async filter(e){return e}};var o=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/actions",{...e,method:"GET"},s).then(n=>new C(n))}},C=class{constructor(e){this.response=e}async result(){return this.response.json()}};var i=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/channels",{...e,method:"GET"},s).then(n=>new A(n))}},A=class{constructor(e){this.response=e}async result(){return this.response.json()}};var p=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/contacts",{...e,method:"GET"},s).then(n=>new P(n))}},P=class{constructor(e){this.response=e}async result(){return this.response.json()}};var c=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/conversations/"+encodeURIComponent(e),{...s,method:"GET"},n).then(r=>new _(r))}},_=class{constructor(e){this.response=e}async result(){return this.response.json()}};var a=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/conversations",{...e,method:"GET"},s).then(n=>new E(n))}},E=class{constructor(e){this.response=e}async result(){return this.response.json()}};import{z as l}from"zod";var d=class t{constructor(e){this._client=e}static SCHEMA=l.object({title:l.string(),description:l.optional(l.string()),account:l.string()});async send({body:e,request:s={},...n}){return this._client.send("/v1/labels",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(e))},n).then(r=>new q(r))}},q=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/labels",{...e,method:"GET"},s).then(n=>new w(n))}},w=class{constructor(e){this.response=e}async result(){return this.response.json()}};var m=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/messages",{...e,method:"GET"},s).then(n=>new T(n))}},T=class{constructor(e){this.response=e}async result(){return this.response.json()}};import{z as R}from"zod";var h=class t{constructor(e){this._client=e}static SCHEMA=R.object({input:R.string().max(65536),original:R.string().max(65536),correction:R.string().max(65536)});async send({id:e,body:s,request:n={},...r}){return this._client.send("/v1/models/"+encodeURIComponent(e)+"/correction",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(s))},r).then(S=>new L(S))}},L=class{constructor(e){this.response=e}async result(){return this.response.json()}};var b=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/models",{...e,method:"GET"},s).then(n=>new I(n))}},I=class{constructor(e){this.response=e}async result(){return this.response.json()}};import{z as x}from"zod";var f=class t{constructor(e){this._client=e}static SCHEMA=x.array(x.object({role:x.enum(["user","assistant"]),content:x.string().max(65536).nullable()})).min(1);async send({id:e,body:s,request:n={},...r}){return this._client.send("/v1/models/"+encodeURIComponent(e)+"/response",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(s))},r).then(S=>new v(S))}},v=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/sources",{...e,method:"GET"},s).then(n=>new U(n))}},U=class{constructor(e){this.response=e}async result(){return this.response.json()}};var y=class t{constructor(e=t.STANDARD_HEADERS){this._standardHeaders=e}static STANDARD_HEADERS=H;async filter(e){return{...e,headers:{...e.headers,...this._standardHeaders}}}};var D=class t{static DEFAULT_BASE_URL=j;options;constructor(e,s={}){this.options={requestFilterables:[new y,e],baseURL:process.env.SUPPORT_BASE_URL??t.DEFAULT_BASE_URL,...s}}action={list:new o(this)};channel={list:new i(this)};contact={list:new p(this)};conversation={get:new c(this),list:new a(this)};label={create:new d(this),list:new u(this)};message={list:new m(this)};model={list:new b(this),response:{create:new f(this)},correction:{create:new h(this)}};source={list:new g(this)};async _filterRequest(e){for(let s of this.options.requestFilterables)e=await s.filter(e);return e}async send(e,s,{fetch:n=fetch}={}){return await n(new Request(new URL(e,this.options.baseURL),await this._filterRequest(s)))}};export{j as a,F as b,O as c,D as d};
|
package/dist/cli.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var
|
|
2
|
+
"use strict";var ct=require("commander");var a=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 P(s))}},P=class{constructor(t){this.response=t}async result(){return this.response.json()}};var c=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/channels",{...t,method:"GET"},e).then(s=>new _(s))}},_=class{constructor(t){this.response=t}async result(){return this.response.json()}};var tt="https://api.support.greatdetail.com",et={"X-Powered-By":"GDSupport/JavaScript"};var d=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/contacts",{...t,method:"GET"},e).then(s=>new E(s))}},E=class{constructor(t){this.response=t}async result(){return this.response.json()}};var l=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 v(o))}},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={},...e}={}){return this._client.send("/v1/conversations",{...t,method:"GET"},e).then(s=>new q(s))}},q=class{constructor(t){this.response=t}async result(){return this.response.json()}};var r=require("zod"),u=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 L(o))}},L=class{constructor(t){this.response=t}async result(){return this.response.json()}};var f=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/labels",{...t,method:"GET"},e).then(s=>new T(s))}},T=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/messages",{...t,method:"GET"},e).then(s=>new j(s))}},j=class{constructor(t){this.response=t}async result(){return this.response.json()}};var x=require("zod"),O=class n{constructor(t){this._client=t}static SCHEMA=x.z.object({input:x.z.string().max(65536),original:x.z.string().max(65536),correction:x.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 I(A))}},I=class{constructor(t){this.response=t}async result(){return this.response.json()}};var C=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/models",{...t,method:"GET"},e).then(s=>new D(s))}},D=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.array(y.z.object({role:y.z.enum(["user","assistant"]),content:y.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 U(A))}},U=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=et;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var R=class{constructor(t){this._client=t}async send({request:t={},...e}={}){return this._client.send("/v1/sources",{...t,method:"GET"},e).then(s=>new F(s))}},F=class{constructor(t){this.response=t}async result(){return this.response.json()}};var w=class n{static DEFAULT_BASE_URL=tt;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 c(this)};contact={list:new d(this)};conversation={get:new l(this),list:new m(this)};label={create:new u(this),list:new f(this)};message={list:new g(this)};model={list:new C(this),response:{create:new h(this)},correction:{create:new O(this)}};source={list:new R(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 H=require("commander"),nt=require("ora");function M({client:n,ora:t}){let e=new H.Command("actions").description("Actions");return e.addCommand(new H.Command("list").description("List actions").action(async()=>{let s=await(0,nt.oraPromise)(()=>n.action.list.send(),{...t,text:"Finding actions"});console.log(await s.result())})),e}var G=require("commander"),st=require("ora");function N({client:n,ora:t}){let e=new G.Command("channels").description("Channels");return e.addCommand(new G.Command("list").description("List channels").action(async()=>{let s=await(0,st.oraPromise)(()=>n.channel.list.send(),{...t,text:"Finding channels"});console.log(await s.result())})),e}var z=require("commander"),ot=require("ora");function B({client:n,ora:t}){let e=new z.Command("contacts").description("Contacts");return e.addCommand(new z.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 S=require("commander"),k=require("ora");function J({client:n,ora:t}){let e=new S.Command("conversations").description("Conversations");return e.addCommand(new S.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async s=>{let o=await(0,k.oraPromise)(()=>n.conversation.get.send({id:s}),{...t,text:"Finding conversation"});console.log(await o.result())})),e.addCommand(new S.Command("list").description("List conversations").action(async()=>{let s=await(0,k.oraPromise)(()=>n.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await s.result())})),e}var K=require("commander"),it=require("ora");function X({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,it.oraPromise)(()=>n.label.list.send(),{...t,text:"Finding labels"});console.log(await s.result())})),e}var Y=require("commander"),rt=require("ora");function Q({client:n,ora:t}){let e=new Y.Command("messages").description("Messages");return e.addCommand(new Y.Command("list").description("List messages").action(async()=>{let s=await(0,rt.oraPromise)(()=>n.message.list.send(),{...t,text:"Finding messages"});console.log(await s.result())})),e}var V=require("commander"),at=require("ora");function W({client:n,ora:t}){let e=new V.Command("models").description("Models");return e.addCommand(new V.Command("list").description("List models").action(async()=>{let s=await(0,at.oraPromise)(()=>n.model.list.send(),{...t,text:"Finding models"});console.log(await s.result())})),e}var Z=require("commander"),pt=require("ora");function $({client:n,ora:t}){let e=new Z.Command("sources").description("Sources");return e.addCommand(new Z.Command("list").description("List sources").action(async()=>{let s=await(0,pt.oraPromise)(()=>n.source.list.send(),{...t,text:"Finding sources"});console.log(await s.result())})),e}var i={ora:{spinner:"simpleDotsScrolling"},client:new w(new a)},lt=new ct.Command("gds").description("Great Detail Support System").addCommand(M(i)).addCommand(N(i)).addCommand(B(i)).addCommand(J(i)).addCommand(X(i)).addCommand(Q(i)).addCommand(W(i)).addCommand($(i)),dt=lt;dt.parseAsync(process.argv);
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{c as u,d as C}from"./chunk-
|
|
2
|
+
import{c as u,d as C}from"./chunk-WCSPJBPY.js";import{Command as I}from"commander";import{Command as O}from"commander";import{oraPromise as h}from"ora";function e({client:n,ora:s}){let o=new O("actions").description("Actions");return o.addCommand(new O("list").description("List actions").action(async()=>{let t=await h(()=>n.action.list.send(),{...s,text:"Finding actions"});console.log(await t.result())})),o}import{Command as x}from"commander";import{oraPromise as j}from"ora";function a({client:n,ora:s}){let o=new x("channels").description("Channels");return o.addCommand(new x("list").description("List channels").action(async()=>{let t=await j(()=>n.channel.list.send(),{...s,text:"Finding channels"});console.log(await t.result())})),o}import{Command as w}from"commander";import{oraPromise as S}from"ora";function r({client:n,ora:s}){let o=new w("contacts").description("Contacts");return o.addCommand(new w("list").description("List contacts").action(async()=>{let t=await S(()=>n.contact.list.send(),{...s,text:"Finding contacts"});console.log(await t.result())})),o}import{Command as m}from"commander";import{oraPromise as g}from"ora";function d({client:n,ora:s}){let o=new m("conversations").description("Conversations");return o.addCommand(new m("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async t=>{let P=await g(()=>n.conversation.get.send({id:t}),{...s,text:"Finding conversation"});console.log(await P.result())})),o.addCommand(new m("list").description("List conversations").action(async()=>{let t=await g(()=>n.conversation.list.send(),{...s,text:"Finding conversations"});console.log(await t.result())})),o}import{Command as y}from"commander";import{oraPromise as A}from"ora";function c({client:n,ora:s}){let o=new y("labels").description("Labels");return o.addCommand(new y("list").description("List labels").action(async()=>{let t=await A(()=>n.label.list.send(),{...s,text:"Finding labels"});console.log(await t.result())})),o}import{Command as v}from"commander";import{oraPromise as D}from"ora";function p({client:n,ora:s}){let o=new v("messages").description("Messages");return o.addCommand(new v("list").description("List messages").action(async()=>{let t=await D(()=>n.message.list.send(),{...s,text:"Finding messages"});console.log(await t.result())})),o}import{Command as F}from"commander";import{oraPromise as M}from"ora";function l({client:n,ora:s}){let o=new F("models").description("Models");return o.addCommand(new F("list").description("List models").action(async()=>{let t=await M(()=>n.model.list.send(),{...s,text:"Finding models"});console.log(await t.result())})),o}import{Command as b}from"commander";import{oraPromise as G}from"ora";function f({client:n,ora:s}){let o=new b("sources").description("Sources");return o.addCommand(new b("list").description("List sources").action(async()=>{let t=await G(()=>n.source.list.send(),{...s,text:"Finding sources"});console.log(await t.result())})),o}var i={ora:{spinner:"simpleDotsScrolling"},client:new C(new u)},k=new I("gds").description("Great Detail Support System").addCommand(e(i)).addCommand(a(i)).addCommand(r(i)).addCommand(d(i)).addCommand(c(i)).addCommand(p(i)).addCommand(l(i)).addCommand(f(i)),L=k;L.parseAsync(process.argv);
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var E=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var K=(t,e)=>{for(var s in e)E(t,s,{get:e[s],enumerable:!0})},J=(t,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of k(e))!z.call(t,o)&&o!==s&&E(t,o,{get:()=>e[o],enumerable:!(n=B(e,o))||n.enumerable});return t};var Y=t=>J(E({},"__esModule",{value:!0}),t);var $={};K($,{Client:()=>i,DEFAULT_SUPPORT_BASE_URL:()=>C,KeyAuthentication:()=>p,PublicAuthentication:()=>c,TokenAuthentication:()=>a,default:()=>i});module.exports=Y($);var C="https://api.support.greatdetail.com",H={"X-Powered-By":"GDSupport/JavaScript"},G="api-key";var p=class t{static DEFAULT_NAME=G;name;#e;constructor({name:e=process.env.SUPPORT_KEY_NAME??t.DEFAULT_NAME,key:s=process.env.SUPPORT_API_KEY}={}){if(!s)throw new Error("API Key option must be specified when using Key Authentication");this.name=e,this.#e=s}async filter(e){return{...e,headers:{...e.headers,Authorization:`Basic ${btoa(this.name+":"+this.#e)}`}}}};var a=class{#e;constructor({token:e=process.env.SUPPORT_ACCESS_TOKEN}={}){if(!e)throw new Error("Access Token option must be specified when using Token Authentication");this.#e=e}async filter(e){return{...e,headers:{...e.headers,Authorization:`Bearer ${this.#e}`}}}};var c=class{async filter(e){return e}};var l=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/actions",{...e,method:"GET"},s).then(n=>new T(n))}},T=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 w(n))}},w=class{constructor(e){this.response=e}async result(){return this.response.json()}};var d=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/contacts",{...e,method:"GET"},s).then(n=>new L(n))}},L=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/conversations/"+encodeURIComponent(e),{...s,method:"GET"},n).then(o=>new q(o))}},q=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 I(n))}},I=class{constructor(e){this.response=e}async result(){return this.response.json()}};var r=require("zod"),h=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 U(o))}},U=class{constructor(e){this.response=e}async result(){return this.response.json()}};var y=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/labels",{...e,method:"GET"},s).then(n=>new v(n))}},v=class{constructor(e){this.response=e}async result(){return this.response.json()}};var R=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/messages",{...e,method:"GET"},s).then(n=>new D(n))}},D=class{constructor(e){this.response=e}async result(){return this.response.json()}};var b=require("zod"),x=class t{constructor(e){this._client=e}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: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(_=>new j(_))}},j=class{constructor(e){this.response=e}async result(){return this.response.json()}};var g=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/models",{...e,method:"GET"},s).then(n=>new M(n))}},M=class{constructor(e){this.response=e}async result(){return this.response.json()}};var A=require("zod"),O=class t{constructor(e){this._client=e}static SCHEMA=A.z.array(A.z.object({role:A.z.enum(["user","assistant"]),content:A.z.string().max(65536).nullable()})).min(1);async send({id: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(_=>new N(_))}},N=class{constructor(e){this.response=e}async result(){return this.response.json()}};var S=class t{constructor(e=t.STANDARD_HEADERS){this._standardHeaders=e}static STANDARD_HEADERS=H;async filter(e){return{...e,headers:{...e.headers,...this._standardHeaders}}}};var P=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/sources",{...e,method:"GET"},s).then(n=>new F(n))}},F=class{constructor(e){this.response=e}async result(){return this.response.json()}};var i=class t{static DEFAULT_BASE_URL=C;options;constructor(e,s={}){this.options={requestFilterables:[new S,e],baseURL:process.env.SUPPORT_BASE_URL??t.DEFAULT_BASE_URL,...s}}action={list:new l(this)};channel={list:new u(this)};contact={list:new d(this)};conversation={get:new m(this),list:new f(this)};label={create:new h(this),list:new y(this)};message={list:new R(this)};model={list:new g(this),response:{create:new O(this)},correction:{create:new x(this)}};source={list:new P(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
|
@@ -48,7 +48,7 @@ interface Authentication extends RequestFilterable {
|
|
|
48
48
|
* @see https://greatdetail.com
|
|
49
49
|
*/
|
|
50
50
|
|
|
51
|
-
interface Options$
|
|
51
|
+
interface Options$d {
|
|
52
52
|
name?: string;
|
|
53
53
|
key?: string;
|
|
54
54
|
}
|
|
@@ -56,7 +56,7 @@ declare class KeyAuthentication implements Authentication {
|
|
|
56
56
|
#private;
|
|
57
57
|
static DEFAULT_NAME: string;
|
|
58
58
|
name: string;
|
|
59
|
-
constructor({ name, key, }?: Options$
|
|
59
|
+
constructor({ name, key, }?: Options$d);
|
|
60
60
|
filter(request: RequestInit): Promise<RequestInit>;
|
|
61
61
|
}
|
|
62
62
|
|
|
@@ -69,12 +69,12 @@ declare class KeyAuthentication implements Authentication {
|
|
|
69
69
|
* @see https://greatdetail.com
|
|
70
70
|
*/
|
|
71
71
|
|
|
72
|
-
interface Options$
|
|
72
|
+
interface Options$c {
|
|
73
73
|
token?: string;
|
|
74
74
|
}
|
|
75
75
|
declare class TokenAuthentication implements Authentication {
|
|
76
76
|
#private;
|
|
77
|
-
constructor({ token }?: Options$
|
|
77
|
+
constructor({ token }?: Options$c);
|
|
78
78
|
filter(request: RequestInit): Promise<RequestInit>;
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -106,13 +106,13 @@ declare class PublicAuthentication implements Authentication {
|
|
|
106
106
|
* @see https://greatdetail.com
|
|
107
107
|
*/
|
|
108
108
|
|
|
109
|
-
interface Options$
|
|
109
|
+
interface Options$b extends SendOptions {
|
|
110
110
|
request?: RequestInit;
|
|
111
111
|
}
|
|
112
112
|
declare class ListActionsRequest {
|
|
113
113
|
protected _client: Client;
|
|
114
114
|
constructor(_client: Client);
|
|
115
|
-
send({ request, ...options }?: Options$
|
|
115
|
+
send({ request, ...options }?: Options$b): Promise<ListActionsResponse>;
|
|
116
116
|
}
|
|
117
117
|
type ListActionsResponsePayload = {
|
|
118
118
|
actions: {
|
|
@@ -139,13 +139,13 @@ declare class ListActionsResponse {
|
|
|
139
139
|
* @see https://greatdetail.com
|
|
140
140
|
*/
|
|
141
141
|
|
|
142
|
-
interface Options$
|
|
142
|
+
interface Options$a extends SendOptions {
|
|
143
143
|
request?: RequestInit;
|
|
144
144
|
}
|
|
145
145
|
declare class ListChannelsRequest {
|
|
146
146
|
protected _client: Client;
|
|
147
147
|
constructor(_client: Client);
|
|
148
|
-
send({ request, ...options }?: Options$
|
|
148
|
+
send({ request, ...options }?: Options$a): Promise<ListChannelsResponse>;
|
|
149
149
|
}
|
|
150
150
|
type ListChannelsResponsePayload = {
|
|
151
151
|
channels: {
|
|
@@ -172,13 +172,13 @@ declare class ListChannelsResponse {
|
|
|
172
172
|
* @see https://greatdetail.com
|
|
173
173
|
*/
|
|
174
174
|
|
|
175
|
-
interface Options$
|
|
175
|
+
interface Options$9 extends SendOptions {
|
|
176
176
|
request?: RequestInit;
|
|
177
177
|
}
|
|
178
178
|
declare class ListContactsRequest {
|
|
179
179
|
protected _client: Client;
|
|
180
180
|
constructor(_client: Client);
|
|
181
|
-
send({ request, ...options }?: Options$
|
|
181
|
+
send({ request, ...options }?: Options$9): Promise<ListContactsResponse>;
|
|
182
182
|
}
|
|
183
183
|
type ListContactsResponsePayload = {
|
|
184
184
|
contacts: {
|
|
@@ -205,14 +205,14 @@ declare class ListContactsResponse {
|
|
|
205
205
|
* @see https://greatdetail.com
|
|
206
206
|
*/
|
|
207
207
|
|
|
208
|
-
interface Options$
|
|
208
|
+
interface Options$8 extends SendOptions {
|
|
209
209
|
id: string;
|
|
210
210
|
request?: RequestInit;
|
|
211
211
|
}
|
|
212
212
|
declare class GetConversationRequest {
|
|
213
213
|
protected _client: Client;
|
|
214
214
|
constructor(_client: Client);
|
|
215
|
-
send({ id, request, ...options }: Options$
|
|
215
|
+
send({ id, request, ...options }: Options$8): Promise<GetConversationResponse>;
|
|
216
216
|
}
|
|
217
217
|
type GetConversationResponsePayload = {
|
|
218
218
|
conversation: {
|
|
@@ -238,13 +238,13 @@ declare class GetConversationResponse {
|
|
|
238
238
|
* @see https://greatdetail.com
|
|
239
239
|
*/
|
|
240
240
|
|
|
241
|
-
interface Options$
|
|
241
|
+
interface Options$7 extends SendOptions {
|
|
242
242
|
request?: RequestInit;
|
|
243
243
|
}
|
|
244
244
|
declare class ListConversationsRequest {
|
|
245
245
|
protected _client: Client;
|
|
246
246
|
constructor(_client: Client);
|
|
247
|
-
send({ request, ...options }?: Options$
|
|
247
|
+
send({ request, ...options }?: Options$7): Promise<ListConversationsResponse>;
|
|
248
248
|
}
|
|
249
249
|
type ListConversationsResponsePayload = {
|
|
250
250
|
conversations: {
|
|
@@ -261,6 +261,52 @@ declare class ListConversationsResponse {
|
|
|
261
261
|
result(): Promise<ListConversationsResponsePayload>;
|
|
262
262
|
}
|
|
263
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$6 extends SendOptions {
|
|
274
|
+
body: z.infer<typeof CreateLabelRequest.SCHEMA>;
|
|
275
|
+
request?: RequestInit;
|
|
276
|
+
}
|
|
277
|
+
declare class CreateLabelRequest {
|
|
278
|
+
protected _client: Client;
|
|
279
|
+
static SCHEMA: z.ZodObject<{
|
|
280
|
+
title: z.ZodString;
|
|
281
|
+
description: z.ZodOptional<z.ZodString>;
|
|
282
|
+
account: z.ZodString;
|
|
283
|
+
}, "strip", z.ZodTypeAny, {
|
|
284
|
+
title: string;
|
|
285
|
+
account: string;
|
|
286
|
+
description?: string | undefined;
|
|
287
|
+
}, {
|
|
288
|
+
title: string;
|
|
289
|
+
account: string;
|
|
290
|
+
description?: string | undefined;
|
|
291
|
+
}>;
|
|
292
|
+
constructor(_client: Client);
|
|
293
|
+
send({ body, request, ...options }: Options$6): Promise<CreateLabelResponse>;
|
|
294
|
+
}
|
|
295
|
+
type CreateLabelResponsePayload = {
|
|
296
|
+
label: {
|
|
297
|
+
id: string;
|
|
298
|
+
title: string;
|
|
299
|
+
description?: string;
|
|
300
|
+
createdAt: string;
|
|
301
|
+
updatedAt?: string;
|
|
302
|
+
};
|
|
303
|
+
};
|
|
304
|
+
declare class CreateLabelResponse {
|
|
305
|
+
response: Response;
|
|
306
|
+
constructor(response: Response);
|
|
307
|
+
result(): Promise<CreateLabelResponsePayload>;
|
|
308
|
+
}
|
|
309
|
+
|
|
264
310
|
/**
|
|
265
311
|
* Great Detail Support System.
|
|
266
312
|
*
|
|
@@ -517,6 +563,7 @@ declare class Client {
|
|
|
517
563
|
list: ListConversationsRequest;
|
|
518
564
|
};
|
|
519
565
|
label: {
|
|
566
|
+
create: CreateLabelRequest;
|
|
520
567
|
list: ListLabelsRequest;
|
|
521
568
|
};
|
|
522
569
|
message: {
|
|
@@ -538,4 +585,4 @@ declare class Client {
|
|
|
538
585
|
send(url: string | URL, request: RequestInit, { fetch: fetchAlternative }?: SendOptions): Promise<Response>;
|
|
539
586
|
}
|
|
540
587
|
|
|
541
|
-
export { Client, type CreateCorrectionResponsePayload, type CreateResponseResponsePayload, DEFAULT_SUPPORT_BASE_URL, type GetConversationResponsePayload, KeyAuthentication, type ListActionsResponsePayload, type ListChannelsResponsePayload, type ListContactsResponsePayload, type ListConversationsResponsePayload, type ListLabelsResponsePayload, type ListMessagesResponsePayload, type ListModelsResponsePayload, type ListSourcesResponsePayload, PublicAuthentication, type RequestFilterable, TokenAuthentication, Client as default };
|
|
588
|
+
export { Client, type CreateCorrectionResponsePayload, type CreateLabelResponsePayload, type CreateResponseResponsePayload, DEFAULT_SUPPORT_BASE_URL, type GetConversationResponsePayload, KeyAuthentication, type ListActionsResponsePayload, type ListChannelsResponsePayload, type ListContactsResponsePayload, type ListConversationsResponsePayload, type ListLabelsResponsePayload, type ListMessagesResponsePayload, type ListModelsResponsePayload, type ListSourcesResponsePayload, PublicAuthentication, type RequestFilterable, TokenAuthentication, Client as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ interface Authentication extends RequestFilterable {
|
|
|
48
48
|
* @see https://greatdetail.com
|
|
49
49
|
*/
|
|
50
50
|
|
|
51
|
-
interface Options$
|
|
51
|
+
interface Options$d {
|
|
52
52
|
name?: string;
|
|
53
53
|
key?: string;
|
|
54
54
|
}
|
|
@@ -56,7 +56,7 @@ declare class KeyAuthentication implements Authentication {
|
|
|
56
56
|
#private;
|
|
57
57
|
static DEFAULT_NAME: string;
|
|
58
58
|
name: string;
|
|
59
|
-
constructor({ name, key, }?: Options$
|
|
59
|
+
constructor({ name, key, }?: Options$d);
|
|
60
60
|
filter(request: RequestInit): Promise<RequestInit>;
|
|
61
61
|
}
|
|
62
62
|
|
|
@@ -69,12 +69,12 @@ declare class KeyAuthentication implements Authentication {
|
|
|
69
69
|
* @see https://greatdetail.com
|
|
70
70
|
*/
|
|
71
71
|
|
|
72
|
-
interface Options$
|
|
72
|
+
interface Options$c {
|
|
73
73
|
token?: string;
|
|
74
74
|
}
|
|
75
75
|
declare class TokenAuthentication implements Authentication {
|
|
76
76
|
#private;
|
|
77
|
-
constructor({ token }?: Options$
|
|
77
|
+
constructor({ token }?: Options$c);
|
|
78
78
|
filter(request: RequestInit): Promise<RequestInit>;
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -106,13 +106,13 @@ declare class PublicAuthentication implements Authentication {
|
|
|
106
106
|
* @see https://greatdetail.com
|
|
107
107
|
*/
|
|
108
108
|
|
|
109
|
-
interface Options$
|
|
109
|
+
interface Options$b extends SendOptions {
|
|
110
110
|
request?: RequestInit;
|
|
111
111
|
}
|
|
112
112
|
declare class ListActionsRequest {
|
|
113
113
|
protected _client: Client;
|
|
114
114
|
constructor(_client: Client);
|
|
115
|
-
send({ request, ...options }?: Options$
|
|
115
|
+
send({ request, ...options }?: Options$b): Promise<ListActionsResponse>;
|
|
116
116
|
}
|
|
117
117
|
type ListActionsResponsePayload = {
|
|
118
118
|
actions: {
|
|
@@ -139,13 +139,13 @@ declare class ListActionsResponse {
|
|
|
139
139
|
* @see https://greatdetail.com
|
|
140
140
|
*/
|
|
141
141
|
|
|
142
|
-
interface Options$
|
|
142
|
+
interface Options$a extends SendOptions {
|
|
143
143
|
request?: RequestInit;
|
|
144
144
|
}
|
|
145
145
|
declare class ListChannelsRequest {
|
|
146
146
|
protected _client: Client;
|
|
147
147
|
constructor(_client: Client);
|
|
148
|
-
send({ request, ...options }?: Options$
|
|
148
|
+
send({ request, ...options }?: Options$a): Promise<ListChannelsResponse>;
|
|
149
149
|
}
|
|
150
150
|
type ListChannelsResponsePayload = {
|
|
151
151
|
channels: {
|
|
@@ -172,13 +172,13 @@ declare class ListChannelsResponse {
|
|
|
172
172
|
* @see https://greatdetail.com
|
|
173
173
|
*/
|
|
174
174
|
|
|
175
|
-
interface Options$
|
|
175
|
+
interface Options$9 extends SendOptions {
|
|
176
176
|
request?: RequestInit;
|
|
177
177
|
}
|
|
178
178
|
declare class ListContactsRequest {
|
|
179
179
|
protected _client: Client;
|
|
180
180
|
constructor(_client: Client);
|
|
181
|
-
send({ request, ...options }?: Options$
|
|
181
|
+
send({ request, ...options }?: Options$9): Promise<ListContactsResponse>;
|
|
182
182
|
}
|
|
183
183
|
type ListContactsResponsePayload = {
|
|
184
184
|
contacts: {
|
|
@@ -205,14 +205,14 @@ declare class ListContactsResponse {
|
|
|
205
205
|
* @see https://greatdetail.com
|
|
206
206
|
*/
|
|
207
207
|
|
|
208
|
-
interface Options$
|
|
208
|
+
interface Options$8 extends SendOptions {
|
|
209
209
|
id: string;
|
|
210
210
|
request?: RequestInit;
|
|
211
211
|
}
|
|
212
212
|
declare class GetConversationRequest {
|
|
213
213
|
protected _client: Client;
|
|
214
214
|
constructor(_client: Client);
|
|
215
|
-
send({ id, request, ...options }: Options$
|
|
215
|
+
send({ id, request, ...options }: Options$8): Promise<GetConversationResponse>;
|
|
216
216
|
}
|
|
217
217
|
type GetConversationResponsePayload = {
|
|
218
218
|
conversation: {
|
|
@@ -238,13 +238,13 @@ declare class GetConversationResponse {
|
|
|
238
238
|
* @see https://greatdetail.com
|
|
239
239
|
*/
|
|
240
240
|
|
|
241
|
-
interface Options$
|
|
241
|
+
interface Options$7 extends SendOptions {
|
|
242
242
|
request?: RequestInit;
|
|
243
243
|
}
|
|
244
244
|
declare class ListConversationsRequest {
|
|
245
245
|
protected _client: Client;
|
|
246
246
|
constructor(_client: Client);
|
|
247
|
-
send({ request, ...options }?: Options$
|
|
247
|
+
send({ request, ...options }?: Options$7): Promise<ListConversationsResponse>;
|
|
248
248
|
}
|
|
249
249
|
type ListConversationsResponsePayload = {
|
|
250
250
|
conversations: {
|
|
@@ -261,6 +261,52 @@ declare class ListConversationsResponse {
|
|
|
261
261
|
result(): Promise<ListConversationsResponsePayload>;
|
|
262
262
|
}
|
|
263
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$6 extends SendOptions {
|
|
274
|
+
body: z.infer<typeof CreateLabelRequest.SCHEMA>;
|
|
275
|
+
request?: RequestInit;
|
|
276
|
+
}
|
|
277
|
+
declare class CreateLabelRequest {
|
|
278
|
+
protected _client: Client;
|
|
279
|
+
static SCHEMA: z.ZodObject<{
|
|
280
|
+
title: z.ZodString;
|
|
281
|
+
description: z.ZodOptional<z.ZodString>;
|
|
282
|
+
account: z.ZodString;
|
|
283
|
+
}, "strip", z.ZodTypeAny, {
|
|
284
|
+
title: string;
|
|
285
|
+
account: string;
|
|
286
|
+
description?: string | undefined;
|
|
287
|
+
}, {
|
|
288
|
+
title: string;
|
|
289
|
+
account: string;
|
|
290
|
+
description?: string | undefined;
|
|
291
|
+
}>;
|
|
292
|
+
constructor(_client: Client);
|
|
293
|
+
send({ body, request, ...options }: Options$6): Promise<CreateLabelResponse>;
|
|
294
|
+
}
|
|
295
|
+
type CreateLabelResponsePayload = {
|
|
296
|
+
label: {
|
|
297
|
+
id: string;
|
|
298
|
+
title: string;
|
|
299
|
+
description?: string;
|
|
300
|
+
createdAt: string;
|
|
301
|
+
updatedAt?: string;
|
|
302
|
+
};
|
|
303
|
+
};
|
|
304
|
+
declare class CreateLabelResponse {
|
|
305
|
+
response: Response;
|
|
306
|
+
constructor(response: Response);
|
|
307
|
+
result(): Promise<CreateLabelResponsePayload>;
|
|
308
|
+
}
|
|
309
|
+
|
|
264
310
|
/**
|
|
265
311
|
* Great Detail Support System.
|
|
266
312
|
*
|
|
@@ -517,6 +563,7 @@ declare class Client {
|
|
|
517
563
|
list: ListConversationsRequest;
|
|
518
564
|
};
|
|
519
565
|
label: {
|
|
566
|
+
create: CreateLabelRequest;
|
|
520
567
|
list: ListLabelsRequest;
|
|
521
568
|
};
|
|
522
569
|
message: {
|
|
@@ -538,4 +585,4 @@ declare class Client {
|
|
|
538
585
|
send(url: string | URL, request: RequestInit, { fetch: fetchAlternative }?: SendOptions): Promise<Response>;
|
|
539
586
|
}
|
|
540
587
|
|
|
541
|
-
export { Client, type CreateCorrectionResponsePayload, type CreateResponseResponsePayload, DEFAULT_SUPPORT_BASE_URL, type GetConversationResponsePayload, KeyAuthentication, type ListActionsResponsePayload, type ListChannelsResponsePayload, type ListContactsResponsePayload, type ListConversationsResponsePayload, type ListLabelsResponsePayload, type ListMessagesResponsePayload, type ListModelsResponsePayload, type ListSourcesResponsePayload, PublicAuthentication, type RequestFilterable, TokenAuthentication, Client as default };
|
|
588
|
+
export { Client, type CreateCorrectionResponsePayload, type CreateLabelResponsePayload, type CreateResponseResponsePayload, DEFAULT_SUPPORT_BASE_URL, type GetConversationResponsePayload, KeyAuthentication, type ListActionsResponsePayload, type ListChannelsResponsePayload, type ListContactsResponsePayload, type ListConversationsResponsePayload, type ListLabelsResponsePayload, type ListMessagesResponsePayload, type ListModelsResponsePayload, type ListSourcesResponsePayload, PublicAuthentication, type RequestFilterable, TokenAuthentication, Client as default };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b as
|
|
1
|
+
import{a,b as n,c as p,d as i}from"./chunk-WCSPJBPY.js";var t=class s{static DEFAULT_NAME=n;name;#e;constructor({name:e=process.env.SUPPORT_KEY_NAME??s.DEFAULT_NAME,key:r=process.env.SUPPORT_API_KEY}={}){if(!r)throw new Error("API Key option must be specified when using Key Authentication");this.name=e,this.#e=r}async filter(e){return{...e,headers:{...e.headers,Authorization:`Basic ${btoa(this.name+":"+this.#e)}`}}}};var o=class{#e;constructor({token:e=process.env.SUPPORT_ACCESS_TOKEN}={}){if(!e)throw new Error("Access Token option must be specified when using Token Authentication");this.#e=e}async filter(e){return{...e,headers:{...e.headers,Authorization:`Bearer ${this.#e}`}}}};export{i as Client,a as DEFAULT_SUPPORT_BASE_URL,t as KeyAuthentication,p as PublicAuthentication,o as TokenAuthentication,i as default};
|
package/package.json
CHANGED
package/src/Client/index.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { DEFAULT_SUPPORT_BASE_URL } from "../constants/index.js";
|
|
|
14
14
|
import ListContactsRequest from "../Contact/ListContacts.js";
|
|
15
15
|
import GetConversationRequest from "../Conversation/GetConversation.js";
|
|
16
16
|
import ListConversationsRequest from "../Conversation/ListConversations.js";
|
|
17
|
+
import CreateLabelRequest from "../Label/CreateLabel.js";
|
|
17
18
|
import ListLabelsRequest from "../Label/ListLabels.js";
|
|
18
19
|
import ListMessagesRequest from "../Message/ListMessages.js";
|
|
19
20
|
import CreateCorrectionModelRequest from "../Model/Correction/CreateCorrectionModel.js";
|
|
@@ -77,6 +78,7 @@ export default class Client {
|
|
|
77
78
|
};
|
|
78
79
|
|
|
79
80
|
public label = {
|
|
81
|
+
create: new CreateLabelRequest(this),
|
|
80
82
|
list: new ListLabelsRequest(this),
|
|
81
83
|
};
|
|
82
84
|
|
|
@@ -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
|
+
body: z.infer<typeof CreateLabelRequest.SCHEMA>;
|
|
15
|
+
request?: RequestInit;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default class CreateLabelRequest {
|
|
19
|
+
public static SCHEMA = z.object({
|
|
20
|
+
title: z.string(),
|
|
21
|
+
description: z.optional(z.string()),
|
|
22
|
+
account: z.string(),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
constructor(protected _client: Client) {}
|
|
26
|
+
|
|
27
|
+
public async send({ body, request = {}, ...options }: Options) {
|
|
28
|
+
return this._client
|
|
29
|
+
.send(
|
|
30
|
+
"/v1/labels",
|
|
31
|
+
{
|
|
32
|
+
...request,
|
|
33
|
+
method: "POST",
|
|
34
|
+
headers: {
|
|
35
|
+
...request.headers,
|
|
36
|
+
"Content-Type": "application/json",
|
|
37
|
+
},
|
|
38
|
+
body: JSON.stringify(CreateLabelRequest.SCHEMA.parse(body)),
|
|
39
|
+
},
|
|
40
|
+
options,
|
|
41
|
+
)
|
|
42
|
+
.then((response) => new CreateLabelResponse(response));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type CreateLabelResponsePayload = {
|
|
47
|
+
label: {
|
|
48
|
+
id: string;
|
|
49
|
+
title: string;
|
|
50
|
+
description?: string;
|
|
51
|
+
createdAt: string;
|
|
52
|
+
updatedAt?: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export class CreateLabelResponse {
|
|
57
|
+
constructor(public response: Response) {}
|
|
58
|
+
|
|
59
|
+
public async result(): Promise<CreateLabelResponsePayload> {
|
|
60
|
+
return this.response.json();
|
|
61
|
+
}
|
|
62
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -18,6 +18,7 @@ export { type ListChannelsResponsePayload } from "./Channel/ListChannels.js";
|
|
|
18
18
|
export { type ListContactsResponsePayload } from "./Contact/ListContacts.js";
|
|
19
19
|
export { type ListConversationsResponsePayload } from "./Conversation/ListConversations.js";
|
|
20
20
|
export { type GetConversationResponsePayload } from "./Conversation/GetConversation.js";
|
|
21
|
+
export { type CreateLabelResponsePayload } from "./Label/CreateLabel.js";
|
|
21
22
|
export { type ListLabelsResponsePayload } from "./Label/ListLabels.js";
|
|
22
23
|
export { type ListMessagesResponsePayload } from "./Message/ListMessages.js";
|
|
23
24
|
export { type ListModelsResponsePayload } from "./Model/ListModels.js";
|
package/dist/chunk-LS7DRWDS.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var U="https://api.support.greatdetail.com",v={"X-Powered-By":"GDSupport/JavaScript"},D="api-key";var x=class{async filter(e){return e}};var o=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/actions",{...e,method:"GET"},s).then(n=>new O(n))}},O=class{constructor(e){this.response=e}async result(){return this.response.json()}};var i=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/channels",{...e,method:"GET"},s).then(n=>new S(n))}},S=class{constructor(e){this.response=e}async result(){return this.response.json()}};var p=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/contacts",{...e,method:"GET"},s).then(n=>new A(n))}},A=class{constructor(e){this.response=e}async result(){return this.response.json()}};var c=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/conversations/"+encodeURIComponent(e),{...s,method:"GET"},n).then(r=>new C(r))}},C=class{constructor(e){this.response=e}async result(){return this.response.json()}};var a=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/conversations",{...e,method:"GET"},s).then(n=>new _(n))}},_=class{constructor(e){this.response=e}async result(){return this.response.json()}};var l=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/labels",{...e,method:"GET"},s).then(n=>new P(n))}},P=class{constructor(e){this.response=e}async result(){return this.response.json()}};var u=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/messages",{...e,method:"GET"},s).then(n=>new E(n))}},E=class{constructor(e){this.response=e}async result(){return this.response.json()}};import{z as g}from"zod";var d=class t{constructor(e){this._client=e}static SCHEMA=g.object({input:g.string().max(65536),original:g.string().max(65536),correction:g.string().max(65536)});async send({id:e,body:s,request:n={},...r}){return this._client.send("/v1/models/"+encodeURIComponent(e)+"/correction",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(s))},r).then(y=>new q(y))}},q=class{constructor(e){this.response=e}async result(){return this.response.json()}};var m=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/models",{...e,method:"GET"},s).then(n=>new w(n))}},w=class{constructor(e){this.response=e}async result(){return this.response.json()}};import{z as R}from"zod";var h=class t{constructor(e){this._client=e}static SCHEMA=R.array(R.object({role:R.enum(["user","assistant"]),content:R.string().max(65536).nullable()})).min(1);async send({id:e,body:s,request:n={},...r}){return this._client.send("/v1/models/"+encodeURIComponent(e)+"/response",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(t.SCHEMA.parse(s))},r).then(y=>new T(y))}},T=class{constructor(e){this.response=e}async result(){return this.response.json()}};var f=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/sources",{...e,method:"GET"},s).then(n=>new L(n))}},L=class{constructor(e){this.response=e}async result(){return this.response.json()}};var b=class t{constructor(e=t.STANDARD_HEADERS){this._standardHeaders=e}static STANDARD_HEADERS=v;async filter(e){return{...e,headers:{...e.headers,...this._standardHeaders}}}};var I=class t{static DEFAULT_BASE_URL=U;options;constructor(e,s={}){this.options={requestFilterables:[new b,e],baseURL:process.env.SUPPORT_BASE_URL??t.DEFAULT_BASE_URL,...s}}action={list:new o(this)};channel={list:new i(this)};contact={list:new p(this)};conversation={get:new c(this),list:new a(this)};label={list:new l(this)};message={list:new u(this)};model={list:new m(this),response:{create:new h(this)},correction:{create:new d(this)}};source={list:new f(this)};async _filterRequest(e){for(let s of this.options.requestFilterables)e=await s.filter(e);return e}async send(e,s,{fetch:n=fetch}={}){return await n(new Request(new URL(e,this.options.baseURL),await this._filterRequest(s)))}};export{U as a,D as b,x as c,I as d};
|