@great-detail/support-sdk 0.3.0 → 0.3.2
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-P5VYQSL7.js +1 -0
- package/dist/{chunk-MIIHAFPV.js → chunk-YZZSFAQF.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-ng6eKA5J.d.cts → index-nN1ajzrl.d.cts} +82 -44
- package/dist/{index-ng6eKA5J.d.ts → index-nN1ajzrl.d.ts} +82 -44
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/src/Client/index.ts +6 -2
- package/src/Conversation/ListContactConversations.ts +52 -0
- package/src/Conversation/index.ts +1 -0
- package/dist/chunk-O5KZWMF7.js +0 -1
|
@@ -28,21 +28,21 @@ interface RequestFilterable {
|
|
|
28
28
|
* @see https://greatdetail.com
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
interface Options$
|
|
31
|
+
interface Options$H {
|
|
32
32
|
requestFilterables: RequestFilterable[];
|
|
33
33
|
}
|
|
34
34
|
interface Transport {
|
|
35
35
|
getURL(url: string): string;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
interface InputOptions extends Options$
|
|
38
|
+
interface InputOptions extends Options$H {
|
|
39
39
|
baseURL: string;
|
|
40
40
|
}
|
|
41
|
-
interface Options$
|
|
41
|
+
interface Options$G extends Options$H {
|
|
42
42
|
baseURL: string;
|
|
43
43
|
}
|
|
44
44
|
declare class FetchTransport implements Transport {
|
|
45
|
-
options: Options$
|
|
45
|
+
options: Options$G;
|
|
46
46
|
constructor({ baseURL, ...options }: InputOptions);
|
|
47
47
|
getURL(url: string): string;
|
|
48
48
|
getRequest(url: string, request: RequestInit): Request;
|
|
@@ -58,13 +58,13 @@ declare class FetchTransport implements Transport {
|
|
|
58
58
|
* @see https://greatdetail.com
|
|
59
59
|
*/
|
|
60
60
|
|
|
61
|
-
interface Options$
|
|
61
|
+
interface Options$F {
|
|
62
62
|
request?: RequestInit;
|
|
63
63
|
}
|
|
64
64
|
declare class ListActions {
|
|
65
65
|
protected _transport: FetchTransport;
|
|
66
66
|
constructor(_transport: FetchTransport);
|
|
67
|
-
send({ request }?: Options$
|
|
67
|
+
send({ request }?: Options$F): Promise<ListActionsResponse>;
|
|
68
68
|
}
|
|
69
69
|
type ListActionsResponsePayload = {
|
|
70
70
|
actions: {
|
|
@@ -106,7 +106,7 @@ type Authentication = RequestFilterable;
|
|
|
106
106
|
* @see https://greatdetail.com
|
|
107
107
|
*/
|
|
108
108
|
|
|
109
|
-
interface Options$
|
|
109
|
+
interface Options$E {
|
|
110
110
|
id: string;
|
|
111
111
|
body: z.infer<typeof CreateBoilerplateCategoryBoilerplate.SCHEMA>;
|
|
112
112
|
request?: RequestInit;
|
|
@@ -127,7 +127,7 @@ declare class CreateBoilerplateCategoryBoilerplate {
|
|
|
127
127
|
account: string;
|
|
128
128
|
}>;
|
|
129
129
|
constructor(_transport: FetchTransport);
|
|
130
|
-
send({ id, body, request }: Options$
|
|
130
|
+
send({ id, body, request }: Options$E): Promise<CreateBoilerplateCategoryBoilerplateResponse>;
|
|
131
131
|
}
|
|
132
132
|
type CreateBoilerplateCategoryBoilerplateResponsePayload = {
|
|
133
133
|
boilerplate: {
|
|
@@ -154,14 +154,14 @@ declare class CreateBoilerplateCategoryBoilerplateResponse {
|
|
|
154
154
|
* @see https://greatdetail.com
|
|
155
155
|
*/
|
|
156
156
|
|
|
157
|
-
interface Options$
|
|
157
|
+
interface Options$D {
|
|
158
158
|
id: string;
|
|
159
159
|
request?: RequestInit;
|
|
160
160
|
}
|
|
161
161
|
declare class GetBoilerplate {
|
|
162
162
|
protected _transport: FetchTransport;
|
|
163
163
|
constructor(_transport: FetchTransport);
|
|
164
|
-
send({ id, request }: Options$
|
|
164
|
+
send({ id, request }: Options$D): Promise<GetBoilerplateResponse>;
|
|
165
165
|
}
|
|
166
166
|
type GetBoilerplateResponsePayload = {
|
|
167
167
|
boilerplate: {
|
|
@@ -189,14 +189,14 @@ declare class GetBoilerplateResponse {
|
|
|
189
189
|
* @see https://greatdetail.com
|
|
190
190
|
*/
|
|
191
191
|
|
|
192
|
-
interface Options$
|
|
192
|
+
interface Options$C {
|
|
193
193
|
id: string;
|
|
194
194
|
request?: RequestInit;
|
|
195
195
|
}
|
|
196
196
|
declare class ListBoilerplateCategoryBoilerplates {
|
|
197
197
|
protected _transport: FetchTransport;
|
|
198
198
|
constructor(_transport: FetchTransport);
|
|
199
|
-
send({ id, request }: Options$
|
|
199
|
+
send({ id, request }: Options$C): Promise<ListBoilerplateCategoryBoilerplatesResponse>;
|
|
200
200
|
}
|
|
201
201
|
type ListBoilerplateCategoryBoilerplatesResponsePayload = {
|
|
202
202
|
boilerplates: {
|
|
@@ -224,13 +224,13 @@ declare class ListBoilerplateCategoryBoilerplatesResponse {
|
|
|
224
224
|
* @see https://greatdetail.com
|
|
225
225
|
*/
|
|
226
226
|
|
|
227
|
-
interface Options$
|
|
227
|
+
interface Options$B {
|
|
228
228
|
request?: RequestInit;
|
|
229
229
|
}
|
|
230
230
|
declare class ListBoilerplates {
|
|
231
231
|
protected _transport: FetchTransport;
|
|
232
232
|
constructor(_transport: FetchTransport);
|
|
233
|
-
send({ request }?: Options$
|
|
233
|
+
send({ request }?: Options$B): Promise<ListBoilerplatesResponse>;
|
|
234
234
|
}
|
|
235
235
|
type ListBoilerplatesResponsePayload = {
|
|
236
236
|
boilerplates: {
|
|
@@ -258,7 +258,7 @@ declare class ListBoilerplatesResponse {
|
|
|
258
258
|
* @see https://greatdetail.com
|
|
259
259
|
*/
|
|
260
260
|
|
|
261
|
-
interface Options$
|
|
261
|
+
interface Options$A {
|
|
262
262
|
id: string;
|
|
263
263
|
body: z.infer<typeof UpdateBoilerplate.SCHEMA>;
|
|
264
264
|
request?: RequestInit;
|
|
@@ -276,7 +276,7 @@ declare class UpdateBoilerplate {
|
|
|
276
276
|
content?: string | undefined;
|
|
277
277
|
}>;
|
|
278
278
|
constructor(_transport: FetchTransport);
|
|
279
|
-
send({ id, body, request }: Options$
|
|
279
|
+
send({ id, body, request }: Options$A): Promise<UpdateBoilerplateResponse>;
|
|
280
280
|
}
|
|
281
281
|
type UpdateBoilerplateResponsePayload = {
|
|
282
282
|
boilerplate: {
|
|
@@ -304,7 +304,7 @@ declare class UpdateBoilerplateResponse {
|
|
|
304
304
|
* @see https://greatdetail.com
|
|
305
305
|
*/
|
|
306
306
|
|
|
307
|
-
interface Options$
|
|
307
|
+
interface Options$z {
|
|
308
308
|
body: z.infer<typeof CreateBoilerplateCategory.SCHEMA>;
|
|
309
309
|
request?: RequestInit;
|
|
310
310
|
}
|
|
@@ -324,7 +324,7 @@ declare class CreateBoilerplateCategory {
|
|
|
324
324
|
description?: string | undefined;
|
|
325
325
|
}>;
|
|
326
326
|
constructor(_transport: FetchTransport);
|
|
327
|
-
send({ body, request }: Options$
|
|
327
|
+
send({ body, request }: Options$z): Promise<CreateBoilerplateCategoryResponse>;
|
|
328
328
|
}
|
|
329
329
|
type CreateBoilerplateCategoryResponsePayload = {
|
|
330
330
|
boilerplateCategory: {
|
|
@@ -351,14 +351,14 @@ declare class CreateBoilerplateCategoryResponse {
|
|
|
351
351
|
* @see https://greatdetail.com
|
|
352
352
|
*/
|
|
353
353
|
|
|
354
|
-
interface Options$
|
|
354
|
+
interface Options$y {
|
|
355
355
|
id: string;
|
|
356
356
|
request?: RequestInit;
|
|
357
357
|
}
|
|
358
358
|
declare class GetBoilerplateCategory {
|
|
359
359
|
protected _transport: FetchTransport;
|
|
360
360
|
constructor(_transport: FetchTransport);
|
|
361
|
-
send({ id, request }: Options$
|
|
361
|
+
send({ id, request }: Options$y): Promise<GetBoilerplateCategoryResponse>;
|
|
362
362
|
}
|
|
363
363
|
type GetBoilerplateCategoryResponsePayload = {
|
|
364
364
|
boilerplateCategory: {
|
|
@@ -385,13 +385,13 @@ declare class GetBoilerplateCategoryResponse {
|
|
|
385
385
|
* @see https://greatdetail.com
|
|
386
386
|
*/
|
|
387
387
|
|
|
388
|
-
interface Options$
|
|
388
|
+
interface Options$x {
|
|
389
389
|
request?: RequestInit;
|
|
390
390
|
}
|
|
391
391
|
declare class ListBoilerplateCategories {
|
|
392
392
|
protected _transport: FetchTransport;
|
|
393
393
|
constructor(_transport: FetchTransport);
|
|
394
|
-
send({ request }?: Options$
|
|
394
|
+
send({ request }?: Options$x): Promise<ListBoilerplateCategoriesResponse>;
|
|
395
395
|
}
|
|
396
396
|
type ListBoilerplateCategoriesResponsePayload = {
|
|
397
397
|
boilerplateCategories: {
|
|
@@ -418,7 +418,7 @@ declare class ListBoilerplateCategoriesResponse {
|
|
|
418
418
|
* @see https://greatdetail.com
|
|
419
419
|
*/
|
|
420
420
|
|
|
421
|
-
interface Options$
|
|
421
|
+
interface Options$w {
|
|
422
422
|
id: string;
|
|
423
423
|
body: z.infer<typeof UpdateBoilerplateCategory.SCHEMA>;
|
|
424
424
|
request?: RequestInit;
|
|
@@ -436,7 +436,7 @@ declare class UpdateBoilerplateCategory {
|
|
|
436
436
|
description?: string | undefined;
|
|
437
437
|
}>;
|
|
438
438
|
constructor(_transport: FetchTransport);
|
|
439
|
-
send({ id, body, request }: Options$
|
|
439
|
+
send({ id, body, request }: Options$w): Promise<UpdateBoilerplateCategoryResponse>;
|
|
440
440
|
}
|
|
441
441
|
type UpdateBoilerplateCategoryResponsePayload = {
|
|
442
442
|
boilerplateCategory: {
|
|
@@ -463,13 +463,13 @@ declare class UpdateBoilerplateCategoryResponse {
|
|
|
463
463
|
* @see https://greatdetail.com
|
|
464
464
|
*/
|
|
465
465
|
|
|
466
|
-
interface Options$
|
|
466
|
+
interface Options$v {
|
|
467
467
|
request?: RequestInit;
|
|
468
468
|
}
|
|
469
469
|
declare class ListChannels {
|
|
470
470
|
protected _transport: FetchTransport;
|
|
471
471
|
constructor(_transport: FetchTransport);
|
|
472
|
-
send({ request }?: Options$
|
|
472
|
+
send({ request }?: Options$v): Promise<ListChannelsResponse>;
|
|
473
473
|
}
|
|
474
474
|
type ListChannelsResponsePayload = {
|
|
475
475
|
channels: ({
|
|
@@ -510,7 +510,7 @@ declare class ListChannelsResponse {
|
|
|
510
510
|
* @see https://greatdetail.com
|
|
511
511
|
*/
|
|
512
512
|
|
|
513
|
-
interface Options$
|
|
513
|
+
interface Options$u {
|
|
514
514
|
id: string;
|
|
515
515
|
vcf?: {
|
|
516
516
|
variant?: "vcard";
|
|
@@ -523,8 +523,8 @@ interface Options$t {
|
|
|
523
523
|
declare class GetContactVCFURL {
|
|
524
524
|
protected _transport: FetchTransport;
|
|
525
525
|
constructor(_transport: FetchTransport);
|
|
526
|
-
getRelativeURL({ id, vcf }: Options$
|
|
527
|
-
getURL(options: Options$
|
|
526
|
+
getRelativeURL({ id, vcf }: Options$u): string;
|
|
527
|
+
getURL(options: Options$u): string;
|
|
528
528
|
}
|
|
529
529
|
|
|
530
530
|
/**
|
|
@@ -536,7 +536,7 @@ declare class GetContactVCFURL {
|
|
|
536
536
|
* @see https://greatdetail.com
|
|
537
537
|
*/
|
|
538
538
|
|
|
539
|
-
interface Options$
|
|
539
|
+
interface Options$t {
|
|
540
540
|
body: z.infer<typeof CreateContact.SCHEMA>;
|
|
541
541
|
request?: RequestInit;
|
|
542
542
|
}
|
|
@@ -559,7 +559,7 @@ declare class CreateContact {
|
|
|
559
559
|
telephoneNumber?: string | undefined;
|
|
560
560
|
}>;
|
|
561
561
|
constructor(_transport: FetchTransport);
|
|
562
|
-
send({ body, request }: Options$
|
|
562
|
+
send({ body, request }: Options$t): Promise<CreateContactResponse>;
|
|
563
563
|
}
|
|
564
564
|
type CreateContactResponsePayload = {
|
|
565
565
|
contact: {
|
|
@@ -587,14 +587,14 @@ declare class CreateContactResponse {
|
|
|
587
587
|
* @see https://greatdetail.com
|
|
588
588
|
*/
|
|
589
589
|
|
|
590
|
-
interface Options$
|
|
590
|
+
interface Options$s {
|
|
591
591
|
id: string;
|
|
592
592
|
request?: RequestInit;
|
|
593
593
|
}
|
|
594
594
|
declare class GetContact {
|
|
595
595
|
protected _transport: FetchTransport;
|
|
596
596
|
constructor(_transport: FetchTransport);
|
|
597
|
-
send({ id, request }: Options$
|
|
597
|
+
send({ id, request }: Options$s): Promise<GetContactResponse>;
|
|
598
598
|
}
|
|
599
599
|
type GetContactResponsePayload = {
|
|
600
600
|
contact: {
|
|
@@ -622,13 +622,13 @@ declare class GetContactResponse {
|
|
|
622
622
|
* @see https://greatdetail.com
|
|
623
623
|
*/
|
|
624
624
|
|
|
625
|
-
interface Options$
|
|
625
|
+
interface Options$r {
|
|
626
626
|
request?: RequestInit;
|
|
627
627
|
}
|
|
628
628
|
declare class ListContacts {
|
|
629
629
|
protected _transport: FetchTransport;
|
|
630
630
|
constructor(_transport: FetchTransport);
|
|
631
|
-
send({ request }?: Options$
|
|
631
|
+
send({ request }?: Options$r): Promise<ListContactsResponse>;
|
|
632
632
|
}
|
|
633
633
|
type ListContactsResponsePayload = {
|
|
634
634
|
contacts: {
|
|
@@ -656,14 +656,14 @@ declare class ListContactsResponse {
|
|
|
656
656
|
* @see https://greatdetail.com
|
|
657
657
|
*/
|
|
658
658
|
|
|
659
|
-
interface Options$
|
|
659
|
+
interface Options$q {
|
|
660
660
|
id: string;
|
|
661
661
|
request?: RequestInit;
|
|
662
662
|
}
|
|
663
663
|
declare class ListLabelContacts {
|
|
664
664
|
protected _transport: FetchTransport;
|
|
665
665
|
constructor(_transport: FetchTransport);
|
|
666
|
-
send({ id, request }: Options$
|
|
666
|
+
send({ id, request }: Options$q): Promise<ListLabelContactsResponse>;
|
|
667
667
|
}
|
|
668
668
|
type ListLabelContactsResponsePayload = {
|
|
669
669
|
contacts: {
|
|
@@ -691,7 +691,7 @@ declare class ListLabelContactsResponse {
|
|
|
691
691
|
* @see https://greatdetail.com
|
|
692
692
|
*/
|
|
693
693
|
|
|
694
|
-
interface Options$
|
|
694
|
+
interface Options$p {
|
|
695
695
|
id: string;
|
|
696
696
|
body: z.infer<typeof UpdateContact.SCHEMA>;
|
|
697
697
|
request?: RequestInit;
|
|
@@ -712,7 +712,7 @@ declare class UpdateContact {
|
|
|
712
712
|
telephoneNumber?: string | undefined;
|
|
713
713
|
}>;
|
|
714
714
|
constructor(_transport: FetchTransport);
|
|
715
|
-
send({ id, body, request }: Options$
|
|
715
|
+
send({ id, body, request }: Options$p): Promise<UpdateContactResponse>;
|
|
716
716
|
}
|
|
717
717
|
type UpdateContactResponsePayload = {
|
|
718
718
|
contact: {
|
|
@@ -740,14 +740,14 @@ declare class UpdateContactResponse {
|
|
|
740
740
|
* @see https://greatdetail.com
|
|
741
741
|
*/
|
|
742
742
|
|
|
743
|
-
interface Options$
|
|
743
|
+
interface Options$o {
|
|
744
744
|
id: string;
|
|
745
745
|
request?: RequestInit;
|
|
746
746
|
}
|
|
747
747
|
declare class GetConversation {
|
|
748
748
|
protected _transport: FetchTransport;
|
|
749
749
|
constructor(_transport: FetchTransport);
|
|
750
|
-
send({ id, request }: Options$
|
|
750
|
+
send({ id, request }: Options$o): Promise<GetConversationResponse>;
|
|
751
751
|
}
|
|
752
752
|
type GetConversationResponsePayload = {
|
|
753
753
|
conversation: {
|
|
@@ -766,6 +766,41 @@ declare class GetConversationResponse {
|
|
|
766
766
|
result(): Promise<GetConversationResponsePayload>;
|
|
767
767
|
}
|
|
768
768
|
|
|
769
|
+
/**
|
|
770
|
+
* Great Detail Support System.
|
|
771
|
+
*
|
|
772
|
+
* @copyright 2024 Great Detail Ltd
|
|
773
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
774
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
775
|
+
* @see https://greatdetail.com
|
|
776
|
+
*/
|
|
777
|
+
|
|
778
|
+
interface Options$n {
|
|
779
|
+
id: string;
|
|
780
|
+
request?: RequestInit;
|
|
781
|
+
}
|
|
782
|
+
declare class ListContactConversations {
|
|
783
|
+
protected _transport: FetchTransport;
|
|
784
|
+
constructor(_transport: FetchTransport);
|
|
785
|
+
send({ id, request }: Options$n): Promise<ListContactConversationsResponse>;
|
|
786
|
+
}
|
|
787
|
+
type ListContactConversationsResponsePayload = {
|
|
788
|
+
conversations: {
|
|
789
|
+
id: string;
|
|
790
|
+
name?: string;
|
|
791
|
+
hasEnded: boolean;
|
|
792
|
+
conversationStatus: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
|
|
793
|
+
accountChannel: string;
|
|
794
|
+
createdAt: string;
|
|
795
|
+
updatedAt: string;
|
|
796
|
+
}[];
|
|
797
|
+
};
|
|
798
|
+
declare class ListContactConversationsResponse {
|
|
799
|
+
response: Response;
|
|
800
|
+
constructor(response: Response);
|
|
801
|
+
result(): Promise<ListContactConversationsResponsePayload>;
|
|
802
|
+
}
|
|
803
|
+
|
|
769
804
|
/**
|
|
770
805
|
* Great Detail Support System.
|
|
771
806
|
*
|
|
@@ -1619,13 +1654,16 @@ declare class Client {
|
|
|
1619
1654
|
list: ListContacts;
|
|
1620
1655
|
update: UpdateContact;
|
|
1621
1656
|
create: CreateContact;
|
|
1622
|
-
|
|
1623
|
-
|
|
1657
|
+
conversation: {
|
|
1658
|
+
list: ListContactConversations;
|
|
1624
1659
|
};
|
|
1625
1660
|
note: {
|
|
1626
1661
|
list: ListContactNotes;
|
|
1627
1662
|
create: CreateContactNote;
|
|
1628
1663
|
};
|
|
1664
|
+
vcf: {
|
|
1665
|
+
get: GetContactVCFURL;
|
|
1666
|
+
};
|
|
1629
1667
|
};
|
|
1630
1668
|
get conversation(): {
|
|
1631
1669
|
get: GetConversation;
|
|
@@ -1675,4 +1713,4 @@ declare class Client {
|
|
|
1675
1713
|
};
|
|
1676
1714
|
}
|
|
1677
1715
|
|
|
1678
|
-
export { type Authentication as A, type
|
|
1716
|
+
export { type Authentication as A, type ListModelsResponsePayload as B, Client as C, type DeleteLabelResponsePayload as D, type CreateCorrectionResponsePayload as E, type CreateResponseResponsePayload as F, type GetBoilerplateResponsePayload as G, type CreateContactNoteResponsePayload as H, type CreateConversationNoteResponsePayload as I, type GetNoteResponsePayload as J, type ListContactNotesResponsePayload as K, type ListActionsResponsePayload as L, type ListConversationNotesResponsePayload as M, type UpdateNoteResponsePayload as N, type Options as O, type GetSourceResponsePayload as P, type ListSourcesResponsePayload as Q, type RequestFilterable as R, type UpdateBoilerplateResponsePayload as U, type Options$H as a, type CreateBoilerplateCategoryBoilerplateResponsePayload as b, type ListBoilerplateCategoryBoilerplatesResponsePayload as c, type ListBoilerplatesResponsePayload as d, type CreateBoilerplateCategoryResponsePayload as e, type GetBoilerplateCategoryResponsePayload as f, type ListBoilerplateCategoriesResponsePayload as g, type UpdateBoilerplateCategoryResponsePayload as h, type ListChannelsResponsePayload as i, type CreateContactResponsePayload as j, type GetContactResponsePayload as k, type ListContactsResponsePayload as l, type ListLabelContactsResponsePayload as m, type UpdateContactResponsePayload as n, type GetConversationResponsePayload as o, type ListConversationsResponsePayload as p, type ListLabelConversationsResponsePayload as q, type UpdateConversationResponsePayload as r, type ListContactConversationsResponsePayload as s, type CreateLabelResponsePayload as t, type GetLabelResponsePayload as u, type ListLabelsResponsePayload as v, type UpdateLabelResponsePayload as w, type ListConversationMessagesResponsePayload as x, type ListMessagesResponsePayload as y, type GetModelResponsePayload as z };
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var xe=Object.create;var lt=Object.defineProperty;var Re=Object.getOwnPropertyDescriptor;var Ae=Object.getOwnPropertyNames;var Ce=Object.getPrototypeOf,Te=Object.prototype.hasOwnProperty;var ie=(e,t)=>{for(var r in t)lt(e,r,{get:t[r],enumerable:!0})},ae=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ae(t))!Te.call(e,o)&&o!==r&<(e,o,{get:()=>t[o],enumerable:!(s=Re(t,o))||s.enumerable});return e};var pe=(e,t,r)=>(r=e!=null?xe(Ce(e)):{},ae(t||!e||!e.__esModule?lt(r,"default",{value:e,enumerable:!0}):r,e)),_e=e=>ae(lt({},"__esModule",{value:!0}),e);var Pe={};ie(Pe,{Client:()=>m,DEFAULT_SUPPORT_BASE_URL:()=>ut,Error:()=>ne,KeyAuthentication:()=>pt,PublicAuthentication:()=>dt,TokenAuthentication:()=>ct,default:()=>m});module.exports=_e(Pe);var ut="https://api.support.greatdetail.com",ce={"X-Powered-By":"GDSupport/JavaScript"},de="api-key";var g=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"}).then(r=>new ft(r))}},ft=class{constructor(t){this.response=t}async result(){return this.response.json()}};var h=require("zod"),f=class e{constructor(t){this._transport=t}static SCHEMA=h.z.object({title:h.z.string(),content:h.z.string(),account:h.z.string()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(o=>new yt(o))}},yt=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:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new bt(s))}},bt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var b=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...r,method:"GET"}).then(s=>new xt(s))}},xt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var x=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/boilerplates",{...t,method:"GET"}).then(r=>new Rt(r))}},Rt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var mt=require("zod"),R=class e{constructor(t){this._transport=t}static SCHEMA=mt.z.object({title:mt.z.string().optional(),content:mt.z.string().optional()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(o=>new At(o))}},At=class{constructor(t){this.response=t}async result(){return this.response.json()}};var A=require("zod"),C=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:r={}}){return this._transport.send("v1/boilerplate-categories",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))}).then(s=>new Ct(s))}},Ct=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:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new Tt(s))}},Tt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var _=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/boilerplate-categories",{...t,method:"GET"}).then(r=>new _t(r))}},_t=class{constructor(t){this.response=t}async result(){return this.response.json()}};var gt=require("zod"),P=class e{constructor(t){this._transport=t}static SCHEMA=gt.z.object({title:gt.z.string().optional(),description:gt.z.string().optional()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(o=>new Pt(o))}},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={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"}).then(r=>new Et(r))}},Et=class{constructor(t){this.response=t}async result(){return this.response.json()}};var le="SUPPORT_ACCESS_TOKEN",ue="SUPPORT_API_KEY",me="SUPPORT_KEY_NAME",ge="SUPPORT_BASE_URL";var O=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:r={}}){let s=r.variant??"vcard",o=r.format??(r.variant==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(s)+"&format="+encodeURIComponent(o)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}};var u=require("zod"),S=class e{constructor(t){this._transport=t}static SCHEMA=u.z.object({name:u.z.string(),account:u.z.string(),emailAddress:u.z.string().email().optional(),telephoneNumber:u.z.string().optional()});async send({body:t,request:r={}}){return this._transport.send("v1/contacts",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))}).then(s=>new Ot(s))}},Ot=class{constructor(t){this.response=t}async result(){return this.response.json()}};var w=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new St(s))}},St=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/contacts",{...t,method:"GET"}).then(r=>new wt(r))}},wt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var F=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...r,method:"GET"}).then(s=>new vt(s))}},vt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var U=require("zod"),I=class e{constructor(t){this._transport=t}static SCHEMA=U.z.object({name:U.z.string().optional(),emailAddress:U.z.string().email().optional(),telephoneNumber:U.z.string().optional()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).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:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new Ut(s))}},Ut=class{constructor(t){this.response=t}async result(){return this.response.json()}};var j=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/conversations",{...t,method:"GET"}).then(r=>new It(r))}},It=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:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...r,method:"GET"}).then(s=>new qt(s))}},qt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var jt=require("zod"),L=class e{constructor(t){this._transport=t}static SCHEMA=jt.z.object({hasEnded:jt.z.boolean()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(o=>new Ht(o))}},Ht=class{constructor(t){this.response=t}async result(){return this.response.json()}};var N=require("zod"),M=class e{constructor(t){this._transport=t}static SCHEMA=N.z.object({title:N.z.string(),description:N.z.string().optional(),account:N.z.string()});async send({body:t,request:r={}}){return this._transport.send("v1/labels",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))}).then(s=>new Lt(s))}},Lt=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:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"DELETE"}).then(s=>new Nt(s))}},Nt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var z=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new Mt(s))}},Mt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var B=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/labels",{...t,method:"GET"}).then(r=>new Gt(r))}},Gt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var ht=require("zod"),D=class e{constructor(t){this._transport=t}static SCHEMA=ht.z.object({title:ht.z.string().optional(),description:ht.z.string().optional()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(o=>new zt(o))}},zt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var V=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET"}).then(s=>new Bt(s))}},Bt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var J=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"}).then(r=>new Dt(r))}},Dt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var k=require("zod"),K=class e{constructor(t){this._transport=t}static SCHEMA=k.z.object({input:k.z.string().max(65536),original:k.z.string().max(65536),correction:k.z.string().max(65536)});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(o=>new Vt(o))}},Vt=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:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new Jt(s))}},Jt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var $=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"}).then(r=>new kt(r))}},kt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var W=require("zod"),X=class e{constructor(t){this._transport=t}static SCHEMA=W.z.array(W.z.object({role:W.z.enum(["user","assistant"]),content:W.z.string().max(65536).nullable()})).min(1);async send({id:t,body:r,request:s={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(o=>new Kt(o))}},Kt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Yt=require("zod"),Q=class e{constructor(t){this._transport=t}static SCHEMA=Yt.z.object({content:Yt.z.string()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(o=>new $t(o))}},$t=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Wt=require("zod"),Z=class e{constructor(t){this._transport=t}static SCHEMA=Wt.z.object({content:Wt.z.string()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(o=>new Xt(o))}},Xt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var tt=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new Qt(s))}},Qt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var et=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"GET"}).then(s=>new Zt(s))}},Zt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var rt=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"GET"}).then(s=>new te(s))}},te=class{constructor(t){this.response=t}async result(){return this.response.json()}};var ee=require("zod"),st=class e{constructor(t){this._transport=t}static SCHEMA=ee.z.object({content:ee.z.string().optional()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(o=>new re(o))}},re=class{constructor(t){this.response=t}async result(){return this.response.json()}};var ot=class e{constructor(t=e.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=ce;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var nt=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new se(s))}},se=class{constructor(t){this.response=t}async result(){return this.response.json()}};var it=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/sources",{...t,method:"GET"}).then(r=>new oe(r))}},oe=class{constructor(t){this.response=t}async result(){return this.response.json()}};var he=pe(require("is-network-error"),1),fe=pe(require("ky"),1);var n=class extends Error{};var i=class extends n{};var p=class extends i{static unauthenticated(){return new this("An unauthenticated request occurred")}};var c=class extends i{static forbidden(){return new this("A forbidden request occurred")}};var a=class extends n{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,r){return new this(`Forbidden method for request: ${t} ${r}`)}};var d=class extends n{};var l=class extends n{static badRequest(){return new this("Bad request")}};var at=class{options;constructor({baseURL:t,...r}){this.options={...r,baseURL:t}}getURL(t){return new URL(t,this.options.baseURL).toString()}getRequest(t,r){r.headers=new Headers(r.headers);for(let s of this.options.requestFilterables){let o=s.getHeaders();for(let[ye,be]of Object.entries(o))r.headers.set(ye,be)}return new Request(this.getURL(t),r)}async send(t,r){return await(0,fe.default)(this.getRequest(t,r)).then(s=>{if(!s.ok){let o=s.status;switch(console.error(JSON.stringify(s)),o){case 400:throw l.badRequest();case 401:throw p.unauthenticated();case 403:throw c.forbidden();case 404:throw a.notFound(t);case 405:throw a.forbiddenMethod(t,r.method??"GET")}}return s}).catch(s=>{throw(0,he.default)(s)?new d("A network error occurred",{cause:s}):s})}};var m=class e{static DEFAULT_BASE_URL=ut;_transport;constructor(t,{baseURL:r,...s}={}){this._transport=new at({requestFilterables:[new ot,t],...s,baseURL:r?.toString()??e.getBaseURL()})}static getBaseURL(){return process.env[ge]??this.DEFAULT_BASE_URL}get action(){return{list:new g(this._transport)}}get boilerplate(){return{get:new y(this._transport),list:new x(this._transport),update:new R(this._transport)}}get boilerplateCategory(){return{get:new T(this._transport),list:new _(this._transport),create:new C(this._transport),update:new P(this._transport),boilerplate:{list:new b(this._transport),create:new f(this._transport)}}}get channel(){return{list:new E(this._transport)}}get contact(){return{get:new w(this._transport),list:new v(this._transport),update:new I(this._transport),create:new S(this._transport),vcf:{get:new O(this._transport)},note:{list:new et(this._transport),create:new Q(this._transport)}}}get conversation(){return{get:new q(this._transport),list:new j(this._transport),update:new L(this._transport),message:{list:new V(this._transport)},note:{list:new rt(this._transport),create:new Z(this._transport)}}}get label(){return{create:new M(this._transport),get:new z(this._transport),list:new B(this._transport),update:new D(this._transport),delete:new G(this._transport),contact:{list:new F(this._transport)},conversation:{list:new H(this._transport)}}}get message(){return{list:new J(this._transport)}}get model(){return{get:new Y(this._transport),list:new $(this._transport),response:{create:new X(this._transport)},correction:{create:new K(this._transport)}}}get note(){return{get:new tt(this._transport),update:new st(this._transport)}}get source(){return{get:new nt(this._transport),list:new it(this._transport)}}};var ne={};ie(ne,{AuthError:()=>i,AuthenticationError:()=>p,AuthorizationError:()=>c,LogicError:()=>a,NetworkError:()=>d,SupportError:()=>n,ValidationError:()=>l});var pt=class e{static DEFAULT_NAME=de;name;#t;constructor({name:t=process.env[me]??e.DEFAULT_NAME,key:r=process.env[ue]}={}){if(!r)throw new Error("API Key option must be specified when using Key Authentication");this.name=t,this.#t=r}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var ct=class{#t;constructor({token:t=process.env[le]}={}){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 dt=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,Error,KeyAuthentication,PublicAuthentication,TokenAuthentication});
|
|
1
|
+
"use strict";var Ae=Object.create;var ut=Object.defineProperty;var Ce=Object.getOwnPropertyDescriptor;var Te=Object.getOwnPropertyNames;var _e=Object.getPrototypeOf,Pe=Object.prototype.hasOwnProperty;var pe=(e,t)=>{for(var r in t)ut(e,r,{get:t[r],enumerable:!0})},ce=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Te(t))!Pe.call(e,o)&&o!==r&&ut(e,o,{get:()=>t[o],enumerable:!(s=Ce(t,o))||s.enumerable});return e};var de=(e,t,r)=>(r=e!=null?Ae(_e(e)):{},ce(t||!e||!e.__esModule?ut(r,"default",{value:e,enumerable:!0}):r,e)),Ee=e=>ce(ut({},"__esModule",{value:!0}),e);var Oe={};pe(Oe,{Client:()=>m,DEFAULT_SUPPORT_BASE_URL:()=>mt,Error:()=>ae,KeyAuthentication:()=>ct,PublicAuthentication:()=>lt,TokenAuthentication:()=>dt,default:()=>m});module.exports=Ee(Oe);var mt="https://api.support.greatdetail.com",le={"X-Powered-By":"GDSupport/JavaScript"},ue="api-key";var g=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"}).then(r=>new yt(r))}},yt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var h=require("zod"),f=class e{constructor(t){this._transport=t}static SCHEMA=h.z.object({title:h.z.string(),content:h.z.string(),account:h.z.string()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(o=>new bt(o))}},bt=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:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new xt(s))}},xt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var b=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...r,method:"GET"}).then(s=>new Rt(s))}},Rt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var x=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/boilerplates",{...t,method:"GET"}).then(r=>new At(r))}},At=class{constructor(t){this.response=t}async result(){return this.response.json()}};var gt=require("zod"),R=class e{constructor(t){this._transport=t}static SCHEMA=gt.z.object({title:gt.z.string().optional(),content:gt.z.string().optional()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(o=>new Ct(o))}},Ct=class{constructor(t){this.response=t}async result(){return this.response.json()}};var A=require("zod"),C=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:r={}}){return this._transport.send("v1/boilerplate-categories",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))}).then(s=>new Tt(s))}},Tt=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:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new _t(s))}},_t=class{constructor(t){this.response=t}async result(){return this.response.json()}};var _=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/boilerplate-categories",{...t,method:"GET"}).then(r=>new Pt(r))}},Pt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var ht=require("zod"),P=class e{constructor(t){this._transport=t}static SCHEMA=ht.z.object({title:ht.z.string().optional(),description:ht.z.string().optional()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(o=>new Et(o))}},Et=class{constructor(t){this.response=t}async result(){return this.response.json()}};var E=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"}).then(r=>new Ot(r))}},Ot=class{constructor(t){this.response=t}async result(){return this.response.json()}};var me="SUPPORT_ACCESS_TOKEN",ge="SUPPORT_API_KEY",he="SUPPORT_KEY_NAME",fe="SUPPORT_BASE_URL";var O=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:r={}}){let s=r.variant??"vcard",o=r.format??(r.variant==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(s)+"&format="+encodeURIComponent(o)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}};var u=require("zod"),S=class e{constructor(t){this._transport=t}static SCHEMA=u.z.object({name:u.z.string(),account:u.z.string(),emailAddress:u.z.string().email().optional(),telephoneNumber:u.z.string().optional()});async send({body:t,request:r={}}){return this._transport.send("v1/contacts",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))}).then(s=>new St(s))}},St=class{constructor(t){this.response=t}async result(){return this.response.json()}};var w=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new wt(s))}},wt=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/contacts",{...t,method:"GET"}).then(r=>new vt(r))}},vt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var F=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...r,method:"GET"}).then(s=>new Ft(s))}},Ft=class{constructor(t){this.response=t}async result(){return this.response.json()}};var U=require("zod"),I=class e{constructor(t){this._transport=t}static SCHEMA=U.z.object({name:U.z.string().optional(),emailAddress:U.z.string().email().optional(),telephoneNumber:U.z.string().optional()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(o=>new Ut(o))}},Ut=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:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new It(s))}},It=class{constructor(t){this.response=t}async result(){return this.response.json()}};var j=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...r,method:"GET"}).then(s=>new qt(s))}},qt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var H=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/conversations",{...t,method:"GET"}).then(r=>new jt(r))}},jt=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:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...r,method:"GET"}).then(s=>new Ht(s))}},Ht=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Lt=require("zod"),N=class e{constructor(t){this._transport=t}static SCHEMA=Lt.z.object({hasEnded:Lt.z.boolean()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(o=>new Nt(o))}},Nt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var M=require("zod"),G=class e{constructor(t){this._transport=t}static SCHEMA=M.z.object({title:M.z.string(),description:M.z.string().optional(),account:M.z.string()});async send({body:t,request:r={}}){return this._transport.send("v1/labels",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))}).then(s=>new Mt(s))}},Mt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var z=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"DELETE"}).then(s=>new Gt(s))}},Gt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var B=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new zt(s))}},zt=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/labels",{...t,method:"GET"}).then(r=>new Bt(r))}},Bt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var ft=require("zod"),V=class e{constructor(t){this._transport=t}static SCHEMA=ft.z.object({title:ft.z.string().optional(),description:ft.z.string().optional()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(o=>new Dt(o))}},Dt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var J=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET"}).then(s=>new Vt(s))}},Vt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var k=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"}).then(r=>new Jt(r))}},Jt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var K=require("zod"),Y=class e{constructor(t){this._transport=t}static SCHEMA=K.z.object({input:K.z.string().max(65536),original:K.z.string().max(65536),correction:K.z.string().max(65536)});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(o=>new kt(o))}},kt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var $=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new Kt(s))}},Kt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var W=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"}).then(r=>new Yt(r))}},Yt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var X=require("zod"),Q=class e{constructor(t){this._transport=t}static SCHEMA=X.z.array(X.z.object({role:X.z.enum(["user","assistant"]),content:X.z.string().max(65536).nullable()})).min(1);async send({id:t,body:r,request:s={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(o=>new $t(o))}},$t=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Wt=require("zod"),Z=class e{constructor(t){this._transport=t}static SCHEMA=Wt.z.object({content:Wt.z.string()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(o=>new Xt(o))}},Xt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Qt=require("zod"),tt=class e{constructor(t){this._transport=t}static SCHEMA=Qt.z.object({content:Qt.z.string()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(o=>new Zt(o))}},Zt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var et=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new te(s))}},te=class{constructor(t){this.response=t}async result(){return this.response.json()}};var rt=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"GET"}).then(s=>new ee(s))}},ee=class{constructor(t){this.response=t}async result(){return this.response.json()}};var st=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"GET"}).then(s=>new re(s))}},re=class{constructor(t){this.response=t}async result(){return this.response.json()}};var se=require("zod"),ot=class e{constructor(t){this._transport=t}static SCHEMA=se.z.object({content:se.z.string().optional()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(o=>new oe(o))}},oe=class{constructor(t){this.response=t}async result(){return this.response.json()}};var nt=class e{constructor(t=e.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=le;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var it=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new ne(s))}},ne=class{constructor(t){this.response=t}async result(){return this.response.json()}};var at=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/sources",{...t,method:"GET"}).then(r=>new ie(r))}},ie=class{constructor(t){this.response=t}async result(){return this.response.json()}};var ye=de(require("is-network-error"),1),be=de(require("ky"),1);var n=class extends Error{};var i=class extends n{};var p=class extends i{static unauthenticated(){return new this("An unauthenticated request occurred")}};var c=class extends i{static forbidden(){return new this("A forbidden request occurred")}};var a=class extends n{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,r){return new this(`Forbidden method for request: ${t} ${r}`)}};var d=class extends n{};var l=class extends n{static badRequest(){return new this("Bad request")}};var pt=class{options;constructor({baseURL:t,...r}){this.options={...r,baseURL:t}}getURL(t){return new URL(t,this.options.baseURL).toString()}getRequest(t,r){r.headers=new Headers(r.headers);for(let s of this.options.requestFilterables){let o=s.getHeaders();for(let[xe,Re]of Object.entries(o))r.headers.set(xe,Re)}return new Request(this.getURL(t),r)}async send(t,r){return await(0,be.default)(this.getRequest(t,r)).then(s=>{if(!s.ok){let o=s.status;switch(console.error(JSON.stringify(s)),o){case 400:throw l.badRequest();case 401:throw p.unauthenticated();case 403:throw c.forbidden();case 404:throw a.notFound(t);case 405:throw a.forbiddenMethod(t,r.method??"GET")}}return s}).catch(s=>{throw(0,ye.default)(s)?new d("A network error occurred",{cause:s}):s})}};var m=class e{static DEFAULT_BASE_URL=mt;_transport;constructor(t,{baseURL:r,...s}={}){this._transport=new pt({requestFilterables:[new nt,t],...s,baseURL:r?.toString()??e.getBaseURL()})}static getBaseURL(){return process.env[fe]??this.DEFAULT_BASE_URL}get action(){return{list:new g(this._transport)}}get boilerplate(){return{get:new y(this._transport),list:new x(this._transport),update:new R(this._transport)}}get boilerplateCategory(){return{get:new T(this._transport),list:new _(this._transport),create:new C(this._transport),update:new P(this._transport),boilerplate:{list:new b(this._transport),create:new f(this._transport)}}}get channel(){return{list:new E(this._transport)}}get contact(){return{get:new w(this._transport),list:new v(this._transport),update:new I(this._transport),create:new S(this._transport),conversation:{list:new j(this._transport)},note:{list:new rt(this._transport),create:new Z(this._transport)},vcf:{get:new O(this._transport)}}}get conversation(){return{get:new q(this._transport),list:new H(this._transport),update:new N(this._transport),message:{list:new J(this._transport)},note:{list:new st(this._transport),create:new tt(this._transport)}}}get label(){return{create:new G(this._transport),get:new B(this._transport),list:new D(this._transport),update:new V(this._transport),delete:new z(this._transport),contact:{list:new F(this._transport)},conversation:{list:new L(this._transport)}}}get message(){return{list:new k(this._transport)}}get model(){return{get:new $(this._transport),list:new W(this._transport),response:{create:new Q(this._transport)},correction:{create:new Y(this._transport)}}}get note(){return{get:new et(this._transport),update:new ot(this._transport)}}get source(){return{get:new it(this._transport),list:new at(this._transport)}}};var ae={};pe(ae,{AuthError:()=>i,AuthenticationError:()=>p,AuthorizationError:()=>c,LogicError:()=>a,NetworkError:()=>d,SupportError:()=>n,ValidationError:()=>l});var ct=class e{static DEFAULT_NAME=ue;name;#t;constructor({name:t=process.env[he]??e.DEFAULT_NAME,key:r=process.env[ge]}={}){if(!r)throw new Error("API Key option must be specified when using Key Authentication");this.name=t,this.#t=r}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var dt=class{#t;constructor({token:t=process.env[me]}={}){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 lt=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,Error,KeyAuthentication,PublicAuthentication,TokenAuthentication});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as Authentication } from './index-
|
|
2
|
-
export { C as Client, b as CreateBoilerplateCategoryBoilerplateResponsePayload, e as CreateBoilerplateCategoryResponsePayload,
|
|
1
|
+
import { A as Authentication } from './index-nN1ajzrl.cjs';
|
|
2
|
+
export { C as Client, b as CreateBoilerplateCategoryBoilerplateResponsePayload, e as CreateBoilerplateCategoryResponsePayload, H as CreateContactNoteResponsePayload, j as CreateContactResponsePayload, I as CreateConversationNoteResponsePayload, E as CreateCorrectionResponsePayload, t as CreateLabelResponsePayload, F as CreateResponseResponsePayload, D as DeleteLabelResponsePayload, f as GetBoilerplateCategoryResponsePayload, G as GetBoilerplateResponsePayload, k as GetContactResponsePayload, o as GetConversationResponsePayload, u as GetLabelResponsePayload, z as GetModelResponsePayload, J as GetNoteResponsePayload, P as GetSourceResponsePayload, L as ListActionsResponsePayload, g as ListBoilerplateCategoriesResponsePayload, c as ListBoilerplateCategoryBoilerplatesResponsePayload, d as ListBoilerplatesResponsePayload, i as ListChannelsResponsePayload, s as ListContactConversationsResponsePayload, K as ListContactNotesResponsePayload, l as ListContactsResponsePayload, x as ListConversationMessagesResponsePayload, M as ListConversationNotesResponsePayload, p as ListConversationsResponsePayload, m as ListLabelContactsResponsePayload, q as ListLabelConversationsResponsePayload, v as ListLabelsResponsePayload, y as ListMessagesResponsePayload, B as ListModelsResponsePayload, Q as ListSourcesResponsePayload, O as Options, R as RequestFilterable, a as TransportOptions, h as UpdateBoilerplateCategoryResponsePayload, U as UpdateBoilerplateResponsePayload, n as UpdateContactResponsePayload, r as UpdateConversationResponsePayload, w as UpdateLabelResponsePayload, N as UpdateNoteResponsePayload, C as default } from './index-nN1ajzrl.cjs';
|
|
3
3
|
import 'ky';
|
|
4
4
|
import 'zod';
|
|
5
5
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as Authentication } from './index-
|
|
2
|
-
export { C as Client, b as CreateBoilerplateCategoryBoilerplateResponsePayload, e as CreateBoilerplateCategoryResponsePayload,
|
|
1
|
+
import { A as Authentication } from './index-nN1ajzrl.js';
|
|
2
|
+
export { C as Client, b as CreateBoilerplateCategoryBoilerplateResponsePayload, e as CreateBoilerplateCategoryResponsePayload, H as CreateContactNoteResponsePayload, j as CreateContactResponsePayload, I as CreateConversationNoteResponsePayload, E as CreateCorrectionResponsePayload, t as CreateLabelResponsePayload, F as CreateResponseResponsePayload, D as DeleteLabelResponsePayload, f as GetBoilerplateCategoryResponsePayload, G as GetBoilerplateResponsePayload, k as GetContactResponsePayload, o as GetConversationResponsePayload, u as GetLabelResponsePayload, z as GetModelResponsePayload, J as GetNoteResponsePayload, P as GetSourceResponsePayload, L as ListActionsResponsePayload, g as ListBoilerplateCategoriesResponsePayload, c as ListBoilerplateCategoryBoilerplatesResponsePayload, d as ListBoilerplatesResponsePayload, i as ListChannelsResponsePayload, s as ListContactConversationsResponsePayload, K as ListContactNotesResponsePayload, l as ListContactsResponsePayload, x as ListConversationMessagesResponsePayload, M as ListConversationNotesResponsePayload, p as ListConversationsResponsePayload, m as ListLabelContactsResponsePayload, q as ListLabelConversationsResponsePayload, v as ListLabelsResponsePayload, y as ListMessagesResponsePayload, B as ListModelsResponsePayload, Q as ListSourcesResponsePayload, O as Options, R as RequestFilterable, a as TransportOptions, h as UpdateBoilerplateCategoryResponsePayload, U as UpdateBoilerplateResponsePayload, n as UpdateContactResponsePayload, r as UpdateConversationResponsePayload, w as UpdateLabelResponsePayload, N as UpdateNoteResponsePayload, C as default } from './index-nN1ajzrl.js';
|
|
3
3
|
import 'ky';
|
|
4
4
|
import 'zod';
|
|
5
5
|
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as d,b as g,c as s,d as n,e as a,f as p,g as f,h as m,i as u,j as c,k as l,l as x,m as A,n as h,o as _}from"./chunk-
|
|
1
|
+
import{a as d,b as g,c as s,d as n,e as a,f as p,g as f,h as m,i as u,j as c,k as l,l as x,m as A,n as h,o as _}from"./chunk-P5VYQSL7.js";var E={};d(E,{AuthError:()=>m,AuthenticationError:()=>u,AuthorizationError:()=>c,LogicError:()=>l,NetworkError:()=>x,SupportError:()=>f,ValidationError:()=>A});var t=class o{static DEFAULT_NAME=s;name;#r;constructor({name:r=process.env[p]??o.DEFAULT_NAME,key:i=process.env[a]}={}){if(!i)throw new Error("API Key option must be specified when using Key Authentication");this.name=r,this.#r=i}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#r)}`}}};var e=class{#r;constructor({token:r=process.env[n]}={}){if(!r)throw new Error("Access Token option must be specified when using Token Authentication");this.#r=r}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Bearer ${this.#r}`}}};export{h as Client,g as DEFAULT_SUPPORT_BASE_URL,E as Error,t as KeyAuthentication,_ as PublicAuthentication,e as TokenAuthentication,h as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@great-detail/support-sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "JavaScript SDK for the Great Detail Support System",
|
|
6
6
|
"author": "Great Detail Ltd <info@greatdetail.com>",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"eslint": "eslint .",
|
|
49
49
|
"eslint:dev": "eslint . --fix",
|
|
50
50
|
"jest": "cross-env NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest --passWithNoTests",
|
|
51
|
-
"lint": "npm-run-all eslint typecheck publint prettier",
|
|
51
|
+
"lint": "npm-run-all --parallel eslint typecheck publint prettier",
|
|
52
52
|
"lint:dev": "npm-run-all eslint:dev typecheck publint prettier:dev",
|
|
53
53
|
"prerelease": "npm-run-all build",
|
|
54
54
|
"prettier": "prettier --check .",
|
package/src/Client/index.ts
CHANGED
|
@@ -28,6 +28,7 @@ import ListContacts from "../Contact/ListContacts.js";
|
|
|
28
28
|
import ListLabelContacts from "../Contact/ListLabelContacts.js";
|
|
29
29
|
import UpdateContact from "../Contact/UpdateContact.js";
|
|
30
30
|
import GetConversation from "../Conversation/GetConversation.js";
|
|
31
|
+
import ListContactConversations from "../Conversation/ListContactConversations.js";
|
|
31
32
|
import ListConversations from "../Conversation/ListConversations.js";
|
|
32
33
|
import ListLabelConversations from "../Conversation/ListLabelConversations.js";
|
|
33
34
|
import UpdateConversation from "../Conversation/UpdateConversation.js";
|
|
@@ -116,13 +117,16 @@ export default class Client {
|
|
|
116
117
|
list: new ListContacts(this._transport),
|
|
117
118
|
update: new UpdateContact(this._transport),
|
|
118
119
|
create: new CreateContact(this._transport),
|
|
119
|
-
|
|
120
|
-
|
|
120
|
+
conversation: {
|
|
121
|
+
list: new ListContactConversations(this._transport),
|
|
121
122
|
},
|
|
122
123
|
note: {
|
|
123
124
|
list: new ListContactNotes(this._transport),
|
|
124
125
|
create: new CreateContactNote(this._transport),
|
|
125
126
|
},
|
|
127
|
+
vcf: {
|
|
128
|
+
get: new GetContactVCFURL(this._transport),
|
|
129
|
+
},
|
|
126
130
|
};
|
|
127
131
|
}
|
|
128
132
|
|
|
@@ -0,0 +1,52 @@
|
|
|
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 FetchTransport from "../Transport/FetchTransport.js";
|
|
11
|
+
|
|
12
|
+
export interface Options {
|
|
13
|
+
id: string;
|
|
14
|
+
request?: RequestInit;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default class ListContactConversations {
|
|
18
|
+
constructor(protected _transport: FetchTransport) {}
|
|
19
|
+
|
|
20
|
+
public async send({ id, request = {} }: Options) {
|
|
21
|
+
return this._transport
|
|
22
|
+
.send("v1/contacts/" + encodeURIComponent(id) + "/conversations", {
|
|
23
|
+
...request,
|
|
24
|
+
method: "GET",
|
|
25
|
+
})
|
|
26
|
+
.then((response) => new ListContactConversationsResponse(response));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export type ListContactConversationsResponsePayload = {
|
|
31
|
+
conversations: {
|
|
32
|
+
id: string;
|
|
33
|
+
name?: string;
|
|
34
|
+
hasEnded: boolean;
|
|
35
|
+
conversationStatus:
|
|
36
|
+
| "AwaitingContactConversationStatus"
|
|
37
|
+
| "AwaitingAgentConversationStatus"
|
|
38
|
+
| "ResolvedConversationStatus"
|
|
39
|
+
| "ClosedConversationStatus";
|
|
40
|
+
accountChannel: string;
|
|
41
|
+
createdAt: string;
|
|
42
|
+
updatedAt: string;
|
|
43
|
+
}[];
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export class ListContactConversationsResponse {
|
|
47
|
+
constructor(public response: Response) {}
|
|
48
|
+
|
|
49
|
+
public async result(): Promise<ListContactConversationsResponsePayload> {
|
|
50
|
+
return this.response.json();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -11,3 +11,4 @@ export { type GetConversationResponsePayload } from "./GetConversation.js";
|
|
|
11
11
|
export { type ListConversationsResponsePayload } from "./ListConversations.js";
|
|
12
12
|
export { type ListLabelConversationsResponsePayload } from "./ListLabelConversations.js";
|
|
13
13
|
export { type UpdateConversationResponsePayload } from "./UpdateConversation.js";
|
|
14
|
+
export { type ListContactConversationsResponsePayload } from "./ListContactConversations.js";
|