@great-detail/support-sdk 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-LS7DRWDS.js +1 -0
- package/dist/cli.cjs +2 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +2 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +541 -0
- package/dist/index.d.ts +541 -0
- package/dist/index.js +1 -0
- package/package.json +2 -1
- package/src/Action/ListActions.ts +2 -2
- package/src/Channel/ListChannels.ts +2 -2
- package/src/Contact/ListContacts.ts +2 -2
- package/src/Conversation/GetConversation.ts +2 -2
- package/src/Conversation/ListConversations.ts +2 -2
- package/src/Label/ListLabels.ts +2 -2
- package/src/Message/ListMessages.ts +2 -2
- package/src/Model/Correction/CreateCorrectionModel.ts +2 -2
- package/src/Model/ListModels.ts +2 -2
- package/src/Model/Response/CreateResponseModel.ts +2 -2
- package/src/Source/ListSources.ts +2 -2
- package/src/index.ts +11 -0
package/dist/index.d.ts
ADDED
|
@@ -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 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$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 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$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 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$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 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$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 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$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 ListLabelsResponsePayload = {
|
|
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<ListLabelsResponsePayload>;
|
|
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 ListMessagesResponsePayload = {
|
|
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<ListMessagesResponsePayload>;
|
|
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 CreateCorrectionResponsePayload = unknown;
|
|
364
|
+
declare class CreateCorrectionModelResponse {
|
|
365
|
+
response: Response;
|
|
366
|
+
constructor(response: Response);
|
|
367
|
+
result(): Promise<CreateCorrectionResponsePayload>;
|
|
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 ListModelsResponsePayload = {
|
|
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<ListModelsResponsePayload>;
|
|
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 CreateResponseResponsePayload = {
|
|
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<CreateResponseResponsePayload>;
|
|
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 ListSourcesResponsePayload = {
|
|
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<ListSourcesResponsePayload>;
|
|
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, type CreateCorrectionResponsePayload, type CreateResponseResponsePayload, DEFAULT_SUPPORT_BASE_URL, type GetConversationResponsePayload, KeyAuthentication, type ListActionsResponsePayload, type ListChannelsResponsePayload, type ListContactsResponsePayload, type ListConversationsResponsePayload, type ListLabelsResponsePayload, type ListMessagesResponsePayload, type ListModelsResponsePayload, type ListSourcesResponsePayload, PublicAuthentication, type RequestFilterable, TokenAuthentication, Client as default };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b as i,c as p,d as n}from"./chunk-LS7DRWDS.js";var t=class s{static DEFAULT_NAME=i;name;#e;constructor({name:e=process.env.SUPPORT_KEY_NAME??s.DEFAULT_NAME,key:r=process.env.SUPPORT_API_KEY}={}){if(!r)throw new Error("API Key option must be specified when using Key Authentication");this.name=e,this.#e=r}async filter(e){return{...e,headers:{...e.headers,Authorization:`Basic ${btoa(this.name+":"+this.#e)}`}}}};var o=class{#e;constructor({token:e=process.env.SUPPORT_ACCESS_TOKEN}={}){if(!e)throw new Error("Access Token option must be specified when using Token Authentication");this.#e=e}async filter(e){return{...e,headers:{...e.headers,Authorization:`Bearer ${this.#e}`}}}};export{n as Client,a as DEFAULT_SUPPORT_BASE_URL,t as KeyAuthentication,p as PublicAuthentication,o as TokenAuthentication,n as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@great-detail/support-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "JavaScript SDK for the Great Detail Support System",
|
|
6
6
|
"author": "Great Detail Ltd <info@greatdetail.com>",
|
|
@@ -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",
|
|
@@ -30,7 +30,7 @@ export default class ListActionsRequest {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export type
|
|
33
|
+
export type ListActionsResponsePayload = {
|
|
34
34
|
actions: {
|
|
35
35
|
id: string;
|
|
36
36
|
actionStatus: string;
|
|
@@ -44,7 +44,7 @@ export type ListResponse = {
|
|
|
44
44
|
export class ListActionsResponse {
|
|
45
45
|
constructor(public response: Response) {}
|
|
46
46
|
|
|
47
|
-
public async result(): Promise<
|
|
47
|
+
public async result(): Promise<ListActionsResponsePayload> {
|
|
48
48
|
return this.response.json();
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -30,7 +30,7 @@ export default class ListChannelsRequest {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export type
|
|
33
|
+
export type ListChannelsResponsePayload = {
|
|
34
34
|
channels: {
|
|
35
35
|
id: string;
|
|
36
36
|
name?: string;
|
|
@@ -44,7 +44,7 @@ export type ListResponse = {
|
|
|
44
44
|
export class ListChannelsResponse {
|
|
45
45
|
constructor(public response: Response) {}
|
|
46
46
|
|
|
47
|
-
public async result(): Promise<
|
|
47
|
+
public async result(): Promise<ListChannelsResponsePayload> {
|
|
48
48
|
return this.response.json();
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -30,7 +30,7 @@ export default class ListContactsRequest {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export type
|
|
33
|
+
export type ListContactsResponsePayload = {
|
|
34
34
|
contacts: {
|
|
35
35
|
id: string;
|
|
36
36
|
name?: string;
|
|
@@ -44,7 +44,7 @@ export type ListResponse = {
|
|
|
44
44
|
export class ListContactsResponse {
|
|
45
45
|
constructor(public response: Response) {}
|
|
46
46
|
|
|
47
|
-
public async result(): Promise<
|
|
47
|
+
public async result(): Promise<ListContactsResponsePayload> {
|
|
48
48
|
return this.response.json();
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -31,7 +31,7 @@ export default class GetConversationRequest {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
export type
|
|
34
|
+
export type GetConversationResponsePayload = {
|
|
35
35
|
conversation: {
|
|
36
36
|
id: string;
|
|
37
37
|
hasEnded: boolean;
|
|
@@ -44,7 +44,7 @@ export type GetResponse = {
|
|
|
44
44
|
export class GetConversationResponse {
|
|
45
45
|
constructor(public response: Response) {}
|
|
46
46
|
|
|
47
|
-
public async result(): Promise<
|
|
47
|
+
public async result(): Promise<GetConversationResponsePayload> {
|
|
48
48
|
return this.response.json();
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -30,7 +30,7 @@ export default class ListConversationsRequest {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export type
|
|
33
|
+
export type ListConversationsResponsePayload = {
|
|
34
34
|
conversations: {
|
|
35
35
|
id: string;
|
|
36
36
|
hasEnded: boolean;
|
|
@@ -43,7 +43,7 @@ export type ListResponse = {
|
|
|
43
43
|
export class ListConversationsResponse {
|
|
44
44
|
constructor(public response: Response) {}
|
|
45
45
|
|
|
46
|
-
public async result(): Promise<
|
|
46
|
+
public async result(): Promise<ListConversationsResponsePayload> {
|
|
47
47
|
return this.response.json();
|
|
48
48
|
}
|
|
49
49
|
}
|
package/src/Label/ListLabels.ts
CHANGED
|
@@ -30,7 +30,7 @@ export default class ListLabelsRequest {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export type
|
|
33
|
+
export type ListLabelsResponsePayload = {
|
|
34
34
|
labels: {
|
|
35
35
|
id: string;
|
|
36
36
|
title: string;
|
|
@@ -43,7 +43,7 @@ export type ListResponse = {
|
|
|
43
43
|
export class ListLabelsResponse {
|
|
44
44
|
constructor(public response: Response) {}
|
|
45
45
|
|
|
46
|
-
public async result(): Promise<
|
|
46
|
+
public async result(): Promise<ListLabelsResponsePayload> {
|
|
47
47
|
return this.response.json();
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -30,7 +30,7 @@ export default class ListMessagesRequest {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export type
|
|
33
|
+
export type ListMessagesResponsePayload = {
|
|
34
34
|
messages: {
|
|
35
35
|
id: string;
|
|
36
36
|
role: "user" | "assistant";
|
|
@@ -46,7 +46,7 @@ export type ListResponse = {
|
|
|
46
46
|
export class ListMessagesResponse {
|
|
47
47
|
constructor(public response: Response) {}
|
|
48
48
|
|
|
49
|
-
public async result(): Promise<
|
|
49
|
+
public async result(): Promise<ListMessagesResponsePayload> {
|
|
50
50
|
return this.response.json();
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -44,12 +44,12 @@ export default class CreateCorrectionModelRequest {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
export type
|
|
47
|
+
export type CreateCorrectionResponsePayload = unknown;
|
|
48
48
|
|
|
49
49
|
export class CreateCorrectionModelResponse {
|
|
50
50
|
constructor(public response: Response) {}
|
|
51
51
|
|
|
52
|
-
public async result(): Promise<
|
|
52
|
+
public async result(): Promise<CreateCorrectionResponsePayload> {
|
|
53
53
|
return this.response.json();
|
|
54
54
|
}
|
|
55
55
|
}
|