@great-detail/support-sdk 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,684 @@
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
+ interface RequestFilterable {
12
+ filter(request: RequestInit): Promise<RequestInit>;
13
+ }
14
+
15
+ /**
16
+ * Great Detail Support System.
17
+ *
18
+ * @copyright 2024 Great Detail Ltd
19
+ * @author Great Detail Ltd <info@greatdetail.com>
20
+ * @author Dom Webber <dom.webber@greatdetail.com>
21
+ * @see https://greatdetail.com
22
+ */
23
+
24
+ interface Authentication extends RequestFilterable {
25
+ }
26
+
27
+ /**
28
+ * Great Detail Support System.
29
+ *
30
+ * @copyright 2024 Great Detail Ltd
31
+ * @author Great Detail Ltd <info@greatdetail.com>
32
+ * @author Dom Webber <dom.webber@greatdetail.com>
33
+ * @see https://greatdetail.com
34
+ */
35
+
36
+ interface Options$f extends SendOptions {
37
+ request?: RequestInit;
38
+ }
39
+ declare class ListActionsRequest {
40
+ protected _client: Client;
41
+ constructor(_client: Client);
42
+ send({ request, ...options }?: Options$f): Promise<ListActionsResponse>;
43
+ }
44
+ type ListActionsResponsePayload = {
45
+ actions: {
46
+ id: string;
47
+ actionStatus: string;
48
+ message: string;
49
+ name: string;
50
+ object?: string;
51
+ result?: string;
52
+ startedAt?: string;
53
+ endedAt?: string;
54
+ createdAt: string;
55
+ updatedAt?: string;
56
+ }[];
57
+ };
58
+ declare class ListActionsResponse {
59
+ response: Response;
60
+ constructor(response: Response);
61
+ result(): Promise<ListActionsResponsePayload>;
62
+ }
63
+
64
+ /**
65
+ * Great Detail Support System.
66
+ *
67
+ * @copyright 2024 Great Detail Ltd
68
+ * @author Great Detail Ltd <info@greatdetail.com>
69
+ * @author Dom Webber <dom.webber@greatdetail.com>
70
+ * @see https://greatdetail.com
71
+ */
72
+
73
+ interface Options$e extends SendOptions {
74
+ request?: RequestInit;
75
+ }
76
+ declare class ListChannelsRequest {
77
+ protected _client: Client;
78
+ constructor(_client: Client);
79
+ send({ request, ...options }?: Options$e): Promise<ListChannelsResponse>;
80
+ }
81
+ type ListChannelsResponsePayload = {
82
+ channels: ({
83
+ id: string;
84
+ name?: string;
85
+ channelStatus: "ActiveChannelStatus" | "PotentialChannelStatus";
86
+ account: string;
87
+ createdAt: string;
88
+ updatedAt?: string;
89
+ } & ({
90
+ source: "meta-whatsapp";
91
+ metaWhatsapp: {
92
+ id: string;
93
+ whatsappAccountID: string;
94
+ whatsappPhoneNumberID: string;
95
+ accessToken: string;
96
+ };
97
+ } | {
98
+ source: "twilio-sendgrid";
99
+ twilioSendgrid: {
100
+ id: string;
101
+ apiKey: string;
102
+ };
103
+ }))[];
104
+ };
105
+ declare class ListChannelsResponse {
106
+ response: Response;
107
+ constructor(response: Response);
108
+ result(): Promise<ListChannelsResponsePayload>;
109
+ }
110
+
111
+ /**
112
+ * Great Detail Support System.
113
+ *
114
+ * @copyright 2024 Great Detail Ltd
115
+ * @author Great Detail Ltd <info@greatdetail.com>
116
+ * @author Dom Webber <dom.webber@greatdetail.com>
117
+ * @see https://greatdetail.com
118
+ */
119
+
120
+ interface Options$d extends SendOptions {
121
+ id: string;
122
+ request?: RequestInit;
123
+ }
124
+ declare class GetContactRequest {
125
+ protected _client: Client;
126
+ constructor(_client: Client);
127
+ send({ id, request, ...options }: Options$d): Promise<GetContactResponse>;
128
+ }
129
+ type GetContactResponsePayload = {
130
+ contact: {
131
+ id: string;
132
+ name?: string;
133
+ emailAddress?: string;
134
+ telephoneNumber?: string;
135
+ account: string;
136
+ createdAt: string;
137
+ updatedAt?: string;
138
+ };
139
+ };
140
+ declare class GetContactResponse {
141
+ response: Response;
142
+ constructor(response: Response);
143
+ result(): Promise<GetContactResponsePayload>;
144
+ }
145
+
146
+ /**
147
+ * Great Detail Support System.
148
+ *
149
+ * @copyright 2024 Great Detail Ltd
150
+ * @author Great Detail Ltd <info@greatdetail.com>
151
+ * @author Dom Webber <dom.webber@greatdetail.com>
152
+ * @see https://greatdetail.com
153
+ */
154
+
155
+ interface Options$c extends SendOptions {
156
+ request?: RequestInit;
157
+ }
158
+ declare class ListContactsRequest {
159
+ protected _client: Client;
160
+ constructor(_client: Client);
161
+ send({ request, ...options }?: Options$c): Promise<ListContactsResponse>;
162
+ }
163
+ type ListContactsResponsePayload = {
164
+ contacts: {
165
+ id: string;
166
+ name?: string;
167
+ emailAddress?: string;
168
+ telephoneNumber?: string;
169
+ account: string;
170
+ createdAt: string;
171
+ updatedAt?: string;
172
+ }[];
173
+ };
174
+ declare class ListContactsResponse {
175
+ response: Response;
176
+ constructor(response: Response);
177
+ result(): Promise<ListContactsResponsePayload>;
178
+ }
179
+
180
+ /**
181
+ * Great Detail Support System.
182
+ *
183
+ * @copyright 2024 Great Detail Ltd
184
+ * @author Great Detail Ltd <info@greatdetail.com>
185
+ * @author Dom Webber <dom.webber@greatdetail.com>
186
+ * @see https://greatdetail.com
187
+ */
188
+
189
+ interface Options$b extends SendOptions {
190
+ id: string;
191
+ request?: RequestInit;
192
+ }
193
+ declare class GetConversationRequest {
194
+ protected _client: Client;
195
+ constructor(_client: Client);
196
+ send({ id, request, ...options }: Options$b): Promise<GetConversationResponse>;
197
+ }
198
+ type GetConversationResponsePayload = {
199
+ conversation: {
200
+ id: string;
201
+ hasEnded: boolean;
202
+ accountChannel: string;
203
+ createdAt: string;
204
+ updatedAt: string;
205
+ };
206
+ };
207
+ declare class GetConversationResponse {
208
+ response: Response;
209
+ constructor(response: Response);
210
+ result(): Promise<GetConversationResponsePayload>;
211
+ }
212
+
213
+ /**
214
+ * Great Detail Support System.
215
+ *
216
+ * @copyright 2024 Great Detail Ltd
217
+ * @author Great Detail Ltd <info@greatdetail.com>
218
+ * @author Dom Webber <dom.webber@greatdetail.com>
219
+ * @see https://greatdetail.com
220
+ */
221
+
222
+ interface Options$a extends SendOptions {
223
+ request?: RequestInit;
224
+ }
225
+ declare class ListConversationsRequest {
226
+ protected _client: Client;
227
+ constructor(_client: Client);
228
+ send({ request, ...options }?: Options$a): Promise<ListConversationsResponse>;
229
+ }
230
+ type ListConversationsResponsePayload = {
231
+ conversations: {
232
+ id: string;
233
+ hasEnded: boolean;
234
+ accountChannel: string;
235
+ createdAt: string;
236
+ updatedAt: string;
237
+ }[];
238
+ };
239
+ declare class ListConversationsResponse {
240
+ response: Response;
241
+ constructor(response: Response);
242
+ result(): Promise<ListConversationsResponsePayload>;
243
+ }
244
+
245
+ /**
246
+ * Great Detail Support System.
247
+ *
248
+ * @copyright 2024 Great Detail Ltd
249
+ * @author Great Detail Ltd <info@greatdetail.com>
250
+ * @author Dom Webber <dom.webber@greatdetail.com>
251
+ * @see https://greatdetail.com
252
+ */
253
+
254
+ interface Options$9 extends SendOptions {
255
+ body: z.infer<typeof CreateLabelRequest.SCHEMA>;
256
+ request?: RequestInit;
257
+ }
258
+ declare class CreateLabelRequest {
259
+ protected _client: Client;
260
+ static SCHEMA: z.ZodObject<{
261
+ title: z.ZodString;
262
+ description: z.ZodOptional<z.ZodString>;
263
+ account: z.ZodString;
264
+ }, "strip", z.ZodTypeAny, {
265
+ title: string;
266
+ account: string;
267
+ description?: string | undefined;
268
+ }, {
269
+ title: string;
270
+ account: string;
271
+ description?: string | undefined;
272
+ }>;
273
+ constructor(_client: Client);
274
+ send({ body, request, ...options }: Options$9): Promise<CreateLabelResponse>;
275
+ }
276
+ type CreateLabelResponsePayload = {
277
+ label: {
278
+ id: string;
279
+ title: string;
280
+ description?: string;
281
+ account: string;
282
+ createdAt: string;
283
+ updatedAt?: string;
284
+ };
285
+ };
286
+ declare class CreateLabelResponse {
287
+ response: Response;
288
+ constructor(response: Response);
289
+ result(): Promise<CreateLabelResponsePayload>;
290
+ }
291
+
292
+ /**
293
+ * Great Detail Support System.
294
+ *
295
+ * @copyright 2024 Great Detail Ltd
296
+ * @author Great Detail Ltd <info@greatdetail.com>
297
+ * @author Dom Webber <dom.webber@greatdetail.com>
298
+ * @see https://greatdetail.com
299
+ */
300
+
301
+ interface Options$8 extends SendOptions {
302
+ id: string;
303
+ request?: RequestInit;
304
+ }
305
+ declare class GetLabelRequest {
306
+ protected _client: Client;
307
+ constructor(_client: Client);
308
+ send({ id, request, ...options }: Options$8): Promise<GetLabelResponse>;
309
+ }
310
+ type GetLabelResponsePayload = {
311
+ label: {
312
+ id: string;
313
+ title: string;
314
+ description?: string;
315
+ account: string;
316
+ createdAt: string;
317
+ updatedAt?: string;
318
+ };
319
+ };
320
+ declare class GetLabelResponse {
321
+ response: Response;
322
+ constructor(response: Response);
323
+ result(): Promise<GetLabelResponsePayload>;
324
+ }
325
+
326
+ /**
327
+ * Great Detail Support System.
328
+ *
329
+ * @copyright 2024 Great Detail Ltd
330
+ * @author Great Detail Ltd <info@greatdetail.com>
331
+ * @author Dom Webber <dom.webber@greatdetail.com>
332
+ * @see https://greatdetail.com
333
+ */
334
+
335
+ interface Options$7 extends SendOptions {
336
+ request?: RequestInit;
337
+ }
338
+ declare class ListLabelsRequest {
339
+ protected _client: Client;
340
+ constructor(_client: Client);
341
+ send({ request, ...options }?: Options$7): Promise<ListLabelsResponse>;
342
+ }
343
+ type ListLabelsResponsePayload = {
344
+ labels: {
345
+ id: string;
346
+ title: string;
347
+ description?: string;
348
+ account: string;
349
+ createdAt: string;
350
+ updatedAt?: string;
351
+ }[];
352
+ };
353
+ declare class ListLabelsResponse {
354
+ response: Response;
355
+ constructor(response: Response);
356
+ result(): Promise<ListLabelsResponsePayload>;
357
+ }
358
+
359
+ /**
360
+ * Great Detail Support System.
361
+ *
362
+ * @copyright 2024 Great Detail Ltd
363
+ * @author Great Detail Ltd <info@greatdetail.com>
364
+ * @author Dom Webber <dom.webber@greatdetail.com>
365
+ * @see https://greatdetail.com
366
+ */
367
+
368
+ interface Options$6 extends SendOptions {
369
+ request?: RequestInit;
370
+ }
371
+ declare class ListMessagesRequest {
372
+ protected _client: Client;
373
+ constructor(_client: Client);
374
+ send({ request, ...options }?: Options$6): Promise<ListMessagesResponse>;
375
+ }
376
+ type ListMessagesResponsePayload = {
377
+ messages: {
378
+ id: string;
379
+ role: "user" | "assistant";
380
+ messageStatus: string;
381
+ externalIdentifier?: string;
382
+ conversation: string;
383
+ contact: string;
384
+ messageEvents: {
385
+ id: string;
386
+ messageEventType: string;
387
+ triggeredAt: string;
388
+ createdAt: string;
389
+ updatedAt?: string;
390
+ }[];
391
+ createdAt: string;
392
+ updatedAt: string;
393
+ }[];
394
+ };
395
+ declare class ListMessagesResponse {
396
+ response: Response;
397
+ constructor(response: Response);
398
+ result(): Promise<ListMessagesResponsePayload>;
399
+ }
400
+
401
+ /**
402
+ * Great Detail Support System.
403
+ *
404
+ * @copyright 2024 Great Detail Ltd
405
+ * @author Great Detail Ltd <info@greatdetail.com>
406
+ * @author Dom Webber <dom.webber@greatdetail.com>
407
+ * @see https://greatdetail.com
408
+ */
409
+
410
+ interface Options$5 extends SendOptions {
411
+ id: string;
412
+ body: z.infer<typeof CreateCorrectionModelRequest.SCHEMA>;
413
+ request?: RequestInit;
414
+ }
415
+ declare class CreateCorrectionModelRequest {
416
+ protected _client: Client;
417
+ static SCHEMA: z.ZodObject<{
418
+ input: z.ZodString;
419
+ original: z.ZodString;
420
+ correction: z.ZodString;
421
+ }, "strip", z.ZodTypeAny, {
422
+ input: string;
423
+ original: string;
424
+ correction: string;
425
+ }, {
426
+ input: string;
427
+ original: string;
428
+ correction: string;
429
+ }>;
430
+ constructor(_client: Client);
431
+ send({ id, body, request, ...options }: Options$5): Promise<CreateCorrectionModelResponse>;
432
+ }
433
+ type CreateCorrectionResponsePayload = unknown;
434
+ declare class CreateCorrectionModelResponse {
435
+ response: Response;
436
+ constructor(response: Response);
437
+ result(): Promise<CreateCorrectionResponsePayload>;
438
+ }
439
+
440
+ /**
441
+ * Great Detail Support System.
442
+ *
443
+ * @copyright 2024 Great Detail Ltd
444
+ * @author Great Detail Ltd <info@greatdetail.com>
445
+ * @author Dom Webber <dom.webber@greatdetail.com>
446
+ * @see https://greatdetail.com
447
+ */
448
+
449
+ interface Options$4 extends SendOptions {
450
+ id: string;
451
+ request?: RequestInit;
452
+ }
453
+ declare class GetModelRequest {
454
+ protected _client: Client;
455
+ constructor(_client: Client);
456
+ send({ id, request, ...options }: Options$4): Promise<GetModelResponse>;
457
+ }
458
+ type GetModelResponsePayload = {
459
+ model: {
460
+ id: string;
461
+ name: string;
462
+ url?: string;
463
+ icon?: string;
464
+ disambiguatingDescription: string;
465
+ };
466
+ };
467
+ declare class GetModelResponse {
468
+ response: Response;
469
+ constructor(response: Response);
470
+ result(): Promise<GetModelResponsePayload>;
471
+ }
472
+
473
+ /**
474
+ * Great Detail Support System.
475
+ *
476
+ * @copyright 2024 Great Detail Ltd
477
+ * @author Great Detail Ltd <info@greatdetail.com>
478
+ * @author Dom Webber <dom.webber@greatdetail.com>
479
+ * @see https://greatdetail.com
480
+ */
481
+
482
+ interface Options$3 extends SendOptions {
483
+ request?: RequestInit;
484
+ }
485
+ declare class ListModelsRequest {
486
+ protected _client: Client;
487
+ constructor(_client: Client);
488
+ send({ request, ...options }?: Options$3): Promise<ListModelsResponse>;
489
+ }
490
+ type ListModelsResponsePayload = {
491
+ models: {
492
+ id: string;
493
+ name: string;
494
+ url?: string;
495
+ icon?: string;
496
+ disambiguatingDescription: string;
497
+ }[];
498
+ };
499
+ declare class ListModelsResponse {
500
+ response: Response;
501
+ constructor(response: Response);
502
+ result(): Promise<ListModelsResponsePayload>;
503
+ }
504
+
505
+ /**
506
+ * Great Detail Support System.
507
+ *
508
+ * @copyright 2024 Great Detail Ltd
509
+ * @author Great Detail Ltd <info@greatdetail.com>
510
+ * @author Dom Webber <dom.webber@greatdetail.com>
511
+ * @see https://greatdetail.com
512
+ */
513
+
514
+ interface Options$2 extends SendOptions {
515
+ id: string;
516
+ body: z.infer<typeof CreateResponseModelRequest.SCHEMA>;
517
+ request?: RequestInit;
518
+ }
519
+ declare class CreateResponseModelRequest {
520
+ protected _client: Client;
521
+ static SCHEMA: z.ZodArray<z.ZodObject<{
522
+ role: z.ZodEnum<["user", "assistant"]>;
523
+ content: z.ZodNullable<z.ZodString>;
524
+ }, "strip", z.ZodTypeAny, {
525
+ role: "user" | "assistant";
526
+ content: string | null;
527
+ }, {
528
+ role: "user" | "assistant";
529
+ content: string | null;
530
+ }>, "many">;
531
+ constructor(_client: Client);
532
+ send({ id, body, request, ...options }: Options$2): Promise<CreateResponseModelResponse>;
533
+ }
534
+ type CreateResponseResponsePayload = {
535
+ message: string | null;
536
+ debug: {
537
+ duration: string;
538
+ sources: (string | undefined)[];
539
+ };
540
+ };
541
+ declare class CreateResponseModelResponse {
542
+ response: Response;
543
+ constructor(response: Response);
544
+ result(): Promise<CreateResponseResponsePayload>;
545
+ }
546
+
547
+ /**
548
+ * Great Detail Support System.
549
+ *
550
+ * @copyright 2024 Great Detail Ltd
551
+ * @author Great Detail Ltd <info@greatdetail.com>
552
+ * @author Dom Webber <dom.webber@greatdetail.com>
553
+ * @see https://greatdetail.com
554
+ */
555
+
556
+ interface Options$1 extends SendOptions {
557
+ id: string;
558
+ request?: RequestInit;
559
+ }
560
+ declare class GetSourceRequest {
561
+ protected _client: Client;
562
+ constructor(_client: Client);
563
+ send({ id, request, ...options }: Options$1): Promise<GetSourceResponse>;
564
+ }
565
+ type GetSourceResponsePayload = {
566
+ source: {
567
+ id: string;
568
+ name: string;
569
+ category: string;
570
+ url?: string;
571
+ icon?: string;
572
+ disambiguatingDescription: string;
573
+ };
574
+ };
575
+ declare class GetSourceResponse {
576
+ response: Response;
577
+ constructor(response: Response);
578
+ result(): Promise<GetSourceResponsePayload>;
579
+ }
580
+
581
+ /**
582
+ * Great Detail Support System.
583
+ *
584
+ * @copyright 2024 Great Detail Ltd
585
+ * @author Great Detail Ltd <info@greatdetail.com>
586
+ * @author Dom Webber <dom.webber@greatdetail.com>
587
+ * @see https://greatdetail.com
588
+ */
589
+
590
+ interface Options extends SendOptions {
591
+ request?: RequestInit;
592
+ }
593
+ declare class ListSourcesRequest {
594
+ protected _client: Client;
595
+ constructor(_client: Client);
596
+ send({ request, ...options }?: Options): Promise<ListSourcesResponse>;
597
+ }
598
+ type ListSourcesResponsePayload = {
599
+ sources: {
600
+ id: string;
601
+ name: string;
602
+ category: string;
603
+ url?: string;
604
+ icon?: string;
605
+ disambiguatingDescription: string;
606
+ }[];
607
+ };
608
+ declare class ListSourcesResponse {
609
+ response: Response;
610
+ constructor(response: Response);
611
+ result(): Promise<ListSourcesResponsePayload>;
612
+ }
613
+
614
+ /**
615
+ * Great Detail Support System.
616
+ *
617
+ * @copyright 2024 Great Detail Ltd
618
+ * @author Great Detail Ltd <info@greatdetail.com>
619
+ * @author Dom Webber <dom.webber@greatdetail.com>
620
+ * @see https://greatdetail.com
621
+ */
622
+
623
+ interface ClientOptions {
624
+ requestFilterables: RequestFilterable[];
625
+ baseURL: string;
626
+ }
627
+ interface InputClientOptions {
628
+ baseURL?: string;
629
+ }
630
+ interface SendOptions {
631
+ /**
632
+ * Alternative Fetch Provider.
633
+ * Used to override the default fetch provider and use polyfills or other
634
+ * libraries.
635
+ *
636
+ * @since 1.0.0
637
+ */
638
+ fetch?: typeof fetch;
639
+ }
640
+ declare class Client {
641
+ static DEFAULT_BASE_URL: string;
642
+ options: ClientOptions;
643
+ constructor(authentication: Authentication, options?: InputClientOptions);
644
+ action: {
645
+ list: ListActionsRequest;
646
+ };
647
+ channel: {
648
+ list: ListChannelsRequest;
649
+ };
650
+ contact: {
651
+ get: GetContactRequest;
652
+ list: ListContactsRequest;
653
+ };
654
+ conversation: {
655
+ get: GetConversationRequest;
656
+ list: ListConversationsRequest;
657
+ };
658
+ label: {
659
+ create: CreateLabelRequest;
660
+ get: GetLabelRequest;
661
+ list: ListLabelsRequest;
662
+ };
663
+ message: {
664
+ list: ListMessagesRequest;
665
+ };
666
+ model: {
667
+ get: GetModelRequest;
668
+ list: ListModelsRequest;
669
+ response: {
670
+ create: CreateResponseModelRequest;
671
+ };
672
+ correction: {
673
+ create: CreateCorrectionModelRequest;
674
+ };
675
+ };
676
+ source: {
677
+ get: GetSourceRequest;
678
+ list: ListSourcesRequest;
679
+ };
680
+ protected _filterRequest(request: RequestInit): Promise<RequestInit>;
681
+ send(url: string | URL, request: RequestInit, { fetch: fetchAlternative }?: SendOptions): Promise<Response>;
682
+ }
683
+
684
+ export { type Authentication as A, Client as C, type GetConversationResponsePayload as G, type ListActionsResponsePayload as L, type RequestFilterable as R, type ListChannelsResponsePayload as a, type ListContactsResponsePayload as b, type ListConversationsResponsePayload as c, type CreateLabelResponsePayload as d, type ListLabelsResponsePayload as e, type ListMessagesResponsePayload as f, type ListModelsResponsePayload as g, type CreateCorrectionResponsePayload as h, type CreateResponseResponsePayload as i, type ListSourcesResponsePayload as j };