@great-detail/support-sdk 0.0.4 → 0.0.6
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 +59 -0
- package/dist/chunk-CQGIX6CO.js +1 -0
- package/dist/chunk-OVSCTY74.js +1 -0
- package/dist/cli/index.cjs +1 -0
- package/dist/cli/index.d.cts +21 -0
- package/dist/cli/index.d.ts +21 -0
- package/dist/cli/index.js +1 -0
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/index-zrmJVCfU.d.cts +684 -0
- package/dist/index-zrmJVCfU.d.ts +684 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +8 -518
- package/dist/index.d.ts +8 -518
- package/dist/index.js +1 -1
- package/package.json +8 -2
- package/src/Action/ListActions.ts +6 -2
- package/src/Authentication/KeyAuthentication.ts +7 -3
- package/src/Authentication/TokenAuthentication.ts +2 -1
- package/src/Channel/ListChannels.ts +20 -3
- package/src/Client/index.ts +8 -0
- package/src/Contact/GetContact.ts +52 -0
- package/src/Contact/ListContacts.ts +1 -0
- package/src/Label/CreateLabel.ts +1 -0
- package/src/Label/GetLabel.ts +51 -0
- package/src/Label/ListLabels.ts +1 -0
- package/src/Message/ListMessages.ts +7 -0
- package/src/Model/GetModel.ts +50 -0
- package/src/Model/ListModels.ts +2 -2
- package/src/Source/GetSource.ts +51 -0
- package/src/Source/ListSources.ts +2 -1
- package/src/__tests__/Authentication/KeyAuthentication.test.ts +79 -0
- package/src/__tests__/Authentication/TokenAuthentication.test.ts +79 -0
- package/src/cli/contacts.ts +14 -0
- package/src/cli/labels.ts +14 -0
- package/src/cli/models.ts +14 -0
- package/src/cli/sources.ts +14 -0
- package/src/constants/index.ts +21 -0
- package/dist/chunk-WCSPJBPY.js +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var I=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var ee=Object.getOwnPropertyNames;var te=Object.prototype.hasOwnProperty;var se=(t,e)=>{for(var s in e)I(t,s,{get:e[s],enumerable:!0})},ne=(t,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ee(e))!te.call(t,o)&&o!==s&&I(t,o,{get:()=>e[o],enumerable:!(n=Z(e,o))||n.enumerable});return t};var oe=t=>ne(I({},"__esModule",{value:!0}),t);var re={};se(re,{Client:()=>i,DEFAULT_SUPPORT_BASE_URL:()=>w,KeyAuthentication:()=>p,PublicAuthentication:()=>c,TokenAuthentication:()=>a,default:()=>i});module.exports=oe(re);var w="https://api.support.greatdetail.com",J={"X-Powered-By":"GDSupport/JavaScript"},$="api-key",W="SUPPORT_ACCESS_TOKEN",X="SUPPORT_API_KEY",Q="SUPPORT_KEY_NAME";var p=class t{static DEFAULT_NAME=$;name;#e;constructor({name:e=process.env[Q]??t.DEFAULT_NAME,key:s=process.env[X]}={}){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[W]}={}){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 L(n))}},L=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/channels",{...e,method:"GET"},s).then(n=>new U(n))}},U=class{constructor(e){this.response=e}async result(){return this.response.json()}};var u=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/contacts/"+encodeURIComponent(e),{...s,method:"GET"},n).then(o=>new v(o))}},v=class{constructor(e){this.response=e}async result(){return this.response.json()}};var m=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/contacts",{...e,method:"GET"},s).then(n=>new D(n))}},D=class{constructor(e){this.response=e}async result(){return this.response.json()}};var g=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 N(o))}},N=class{constructor(e){this.response=e}async result(){return this.response.json()}};var h=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/conversations",{...e,method:"GET"},s).then(n=>new j(n))}},j=class{constructor(e){this.response=e}async result(){return this.response.json()}};var r=require("zod"),f=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 G(o))}},G=class{constructor(e){this.response=e}async result(){return this.response.json()}};var y=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/labels/"+encodeURIComponent(e),{...s,method:"GET"},n).then(o=>new M(o))}},M=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/labels",{...e,method:"GET"},s).then(n=>new F(n))}},F=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/messages",{...e,method:"GET"},s).then(n=>new H(n))}},H=class{constructor(e){this.response=e}async result(){return this.response.json()}};var x=require("zod"),A=class t{constructor(e){this._client=e}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: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(q=>new K(q))}},K=class{constructor(e){this.response=e}async result(){return this.response.json()}};var O=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/models/"+encodeURIComponent(e),{...s,method:"GET"},n).then(o=>new V(o))}},V=class{constructor(e){this.response=e}async result(){return this.response.json()}};var P=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/models",{...e,method:"GET"},s).then(n=>new B(n))}},B=class{constructor(e){this.response=e}async result(){return this.response.json()}};var S=require("zod"),C=class t{constructor(e){this._client=e}static SCHEMA=S.z.array(S.z.object({role:S.z.enum(["user","assistant"]),content:S.z.string().max(65536).nullable()})).min(1);async send({id: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(q=>new z(q))}},z=class{constructor(e){this.response=e}async result(){return this.response.json()}};var _=class t{constructor(e=t.STANDARD_HEADERS){this._standardHeaders=e}static STANDARD_HEADERS=J;async filter(e){return{...e,headers:{...e.headers,...this._standardHeaders}}}};var E=class{constructor(e){this._client=e}async send({id:e,request:s={},...n}){return this._client.send("/v1/sources/"+encodeURIComponent(e),{...s,method:"GET"},n).then(o=>new k(o))}},k=class{constructor(e){this.response=e}async result(){return this.response.json()}};var T=class{constructor(e){this._client=e}async send({request:e={},...s}={}){return this._client.send("/v1/sources",{...e,method:"GET"},s).then(n=>new Y(n))}},Y=class{constructor(e){this.response=e}async result(){return this.response.json()}};var i=class t{static DEFAULT_BASE_URL=w;options;constructor(e,s={}){this.options={requestFilterables:[new _,e],baseURL:process.env.SUPPORT_BASE_URL??t.DEFAULT_BASE_URL,...s}}action={list:new l(this)};channel={list:new d(this)};contact={get:new u(this),list:new m(this)};conversation={get:new g(this),list:new h(this)};label={create:new f(this),get:new y(this),list:new R(this)};message={list:new b(this)};model={get:new O(this),list:new P(this),response:{create:new C(this)},correction:{create:new A(this)}};source={get:new E(this),list:new T(this)};async _filterRequest(e){for(let s of this.options.requestFilterables)e=await s.filter(e);return e}async send(e,s,{fetch:n=fetch}={}){return await n(new Request(new URL(e,this.options.baseURL),await this._filterRequest(s)))}};0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,KeyAuthentication,PublicAuthentication,TokenAuthentication});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as Authentication } from './index-zrmJVCfU.cjs';
|
|
2
|
+
export { C as Client, h as CreateCorrectionResponsePayload, d as CreateLabelResponsePayload, i as CreateResponseResponsePayload, G as GetConversationResponsePayload, L as ListActionsResponsePayload, a as ListChannelsResponsePayload, b as ListContactsResponsePayload, c as ListConversationsResponsePayload, e as ListLabelsResponsePayload, f as ListMessagesResponsePayload, g as ListModelsResponsePayload, j as ListSourcesResponsePayload, R as RequestFilterable, C as default } from './index-zrmJVCfU.cjs';
|
|
3
|
+
import 'zod';
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* Great Detail Support System.
|
|
@@ -15,30 +17,6 @@ import { z } from 'zod';
|
|
|
15
17
|
*/
|
|
16
18
|
declare const DEFAULT_SUPPORT_BASE_URL = "https://api.support.greatdetail.com";
|
|
17
19
|
|
|
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
20
|
/**
|
|
43
21
|
* Great Detail Support System.
|
|
44
22
|
*
|
|
@@ -48,7 +26,7 @@ interface Authentication extends RequestFilterable {
|
|
|
48
26
|
* @see https://greatdetail.com
|
|
49
27
|
*/
|
|
50
28
|
|
|
51
|
-
interface Options$
|
|
29
|
+
interface Options$1 {
|
|
52
30
|
name?: string;
|
|
53
31
|
key?: string;
|
|
54
32
|
}
|
|
@@ -56,7 +34,7 @@ declare class KeyAuthentication implements Authentication {
|
|
|
56
34
|
#private;
|
|
57
35
|
static DEFAULT_NAME: string;
|
|
58
36
|
name: string;
|
|
59
|
-
constructor({ name, key, }?: Options$
|
|
37
|
+
constructor({ name, key, }?: Options$1);
|
|
60
38
|
filter(request: RequestInit): Promise<RequestInit>;
|
|
61
39
|
}
|
|
62
40
|
|
|
@@ -69,12 +47,12 @@ declare class KeyAuthentication implements Authentication {
|
|
|
69
47
|
* @see https://greatdetail.com
|
|
70
48
|
*/
|
|
71
49
|
|
|
72
|
-
interface Options
|
|
50
|
+
interface Options {
|
|
73
51
|
token?: string;
|
|
74
52
|
}
|
|
75
53
|
declare class TokenAuthentication implements Authentication {
|
|
76
54
|
#private;
|
|
77
|
-
constructor({ token }?: Options
|
|
55
|
+
constructor({ token }?: Options);
|
|
78
56
|
filter(request: RequestInit): Promise<RequestInit>;
|
|
79
57
|
}
|
|
80
58
|
|
|
@@ -97,492 +75,4 @@ declare class PublicAuthentication implements Authentication {
|
|
|
97
75
|
filter(request: RequestInit): Promise<RequestInit>;
|
|
98
76
|
}
|
|
99
77
|
|
|
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$b extends SendOptions {
|
|
110
|
-
request?: RequestInit;
|
|
111
|
-
}
|
|
112
|
-
declare class ListActionsRequest {
|
|
113
|
-
protected _client: Client;
|
|
114
|
-
constructor(_client: Client);
|
|
115
|
-
send({ request, ...options }?: Options$b): Promise<ListActionsResponse>;
|
|
116
|
-
}
|
|
117
|
-
type ListActionsResponsePayload = {
|
|
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<ListActionsResponsePayload>;
|
|
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$a extends SendOptions {
|
|
143
|
-
request?: RequestInit;
|
|
144
|
-
}
|
|
145
|
-
declare class ListChannelsRequest {
|
|
146
|
-
protected _client: Client;
|
|
147
|
-
constructor(_client: Client);
|
|
148
|
-
send({ request, ...options }?: Options$a): Promise<ListChannelsResponse>;
|
|
149
|
-
}
|
|
150
|
-
type ListChannelsResponsePayload = {
|
|
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<ListChannelsResponsePayload>;
|
|
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$9 extends SendOptions {
|
|
176
|
-
request?: RequestInit;
|
|
177
|
-
}
|
|
178
|
-
declare class ListContactsRequest {
|
|
179
|
-
protected _client: Client;
|
|
180
|
-
constructor(_client: Client);
|
|
181
|
-
send({ request, ...options }?: Options$9): Promise<ListContactsResponse>;
|
|
182
|
-
}
|
|
183
|
-
type ListContactsResponsePayload = {
|
|
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<ListContactsResponsePayload>;
|
|
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$8 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$8): Promise<GetConversationResponse>;
|
|
216
|
-
}
|
|
217
|
-
type GetConversationResponsePayload = {
|
|
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<GetConversationResponsePayload>;
|
|
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$7 extends SendOptions {
|
|
242
|
-
request?: RequestInit;
|
|
243
|
-
}
|
|
244
|
-
declare class ListConversationsRequest {
|
|
245
|
-
protected _client: Client;
|
|
246
|
-
constructor(_client: Client);
|
|
247
|
-
send({ request, ...options }?: Options$7): Promise<ListConversationsResponse>;
|
|
248
|
-
}
|
|
249
|
-
type ListConversationsResponsePayload = {
|
|
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<ListConversationsResponsePayload>;
|
|
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$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
|
-
|
|
310
|
-
/**
|
|
311
|
-
* Great Detail Support System.
|
|
312
|
-
*
|
|
313
|
-
* @copyright 2024 Great Detail Ltd
|
|
314
|
-
* @author Great Detail Ltd <info@greatdetail.com>
|
|
315
|
-
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
316
|
-
* @see https://greatdetail.com
|
|
317
|
-
*/
|
|
318
|
-
|
|
319
|
-
interface Options$5 extends SendOptions {
|
|
320
|
-
request?: RequestInit;
|
|
321
|
-
}
|
|
322
|
-
declare class ListLabelsRequest {
|
|
323
|
-
protected _client: Client;
|
|
324
|
-
constructor(_client: Client);
|
|
325
|
-
send({ request, ...options }?: Options$5): Promise<ListLabelsResponse>;
|
|
326
|
-
}
|
|
327
|
-
type ListLabelsResponsePayload = {
|
|
328
|
-
labels: {
|
|
329
|
-
id: string;
|
|
330
|
-
title: string;
|
|
331
|
-
description?: string;
|
|
332
|
-
createdAt: string;
|
|
333
|
-
updatedAt?: string;
|
|
334
|
-
}[];
|
|
335
|
-
};
|
|
336
|
-
declare class ListLabelsResponse {
|
|
337
|
-
response: Response;
|
|
338
|
-
constructor(response: Response);
|
|
339
|
-
result(): Promise<ListLabelsResponsePayload>;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
/**
|
|
343
|
-
* Great Detail Support System.
|
|
344
|
-
*
|
|
345
|
-
* @copyright 2024 Great Detail Ltd
|
|
346
|
-
* @author Great Detail Ltd <info@greatdetail.com>
|
|
347
|
-
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
348
|
-
* @see https://greatdetail.com
|
|
349
|
-
*/
|
|
350
|
-
|
|
351
|
-
interface Options$4 extends SendOptions {
|
|
352
|
-
request?: RequestInit;
|
|
353
|
-
}
|
|
354
|
-
declare class ListMessagesRequest {
|
|
355
|
-
protected _client: Client;
|
|
356
|
-
constructor(_client: Client);
|
|
357
|
-
send({ request, ...options }?: Options$4): Promise<ListMessagesResponse>;
|
|
358
|
-
}
|
|
359
|
-
type ListMessagesResponsePayload = {
|
|
360
|
-
messages: {
|
|
361
|
-
id: string;
|
|
362
|
-
role: "user" | "assistant";
|
|
363
|
-
messageStatus: string;
|
|
364
|
-
externalIdentifier?: string;
|
|
365
|
-
conversation: string;
|
|
366
|
-
contact: string;
|
|
367
|
-
createdAt: string;
|
|
368
|
-
updatedAt: string;
|
|
369
|
-
}[];
|
|
370
|
-
};
|
|
371
|
-
declare class ListMessagesResponse {
|
|
372
|
-
response: Response;
|
|
373
|
-
constructor(response: Response);
|
|
374
|
-
result(): Promise<ListMessagesResponsePayload>;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
/**
|
|
378
|
-
* Great Detail Support System.
|
|
379
|
-
*
|
|
380
|
-
* @copyright 2024 Great Detail Ltd
|
|
381
|
-
* @author Great Detail Ltd <info@greatdetail.com>
|
|
382
|
-
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
383
|
-
* @see https://greatdetail.com
|
|
384
|
-
*/
|
|
385
|
-
|
|
386
|
-
interface Options$3 extends SendOptions {
|
|
387
|
-
id: string;
|
|
388
|
-
body: z.infer<typeof CreateCorrectionModelRequest.SCHEMA>;
|
|
389
|
-
request?: RequestInit;
|
|
390
|
-
}
|
|
391
|
-
declare class CreateCorrectionModelRequest {
|
|
392
|
-
protected _client: Client;
|
|
393
|
-
static SCHEMA: z.ZodObject<{
|
|
394
|
-
input: z.ZodString;
|
|
395
|
-
original: z.ZodString;
|
|
396
|
-
correction: z.ZodString;
|
|
397
|
-
}, "strip", z.ZodTypeAny, {
|
|
398
|
-
input: string;
|
|
399
|
-
original: string;
|
|
400
|
-
correction: string;
|
|
401
|
-
}, {
|
|
402
|
-
input: string;
|
|
403
|
-
original: string;
|
|
404
|
-
correction: string;
|
|
405
|
-
}>;
|
|
406
|
-
constructor(_client: Client);
|
|
407
|
-
send({ id, body, request, ...options }: Options$3): Promise<CreateCorrectionModelResponse>;
|
|
408
|
-
}
|
|
409
|
-
type CreateCorrectionResponsePayload = unknown;
|
|
410
|
-
declare class CreateCorrectionModelResponse {
|
|
411
|
-
response: Response;
|
|
412
|
-
constructor(response: Response);
|
|
413
|
-
result(): Promise<CreateCorrectionResponsePayload>;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
/**
|
|
417
|
-
* Great Detail Support System.
|
|
418
|
-
*
|
|
419
|
-
* @copyright 2024 Great Detail Ltd
|
|
420
|
-
* @author Great Detail Ltd <info@greatdetail.com>
|
|
421
|
-
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
422
|
-
* @see https://greatdetail.com
|
|
423
|
-
*/
|
|
424
|
-
|
|
425
|
-
interface Options$2 extends SendOptions {
|
|
426
|
-
request?: RequestInit;
|
|
427
|
-
}
|
|
428
|
-
declare class ListModelsRequest {
|
|
429
|
-
protected _client: Client;
|
|
430
|
-
constructor(_client: Client);
|
|
431
|
-
send({ request, ...options }?: Options$2): Promise<ListModelsResponse>;
|
|
432
|
-
}
|
|
433
|
-
type ListModelsResponsePayload = {
|
|
434
|
-
models: {
|
|
435
|
-
id: string;
|
|
436
|
-
name: string;
|
|
437
|
-
url: string;
|
|
438
|
-
icon: string;
|
|
439
|
-
disambiguatingDescription: string;
|
|
440
|
-
}[];
|
|
441
|
-
};
|
|
442
|
-
declare class ListModelsResponse {
|
|
443
|
-
response: Response;
|
|
444
|
-
constructor(response: Response);
|
|
445
|
-
result(): Promise<ListModelsResponsePayload>;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
/**
|
|
449
|
-
* Great Detail Support System.
|
|
450
|
-
*
|
|
451
|
-
* @copyright 2024 Great Detail Ltd
|
|
452
|
-
* @author Great Detail Ltd <info@greatdetail.com>
|
|
453
|
-
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
454
|
-
* @see https://greatdetail.com
|
|
455
|
-
*/
|
|
456
|
-
|
|
457
|
-
interface Options$1 extends SendOptions {
|
|
458
|
-
id: string;
|
|
459
|
-
body: z.infer<typeof CreateResponseModelRequest.SCHEMA>;
|
|
460
|
-
request?: RequestInit;
|
|
461
|
-
}
|
|
462
|
-
declare class CreateResponseModelRequest {
|
|
463
|
-
protected _client: Client;
|
|
464
|
-
static SCHEMA: z.ZodArray<z.ZodObject<{
|
|
465
|
-
role: z.ZodEnum<["user", "assistant"]>;
|
|
466
|
-
content: z.ZodNullable<z.ZodString>;
|
|
467
|
-
}, "strip", z.ZodTypeAny, {
|
|
468
|
-
role: "user" | "assistant";
|
|
469
|
-
content: string | null;
|
|
470
|
-
}, {
|
|
471
|
-
role: "user" | "assistant";
|
|
472
|
-
content: string | null;
|
|
473
|
-
}>, "many">;
|
|
474
|
-
constructor(_client: Client);
|
|
475
|
-
send({ id, body, request, ...options }: Options$1): Promise<CreateResponseModelResponse>;
|
|
476
|
-
}
|
|
477
|
-
type CreateResponseResponsePayload = {
|
|
478
|
-
message: string | null;
|
|
479
|
-
debug: {
|
|
480
|
-
duration: string;
|
|
481
|
-
sources: (string | undefined)[];
|
|
482
|
-
};
|
|
483
|
-
};
|
|
484
|
-
declare class CreateResponseModelResponse {
|
|
485
|
-
response: Response;
|
|
486
|
-
constructor(response: Response);
|
|
487
|
-
result(): Promise<CreateResponseResponsePayload>;
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
/**
|
|
491
|
-
* Great Detail Support System.
|
|
492
|
-
*
|
|
493
|
-
* @copyright 2024 Great Detail Ltd
|
|
494
|
-
* @author Great Detail Ltd <info@greatdetail.com>
|
|
495
|
-
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
496
|
-
* @see https://greatdetail.com
|
|
497
|
-
*/
|
|
498
|
-
|
|
499
|
-
interface Options extends SendOptions {
|
|
500
|
-
request?: RequestInit;
|
|
501
|
-
}
|
|
502
|
-
declare class ListSourcesRequest {
|
|
503
|
-
protected _client: Client;
|
|
504
|
-
constructor(_client: Client);
|
|
505
|
-
send({ request, ...options }?: Options): Promise<ListSourcesResponse>;
|
|
506
|
-
}
|
|
507
|
-
type ListSourcesResponsePayload = {
|
|
508
|
-
sources: {
|
|
509
|
-
id: string;
|
|
510
|
-
name: string;
|
|
511
|
-
category: string;
|
|
512
|
-
url: string;
|
|
513
|
-
disambiguatingDescription: string;
|
|
514
|
-
}[];
|
|
515
|
-
};
|
|
516
|
-
declare class ListSourcesResponse {
|
|
517
|
-
response: Response;
|
|
518
|
-
constructor(response: Response);
|
|
519
|
-
result(): Promise<ListSourcesResponsePayload>;
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
/**
|
|
523
|
-
* Great Detail Support System.
|
|
524
|
-
*
|
|
525
|
-
* @copyright 2024 Great Detail Ltd
|
|
526
|
-
* @author Great Detail Ltd <info@greatdetail.com>
|
|
527
|
-
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
528
|
-
* @see https://greatdetail.com
|
|
529
|
-
*/
|
|
530
|
-
|
|
531
|
-
interface ClientOptions {
|
|
532
|
-
requestFilterables: RequestFilterable[];
|
|
533
|
-
baseURL: string;
|
|
534
|
-
}
|
|
535
|
-
interface InputClientOptions {
|
|
536
|
-
baseURL?: string;
|
|
537
|
-
}
|
|
538
|
-
interface SendOptions {
|
|
539
|
-
/**
|
|
540
|
-
* Alternative Fetch Provider.
|
|
541
|
-
* Used to override the default fetch provider and use polyfills or other
|
|
542
|
-
* libraries.
|
|
543
|
-
*
|
|
544
|
-
* @since 1.0.0
|
|
545
|
-
*/
|
|
546
|
-
fetch?: typeof fetch;
|
|
547
|
-
}
|
|
548
|
-
declare class Client {
|
|
549
|
-
static DEFAULT_BASE_URL: string;
|
|
550
|
-
options: ClientOptions;
|
|
551
|
-
constructor(authentication: Authentication, options?: InputClientOptions);
|
|
552
|
-
action: {
|
|
553
|
-
list: ListActionsRequest;
|
|
554
|
-
};
|
|
555
|
-
channel: {
|
|
556
|
-
list: ListChannelsRequest;
|
|
557
|
-
};
|
|
558
|
-
contact: {
|
|
559
|
-
list: ListContactsRequest;
|
|
560
|
-
};
|
|
561
|
-
conversation: {
|
|
562
|
-
get: GetConversationRequest;
|
|
563
|
-
list: ListConversationsRequest;
|
|
564
|
-
};
|
|
565
|
-
label: {
|
|
566
|
-
create: CreateLabelRequest;
|
|
567
|
-
list: ListLabelsRequest;
|
|
568
|
-
};
|
|
569
|
-
message: {
|
|
570
|
-
list: ListMessagesRequest;
|
|
571
|
-
};
|
|
572
|
-
model: {
|
|
573
|
-
list: ListModelsRequest;
|
|
574
|
-
response: {
|
|
575
|
-
create: CreateResponseModelRequest;
|
|
576
|
-
};
|
|
577
|
-
correction: {
|
|
578
|
-
create: CreateCorrectionModelRequest;
|
|
579
|
-
};
|
|
580
|
-
};
|
|
581
|
-
source: {
|
|
582
|
-
list: ListSourcesRequest;
|
|
583
|
-
};
|
|
584
|
-
protected _filterRequest(request: RequestInit): Promise<RequestInit>;
|
|
585
|
-
send(url: string | URL, request: RequestInit, { fetch: fetchAlternative }?: SendOptions): Promise<Response>;
|
|
586
|
-
}
|
|
587
|
-
|
|
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 };
|
|
78
|
+
export { DEFAULT_SUPPORT_BASE_URL, KeyAuthentication, PublicAuthentication, TokenAuthentication };
|