@great-detail/support-sdk 0.0.3 → 0.0.5
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-BFO7RVLV.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 +209 -25
- package/dist/index.d.ts +209 -25
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/Client/index.ts +10 -0
- package/src/Contact/GetContact.ts +51 -0
- package/src/Label/CreateLabel.ts +62 -0
- package/src/Label/GetLabel.ts +50 -0
- package/src/Model/GetModel.ts +50 -0
- package/src/Source/GetSource.ts +50 -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/index.ts +1 -0
- package/dist/chunk-LS7DRWDS.js +0 -1
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$h {
|
|
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$h);
|
|
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$g {
|
|
73
73
|
token?: string;
|
|
74
74
|
}
|
|
75
75
|
declare class TokenAuthentication implements Authentication {
|
|
76
76
|
#private;
|
|
77
|
-
constructor({ token }?: Options$
|
|
77
|
+
constructor({ token }?: Options$g);
|
|
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$f 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$f): 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$e 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$e): Promise<ListChannelsResponse>;
|
|
149
149
|
}
|
|
150
150
|
type ListChannelsResponsePayload = {
|
|
151
151
|
channels: {
|
|
@@ -172,13 +172,47 @@ declare class ListChannelsResponse {
|
|
|
172
172
|
* @see https://greatdetail.com
|
|
173
173
|
*/
|
|
174
174
|
|
|
175
|
-
interface Options$
|
|
175
|
+
interface Options$d extends SendOptions {
|
|
176
|
+
id: string;
|
|
177
|
+
request?: RequestInit;
|
|
178
|
+
}
|
|
179
|
+
declare class GetContactRequest {
|
|
180
|
+
protected _client: Client;
|
|
181
|
+
constructor(_client: Client);
|
|
182
|
+
send({ id, request, ...options }: Options$d): Promise<GetContactResponse>;
|
|
183
|
+
}
|
|
184
|
+
type GetContactResponsePayload = {
|
|
185
|
+
contact: {
|
|
186
|
+
id: string;
|
|
187
|
+
name?: string;
|
|
188
|
+
emailAddress?: string;
|
|
189
|
+
telephoneNumber?: string;
|
|
190
|
+
createdAt: string;
|
|
191
|
+
updatedAt?: string;
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
declare class GetContactResponse {
|
|
195
|
+
response: Response;
|
|
196
|
+
constructor(response: Response);
|
|
197
|
+
result(): Promise<GetContactResponsePayload>;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Great Detail Support System.
|
|
202
|
+
*
|
|
203
|
+
* @copyright 2024 Great Detail Ltd
|
|
204
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
205
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
206
|
+
* @see https://greatdetail.com
|
|
207
|
+
*/
|
|
208
|
+
|
|
209
|
+
interface Options$c extends SendOptions {
|
|
176
210
|
request?: RequestInit;
|
|
177
211
|
}
|
|
178
212
|
declare class ListContactsRequest {
|
|
179
213
|
protected _client: Client;
|
|
180
214
|
constructor(_client: Client);
|
|
181
|
-
send({ request, ...options }?: Options$
|
|
215
|
+
send({ request, ...options }?: Options$c): Promise<ListContactsResponse>;
|
|
182
216
|
}
|
|
183
217
|
type ListContactsResponsePayload = {
|
|
184
218
|
contacts: {
|
|
@@ -205,14 +239,14 @@ declare class ListContactsResponse {
|
|
|
205
239
|
* @see https://greatdetail.com
|
|
206
240
|
*/
|
|
207
241
|
|
|
208
|
-
interface Options$
|
|
242
|
+
interface Options$b extends SendOptions {
|
|
209
243
|
id: string;
|
|
210
244
|
request?: RequestInit;
|
|
211
245
|
}
|
|
212
246
|
declare class GetConversationRequest {
|
|
213
247
|
protected _client: Client;
|
|
214
248
|
constructor(_client: Client);
|
|
215
|
-
send({ id, request, ...options }: Options$
|
|
249
|
+
send({ id, request, ...options }: Options$b): Promise<GetConversationResponse>;
|
|
216
250
|
}
|
|
217
251
|
type GetConversationResponsePayload = {
|
|
218
252
|
conversation: {
|
|
@@ -238,13 +272,13 @@ declare class GetConversationResponse {
|
|
|
238
272
|
* @see https://greatdetail.com
|
|
239
273
|
*/
|
|
240
274
|
|
|
241
|
-
interface Options$
|
|
275
|
+
interface Options$a extends SendOptions {
|
|
242
276
|
request?: RequestInit;
|
|
243
277
|
}
|
|
244
278
|
declare class ListConversationsRequest {
|
|
245
279
|
protected _client: Client;
|
|
246
280
|
constructor(_client: Client);
|
|
247
|
-
send({ request, ...options }?: Options$
|
|
281
|
+
send({ request, ...options }?: Options$a): Promise<ListConversationsResponse>;
|
|
248
282
|
}
|
|
249
283
|
type ListConversationsResponsePayload = {
|
|
250
284
|
conversations: {
|
|
@@ -270,13 +304,92 @@ declare class ListConversationsResponse {
|
|
|
270
304
|
* @see https://greatdetail.com
|
|
271
305
|
*/
|
|
272
306
|
|
|
273
|
-
interface Options$
|
|
307
|
+
interface Options$9 extends SendOptions {
|
|
308
|
+
body: z.infer<typeof CreateLabelRequest.SCHEMA>;
|
|
309
|
+
request?: RequestInit;
|
|
310
|
+
}
|
|
311
|
+
declare class CreateLabelRequest {
|
|
312
|
+
protected _client: Client;
|
|
313
|
+
static SCHEMA: z.ZodObject<{
|
|
314
|
+
title: z.ZodString;
|
|
315
|
+
description: z.ZodOptional<z.ZodString>;
|
|
316
|
+
account: z.ZodString;
|
|
317
|
+
}, "strip", z.ZodTypeAny, {
|
|
318
|
+
title: string;
|
|
319
|
+
account: string;
|
|
320
|
+
description?: string | undefined;
|
|
321
|
+
}, {
|
|
322
|
+
title: string;
|
|
323
|
+
account: string;
|
|
324
|
+
description?: string | undefined;
|
|
325
|
+
}>;
|
|
326
|
+
constructor(_client: Client);
|
|
327
|
+
send({ body, request, ...options }: Options$9): Promise<CreateLabelResponse>;
|
|
328
|
+
}
|
|
329
|
+
type CreateLabelResponsePayload = {
|
|
330
|
+
label: {
|
|
331
|
+
id: string;
|
|
332
|
+
title: string;
|
|
333
|
+
description?: string;
|
|
334
|
+
createdAt: string;
|
|
335
|
+
updatedAt?: string;
|
|
336
|
+
};
|
|
337
|
+
};
|
|
338
|
+
declare class CreateLabelResponse {
|
|
339
|
+
response: Response;
|
|
340
|
+
constructor(response: Response);
|
|
341
|
+
result(): Promise<CreateLabelResponsePayload>;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Great Detail Support System.
|
|
346
|
+
*
|
|
347
|
+
* @copyright 2024 Great Detail Ltd
|
|
348
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
349
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
350
|
+
* @see https://greatdetail.com
|
|
351
|
+
*/
|
|
352
|
+
|
|
353
|
+
interface Options$8 extends SendOptions {
|
|
354
|
+
id: string;
|
|
355
|
+
request?: RequestInit;
|
|
356
|
+
}
|
|
357
|
+
declare class GetLabelRequest {
|
|
358
|
+
protected _client: Client;
|
|
359
|
+
constructor(_client: Client);
|
|
360
|
+
send({ id, request, ...options }: Options$8): Promise<GetLabelResponse>;
|
|
361
|
+
}
|
|
362
|
+
type GetLabelResponsePayload = {
|
|
363
|
+
label: {
|
|
364
|
+
id: string;
|
|
365
|
+
title: string;
|
|
366
|
+
description?: string;
|
|
367
|
+
createdAt: string;
|
|
368
|
+
updatedAt?: string;
|
|
369
|
+
};
|
|
370
|
+
};
|
|
371
|
+
declare class GetLabelResponse {
|
|
372
|
+
response: Response;
|
|
373
|
+
constructor(response: Response);
|
|
374
|
+
result(): Promise<GetLabelResponsePayload>;
|
|
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$7 extends SendOptions {
|
|
274
387
|
request?: RequestInit;
|
|
275
388
|
}
|
|
276
389
|
declare class ListLabelsRequest {
|
|
277
390
|
protected _client: Client;
|
|
278
391
|
constructor(_client: Client);
|
|
279
|
-
send({ request, ...options }?: Options$
|
|
392
|
+
send({ request, ...options }?: Options$7): Promise<ListLabelsResponse>;
|
|
280
393
|
}
|
|
281
394
|
type ListLabelsResponsePayload = {
|
|
282
395
|
labels: {
|
|
@@ -302,13 +415,13 @@ declare class ListLabelsResponse {
|
|
|
302
415
|
* @see https://greatdetail.com
|
|
303
416
|
*/
|
|
304
417
|
|
|
305
|
-
interface Options$
|
|
418
|
+
interface Options$6 extends SendOptions {
|
|
306
419
|
request?: RequestInit;
|
|
307
420
|
}
|
|
308
421
|
declare class ListMessagesRequest {
|
|
309
422
|
protected _client: Client;
|
|
310
423
|
constructor(_client: Client);
|
|
311
|
-
send({ request, ...options }?: Options$
|
|
424
|
+
send({ request, ...options }?: Options$6): Promise<ListMessagesResponse>;
|
|
312
425
|
}
|
|
313
426
|
type ListMessagesResponsePayload = {
|
|
314
427
|
messages: {
|
|
@@ -337,7 +450,7 @@ declare class ListMessagesResponse {
|
|
|
337
450
|
* @see https://greatdetail.com
|
|
338
451
|
*/
|
|
339
452
|
|
|
340
|
-
interface Options$
|
|
453
|
+
interface Options$5 extends SendOptions {
|
|
341
454
|
id: string;
|
|
342
455
|
body: z.infer<typeof CreateCorrectionModelRequest.SCHEMA>;
|
|
343
456
|
request?: RequestInit;
|
|
@@ -358,7 +471,7 @@ declare class CreateCorrectionModelRequest {
|
|
|
358
471
|
correction: string;
|
|
359
472
|
}>;
|
|
360
473
|
constructor(_client: Client);
|
|
361
|
-
send({ id, body, request, ...options }: Options$
|
|
474
|
+
send({ id, body, request, ...options }: Options$5): Promise<CreateCorrectionModelResponse>;
|
|
362
475
|
}
|
|
363
476
|
type CreateCorrectionResponsePayload = unknown;
|
|
364
477
|
declare class CreateCorrectionModelResponse {
|
|
@@ -376,13 +489,46 @@ declare class CreateCorrectionModelResponse {
|
|
|
376
489
|
* @see https://greatdetail.com
|
|
377
490
|
*/
|
|
378
491
|
|
|
379
|
-
interface Options$
|
|
492
|
+
interface Options$4 extends SendOptions {
|
|
493
|
+
id: string;
|
|
494
|
+
request?: RequestInit;
|
|
495
|
+
}
|
|
496
|
+
declare class GetModelRequest {
|
|
497
|
+
protected _client: Client;
|
|
498
|
+
constructor(_client: Client);
|
|
499
|
+
send({ id, request, ...options }: Options$4): Promise<GetModelResponse>;
|
|
500
|
+
}
|
|
501
|
+
type GetModelResponsePayload = {
|
|
502
|
+
model: {
|
|
503
|
+
id: string;
|
|
504
|
+
name: string;
|
|
505
|
+
url: string;
|
|
506
|
+
icon: string;
|
|
507
|
+
disambiguatingDescription: string;
|
|
508
|
+
};
|
|
509
|
+
};
|
|
510
|
+
declare class GetModelResponse {
|
|
511
|
+
response: Response;
|
|
512
|
+
constructor(response: Response);
|
|
513
|
+
result(): Promise<GetModelResponsePayload>;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* Great Detail Support System.
|
|
518
|
+
*
|
|
519
|
+
* @copyright 2024 Great Detail Ltd
|
|
520
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
521
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
522
|
+
* @see https://greatdetail.com
|
|
523
|
+
*/
|
|
524
|
+
|
|
525
|
+
interface Options$3 extends SendOptions {
|
|
380
526
|
request?: RequestInit;
|
|
381
527
|
}
|
|
382
528
|
declare class ListModelsRequest {
|
|
383
529
|
protected _client: Client;
|
|
384
530
|
constructor(_client: Client);
|
|
385
|
-
send({ request, ...options }?: Options$
|
|
531
|
+
send({ request, ...options }?: Options$3): Promise<ListModelsResponse>;
|
|
386
532
|
}
|
|
387
533
|
type ListModelsResponsePayload = {
|
|
388
534
|
models: {
|
|
@@ -408,7 +554,7 @@ declare class ListModelsResponse {
|
|
|
408
554
|
* @see https://greatdetail.com
|
|
409
555
|
*/
|
|
410
556
|
|
|
411
|
-
interface Options$
|
|
557
|
+
interface Options$2 extends SendOptions {
|
|
412
558
|
id: string;
|
|
413
559
|
body: z.infer<typeof CreateResponseModelRequest.SCHEMA>;
|
|
414
560
|
request?: RequestInit;
|
|
@@ -426,7 +572,7 @@ declare class CreateResponseModelRequest {
|
|
|
426
572
|
content: string | null;
|
|
427
573
|
}>, "many">;
|
|
428
574
|
constructor(_client: Client);
|
|
429
|
-
send({ id, body, request, ...options }: Options$
|
|
575
|
+
send({ id, body, request, ...options }: Options$2): Promise<CreateResponseModelResponse>;
|
|
430
576
|
}
|
|
431
577
|
type CreateResponseResponsePayload = {
|
|
432
578
|
message: string | null;
|
|
@@ -441,6 +587,39 @@ declare class CreateResponseModelResponse {
|
|
|
441
587
|
result(): Promise<CreateResponseResponsePayload>;
|
|
442
588
|
}
|
|
443
589
|
|
|
590
|
+
/**
|
|
591
|
+
* Great Detail Support System.
|
|
592
|
+
*
|
|
593
|
+
* @copyright 2024 Great Detail Ltd
|
|
594
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
595
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
596
|
+
* @see https://greatdetail.com
|
|
597
|
+
*/
|
|
598
|
+
|
|
599
|
+
interface Options$1 extends SendOptions {
|
|
600
|
+
id: string;
|
|
601
|
+
request?: RequestInit;
|
|
602
|
+
}
|
|
603
|
+
declare class GetSourceRequest {
|
|
604
|
+
protected _client: Client;
|
|
605
|
+
constructor(_client: Client);
|
|
606
|
+
send({ id, request, ...options }: Options$1): Promise<GetSourceResponse>;
|
|
607
|
+
}
|
|
608
|
+
type GetSourceResponsePayload = {
|
|
609
|
+
source: {
|
|
610
|
+
id: string;
|
|
611
|
+
name: string;
|
|
612
|
+
category: string;
|
|
613
|
+
url: string;
|
|
614
|
+
disambiguatingDescription: string;
|
|
615
|
+
};
|
|
616
|
+
};
|
|
617
|
+
declare class GetSourceResponse {
|
|
618
|
+
response: Response;
|
|
619
|
+
constructor(response: Response);
|
|
620
|
+
result(): Promise<GetSourceResponsePayload>;
|
|
621
|
+
}
|
|
622
|
+
|
|
444
623
|
/**
|
|
445
624
|
* Great Detail Support System.
|
|
446
625
|
*
|
|
@@ -510,6 +689,7 @@ declare class Client {
|
|
|
510
689
|
list: ListChannelsRequest;
|
|
511
690
|
};
|
|
512
691
|
contact: {
|
|
692
|
+
get: GetContactRequest;
|
|
513
693
|
list: ListContactsRequest;
|
|
514
694
|
};
|
|
515
695
|
conversation: {
|
|
@@ -517,12 +697,15 @@ declare class Client {
|
|
|
517
697
|
list: ListConversationsRequest;
|
|
518
698
|
};
|
|
519
699
|
label: {
|
|
700
|
+
create: CreateLabelRequest;
|
|
701
|
+
get: GetLabelRequest;
|
|
520
702
|
list: ListLabelsRequest;
|
|
521
703
|
};
|
|
522
704
|
message: {
|
|
523
705
|
list: ListMessagesRequest;
|
|
524
706
|
};
|
|
525
707
|
model: {
|
|
708
|
+
get: GetModelRequest;
|
|
526
709
|
list: ListModelsRequest;
|
|
527
710
|
response: {
|
|
528
711
|
create: CreateResponseModelRequest;
|
|
@@ -532,10 +715,11 @@ declare class Client {
|
|
|
532
715
|
};
|
|
533
716
|
};
|
|
534
717
|
source: {
|
|
718
|
+
get: GetSourceRequest;
|
|
535
719
|
list: ListSourcesRequest;
|
|
536
720
|
};
|
|
537
721
|
protected _filterRequest(request: RequestInit): Promise<RequestInit>;
|
|
538
722
|
send(url: string | URL, request: RequestInit, { fetch: fetchAlternative }?: SendOptions): Promise<Response>;
|
|
539
723
|
}
|
|
540
724
|
|
|
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 };
|
|
725
|
+
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-BFO7RVLV.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
|
@@ -11,16 +11,21 @@ import ListActionsRequest from "../Action/ListActions.js";
|
|
|
11
11
|
import Authentication from "../Authentication/index.js";
|
|
12
12
|
import ListChannelsRequest from "../Channel/ListChannels.js";
|
|
13
13
|
import { DEFAULT_SUPPORT_BASE_URL } from "../constants/index.js";
|
|
14
|
+
import GetContactRequest from "../Contact/GetContact.js";
|
|
14
15
|
import ListContactsRequest from "../Contact/ListContacts.js";
|
|
15
16
|
import GetConversationRequest from "../Conversation/GetConversation.js";
|
|
16
17
|
import ListConversationsRequest from "../Conversation/ListConversations.js";
|
|
18
|
+
import CreateLabelRequest from "../Label/CreateLabel.js";
|
|
19
|
+
import GetLabelRequest from "../Label/GetLabel.js";
|
|
17
20
|
import ListLabelsRequest from "../Label/ListLabels.js";
|
|
18
21
|
import ListMessagesRequest from "../Message/ListMessages.js";
|
|
19
22
|
import CreateCorrectionModelRequest from "../Model/Correction/CreateCorrectionModel.js";
|
|
23
|
+
import GetModelRequest from "../Model/GetModel.js";
|
|
20
24
|
import ListModelsRequest from "../Model/ListModels.js";
|
|
21
25
|
import CreateResponseModelRequest from "../Model/Response/CreateResponseModel.js";
|
|
22
26
|
import RequestFilterable from "../Request/RequestFilterable.js";
|
|
23
27
|
import RequestStandardHeaders from "../Request/RequestStandardHeaders.js";
|
|
28
|
+
import GetSourceRequest from "../Source/GetSource.js";
|
|
24
29
|
import ListSourcesRequest from "../Source/ListSources.js";
|
|
25
30
|
|
|
26
31
|
export interface ClientOptions {
|
|
@@ -68,6 +73,7 @@ export default class Client {
|
|
|
68
73
|
};
|
|
69
74
|
|
|
70
75
|
public contact = {
|
|
76
|
+
get: new GetContactRequest(this),
|
|
71
77
|
list: new ListContactsRequest(this),
|
|
72
78
|
};
|
|
73
79
|
|
|
@@ -77,6 +83,8 @@ export default class Client {
|
|
|
77
83
|
};
|
|
78
84
|
|
|
79
85
|
public label = {
|
|
86
|
+
create: new CreateLabelRequest(this),
|
|
87
|
+
get: new GetLabelRequest(this),
|
|
80
88
|
list: new ListLabelsRequest(this),
|
|
81
89
|
};
|
|
82
90
|
|
|
@@ -85,6 +93,7 @@ export default class Client {
|
|
|
85
93
|
};
|
|
86
94
|
|
|
87
95
|
public model = {
|
|
96
|
+
get: new GetModelRequest(this),
|
|
88
97
|
list: new ListModelsRequest(this),
|
|
89
98
|
response: {
|
|
90
99
|
create: new CreateResponseModelRequest(this),
|
|
@@ -95,6 +104,7 @@ export default class Client {
|
|
|
95
104
|
};
|
|
96
105
|
|
|
97
106
|
public source = {
|
|
107
|
+
get: new GetSourceRequest(this),
|
|
98
108
|
list: new ListSourcesRequest(this),
|
|
99
109
|
};
|
|
100
110
|
|
|
@@ -0,0 +1,51 @@
|
|
|
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 Client, { SendOptions } from "../Client/index.js";
|
|
11
|
+
|
|
12
|
+
export interface Options extends SendOptions {
|
|
13
|
+
id: string;
|
|
14
|
+
request?: RequestInit;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default class GetContactRequest {
|
|
18
|
+
constructor(protected _client: Client) {}
|
|
19
|
+
|
|
20
|
+
public async send({ id, request = {}, ...options }: Options) {
|
|
21
|
+
return this._client
|
|
22
|
+
.send(
|
|
23
|
+
"/v1/contacts/" + encodeURIComponent(id),
|
|
24
|
+
{
|
|
25
|
+
...request,
|
|
26
|
+
method: "GET",
|
|
27
|
+
},
|
|
28
|
+
options,
|
|
29
|
+
)
|
|
30
|
+
.then((response) => new GetContactResponse(response));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type GetContactResponsePayload = {
|
|
35
|
+
contact: {
|
|
36
|
+
id: string;
|
|
37
|
+
name?: string;
|
|
38
|
+
emailAddress?: string;
|
|
39
|
+
telephoneNumber?: string;
|
|
40
|
+
createdAt: string;
|
|
41
|
+
updatedAt?: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export class GetContactResponse {
|
|
46
|
+
constructor(public response: Response) {}
|
|
47
|
+
|
|
48
|
+
public async result(): Promise<GetContactResponsePayload> {
|
|
49
|
+
return this.response.json();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
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 Client, { SendOptions } from "../Client/index.js";
|
|
11
|
+
|
|
12
|
+
export interface Options extends SendOptions {
|
|
13
|
+
id: string;
|
|
14
|
+
request?: RequestInit;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default class GetLabelRequest {
|
|
18
|
+
constructor(protected _client: Client) {}
|
|
19
|
+
|
|
20
|
+
public async send({ id, request = {}, ...options }: Options) {
|
|
21
|
+
return this._client
|
|
22
|
+
.send(
|
|
23
|
+
"/v1/labels/" + encodeURIComponent(id),
|
|
24
|
+
{
|
|
25
|
+
...request,
|
|
26
|
+
method: "GET",
|
|
27
|
+
},
|
|
28
|
+
options,
|
|
29
|
+
)
|
|
30
|
+
.then((response) => new GetLabelResponse(response));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type GetLabelResponsePayload = {
|
|
35
|
+
label: {
|
|
36
|
+
id: string;
|
|
37
|
+
title: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
createdAt: string;
|
|
40
|
+
updatedAt?: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export class GetLabelResponse {
|
|
45
|
+
constructor(public response: Response) {}
|
|
46
|
+
|
|
47
|
+
public async result(): Promise<GetLabelResponsePayload> {
|
|
48
|
+
return this.response.json();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
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 Client, { SendOptions } from "../Client/index.js";
|
|
11
|
+
|
|
12
|
+
export interface Options extends SendOptions {
|
|
13
|
+
id: string;
|
|
14
|
+
request?: RequestInit;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default class GetModelRequest {
|
|
18
|
+
constructor(protected _client: Client) {}
|
|
19
|
+
|
|
20
|
+
public async send({ id, request = {}, ...options }: Options) {
|
|
21
|
+
return this._client
|
|
22
|
+
.send(
|
|
23
|
+
"/v1/models/" + encodeURIComponent(id),
|
|
24
|
+
{
|
|
25
|
+
...request,
|
|
26
|
+
method: "GET",
|
|
27
|
+
},
|
|
28
|
+
options,
|
|
29
|
+
)
|
|
30
|
+
.then((response) => new GetModelResponse(response));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type GetModelResponsePayload = {
|
|
35
|
+
model: {
|
|
36
|
+
id: string;
|
|
37
|
+
name: string;
|
|
38
|
+
url: string;
|
|
39
|
+
icon: string;
|
|
40
|
+
disambiguatingDescription: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export class GetModelResponse {
|
|
45
|
+
constructor(public response: Response) {}
|
|
46
|
+
|
|
47
|
+
public async result(): Promise<GetModelResponsePayload> {
|
|
48
|
+
return this.response.json();
|
|
49
|
+
}
|
|
50
|
+
}
|