@great-detail/support-sdk 0.1.6 → 0.2.0
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-IXJNWCJL.js +1 -0
- package/dist/{chunk-GQPMRQEH.js → chunk-SRYAEALQ.js} +1 -1
- package/dist/cli/index.cjs +1 -1
- package/dist/cli/index.d.cts +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/{index-fAkhYzqW.d.cts → index-Dj17QRj0.d.cts} +135 -112
- package/dist/{index-fAkhYzqW.d.ts → index-Dj17QRj0.d.ts} +135 -112
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +63 -6
- package/dist/index.d.ts +63 -6
- package/dist/index.js +1 -1
- package/package.json +2 -1
- package/src/Action/ListActions.ts +8 -12
- package/src/Authentication/KeyAuthentication.ts +10 -11
- package/src/Authentication/PublicAuthentication.ts +8 -2
- package/src/Authentication/TokenAuthentication.ts +9 -7
- package/src/Channel/ListChannels.ts +8 -12
- package/src/Client/index.ts +6 -5
- package/src/Contact/ContactVCF/GetContactVCF.ts +13 -11
- package/src/Contact/CreateContact.ts +12 -16
- package/src/Contact/GetContact.ts +8 -12
- package/src/Contact/ListContacts.ts +8 -12
- package/src/Contact/ListLabelContacts.ts +8 -12
- package/src/Contact/UpdateContact.ts +12 -16
- package/src/Conversation/GetConversation.ts +8 -12
- package/src/Conversation/ListConversations.ts +8 -12
- package/src/Conversation/ListLabelConversations.ts +8 -12
- package/src/Conversation/UpdateConversation.ts +12 -16
- package/src/Error/AuthError.ts +12 -0
- package/src/Error/AuthenticationError.ts +16 -0
- package/src/Error/AuthorizationError.ts +16 -0
- package/src/Error/LogicError.ts +20 -0
- package/src/Error/NetworkError.ts +12 -0
- package/src/Error/SupportError.ts +10 -0
- package/src/Error/ValidationError.ts +16 -0
- package/src/Error/index.ts +11 -0
- package/src/Label/CreateLabel.ts +12 -16
- package/src/Label/DeleteLabel.ts +8 -12
- package/src/Label/GetLabel.ts +8 -12
- package/src/Label/ListLabels.ts +8 -12
- package/src/Label/UpdateLabel.ts +12 -16
- package/src/Message/ListConversationMessages.ts +8 -12
- package/src/Message/ListMessages.ts +8 -12
- package/src/Model/Correction/CreateCorrectionModel.ts +12 -16
- package/src/Model/GetModel.ts +8 -12
- package/src/Model/ListModels.ts +8 -12
- package/src/Model/Response/CreateResponseModel.ts +12 -16
- package/src/Request/RequestFilterable.ts +5 -1
- package/src/Request/RequestStandardHeaders.ts +6 -6
- package/src/Source/GetSource.ts +8 -12
- package/src/Source/ListSources.ts +8 -12
- package/src/Transport/FetchTransport.ts +112 -0
- package/src/Transport/index.ts +2 -44
- package/src/__tests__/Client/Client.test.ts +38 -0
- package/src/constants/environment.ts +36 -0
- package/src/constants/index.ts +0 -21
- package/src/index.ts +4 -4
- package/dist/chunk-Q4LJP3V4.js +0 -1
- package/src/__tests__/Authentication/KeyAuthentication.test.ts +0 -79
- package/src/__tests__/Authentication/TokenAuthentication.test.ts +0 -79
|
@@ -9,7 +9,13 @@ import { z } from 'zod';
|
|
|
9
9
|
* @see https://greatdetail.com
|
|
10
10
|
*/
|
|
11
11
|
interface RequestFilterable {
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated
|
|
14
|
+
*/
|
|
15
|
+
filter(...options: unknown[]): Promise<{
|
|
16
|
+
headers: Record<string, string>;
|
|
17
|
+
}>;
|
|
18
|
+
getHeaders(): Record<string, string>;
|
|
13
19
|
}
|
|
14
20
|
|
|
15
21
|
/**
|
|
@@ -21,11 +27,24 @@ interface RequestFilterable {
|
|
|
21
27
|
* @see https://greatdetail.com
|
|
22
28
|
*/
|
|
23
29
|
|
|
24
|
-
interface Options$
|
|
30
|
+
interface Options$r {
|
|
25
31
|
requestFilterables: RequestFilterable[];
|
|
26
|
-
baseURL: string;
|
|
27
32
|
}
|
|
28
|
-
interface
|
|
33
|
+
interface Transport {
|
|
34
|
+
getURL(url: string): string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Great Detail Support System.
|
|
39
|
+
*
|
|
40
|
+
* @copyright 2024 Great Detail Ltd
|
|
41
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
42
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
43
|
+
* @see https://greatdetail.com
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
interface InputOptions extends Options$r {
|
|
47
|
+
baseURL: string;
|
|
29
48
|
/**
|
|
30
49
|
* Alternative Fetch Provider.
|
|
31
50
|
* Used to override the default fetch provider and use polyfills or other
|
|
@@ -35,12 +54,16 @@ interface SendOptions {
|
|
|
35
54
|
*/
|
|
36
55
|
fetch?: typeof fetch;
|
|
37
56
|
}
|
|
38
|
-
|
|
57
|
+
interface Options$q extends Options$r {
|
|
58
|
+
baseURL: string;
|
|
59
|
+
fetch: typeof fetch;
|
|
60
|
+
}
|
|
61
|
+
declare class FetchTransport implements Transport {
|
|
39
62
|
options: Options$q;
|
|
40
|
-
constructor({ baseURL, ...options }:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
send(url: string
|
|
63
|
+
constructor({ baseURL, fetch: fetchAlternative, ...options }: InputOptions);
|
|
64
|
+
getURL(url: string): string;
|
|
65
|
+
getRequest(url: string, request: RequestInit): Request;
|
|
66
|
+
send(url: string, request: RequestInit): Promise<Response>;
|
|
44
67
|
}
|
|
45
68
|
|
|
46
69
|
/**
|
|
@@ -52,13 +75,13 @@ declare class Transport {
|
|
|
52
75
|
* @see https://greatdetail.com
|
|
53
76
|
*/
|
|
54
77
|
|
|
55
|
-
interface Options$p
|
|
78
|
+
interface Options$p {
|
|
56
79
|
request?: RequestInit;
|
|
57
80
|
}
|
|
58
81
|
declare class ListActions {
|
|
59
|
-
protected _transport:
|
|
60
|
-
constructor(_transport:
|
|
61
|
-
send({ request
|
|
82
|
+
protected _transport: FetchTransport;
|
|
83
|
+
constructor(_transport: FetchTransport);
|
|
84
|
+
send({ request }?: Options$p): Promise<ListActionsResponse>;
|
|
62
85
|
}
|
|
63
86
|
type ListActionsResponsePayload = {
|
|
64
87
|
actions: {
|
|
@@ -100,13 +123,13 @@ type Authentication = RequestFilterable;
|
|
|
100
123
|
* @see https://greatdetail.com
|
|
101
124
|
*/
|
|
102
125
|
|
|
103
|
-
interface Options$o
|
|
126
|
+
interface Options$o {
|
|
104
127
|
request?: RequestInit;
|
|
105
128
|
}
|
|
106
129
|
declare class ListChannels {
|
|
107
|
-
protected _transport:
|
|
108
|
-
constructor(_transport:
|
|
109
|
-
send({ request
|
|
130
|
+
protected _transport: FetchTransport;
|
|
131
|
+
constructor(_transport: FetchTransport);
|
|
132
|
+
send({ request }?: Options$o): Promise<ListChannelsResponse>;
|
|
110
133
|
}
|
|
111
134
|
type ListChannelsResponsePayload = {
|
|
112
135
|
channels: ({
|
|
@@ -150,7 +173,7 @@ declare class ListChannelsResponse {
|
|
|
150
173
|
interface Options$n {
|
|
151
174
|
id: string;
|
|
152
175
|
vcf?: {
|
|
153
|
-
variant
|
|
176
|
+
variant?: "vcard";
|
|
154
177
|
format?: "vcf" | "qr";
|
|
155
178
|
} | {
|
|
156
179
|
variant: "jcard";
|
|
@@ -158,9 +181,9 @@ interface Options$n {
|
|
|
158
181
|
};
|
|
159
182
|
}
|
|
160
183
|
declare class GetContactVCFURL {
|
|
161
|
-
protected _transport:
|
|
162
|
-
constructor(_transport:
|
|
163
|
-
getURL({ id, vcf }: Options$n):
|
|
184
|
+
protected _transport: FetchTransport;
|
|
185
|
+
constructor(_transport: FetchTransport);
|
|
186
|
+
getURL({ id, vcf }: Options$n): string;
|
|
164
187
|
}
|
|
165
188
|
|
|
166
189
|
/**
|
|
@@ -172,12 +195,12 @@ declare class GetContactVCFURL {
|
|
|
172
195
|
* @see https://greatdetail.com
|
|
173
196
|
*/
|
|
174
197
|
|
|
175
|
-
interface Options$m
|
|
198
|
+
interface Options$m {
|
|
176
199
|
body: z.infer<typeof CreateContact.SCHEMA>;
|
|
177
200
|
request?: RequestInit;
|
|
178
201
|
}
|
|
179
202
|
declare class CreateContact {
|
|
180
|
-
protected _transport:
|
|
203
|
+
protected _transport: FetchTransport;
|
|
181
204
|
static SCHEMA: z.ZodObject<{
|
|
182
205
|
name: z.ZodString;
|
|
183
206
|
account: z.ZodString;
|
|
@@ -194,8 +217,8 @@ declare class CreateContact {
|
|
|
194
217
|
emailAddress?: string | undefined;
|
|
195
218
|
telephoneNumber?: string | undefined;
|
|
196
219
|
}>;
|
|
197
|
-
constructor(_transport:
|
|
198
|
-
send({ body, request
|
|
220
|
+
constructor(_transport: FetchTransport);
|
|
221
|
+
send({ body, request }: Options$m): Promise<CreateContactResponse>;
|
|
199
222
|
}
|
|
200
223
|
type CreateContactResponsePayload = {
|
|
201
224
|
contact: {
|
|
@@ -223,14 +246,14 @@ declare class CreateContactResponse {
|
|
|
223
246
|
* @see https://greatdetail.com
|
|
224
247
|
*/
|
|
225
248
|
|
|
226
|
-
interface Options$l
|
|
249
|
+
interface Options$l {
|
|
227
250
|
id: string;
|
|
228
251
|
request?: RequestInit;
|
|
229
252
|
}
|
|
230
253
|
declare class GetContact {
|
|
231
|
-
protected _transport:
|
|
232
|
-
constructor(_transport:
|
|
233
|
-
send({ id, request
|
|
254
|
+
protected _transport: FetchTransport;
|
|
255
|
+
constructor(_transport: FetchTransport);
|
|
256
|
+
send({ id, request }: Options$l): Promise<GetContactResponse>;
|
|
234
257
|
}
|
|
235
258
|
type GetContactResponsePayload = {
|
|
236
259
|
contact: {
|
|
@@ -258,13 +281,13 @@ declare class GetContactResponse {
|
|
|
258
281
|
* @see https://greatdetail.com
|
|
259
282
|
*/
|
|
260
283
|
|
|
261
|
-
interface Options$k
|
|
284
|
+
interface Options$k {
|
|
262
285
|
request?: RequestInit;
|
|
263
286
|
}
|
|
264
287
|
declare class ListContacts {
|
|
265
|
-
protected _transport:
|
|
266
|
-
constructor(_transport:
|
|
267
|
-
send({ request
|
|
288
|
+
protected _transport: FetchTransport;
|
|
289
|
+
constructor(_transport: FetchTransport);
|
|
290
|
+
send({ request }?: Options$k): Promise<ListContactsResponse>;
|
|
268
291
|
}
|
|
269
292
|
type ListContactsResponsePayload = {
|
|
270
293
|
contacts: {
|
|
@@ -292,14 +315,14 @@ declare class ListContactsResponse {
|
|
|
292
315
|
* @see https://greatdetail.com
|
|
293
316
|
*/
|
|
294
317
|
|
|
295
|
-
interface Options$j
|
|
318
|
+
interface Options$j {
|
|
296
319
|
id: string;
|
|
297
320
|
request?: RequestInit;
|
|
298
321
|
}
|
|
299
322
|
declare class ListLabelContacts {
|
|
300
|
-
protected _transport:
|
|
301
|
-
constructor(_transport:
|
|
302
|
-
send({ id, request
|
|
323
|
+
protected _transport: FetchTransport;
|
|
324
|
+
constructor(_transport: FetchTransport);
|
|
325
|
+
send({ id, request }: Options$j): Promise<ListLabelContactsResponse>;
|
|
303
326
|
}
|
|
304
327
|
type ListLabelContactsResponsePayload = {
|
|
305
328
|
contacts: {
|
|
@@ -327,13 +350,13 @@ declare class ListLabelContactsResponse {
|
|
|
327
350
|
* @see https://greatdetail.com
|
|
328
351
|
*/
|
|
329
352
|
|
|
330
|
-
interface Options$i
|
|
353
|
+
interface Options$i {
|
|
331
354
|
id: string;
|
|
332
355
|
body: z.infer<typeof UpdateContact.SCHEMA>;
|
|
333
356
|
request?: RequestInit;
|
|
334
357
|
}
|
|
335
358
|
declare class UpdateContact {
|
|
336
|
-
protected _transport:
|
|
359
|
+
protected _transport: FetchTransport;
|
|
337
360
|
static SCHEMA: z.ZodObject<{
|
|
338
361
|
name: z.ZodOptional<z.ZodString>;
|
|
339
362
|
emailAddress: z.ZodOptional<z.ZodString>;
|
|
@@ -347,8 +370,8 @@ declare class UpdateContact {
|
|
|
347
370
|
emailAddress?: string | undefined;
|
|
348
371
|
telephoneNumber?: string | undefined;
|
|
349
372
|
}>;
|
|
350
|
-
constructor(_transport:
|
|
351
|
-
send({ id, body, request
|
|
373
|
+
constructor(_transport: FetchTransport);
|
|
374
|
+
send({ id, body, request }: Options$i): Promise<UpdateContactResponse>;
|
|
352
375
|
}
|
|
353
376
|
type UpdateContactResponsePayload = {
|
|
354
377
|
contact: {
|
|
@@ -376,14 +399,14 @@ declare class UpdateContactResponse {
|
|
|
376
399
|
* @see https://greatdetail.com
|
|
377
400
|
*/
|
|
378
401
|
|
|
379
|
-
interface Options$h
|
|
402
|
+
interface Options$h {
|
|
380
403
|
id: string;
|
|
381
404
|
request?: RequestInit;
|
|
382
405
|
}
|
|
383
406
|
declare class GetConversation {
|
|
384
|
-
protected _transport:
|
|
385
|
-
constructor(_transport:
|
|
386
|
-
send({ id, request
|
|
407
|
+
protected _transport: FetchTransport;
|
|
408
|
+
constructor(_transport: FetchTransport);
|
|
409
|
+
send({ id, request }: Options$h): Promise<GetConversationResponse>;
|
|
387
410
|
}
|
|
388
411
|
type GetConversationResponsePayload = {
|
|
389
412
|
conversation: {
|
|
@@ -411,13 +434,13 @@ declare class GetConversationResponse {
|
|
|
411
434
|
* @see https://greatdetail.com
|
|
412
435
|
*/
|
|
413
436
|
|
|
414
|
-
interface Options$g
|
|
437
|
+
interface Options$g {
|
|
415
438
|
request?: RequestInit;
|
|
416
439
|
}
|
|
417
440
|
declare class ListConversations {
|
|
418
|
-
protected _transport:
|
|
419
|
-
constructor(_transport:
|
|
420
|
-
send({ request
|
|
441
|
+
protected _transport: FetchTransport;
|
|
442
|
+
constructor(_transport: FetchTransport);
|
|
443
|
+
send({ request }?: Options$g): Promise<ListConversationsResponse>;
|
|
421
444
|
}
|
|
422
445
|
type ListConversationsResponsePayload = {
|
|
423
446
|
conversations: {
|
|
@@ -445,14 +468,14 @@ declare class ListConversationsResponse {
|
|
|
445
468
|
* @see https://greatdetail.com
|
|
446
469
|
*/
|
|
447
470
|
|
|
448
|
-
interface Options$f
|
|
471
|
+
interface Options$f {
|
|
449
472
|
id: string;
|
|
450
473
|
request?: RequestInit;
|
|
451
474
|
}
|
|
452
475
|
declare class ListLabelConversations {
|
|
453
|
-
protected _transport:
|
|
454
|
-
constructor(_transport:
|
|
455
|
-
send({ id, request
|
|
476
|
+
protected _transport: FetchTransport;
|
|
477
|
+
constructor(_transport: FetchTransport);
|
|
478
|
+
send({ id, request }: Options$f): Promise<ListLabelConversationsResponse>;
|
|
456
479
|
}
|
|
457
480
|
type ListLabelConversationsResponsePayload = {
|
|
458
481
|
conversations: {
|
|
@@ -480,13 +503,13 @@ declare class ListLabelConversationsResponse {
|
|
|
480
503
|
* @see https://greatdetail.com
|
|
481
504
|
*/
|
|
482
505
|
|
|
483
|
-
interface Options$e
|
|
506
|
+
interface Options$e {
|
|
484
507
|
id: string;
|
|
485
508
|
body: z.infer<typeof UpdateConversation.SCHEMA>;
|
|
486
509
|
request?: RequestInit;
|
|
487
510
|
}
|
|
488
511
|
declare class UpdateConversation {
|
|
489
|
-
protected _transport:
|
|
512
|
+
protected _transport: FetchTransport;
|
|
490
513
|
static SCHEMA: z.ZodObject<{
|
|
491
514
|
hasEnded: z.ZodBoolean;
|
|
492
515
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -494,8 +517,8 @@ declare class UpdateConversation {
|
|
|
494
517
|
}, {
|
|
495
518
|
hasEnded: boolean;
|
|
496
519
|
}>;
|
|
497
|
-
constructor(_transport:
|
|
498
|
-
send({ id, body, request
|
|
520
|
+
constructor(_transport: FetchTransport);
|
|
521
|
+
send({ id, body, request }: Options$e): Promise<UpdateConversationResponse>;
|
|
499
522
|
}
|
|
500
523
|
type UpdateConversationResponsePayload = {
|
|
501
524
|
conversation: {
|
|
@@ -523,12 +546,12 @@ declare class UpdateConversationResponse {
|
|
|
523
546
|
* @see https://greatdetail.com
|
|
524
547
|
*/
|
|
525
548
|
|
|
526
|
-
interface Options$d
|
|
549
|
+
interface Options$d {
|
|
527
550
|
body: z.infer<typeof CreateLabel.SCHEMA>;
|
|
528
551
|
request?: RequestInit;
|
|
529
552
|
}
|
|
530
553
|
declare class CreateLabel {
|
|
531
|
-
protected _transport:
|
|
554
|
+
protected _transport: FetchTransport;
|
|
532
555
|
static SCHEMA: z.ZodObject<{
|
|
533
556
|
title: z.ZodString;
|
|
534
557
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -542,8 +565,8 @@ declare class CreateLabel {
|
|
|
542
565
|
title: string;
|
|
543
566
|
description?: string | undefined;
|
|
544
567
|
}>;
|
|
545
|
-
constructor(_transport:
|
|
546
|
-
send({ body, request
|
|
568
|
+
constructor(_transport: FetchTransport);
|
|
569
|
+
send({ body, request }: Options$d): Promise<CreateLabelResponse>;
|
|
547
570
|
}
|
|
548
571
|
type CreateLabelResponsePayload = {
|
|
549
572
|
label: {
|
|
@@ -570,14 +593,14 @@ declare class CreateLabelResponse {
|
|
|
570
593
|
* @see https://greatdetail.com
|
|
571
594
|
*/
|
|
572
595
|
|
|
573
|
-
interface Options$c
|
|
596
|
+
interface Options$c {
|
|
574
597
|
id: string;
|
|
575
598
|
request?: RequestInit;
|
|
576
599
|
}
|
|
577
600
|
declare class DeleteLabel {
|
|
578
|
-
protected _transport:
|
|
579
|
-
constructor(_transport:
|
|
580
|
-
send({ id, request
|
|
601
|
+
protected _transport: FetchTransport;
|
|
602
|
+
constructor(_transport: FetchTransport);
|
|
603
|
+
send({ id, request }: Options$c): Promise<DeleteLabelResponse>;
|
|
581
604
|
}
|
|
582
605
|
type DeleteLabelResponsePayload = Record<string, never>;
|
|
583
606
|
declare class DeleteLabelResponse {
|
|
@@ -595,14 +618,14 @@ declare class DeleteLabelResponse {
|
|
|
595
618
|
* @see https://greatdetail.com
|
|
596
619
|
*/
|
|
597
620
|
|
|
598
|
-
interface Options$b
|
|
621
|
+
interface Options$b {
|
|
599
622
|
id: string;
|
|
600
623
|
request?: RequestInit;
|
|
601
624
|
}
|
|
602
625
|
declare class GetLabel {
|
|
603
|
-
protected _transport:
|
|
604
|
-
constructor(_transport:
|
|
605
|
-
send({ id, request
|
|
626
|
+
protected _transport: FetchTransport;
|
|
627
|
+
constructor(_transport: FetchTransport);
|
|
628
|
+
send({ id, request }: Options$b): Promise<GetLabelResponse>;
|
|
606
629
|
}
|
|
607
630
|
type GetLabelResponsePayload = {
|
|
608
631
|
label: {
|
|
@@ -629,13 +652,13 @@ declare class GetLabelResponse {
|
|
|
629
652
|
* @see https://greatdetail.com
|
|
630
653
|
*/
|
|
631
654
|
|
|
632
|
-
interface Options$a
|
|
655
|
+
interface Options$a {
|
|
633
656
|
request?: RequestInit;
|
|
634
657
|
}
|
|
635
658
|
declare class ListLabels {
|
|
636
|
-
protected _transport:
|
|
637
|
-
constructor(_transport:
|
|
638
|
-
send({ request
|
|
659
|
+
protected _transport: FetchTransport;
|
|
660
|
+
constructor(_transport: FetchTransport);
|
|
661
|
+
send({ request }?: Options$a): Promise<ListLabelsResponse>;
|
|
639
662
|
}
|
|
640
663
|
type ListLabelsResponsePayload = {
|
|
641
664
|
labels: {
|
|
@@ -662,13 +685,13 @@ declare class ListLabelsResponse {
|
|
|
662
685
|
* @see https://greatdetail.com
|
|
663
686
|
*/
|
|
664
687
|
|
|
665
|
-
interface Options$9
|
|
688
|
+
interface Options$9 {
|
|
666
689
|
id: string;
|
|
667
690
|
body: z.infer<typeof UpdateLabel.SCHEMA>;
|
|
668
691
|
request?: RequestInit;
|
|
669
692
|
}
|
|
670
693
|
declare class UpdateLabel {
|
|
671
|
-
protected _transport:
|
|
694
|
+
protected _transport: FetchTransport;
|
|
672
695
|
static SCHEMA: z.ZodObject<{
|
|
673
696
|
title: z.ZodOptional<z.ZodString>;
|
|
674
697
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -679,8 +702,8 @@ declare class UpdateLabel {
|
|
|
679
702
|
title?: string | undefined;
|
|
680
703
|
description?: string | undefined;
|
|
681
704
|
}>;
|
|
682
|
-
constructor(_transport:
|
|
683
|
-
send({ id, body, request
|
|
705
|
+
constructor(_transport: FetchTransport);
|
|
706
|
+
send({ id, body, request }: Options$9): Promise<UpdateLabelResponse>;
|
|
684
707
|
}
|
|
685
708
|
type UpdateLabelResponsePayload = {
|
|
686
709
|
label: {
|
|
@@ -707,14 +730,14 @@ declare class UpdateLabelResponse {
|
|
|
707
730
|
* @see https://greatdetail.com
|
|
708
731
|
*/
|
|
709
732
|
|
|
710
|
-
interface Options$8
|
|
733
|
+
interface Options$8 {
|
|
711
734
|
id: string;
|
|
712
735
|
request?: RequestInit;
|
|
713
736
|
}
|
|
714
737
|
declare class ListConversationMessages {
|
|
715
|
-
protected _transport:
|
|
716
|
-
constructor(_transport:
|
|
717
|
-
send({ id, request
|
|
738
|
+
protected _transport: FetchTransport;
|
|
739
|
+
constructor(_transport: FetchTransport);
|
|
740
|
+
send({ id, request }: Options$8): Promise<ListConversationMessagesResponse>;
|
|
718
741
|
}
|
|
719
742
|
type ListConversationMessagesResponsePayload = {
|
|
720
743
|
messages: {
|
|
@@ -750,13 +773,13 @@ declare class ListConversationMessagesResponse {
|
|
|
750
773
|
* @see https://greatdetail.com
|
|
751
774
|
*/
|
|
752
775
|
|
|
753
|
-
interface Options$7
|
|
776
|
+
interface Options$7 {
|
|
754
777
|
request?: RequestInit;
|
|
755
778
|
}
|
|
756
779
|
declare class ListMessages {
|
|
757
|
-
protected _transport:
|
|
758
|
-
constructor(_transport:
|
|
759
|
-
send({ request
|
|
780
|
+
protected _transport: FetchTransport;
|
|
781
|
+
constructor(_transport: FetchTransport);
|
|
782
|
+
send({ request }?: Options$7): Promise<ListMessagesResponse>;
|
|
760
783
|
}
|
|
761
784
|
type ListMessagesResponsePayload = {
|
|
762
785
|
messages: {
|
|
@@ -792,13 +815,13 @@ declare class ListMessagesResponse {
|
|
|
792
815
|
* @see https://greatdetail.com
|
|
793
816
|
*/
|
|
794
817
|
|
|
795
|
-
interface Options$6
|
|
818
|
+
interface Options$6 {
|
|
796
819
|
id: string;
|
|
797
820
|
body: z.infer<typeof CreateCorrectionModel.SCHEMA>;
|
|
798
821
|
request?: RequestInit;
|
|
799
822
|
}
|
|
800
823
|
declare class CreateCorrectionModel {
|
|
801
|
-
protected _transport:
|
|
824
|
+
protected _transport: FetchTransport;
|
|
802
825
|
static SCHEMA: z.ZodObject<{
|
|
803
826
|
input: z.ZodString;
|
|
804
827
|
original: z.ZodString;
|
|
@@ -812,8 +835,8 @@ declare class CreateCorrectionModel {
|
|
|
812
835
|
original: string;
|
|
813
836
|
correction: string;
|
|
814
837
|
}>;
|
|
815
|
-
constructor(_transport:
|
|
816
|
-
send({ id, body, request
|
|
838
|
+
constructor(_transport: FetchTransport);
|
|
839
|
+
send({ id, body, request }: Options$6): Promise<CreateCorrectionModelResponse>;
|
|
817
840
|
}
|
|
818
841
|
type CreateCorrectionResponsePayload = unknown;
|
|
819
842
|
declare class CreateCorrectionModelResponse {
|
|
@@ -831,14 +854,14 @@ declare class CreateCorrectionModelResponse {
|
|
|
831
854
|
* @see https://greatdetail.com
|
|
832
855
|
*/
|
|
833
856
|
|
|
834
|
-
interface Options$5
|
|
857
|
+
interface Options$5 {
|
|
835
858
|
id: string;
|
|
836
859
|
request?: RequestInit;
|
|
837
860
|
}
|
|
838
861
|
declare class GetModel {
|
|
839
|
-
protected _transport:
|
|
840
|
-
constructor(_transport:
|
|
841
|
-
send({ id, request
|
|
862
|
+
protected _transport: FetchTransport;
|
|
863
|
+
constructor(_transport: FetchTransport);
|
|
864
|
+
send({ id, request }: Options$5): Promise<GetModelResponse>;
|
|
842
865
|
}
|
|
843
866
|
type GetModelResponsePayload = {
|
|
844
867
|
model: {
|
|
@@ -864,13 +887,13 @@ declare class GetModelResponse {
|
|
|
864
887
|
* @see https://greatdetail.com
|
|
865
888
|
*/
|
|
866
889
|
|
|
867
|
-
interface Options$4
|
|
890
|
+
interface Options$4 {
|
|
868
891
|
request?: RequestInit;
|
|
869
892
|
}
|
|
870
893
|
declare class ListModels {
|
|
871
|
-
protected _transport:
|
|
872
|
-
constructor(_transport:
|
|
873
|
-
send({ request
|
|
894
|
+
protected _transport: FetchTransport;
|
|
895
|
+
constructor(_transport: FetchTransport);
|
|
896
|
+
send({ request }?: Options$4): Promise<ListModelsResponse>;
|
|
874
897
|
}
|
|
875
898
|
type ListModelsResponsePayload = {
|
|
876
899
|
models: {
|
|
@@ -896,13 +919,13 @@ declare class ListModelsResponse {
|
|
|
896
919
|
* @see https://greatdetail.com
|
|
897
920
|
*/
|
|
898
921
|
|
|
899
|
-
interface Options$3
|
|
922
|
+
interface Options$3 {
|
|
900
923
|
id: string;
|
|
901
924
|
body: z.infer<typeof CreateResponseModel.SCHEMA>;
|
|
902
925
|
request?: RequestInit;
|
|
903
926
|
}
|
|
904
927
|
declare class CreateResponseModel {
|
|
905
|
-
protected _transport:
|
|
928
|
+
protected _transport: FetchTransport;
|
|
906
929
|
static SCHEMA: z.ZodArray<z.ZodObject<{
|
|
907
930
|
role: z.ZodEnum<["user", "assistant"]>;
|
|
908
931
|
content: z.ZodNullable<z.ZodString>;
|
|
@@ -913,8 +936,8 @@ declare class CreateResponseModel {
|
|
|
913
936
|
role: "user" | "assistant";
|
|
914
937
|
content: string | null;
|
|
915
938
|
}>, "many">;
|
|
916
|
-
constructor(_transport:
|
|
917
|
-
send({ id, body, request
|
|
939
|
+
constructor(_transport: FetchTransport);
|
|
940
|
+
send({ id, body, request }: Options$3): Promise<CreateResponseModelResponse>;
|
|
918
941
|
}
|
|
919
942
|
type CreateResponseResponsePayload = {
|
|
920
943
|
message: string | null;
|
|
@@ -938,14 +961,14 @@ declare class CreateResponseModelResponse {
|
|
|
938
961
|
* @see https://greatdetail.com
|
|
939
962
|
*/
|
|
940
963
|
|
|
941
|
-
interface Options$2
|
|
964
|
+
interface Options$2 {
|
|
942
965
|
id: string;
|
|
943
966
|
request?: RequestInit;
|
|
944
967
|
}
|
|
945
968
|
declare class GetSource {
|
|
946
|
-
protected _transport:
|
|
947
|
-
constructor(_transport:
|
|
948
|
-
send({ id, request
|
|
969
|
+
protected _transport: FetchTransport;
|
|
970
|
+
constructor(_transport: FetchTransport);
|
|
971
|
+
send({ id, request }: Options$2): Promise<GetSourceResponse>;
|
|
949
972
|
}
|
|
950
973
|
type GetSourceResponsePayload = {
|
|
951
974
|
source: {
|
|
@@ -972,13 +995,13 @@ declare class GetSourceResponse {
|
|
|
972
995
|
* @see https://greatdetail.com
|
|
973
996
|
*/
|
|
974
997
|
|
|
975
|
-
interface Options$1
|
|
998
|
+
interface Options$1 {
|
|
976
999
|
request?: RequestInit;
|
|
977
1000
|
}
|
|
978
1001
|
declare class ListSources {
|
|
979
|
-
protected _transport:
|
|
980
|
-
constructor(_transport:
|
|
981
|
-
send({ request
|
|
1002
|
+
protected _transport: FetchTransport;
|
|
1003
|
+
constructor(_transport: FetchTransport);
|
|
1004
|
+
send({ request }?: Options$1): Promise<ListSourcesResponse>;
|
|
982
1005
|
}
|
|
983
1006
|
type ListSourcesResponsePayload = {
|
|
984
1007
|
sources: {
|
|
@@ -1010,7 +1033,7 @@ interface Options {
|
|
|
1010
1033
|
}
|
|
1011
1034
|
declare class Client {
|
|
1012
1035
|
static DEFAULT_BASE_URL: string;
|
|
1013
|
-
_transport:
|
|
1036
|
+
_transport: FetchTransport;
|
|
1014
1037
|
constructor(authentication: Authentication, { baseURL, ...options }?: Options);
|
|
1015
1038
|
static getBaseURL(): string;
|
|
1016
1039
|
get action(): {
|
|
@@ -1025,7 +1048,7 @@ declare class Client {
|
|
|
1025
1048
|
update: UpdateContact;
|
|
1026
1049
|
create: CreateContact;
|
|
1027
1050
|
vcf: {
|
|
1028
|
-
|
|
1051
|
+
get: GetContactVCFURL;
|
|
1029
1052
|
};
|
|
1030
1053
|
};
|
|
1031
1054
|
get conversation(): {
|
|
@@ -1068,4 +1091,4 @@ declare class Client {
|
|
|
1068
1091
|
};
|
|
1069
1092
|
}
|
|
1070
1093
|
|
|
1071
|
-
export { type Authentication as A, Client as C, type DeleteLabelResponsePayload as D, type GetContactResponsePayload as G, type ListActionsResponsePayload as L, type Options as O, type RequestFilterable as R, type
|
|
1094
|
+
export { type Authentication as A, Client as C, type DeleteLabelResponsePayload as D, type GetContactResponsePayload as G, type ListActionsResponsePayload as L, type Options as O, type RequestFilterable as R, type UpdateContactResponsePayload as U, type Options$r as a, type ListChannelsResponsePayload as b, type ListContactsResponsePayload as c, type ListLabelContactsResponsePayload as d, type CreateContactResponsePayload as e, type GetConversationResponsePayload as f, type ListConversationsResponsePayload as g, type ListLabelConversationsResponsePayload as h, type UpdateConversationResponsePayload as i, type CreateLabelResponsePayload as j, type GetLabelResponsePayload as k, type ListLabelsResponsePayload as l, type UpdateLabelResponsePayload as m, type ListConversationMessagesResponsePayload as n, type ListMessagesResponsePayload as o, type GetModelResponsePayload as p, type ListModelsResponsePayload as q, type CreateCorrectionResponsePayload as r, type CreateResponseResponsePayload as s, type GetSourceResponsePayload as t, type ListSourcesResponsePayload as u };
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var V=Object.defineProperty;var At=Object.getOwnPropertyDescriptor;var St=Object.getOwnPropertyNames;var Ot=Object.prototype.hasOwnProperty;var Pt=(e,t)=>{for(var s in t)V(e,s,{get:t[s],enumerable:!0})},_t=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of St(t))!Ot.call(e,r)&&r!==s&&V(e,r,{get:()=>t[r],enumerable:!(n=At(t,r))||n.enumerable});return e};var Ct=e=>_t(V({},"__esModule",{value:!0}),e);var Tt={};Pt(Tt,{Client:()=>a,DEFAULT_SUPPORT_BASE_URL:()=>z,KeyAuthentication:()=>H,PublicAuthentication:()=>F,TokenAuthentication:()=>G,default:()=>a});module.exports=Ct(Tt);var z="https://api.support.greatdetail.com",ft={"X-Powered-By":"GDSupport/JavaScript"},ht="api-key",bt="SUPPORT_ACCESS_TOKEN",Rt="SUPPORT_API_KEY",xt="SUPPORT_KEY_NAME";var p=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/actions",{...t,method:"GET"},s).then(n=>new B(n))}},B=class{constructor(t){this.response=t}async result(){return this.response.json()}};var c=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/channels",{...t,method:"GET"},s).then(n=>new J(n))}},J=class{constructor(t){this.response=t}async result(){return this.response.json()}};var d=class{constructor(t){this._transport=t}getURL({id:t,vcf:s={variant:"vcard",format:"vcf"}}){let n=this._transport.getURL("v1/contacts/"+encodeURIComponent(t)+"/vcf");return n.searchParams.set("variant",s.variant),n.searchParams.set("format",s.format??(s.variant==="vcard"?"vcf":"json")),n}};var i=require("zod"),l=class e{constructor(t){this._transport=t}static SCHEMA=i.z.object({name:i.z.string(),account:i.z.string(),emailAddress:i.z.string().email().optional(),telephoneNumber:i.z.string().optional()});async send({body:t,request:s={},...n}){return this._transport.send("v1/contacts",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))},n).then(r=>new k(r))}},k=class{constructor(t){this.response=t}async result(){return this.response.json()}};var u=class{constructor(t){this._transport=t}async send({id:t,request:s={},...n}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new Y(r))}},Y=class{constructor(t){this.response=t}async result(){return this.response.json()}};var m=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/contacts",{...t,method:"GET"},s).then(n=>new $(n))}},$=class{constructor(t){this.response=t}async result(){return this.response.json()}};var g=class{constructor(t){this._transport=t}async send({id:t,request:s={},...n}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...s,method:"GET"},n).then(r=>new W(r))}},W=class{constructor(t){this.response=t}async result(){return this.response.json()}};var y=require("zod"),f=class e{constructor(t){this._transport=t}static SCHEMA=y.z.object({name:y.z.string().optional(),emailAddress:y.z.string().email().optional(),telephoneNumber:y.z.string().optional()});async send({id:t,body:s,request:n={},...r}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))},r).then(o=>new X(o))}},X=class{constructor(t){this.response=t}async result(){return this.response.json()}};var h=class{constructor(t){this._transport=t}async send({id:t,request:s={},...n}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new Q(r))}},Q=class{constructor(t){this.response=t}async result(){return this.response.json()}};var b=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/conversations",{...t,method:"GET"},s).then(n=>new Z(n))}},Z=class{constructor(t){this.response=t}async result(){return this.response.json()}};var R=class{constructor(t){this._transport=t}async send({id:t,request:s={},...n}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...s,method:"GET"},n).then(r=>new tt(r))}},tt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var et=require("zod"),x=class e{constructor(t){this._transport=t}static SCHEMA=et.z.object({hasEnded:et.z.boolean()});async send({id:t,body:s,request:n={},...r}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))},r).then(o=>new st(o))}},st=class{constructor(t){this.response=t}async result(){return this.response.json()}};var A=require("zod"),S=class e{constructor(t){this._transport=t}static SCHEMA=A.z.object({title:A.z.string(),description:A.z.string().optional(),account:A.z.string()});async send({body:t,request:s={},...n}){return this._transport.send("v1/labels",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))},n).then(r=>new nt(r))}},nt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var O=class{constructor(t){this._transport=t}async send({id:t,request:s={},...n}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"DELETE"},n).then(r=>new rt(r))}},rt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var P=class{constructor(t){this._transport=t}async send({id:t,request:s={},...n}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new ot(r))}},ot=class{constructor(t){this.response=t}async result(){return this.response.json()}};var _=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/labels",{...t,method:"GET"},s).then(n=>new it(n))}},it=class{constructor(t){this.response=t}async result(){return this.response.json()}};var K=require("zod"),C=class e{constructor(t){this._transport=t}static SCHEMA=K.z.object({title:K.z.string().optional(),description:K.z.string().optional()});async send({id:t,body:s,request:n={},...r}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))},r).then(o=>new at(o))}},at=class{constructor(t){this.response=t}async result(){return this.response.json()}};var T=class{constructor(t){this._transport=t}async send({id:t,request:s={},...n}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...s,method:"GET"},n).then(r=>new pt(r))}},pt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var E=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/messages",{...t,method:"GET"},s).then(n=>new ct(n))}},ct=class{constructor(t){this.response=t}async result(){return this.response.json()}};var v=require("zod"),w=class e{constructor(t){this._transport=t}static SCHEMA=v.z.object({input:v.z.string().max(65536),original:v.z.string().max(65536),correction:v.z.string().max(65536)});async send({id:t,body:s,request:n={},...r}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))},r).then(o=>new dt(o))}},dt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var L=class{constructor(t){this._transport=t}async send({id:t,request:s={},...n}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new lt(r))}},lt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var U=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/models",{...t,method:"GET"},s).then(n=>new ut(n))}},ut=class{constructor(t){this.response=t}async result(){return this.response.json()}};var I=require("zod"),q=class e{constructor(t){this._transport=t}static SCHEMA=I.z.array(I.z.object({role:I.z.enum(["user","assistant"]),content:I.z.string().max(65536).nullable()})).min(1);async send({id:t,body:s,request:n={},...r}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))},r).then(o=>new mt(o))}},mt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var j=class e{constructor(t=e.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=ft;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var N=class{constructor(t){this._transport=t}async send({id:t,request:s={},...n}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new gt(r))}},gt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var M=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/sources",{...t,method:"GET"},s).then(n=>new yt(n))}},yt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var D=class{options;constructor({baseURL:t,...s}){this.options={...s,baseURL:t}}async _filterRequest(t){for(let s of this.options.requestFilterables)t=await s.filter(t);return t}getURL(t){return new URL(t,this.options.baseURL)}async send(t,s,{fetch:n=fetch}={}){return await n(new Request(this.getURL(t),await this._filterRequest(s)))}};var a=class e{static DEFAULT_BASE_URL=z;_transport;constructor(t,{baseURL:s,...n}={}){this._transport=new D({requestFilterables:[new j,t],...n,baseURL:s?.toString()??e.getBaseURL()})}static getBaseURL(){return process.env.SUPPORT_BASE_URL??this.DEFAULT_BASE_URL}get action(){return{list:new p(this._transport)}}get channel(){return{list:new c(this._transport)}}get contact(){return{get:new u(this._transport),list:new m(this._transport),update:new f(this._transport),create:new l(this._transport),vcf:{getURL:new d(this._transport)}}}get conversation(){return{get:new h(this._transport),list:new b(this._transport),update:new x(this._transport),message:{list:new T(this._transport)}}}get label(){return{create:new S(this._transport),get:new P(this._transport),list:new _(this._transport),update:new C(this._transport),delete:new O(this._transport),contact:{list:new g(this._transport)},conversation:{list:new R(this._transport)}}}get message(){return{list:new E(this._transport)}}get model(){return{get:new L(this._transport),list:new U(this._transport),response:{create:new q(this._transport)},correction:{create:new w(this._transport)}}}get source(){return{get:new N(this._transport),list:new M(this._transport)}}};var H=class e{static DEFAULT_NAME=ht;name;#t;constructor({name:t=process.env[xt]??e.DEFAULT_NAME,key:s=process.env[Rt]}={}){if(!s)throw new Error("API Key option must be specified when using Key Authentication");this.name=t,this.#t=s}async filter(t){return{...t,headers:{...t.headers,Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}}};var G=class{#t;constructor({token:t=process.env[bt]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}async filter(t){return{...t,headers:{...t.headers,Authorization:`Bearer ${this.#t}`}}}};var F=class{async filter(t){return t}};0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,KeyAuthentication,PublicAuthentication,TokenAuthentication});
|
|
1
|
+
"use strict";var qt=Object.create;var Y=Object.defineProperty;var It=Object.getOwnPropertyDescriptor;var jt=Object.getOwnPropertyNames;var Nt=Object.getPrototypeOf,Ht=Object.prototype.hasOwnProperty;var Pt=(e,t)=>{for(var s in t)Y(e,s,{get:t[s],enumerable:!0})},Ct=(e,t,s,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of jt(t))!Ht.call(e,o)&&o!==s&&Y(e,o,{get:()=>t[o],enumerable:!(r=It(t,o))||r.enumerable});return e};var Mt=(e,t,s)=>(s=e!=null?qt(Nt(e)):{},Ct(t||!e||!e.__esModule?Y(s,"default",{value:e,enumerable:!0}):s,e)),Dt=e=>Ct(Y({},"__esModule",{value:!0}),e);var Gt={};Pt(Gt,{Client:()=>d,DEFAULT_SUPPORT_BASE_URL:()=>$,Error:()=>_t,KeyAuthentication:()=>K,PublicAuthentication:()=>J,TokenAuthentication:()=>k,default:()=>d});module.exports=Dt(Gt);var $="https://api.support.greatdetail.com",Et={"X-Powered-By":"GDSupport/JavaScript"},St="api-key";var u=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"}).then(s=>new X(s))}},X=class{constructor(t){this.response=t}async result(){return this.response.json()}};var l=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"}).then(s=>new Q(s))}},Q=class{constructor(t){this.response=t}async result(){return this.response.json()}};var vt="SUPPORT_ACCESS_TOKEN",wt="SUPPORT_API_KEY",Ot="SUPPORT_KEY_NAME",Lt="SUPPORT_BASE_URL";var m=class{constructor(t){this._transport=t}getURL({id:t,vcf:s={}}){let r=s.variant??"vcard",o=s.format??(s.variant==="vcard"?"vcf":"json");return this._transport.getURL("v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(o))}};var p=require("zod"),g=class e{constructor(t){this._transport=t}static SCHEMA=p.z.object({name:p.z.string(),account:p.z.string(),emailAddress:p.z.string().email().optional(),telephoneNumber:p.z.string().optional()});async send({body:t,request:s={}}){return this._transport.send("v1/contacts",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))}).then(r=>new Z(r))}},Z=class{constructor(t){this.response=t}async result(){return this.response.json()}};var h=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new tt(r))}},tt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var f=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/contacts",{...t,method:"GET"}).then(s=>new et(s))}},et=class{constructor(t){this.response=t}async result(){return this.response.json()}};var y=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...s,method:"GET"}).then(r=>new st(r))}},st=class{constructor(t){this.response=t}async result(){return this.response.json()}};var b=require("zod"),R=class e{constructor(t){this._transport=t}static SCHEMA=b.z.object({name:b.z.string().optional(),emailAddress:b.z.string().email().optional(),telephoneNumber:b.z.string().optional()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(o=>new rt(o))}},rt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var x=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new ot(r))}},ot=class{constructor(t){this.response=t}async result(){return this.response.json()}};var A=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/conversations",{...t,method:"GET"}).then(s=>new nt(s))}},nt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var _=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...s,method:"GET"}).then(r=>new it(r))}},it=class{constructor(t){this.response=t}async result(){return this.response.json()}};var at=require("zod"),T=class e{constructor(t){this._transport=t}static SCHEMA=at.z.object({hasEnded:at.z.boolean()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(o=>new pt(o))}},pt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var P=require("zod"),C=class e{constructor(t){this._transport=t}static SCHEMA=P.z.object({title:P.z.string(),description:P.z.string().optional(),account:P.z.string()});async send({body:t,request:s={}}){return this._transport.send("v1/labels",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))}).then(r=>new ct(r))}},ct=class{constructor(t){this.response=t}async result(){return this.response.json()}};var E=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"DELETE"}).then(r=>new dt(r))}},dt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var S=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new ut(r))}},ut=class{constructor(t){this.response=t}async result(){return this.response.json()}};var v=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/labels",{...t,method:"GET"}).then(s=>new lt(s))}},lt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var W=require("zod"),w=class e{constructor(t){this._transport=t}static SCHEMA=W.z.object({title:W.z.string().optional(),description:W.z.string().optional()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(o=>new mt(o))}},mt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var O=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...s,method:"GET"}).then(r=>new gt(r))}},gt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var L=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"}).then(s=>new ht(s))}},ht=class{constructor(t){this.response=t}async result(){return this.response.json()}};var F=require("zod"),U=class e{constructor(t){this._transport=t}static SCHEMA=F.z.object({input:F.z.string().max(65536),original:F.z.string().max(65536),correction:F.z.string().max(65536)});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(o=>new ft(o))}},ft=class{constructor(t){this.response=t}async result(){return this.response.json()}};var q=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new yt(r))}},yt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var I=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"}).then(s=>new bt(s))}},bt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var j=require("zod"),N=class e{constructor(t){this._transport=t}static SCHEMA=j.z.array(j.z.object({role:j.z.enum(["user","assistant"]),content:j.z.string().max(65536).nullable()})).min(1);async send({id:t,body:s,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(o=>new Rt(o))}},Rt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var H=class e{constructor(t=e.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Et;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var M=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new xt(r))}},xt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var D=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/sources",{...t,method:"GET"}).then(s=>new At(s))}},At=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Ft=Mt(require("is-network-error"),1);var n=class extends Error{};var i=class extends n{};var G=class extends i{static unauthenticated(){return new this("An unauthenticated request occurred")}};var V=class extends i{static forbidden(){return new this("A forbidden request occurred")}};var c=class extends n{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,s){return new this(`Forbidden method for request: ${t} ${s}`)}};var a=class extends n{};var z=class extends n{static badRequest(){return new this("Bad request")}};var B=class{options;constructor({baseURL:t,fetch:s=fetch,...r}){this.options={...r,fetch:s,baseURL:t}}getURL(t){return new URL(t,this.options.baseURL).toString()}getRequest(t,s){s.headers=new Headers(s.headers);for(let r of this.options.requestFilterables){let o=r.getHeaders();for(let[Tt,Ut]of Object.entries(o))s.headers.set(Tt,Ut)}return new Request(this.getURL(t),s)}async send(t,s){return await this.options.fetch(this.getRequest(t,s)).then(r=>{if(!r.ok){let o=r.status;switch(console.error(JSON.stringify(r)),o){case 400:throw z.badRequest();case 401:throw G.unauthenticated();case 403:throw V.forbidden();case 404:throw c.notFound(t);case 405:throw c.forbiddenMethod(t,s.method??"GET")}}return r}).catch(r=>{throw(0,Ft.default)(r)?new a("A network error occurred",{cause:r}):r})}};var d=class e{static DEFAULT_BASE_URL=$;_transport;constructor(t,{baseURL:s,...r}={}){this._transport=new B({requestFilterables:[new H,t],...r,baseURL:s?.toString()??e.getBaseURL()})}static getBaseURL(){return process.env[Lt]??this.DEFAULT_BASE_URL}get action(){return{list:new u(this._transport)}}get channel(){return{list:new l(this._transport)}}get contact(){return{get:new h(this._transport),list:new f(this._transport),update:new R(this._transport),create:new g(this._transport),vcf:{get:new m(this._transport)}}}get conversation(){return{get:new x(this._transport),list:new A(this._transport),update:new T(this._transport),message:{list:new O(this._transport)}}}get label(){return{create:new C(this._transport),get:new S(this._transport),list:new v(this._transport),update:new w(this._transport),delete:new E(this._transport),contact:{list:new y(this._transport)},conversation:{list:new _(this._transport)}}}get message(){return{list:new L(this._transport)}}get model(){return{get:new q(this._transport),list:new I(this._transport),response:{create:new N(this._transport)},correction:{create:new U(this._transport)}}}get source(){return{get:new M(this._transport),list:new D(this._transport)}}};var _t={};Pt(_t,{NetworkError:()=>a,SupportError:()=>n});var K=class e{static DEFAULT_NAME=St;name;#t;constructor({name:t=process.env[Ot]??e.DEFAULT_NAME,key:s=process.env[wt]}={}){if(!s)throw new Error("API Key option must be specified when using Key Authentication");this.name=t,this.#t=s}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var k=class{#t;constructor({token:t=process.env[vt]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var J=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,Error,KeyAuthentication,PublicAuthentication,TokenAuthentication});
|