@great-detail/support-sdk 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-ALRXWW2N.js +1 -0
- package/dist/{chunk-YQ6LXSV4.js → chunk-JLXFVLGR.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-BwsedLC7.d.cts → index-cTKZe1yJ.d.cts} +89 -54
- package/dist/{index-BwsedLC7.d.ts → index-cTKZe1yJ.d.ts} +89 -54
- 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 +1 -1
- package/src/Client/index.ts +4 -0
- package/src/Note/ListConversationNotes.ts +45 -0
- package/src/index.ts +1 -0
- package/dist/chunk-WAY6IGDK.js +0 -1
|
@@ -27,7 +27,7 @@ interface RequestFilterable {
|
|
|
27
27
|
* @see https://greatdetail.com
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
|
-
interface Options$
|
|
30
|
+
interface Options$u {
|
|
31
31
|
requestFilterables: RequestFilterable[];
|
|
32
32
|
}
|
|
33
33
|
interface Transport {
|
|
@@ -43,7 +43,7 @@ interface Transport {
|
|
|
43
43
|
* @see https://greatdetail.com
|
|
44
44
|
*/
|
|
45
45
|
|
|
46
|
-
interface InputOptions extends Options$
|
|
46
|
+
interface InputOptions extends Options$u {
|
|
47
47
|
baseURL: string;
|
|
48
48
|
/**
|
|
49
49
|
* Alternative Fetch Provider.
|
|
@@ -54,12 +54,12 @@ interface InputOptions extends Options$t {
|
|
|
54
54
|
*/
|
|
55
55
|
fetch?: typeof fetch;
|
|
56
56
|
}
|
|
57
|
-
interface Options$
|
|
57
|
+
interface Options$t extends Options$u {
|
|
58
58
|
baseURL: string;
|
|
59
59
|
fetch: typeof fetch;
|
|
60
60
|
}
|
|
61
61
|
declare class FetchTransport implements Transport {
|
|
62
|
-
options: Options$
|
|
62
|
+
options: Options$t;
|
|
63
63
|
constructor({ baseURL, fetch: fetchAlternative, ...options }: InputOptions);
|
|
64
64
|
getURL(url: string): string;
|
|
65
65
|
getRequest(url: string, request: RequestInit): Request;
|
|
@@ -75,13 +75,13 @@ declare class FetchTransport implements Transport {
|
|
|
75
75
|
* @see https://greatdetail.com
|
|
76
76
|
*/
|
|
77
77
|
|
|
78
|
-
interface Options$
|
|
78
|
+
interface Options$s {
|
|
79
79
|
request?: RequestInit;
|
|
80
80
|
}
|
|
81
81
|
declare class ListActions {
|
|
82
82
|
protected _transport: FetchTransport;
|
|
83
83
|
constructor(_transport: FetchTransport);
|
|
84
|
-
send({ request }?: Options$
|
|
84
|
+
send({ request }?: Options$s): Promise<ListActionsResponse>;
|
|
85
85
|
}
|
|
86
86
|
type ListActionsResponsePayload = {
|
|
87
87
|
actions: {
|
|
@@ -123,13 +123,13 @@ type Authentication = RequestFilterable;
|
|
|
123
123
|
* @see https://greatdetail.com
|
|
124
124
|
*/
|
|
125
125
|
|
|
126
|
-
interface Options$
|
|
126
|
+
interface Options$r {
|
|
127
127
|
request?: RequestInit;
|
|
128
128
|
}
|
|
129
129
|
declare class ListChannels {
|
|
130
130
|
protected _transport: FetchTransport;
|
|
131
131
|
constructor(_transport: FetchTransport);
|
|
132
|
-
send({ request }?: Options$
|
|
132
|
+
send({ request }?: Options$r): Promise<ListChannelsResponse>;
|
|
133
133
|
}
|
|
134
134
|
type ListChannelsResponsePayload = {
|
|
135
135
|
channels: ({
|
|
@@ -170,7 +170,7 @@ declare class ListChannelsResponse {
|
|
|
170
170
|
* @see https://greatdetail.com
|
|
171
171
|
*/
|
|
172
172
|
|
|
173
|
-
interface Options$
|
|
173
|
+
interface Options$q {
|
|
174
174
|
id: string;
|
|
175
175
|
vcf?: {
|
|
176
176
|
variant?: "vcard";
|
|
@@ -183,8 +183,8 @@ interface Options$p {
|
|
|
183
183
|
declare class GetContactVCFURL {
|
|
184
184
|
protected _transport: FetchTransport;
|
|
185
185
|
constructor(_transport: FetchTransport);
|
|
186
|
-
getRelativeURL({ id, vcf }: Options$
|
|
187
|
-
getURL(options: Options$
|
|
186
|
+
getRelativeURL({ id, vcf }: Options$q): string;
|
|
187
|
+
getURL(options: Options$q): string;
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
/**
|
|
@@ -196,7 +196,7 @@ declare class GetContactVCFURL {
|
|
|
196
196
|
* @see https://greatdetail.com
|
|
197
197
|
*/
|
|
198
198
|
|
|
199
|
-
interface Options$
|
|
199
|
+
interface Options$p {
|
|
200
200
|
body: z.infer<typeof CreateContact.SCHEMA>;
|
|
201
201
|
request?: RequestInit;
|
|
202
202
|
}
|
|
@@ -219,7 +219,7 @@ declare class CreateContact {
|
|
|
219
219
|
telephoneNumber?: string | undefined;
|
|
220
220
|
}>;
|
|
221
221
|
constructor(_transport: FetchTransport);
|
|
222
|
-
send({ body, request }: Options$
|
|
222
|
+
send({ body, request }: Options$p): Promise<CreateContactResponse>;
|
|
223
223
|
}
|
|
224
224
|
type CreateContactResponsePayload = {
|
|
225
225
|
contact: {
|
|
@@ -247,14 +247,14 @@ declare class CreateContactResponse {
|
|
|
247
247
|
* @see https://greatdetail.com
|
|
248
248
|
*/
|
|
249
249
|
|
|
250
|
-
interface Options$
|
|
250
|
+
interface Options$o {
|
|
251
251
|
id: string;
|
|
252
252
|
request?: RequestInit;
|
|
253
253
|
}
|
|
254
254
|
declare class GetContact {
|
|
255
255
|
protected _transport: FetchTransport;
|
|
256
256
|
constructor(_transport: FetchTransport);
|
|
257
|
-
send({ id, request }: Options$
|
|
257
|
+
send({ id, request }: Options$o): Promise<GetContactResponse>;
|
|
258
258
|
}
|
|
259
259
|
type GetContactResponsePayload = {
|
|
260
260
|
contact: {
|
|
@@ -282,13 +282,13 @@ declare class GetContactResponse {
|
|
|
282
282
|
* @see https://greatdetail.com
|
|
283
283
|
*/
|
|
284
284
|
|
|
285
|
-
interface Options$
|
|
285
|
+
interface Options$n {
|
|
286
286
|
request?: RequestInit;
|
|
287
287
|
}
|
|
288
288
|
declare class ListContacts {
|
|
289
289
|
protected _transport: FetchTransport;
|
|
290
290
|
constructor(_transport: FetchTransport);
|
|
291
|
-
send({ request }?: Options$
|
|
291
|
+
send({ request }?: Options$n): Promise<ListContactsResponse>;
|
|
292
292
|
}
|
|
293
293
|
type ListContactsResponsePayload = {
|
|
294
294
|
contacts: {
|
|
@@ -316,14 +316,14 @@ declare class ListContactsResponse {
|
|
|
316
316
|
* @see https://greatdetail.com
|
|
317
317
|
*/
|
|
318
318
|
|
|
319
|
-
interface Options$
|
|
319
|
+
interface Options$m {
|
|
320
320
|
id: string;
|
|
321
321
|
request?: RequestInit;
|
|
322
322
|
}
|
|
323
323
|
declare class ListLabelContacts {
|
|
324
324
|
protected _transport: FetchTransport;
|
|
325
325
|
constructor(_transport: FetchTransport);
|
|
326
|
-
send({ id, request }: Options$
|
|
326
|
+
send({ id, request }: Options$m): Promise<ListLabelContactsResponse>;
|
|
327
327
|
}
|
|
328
328
|
type ListLabelContactsResponsePayload = {
|
|
329
329
|
contacts: {
|
|
@@ -351,7 +351,7 @@ declare class ListLabelContactsResponse {
|
|
|
351
351
|
* @see https://greatdetail.com
|
|
352
352
|
*/
|
|
353
353
|
|
|
354
|
-
interface Options$
|
|
354
|
+
interface Options$l {
|
|
355
355
|
id: string;
|
|
356
356
|
body: z.infer<typeof UpdateContact.SCHEMA>;
|
|
357
357
|
request?: RequestInit;
|
|
@@ -372,7 +372,7 @@ declare class UpdateContact {
|
|
|
372
372
|
telephoneNumber?: string | undefined;
|
|
373
373
|
}>;
|
|
374
374
|
constructor(_transport: FetchTransport);
|
|
375
|
-
send({ id, body, request }: Options$
|
|
375
|
+
send({ id, body, request }: Options$l): Promise<UpdateContactResponse>;
|
|
376
376
|
}
|
|
377
377
|
type UpdateContactResponsePayload = {
|
|
378
378
|
contact: {
|
|
@@ -400,14 +400,14 @@ declare class UpdateContactResponse {
|
|
|
400
400
|
* @see https://greatdetail.com
|
|
401
401
|
*/
|
|
402
402
|
|
|
403
|
-
interface Options$
|
|
403
|
+
interface Options$k {
|
|
404
404
|
id: string;
|
|
405
405
|
request?: RequestInit;
|
|
406
406
|
}
|
|
407
407
|
declare class GetConversation {
|
|
408
408
|
protected _transport: FetchTransport;
|
|
409
409
|
constructor(_transport: FetchTransport);
|
|
410
|
-
send({ id, request }: Options$
|
|
410
|
+
send({ id, request }: Options$k): Promise<GetConversationResponse>;
|
|
411
411
|
}
|
|
412
412
|
type GetConversationResponsePayload = {
|
|
413
413
|
conversation: {
|
|
@@ -435,13 +435,13 @@ declare class GetConversationResponse {
|
|
|
435
435
|
* @see https://greatdetail.com
|
|
436
436
|
*/
|
|
437
437
|
|
|
438
|
-
interface Options$
|
|
438
|
+
interface Options$j {
|
|
439
439
|
request?: RequestInit;
|
|
440
440
|
}
|
|
441
441
|
declare class ListConversations {
|
|
442
442
|
protected _transport: FetchTransport;
|
|
443
443
|
constructor(_transport: FetchTransport);
|
|
444
|
-
send({ request }?: Options$
|
|
444
|
+
send({ request }?: Options$j): Promise<ListConversationsResponse>;
|
|
445
445
|
}
|
|
446
446
|
type ListConversationsResponsePayload = {
|
|
447
447
|
conversations: {
|
|
@@ -469,14 +469,14 @@ declare class ListConversationsResponse {
|
|
|
469
469
|
* @see https://greatdetail.com
|
|
470
470
|
*/
|
|
471
471
|
|
|
472
|
-
interface Options$
|
|
472
|
+
interface Options$i {
|
|
473
473
|
id: string;
|
|
474
474
|
request?: RequestInit;
|
|
475
475
|
}
|
|
476
476
|
declare class ListLabelConversations {
|
|
477
477
|
protected _transport: FetchTransport;
|
|
478
478
|
constructor(_transport: FetchTransport);
|
|
479
|
-
send({ id, request }: Options$
|
|
479
|
+
send({ id, request }: Options$i): Promise<ListLabelConversationsResponse>;
|
|
480
480
|
}
|
|
481
481
|
type ListLabelConversationsResponsePayload = {
|
|
482
482
|
conversations: {
|
|
@@ -504,7 +504,7 @@ declare class ListLabelConversationsResponse {
|
|
|
504
504
|
* @see https://greatdetail.com
|
|
505
505
|
*/
|
|
506
506
|
|
|
507
|
-
interface Options$
|
|
507
|
+
interface Options$h {
|
|
508
508
|
id: string;
|
|
509
509
|
body: z.infer<typeof UpdateConversation.SCHEMA>;
|
|
510
510
|
request?: RequestInit;
|
|
@@ -519,7 +519,7 @@ declare class UpdateConversation {
|
|
|
519
519
|
hasEnded: boolean;
|
|
520
520
|
}>;
|
|
521
521
|
constructor(_transport: FetchTransport);
|
|
522
|
-
send({ id, body, request }: Options$
|
|
522
|
+
send({ id, body, request }: Options$h): Promise<UpdateConversationResponse>;
|
|
523
523
|
}
|
|
524
524
|
type UpdateConversationResponsePayload = {
|
|
525
525
|
conversation: {
|
|
@@ -547,7 +547,7 @@ declare class UpdateConversationResponse {
|
|
|
547
547
|
* @see https://greatdetail.com
|
|
548
548
|
*/
|
|
549
549
|
|
|
550
|
-
interface Options$
|
|
550
|
+
interface Options$g {
|
|
551
551
|
body: z.infer<typeof CreateLabel.SCHEMA>;
|
|
552
552
|
request?: RequestInit;
|
|
553
553
|
}
|
|
@@ -567,7 +567,7 @@ declare class CreateLabel {
|
|
|
567
567
|
description?: string | undefined;
|
|
568
568
|
}>;
|
|
569
569
|
constructor(_transport: FetchTransport);
|
|
570
|
-
send({ body, request }: Options$
|
|
570
|
+
send({ body, request }: Options$g): Promise<CreateLabelResponse>;
|
|
571
571
|
}
|
|
572
572
|
type CreateLabelResponsePayload = {
|
|
573
573
|
label: {
|
|
@@ -594,14 +594,14 @@ declare class CreateLabelResponse {
|
|
|
594
594
|
* @see https://greatdetail.com
|
|
595
595
|
*/
|
|
596
596
|
|
|
597
|
-
interface Options$
|
|
597
|
+
interface Options$f {
|
|
598
598
|
id: string;
|
|
599
599
|
request?: RequestInit;
|
|
600
600
|
}
|
|
601
601
|
declare class DeleteLabel {
|
|
602
602
|
protected _transport: FetchTransport;
|
|
603
603
|
constructor(_transport: FetchTransport);
|
|
604
|
-
send({ id, request }: Options$
|
|
604
|
+
send({ id, request }: Options$f): Promise<DeleteLabelResponse>;
|
|
605
605
|
}
|
|
606
606
|
type DeleteLabelResponsePayload = Record<string, never>;
|
|
607
607
|
declare class DeleteLabelResponse {
|
|
@@ -619,14 +619,14 @@ declare class DeleteLabelResponse {
|
|
|
619
619
|
* @see https://greatdetail.com
|
|
620
620
|
*/
|
|
621
621
|
|
|
622
|
-
interface Options$
|
|
622
|
+
interface Options$e {
|
|
623
623
|
id: string;
|
|
624
624
|
request?: RequestInit;
|
|
625
625
|
}
|
|
626
626
|
declare class GetLabel {
|
|
627
627
|
protected _transport: FetchTransport;
|
|
628
628
|
constructor(_transport: FetchTransport);
|
|
629
|
-
send({ id, request }: Options$
|
|
629
|
+
send({ id, request }: Options$e): Promise<GetLabelResponse>;
|
|
630
630
|
}
|
|
631
631
|
type GetLabelResponsePayload = {
|
|
632
632
|
label: {
|
|
@@ -653,13 +653,13 @@ declare class GetLabelResponse {
|
|
|
653
653
|
* @see https://greatdetail.com
|
|
654
654
|
*/
|
|
655
655
|
|
|
656
|
-
interface Options$
|
|
656
|
+
interface Options$d {
|
|
657
657
|
request?: RequestInit;
|
|
658
658
|
}
|
|
659
659
|
declare class ListLabels {
|
|
660
660
|
protected _transport: FetchTransport;
|
|
661
661
|
constructor(_transport: FetchTransport);
|
|
662
|
-
send({ request }?: Options$
|
|
662
|
+
send({ request }?: Options$d): Promise<ListLabelsResponse>;
|
|
663
663
|
}
|
|
664
664
|
type ListLabelsResponsePayload = {
|
|
665
665
|
labels: {
|
|
@@ -686,7 +686,7 @@ declare class ListLabelsResponse {
|
|
|
686
686
|
* @see https://greatdetail.com
|
|
687
687
|
*/
|
|
688
688
|
|
|
689
|
-
interface Options$
|
|
689
|
+
interface Options$c {
|
|
690
690
|
id: string;
|
|
691
691
|
body: z.infer<typeof UpdateLabel.SCHEMA>;
|
|
692
692
|
request?: RequestInit;
|
|
@@ -704,7 +704,7 @@ declare class UpdateLabel {
|
|
|
704
704
|
description?: string | undefined;
|
|
705
705
|
}>;
|
|
706
706
|
constructor(_transport: FetchTransport);
|
|
707
|
-
send({ id, body, request }: Options$
|
|
707
|
+
send({ id, body, request }: Options$c): Promise<UpdateLabelResponse>;
|
|
708
708
|
}
|
|
709
709
|
type UpdateLabelResponsePayload = {
|
|
710
710
|
label: {
|
|
@@ -731,14 +731,14 @@ declare class UpdateLabelResponse {
|
|
|
731
731
|
* @see https://greatdetail.com
|
|
732
732
|
*/
|
|
733
733
|
|
|
734
|
-
interface Options$
|
|
734
|
+
interface Options$b {
|
|
735
735
|
id: string;
|
|
736
736
|
request?: RequestInit;
|
|
737
737
|
}
|
|
738
738
|
declare class ListConversationMessages {
|
|
739
739
|
protected _transport: FetchTransport;
|
|
740
740
|
constructor(_transport: FetchTransport);
|
|
741
|
-
send({ id, request }: Options$
|
|
741
|
+
send({ id, request }: Options$b): Promise<ListConversationMessagesResponse>;
|
|
742
742
|
}
|
|
743
743
|
type ListConversationMessagesResponsePayload = {
|
|
744
744
|
messages: {
|
|
@@ -774,13 +774,13 @@ declare class ListConversationMessagesResponse {
|
|
|
774
774
|
* @see https://greatdetail.com
|
|
775
775
|
*/
|
|
776
776
|
|
|
777
|
-
interface Options$
|
|
777
|
+
interface Options$a {
|
|
778
778
|
request?: RequestInit;
|
|
779
779
|
}
|
|
780
780
|
declare class ListMessages {
|
|
781
781
|
protected _transport: FetchTransport;
|
|
782
782
|
constructor(_transport: FetchTransport);
|
|
783
|
-
send({ request }?: Options$
|
|
783
|
+
send({ request }?: Options$a): Promise<ListMessagesResponse>;
|
|
784
784
|
}
|
|
785
785
|
type ListMessagesResponsePayload = {
|
|
786
786
|
messages: {
|
|
@@ -816,7 +816,7 @@ declare class ListMessagesResponse {
|
|
|
816
816
|
* @see https://greatdetail.com
|
|
817
817
|
*/
|
|
818
818
|
|
|
819
|
-
interface Options$
|
|
819
|
+
interface Options$9 {
|
|
820
820
|
id: string;
|
|
821
821
|
body: z.infer<typeof CreateCorrectionModel.SCHEMA>;
|
|
822
822
|
request?: RequestInit;
|
|
@@ -837,7 +837,7 @@ declare class CreateCorrectionModel {
|
|
|
837
837
|
correction: string;
|
|
838
838
|
}>;
|
|
839
839
|
constructor(_transport: FetchTransport);
|
|
840
|
-
send({ id, body, request }: Options$
|
|
840
|
+
send({ id, body, request }: Options$9): Promise<CreateCorrectionModelResponse>;
|
|
841
841
|
}
|
|
842
842
|
type CreateCorrectionResponsePayload = unknown;
|
|
843
843
|
declare class CreateCorrectionModelResponse {
|
|
@@ -855,14 +855,14 @@ declare class CreateCorrectionModelResponse {
|
|
|
855
855
|
* @see https://greatdetail.com
|
|
856
856
|
*/
|
|
857
857
|
|
|
858
|
-
interface Options$
|
|
858
|
+
interface Options$8 {
|
|
859
859
|
id: string;
|
|
860
860
|
request?: RequestInit;
|
|
861
861
|
}
|
|
862
862
|
declare class GetModel {
|
|
863
863
|
protected _transport: FetchTransport;
|
|
864
864
|
constructor(_transport: FetchTransport);
|
|
865
|
-
send({ id, request }: Options$
|
|
865
|
+
send({ id, request }: Options$8): Promise<GetModelResponse>;
|
|
866
866
|
}
|
|
867
867
|
type GetModelResponsePayload = {
|
|
868
868
|
model: {
|
|
@@ -888,13 +888,13 @@ declare class GetModelResponse {
|
|
|
888
888
|
* @see https://greatdetail.com
|
|
889
889
|
*/
|
|
890
890
|
|
|
891
|
-
interface Options$
|
|
891
|
+
interface Options$7 {
|
|
892
892
|
request?: RequestInit;
|
|
893
893
|
}
|
|
894
894
|
declare class ListModels {
|
|
895
895
|
protected _transport: FetchTransport;
|
|
896
896
|
constructor(_transport: FetchTransport);
|
|
897
|
-
send({ request }?: Options$
|
|
897
|
+
send({ request }?: Options$7): Promise<ListModelsResponse>;
|
|
898
898
|
}
|
|
899
899
|
type ListModelsResponsePayload = {
|
|
900
900
|
models: {
|
|
@@ -920,7 +920,7 @@ declare class ListModelsResponse {
|
|
|
920
920
|
* @see https://greatdetail.com
|
|
921
921
|
*/
|
|
922
922
|
|
|
923
|
-
interface Options$
|
|
923
|
+
interface Options$6 {
|
|
924
924
|
id: string;
|
|
925
925
|
body: z.infer<typeof CreateResponseModel.SCHEMA>;
|
|
926
926
|
request?: RequestInit;
|
|
@@ -938,7 +938,7 @@ declare class CreateResponseModel {
|
|
|
938
938
|
content: string | null;
|
|
939
939
|
}>, "many">;
|
|
940
940
|
constructor(_transport: FetchTransport);
|
|
941
|
-
send({ id, body, request }: Options$
|
|
941
|
+
send({ id, body, request }: Options$6): Promise<CreateResponseModelResponse>;
|
|
942
942
|
}
|
|
943
943
|
type CreateResponseResponsePayload = {
|
|
944
944
|
message: string | null;
|
|
@@ -962,14 +962,14 @@ declare class CreateResponseModelResponse {
|
|
|
962
962
|
* @see https://greatdetail.com
|
|
963
963
|
*/
|
|
964
964
|
|
|
965
|
-
interface Options$
|
|
965
|
+
interface Options$5 {
|
|
966
966
|
id: string;
|
|
967
967
|
request?: RequestInit;
|
|
968
968
|
}
|
|
969
969
|
declare class GetNote {
|
|
970
970
|
protected _transport: FetchTransport;
|
|
971
971
|
constructor(_transport: FetchTransport);
|
|
972
|
-
send({ id, request }: Options$
|
|
972
|
+
send({ id, request }: Options$5): Promise<GetNoteResponse>;
|
|
973
973
|
}
|
|
974
974
|
type GetNoteResponsePayload = {
|
|
975
975
|
note: {
|
|
@@ -985,6 +985,38 @@ declare class GetNoteResponse {
|
|
|
985
985
|
result(): Promise<GetNoteResponsePayload>;
|
|
986
986
|
}
|
|
987
987
|
|
|
988
|
+
/**
|
|
989
|
+
* Great Detail Support System.
|
|
990
|
+
*
|
|
991
|
+
* @copyright 2024 Great Detail Ltd
|
|
992
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
993
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
994
|
+
* @see https://greatdetail.com
|
|
995
|
+
*/
|
|
996
|
+
|
|
997
|
+
interface Options$4 {
|
|
998
|
+
id: string;
|
|
999
|
+
request?: RequestInit;
|
|
1000
|
+
}
|
|
1001
|
+
declare class ListConversationNotes {
|
|
1002
|
+
protected _transport: FetchTransport;
|
|
1003
|
+
constructor(_transport: FetchTransport);
|
|
1004
|
+
send({ id, request }: Options$4): Promise<ListConversationNotesResponse>;
|
|
1005
|
+
}
|
|
1006
|
+
type ListConversationNotesResponsePayload = {
|
|
1007
|
+
notes: {
|
|
1008
|
+
id: string;
|
|
1009
|
+
content: string;
|
|
1010
|
+
createdAt: string;
|
|
1011
|
+
updatedAt: string;
|
|
1012
|
+
}[];
|
|
1013
|
+
};
|
|
1014
|
+
declare class ListConversationNotesResponse {
|
|
1015
|
+
response: Response;
|
|
1016
|
+
constructor(response: Response);
|
|
1017
|
+
result(): Promise<ListConversationNotesResponsePayload>;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
988
1020
|
/**
|
|
989
1021
|
* Great Detail Support System.
|
|
990
1022
|
*
|
|
@@ -1131,6 +1163,9 @@ declare class Client {
|
|
|
1131
1163
|
message: {
|
|
1132
1164
|
list: ListConversationMessages;
|
|
1133
1165
|
};
|
|
1166
|
+
note: {
|
|
1167
|
+
list: ListConversationNotes;
|
|
1168
|
+
};
|
|
1134
1169
|
};
|
|
1135
1170
|
get label(): {
|
|
1136
1171
|
create: CreateLabel;
|
|
@@ -1168,4 +1203,4 @@ declare class Client {
|
|
|
1168
1203
|
};
|
|
1169
1204
|
}
|
|
1170
1205
|
|
|
1171
|
-
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$
|
|
1206
|
+
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$u 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 GetNoteResponsePayload as t, type UpdateNoteResponsePayload as u, type ListConversationNotesResponsePayload as v, type GetSourceResponsePayload as w, type ListSourcesResponsePayload as x };
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Mt=Object.create;var W=Object.defineProperty;var Dt=Object.getOwnPropertyDescriptor;var Gt=Object.getOwnPropertyNames;var zt=Object.getPrototypeOf,Vt=Object.prototype.hasOwnProperty;var vt=(e,t)=>{for(var r in t)W(e,r,{get:t[r],enumerable:!0})},Ot=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Gt(t))!Vt.call(e,o)&&o!==r&&W(e,o,{get:()=>t[o],enumerable:!(s=Dt(t,o))||s.enumerable});return e};var Bt=(e,t,r)=>(r=e!=null?Mt(zt(e)):{},Ot(t||!e||!e.__esModule?W(r,"default",{value:e,enumerable:!0}):r,e)),Kt=e=>Ot(W({},"__esModule",{value:!0}),e);var kt={};vt(kt,{Client:()=>m,DEFAULT_SUPPORT_BASE_URL:()=>X,Error:()=>St,KeyAuthentication:()=>J,PublicAuthentication:()=>$,TokenAuthentication:()=>Y,default:()=>m});module.exports=Kt(kt);var X="https://api.support.greatdetail.com",wt={"X-Powered-By":"GDSupport/JavaScript"},Ut="api-key";var h=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"}).then(r=>new Z(r))}},Z=class{constructor(t){this.response=t}async result(){return this.response.json()}};var g=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"}).then(r=>new tt(r))}},tt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Ft="SUPPORT_ACCESS_TOKEN",Lt="SUPPORT_API_KEY",qt="SUPPORT_KEY_NAME",It="SUPPORT_BASE_URL";var f=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 l=require("zod"),y=class e{constructor(t){this._transport=t}static SCHEMA=l.z.object({name:l.z.string(),account:l.z.string(),emailAddress:l.z.string().email().optional(),telephoneNumber:l.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 et(s))}},et=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/contacts/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new rt(s))}},rt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var R=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/contacts",{...t,method:"GET"}).then(r=>new st(r))}},st=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:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...r,method:"GET"}).then(s=>new ot(s))}},ot=class{constructor(t){this.response=t}async result(){return this.response.json()}};var A=require("zod"),P=class e{constructor(t){this._transport=t}static SCHEMA=A.z.object({name:A.z.string().optional(),emailAddress:A.z.string().email().optional(),telephoneNumber:A.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 nt(o))}},nt=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/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 _=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/conversations",{...t,method:"GET"}).then(r=>new at(r))}},at=class{constructor(t){this.response=t}async result(){return this.response.json()}};var C=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 pt(s))}},pt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var ct=require("zod"),E=class e{constructor(t){this._transport=t}static SCHEMA=ct.z.object({hasEnded:ct.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 dt(o))}},dt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var S=require("zod"),v=class e{constructor(t){this._transport=t}static SCHEMA=S.z.object({title:S.z.string(),description:S.z.string().optional(),account:S.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 ut(s))}},ut=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:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"DELETE"}).then(s=>new lt(s))}},lt=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/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 U=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/labels",{...t,method:"GET"}).then(r=>new ht(r))}},ht=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Q=require("zod"),F=class e{constructor(t){this._transport=t}static SCHEMA=Q.z.object({title:Q.z.string().optional(),description:Q.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 gt(o))}},gt=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/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET"}).then(s=>new ft(s))}},ft=class{constructor(t){this.response=t}async result(){return this.response.json()}};var q=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"}).then(r=>new yt(r))}},yt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var I=require("zod"),N=class e{constructor(t){this._transport=t}static SCHEMA=I.z.object({input:I.z.string().max(65536),original:I.z.string().max(65536),correction:I.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 bt(o))}},bt=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/models/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new Rt(s))}},Rt=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/models",{...t,method:"GET"}).then(r=>new xt(r))}},xt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var M=require("zod"),D=class e{constructor(t){this._transport=t}static SCHEMA=M.z.array(M.z.object({role:M.z.enum(["user","assistant"]),content:M.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 At(o))}},At=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/notes/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new Pt(s))}},Pt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Tt=require("zod"),z=class e{constructor(t){this._transport=t}static SCHEMA=Tt.z.object({content:Tt.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 _t(o))}},_t=class{constructor(t){this.response=t}async result(){return this.response.json()}};var V=class e{constructor(t=e.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=wt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var B=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 Ct(s))}},Ct=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/sources",{...t,method:"GET"}).then(r=>new Et(r))}},Et=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Nt=Bt(require("is-network-error"),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 u=class extends n{static badRequest(){return new this("Bad request")}};var k=class{options;constructor({baseURL:t,fetch:r=fetch,...s}){this.options={...s,fetch: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[jt,Ht]of Object.entries(o))r.headers.set(jt,Ht)}return new Request(this.getURL(t),r)}async send(t,r){return await this.options.fetch(this.getRequest(t,r)).then(s=>{if(!s.ok){let o=s.status;switch(console.error(JSON.stringify(s)),o){case 400:throw u.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,Nt.default)(s)?new d("A network error occurred",{cause:s}):s})}};var m=class e{static DEFAULT_BASE_URL=X;_transport;constructor(t,{baseURL:r,...s}={}){this._transport=new k({requestFilterables:[new V,t],...s,baseURL:r?.toString()??e.getBaseURL()})}static getBaseURL(){return process.env[It]??this.DEFAULT_BASE_URL}get action(){return{list:new h(this._transport)}}get channel(){return{list:new g(this._transport)}}get contact(){return{get:new b(this._transport),list:new R(this._transport),update:new P(this._transport),create:new y(this._transport),vcf:{get:new f(this._transport)}}}get conversation(){return{get:new T(this._transport),list:new _(this._transport),update:new E(this._transport),message:{list:new L(this._transport)}}}get label(){return{create:new v(this._transport),get:new w(this._transport),list:new U(this._transport),update:new F(this._transport),delete:new O(this._transport),contact:{list:new x(this._transport)},conversation:{list:new C(this._transport)}}}get message(){return{list:new q(this._transport)}}get model(){return{get:new j(this._transport),list:new H(this._transport),response:{create:new D(this._transport)},correction:{create:new N(this._transport)}}}get note(){return{get:new G(this._transport),update:new z(this._transport)}}get source(){return{get:new B(this._transport),list:new K(this._transport)}}};var St={};vt(St,{AuthError:()=>i,AuthenticationError:()=>p,AuthorizationError:()=>c,LogicError:()=>a,NetworkError:()=>d,SupportError:()=>n,ValidationError:()=>u});var J=class e{static DEFAULT_NAME=Ut;name;#t;constructor({name:t=process.env[qt]??e.DEFAULT_NAME,key:r=process.env[Lt]}={}){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 Y=class{#t;constructor({token:t=process.env[Ft]}={}){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 $=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 Dt=Object.create;var X=Object.defineProperty;var zt=Object.getOwnPropertyDescriptor;var Vt=Object.getOwnPropertyNames;var Bt=Object.getPrototypeOf,Kt=Object.prototype.hasOwnProperty;var wt=(e,t)=>{for(var r in t)X(e,r,{get:t[r],enumerable:!0})},Ut=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Vt(t))!Kt.call(e,o)&&o!==r&&X(e,o,{get:()=>t[o],enumerable:!(s=zt(t,o))||s.enumerable});return e};var kt=(e,t,r)=>(r=e!=null?Dt(Bt(e)):{},Ut(t||!e||!e.__esModule?X(r,"default",{value:e,enumerable:!0}):r,e)),Jt=e=>Ut(X({},"__esModule",{value:!0}),e);var Yt={};wt(Yt,{Client:()=>m,DEFAULT_SUPPORT_BASE_URL:()=>Q,Error:()=>Ot,KeyAuthentication:()=>Y,PublicAuthentication:()=>W,TokenAuthentication:()=>$,default:()=>m});module.exports=Jt(Yt);var Q="https://api.support.greatdetail.com",Ft={"X-Powered-By":"GDSupport/JavaScript"},Lt="api-key";var h=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"}).then(r=>new tt(r))}},tt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var g=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 qt="SUPPORT_ACCESS_TOKEN",It="SUPPORT_API_KEY",Nt="SUPPORT_KEY_NAME",jt="SUPPORT_BASE_URL";var f=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 l=require("zod"),y=class e{constructor(t){this._transport=t}static SCHEMA=l.z.object({name:l.z.string(),account:l.z.string(),emailAddress:l.z.string().email().optional(),telephoneNumber:l.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 rt(s))}},rt=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/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 R=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/contacts",{...t,method:"GET"}).then(r=>new ot(r))}},ot=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:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...r,method:"GET"}).then(s=>new nt(s))}},nt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var A=require("zod"),P=class e{constructor(t){this._transport=t}static SCHEMA=A.z.object({name:A.z.string().optional(),emailAddress:A.z.string().email().optional(),telephoneNumber:A.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 it(o))}},it=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/conversations/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new at(s))}},at=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/conversations",{...t,method:"GET"}).then(r=>new pt(r))}},pt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var C=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 ct(s))}},ct=class{constructor(t){this.response=t}async result(){return this.response.json()}};var dt=require("zod"),E=class e{constructor(t){this._transport=t}static SCHEMA=dt.z.object({hasEnded:dt.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 ut(o))}},ut=class{constructor(t){this.response=t}async result(){return this.response.json()}};var v=require("zod"),S=class e{constructor(t){this._transport=t}static SCHEMA=v.z.object({title:v.z.string(),description:v.z.string().optional(),account:v.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 O=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 mt(s))}},mt=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/labels/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new ht(s))}},ht=class{constructor(t){this.response=t}async result(){return this.response.json()}};var U=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 Z=require("zod"),F=class e{constructor(t){this._transport=t}static SCHEMA=Z.z.object({title:Z.z.string().optional(),description:Z.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 ft(o))}},ft=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/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET"}).then(s=>new yt(s))}},yt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var q=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"}).then(r=>new bt(r))}},bt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var I=require("zod"),N=class e{constructor(t){this._transport=t}static SCHEMA=I.z.object({input:I.z.string().max(65536),original:I.z.string().max(65536),correction:I.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 Rt(o))}},Rt=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/models/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new xt(s))}},xt=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/models",{...t,method:"GET"}).then(r=>new At(r))}},At=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.array(M.z.object({role:M.z.enum(["user","assistant"]),content:M.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 Pt(o))}},Pt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var D=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 Tt(s))}},Tt=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/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"GET"}).then(s=>new _t(s))}},_t=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Ct=require("zod"),V=class e{constructor(t){this._transport=t}static SCHEMA=Ct.z.object({content:Ct.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 Et(o))}},Et=class{constructor(t){this.response=t}async result(){return this.response.json()}};var B=class e{constructor(t=e.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Ft;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var K=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 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/sources",{...t,method:"GET"}).then(r=>new St(r))}},St=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Ht=kt(require("is-network-error"),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 u=class extends n{static badRequest(){return new this("Bad request")}};var J=class{options;constructor({baseURL:t,fetch:r=fetch,...s}){this.options={...s,fetch: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[Mt,Gt]of Object.entries(o))r.headers.set(Mt,Gt)}return new Request(this.getURL(t),r)}async send(t,r){return await this.options.fetch(this.getRequest(t,r)).then(s=>{if(!s.ok){let o=s.status;switch(console.error(JSON.stringify(s)),o){case 400:throw u.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,Ht.default)(s)?new d("A network error occurred",{cause:s}):s})}};var m=class e{static DEFAULT_BASE_URL=Q;_transport;constructor(t,{baseURL:r,...s}={}){this._transport=new J({requestFilterables:[new B,t],...s,baseURL:r?.toString()??e.getBaseURL()})}static getBaseURL(){return process.env[jt]??this.DEFAULT_BASE_URL}get action(){return{list:new h(this._transport)}}get channel(){return{list:new g(this._transport)}}get contact(){return{get:new b(this._transport),list:new R(this._transport),update:new P(this._transport),create:new y(this._transport),vcf:{get:new f(this._transport)}}}get conversation(){return{get:new T(this._transport),list:new _(this._transport),update:new E(this._transport),message:{list:new L(this._transport)},note:{list:new z(this._transport)}}}get label(){return{create:new S(this._transport),get:new w(this._transport),list:new U(this._transport),update:new F(this._transport),delete:new O(this._transport),contact:{list:new x(this._transport)},conversation:{list:new C(this._transport)}}}get message(){return{list:new q(this._transport)}}get model(){return{get:new j(this._transport),list:new H(this._transport),response:{create:new G(this._transport)},correction:{create:new N(this._transport)}}}get note(){return{get:new D(this._transport),update:new V(this._transport)}}get source(){return{get:new K(this._transport),list:new k(this._transport)}}};var Ot={};wt(Ot,{AuthError:()=>i,AuthenticationError:()=>p,AuthorizationError:()=>c,LogicError:()=>a,NetworkError:()=>d,SupportError:()=>n,ValidationError:()=>u});var Y=class e{static DEFAULT_NAME=Lt;name;#t;constructor({name:t=process.env[Nt]??e.DEFAULT_NAME,key:r=process.env[It]}={}){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 $=class{#t;constructor({token:t=process.env[qt]}={}){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 W=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, e as CreateContactResponsePayload, r as CreateCorrectionResponsePayload, j as CreateLabelResponsePayload, s as CreateResponseResponsePayload, D as DeleteLabelResponsePayload, G as GetContactResponsePayload, f as GetConversationResponsePayload, k as GetLabelResponsePayload, p as GetModelResponsePayload, t as GetNoteResponsePayload,
|
|
1
|
+
import { A as Authentication } from './index-cTKZe1yJ.cjs';
|
|
2
|
+
export { C as Client, e as CreateContactResponsePayload, r as CreateCorrectionResponsePayload, j as CreateLabelResponsePayload, s as CreateResponseResponsePayload, D as DeleteLabelResponsePayload, G as GetContactResponsePayload, f as GetConversationResponsePayload, k as GetLabelResponsePayload, p as GetModelResponsePayload, t as GetNoteResponsePayload, w as GetSourceResponsePayload, L as ListActionsResponsePayload, b as ListChannelsResponsePayload, c as ListContactsResponsePayload, n as ListConversationMessagesResponsePayload, v as ListConversationNotesResponsePayload, g as ListConversationsResponsePayload, d as ListLabelContactsResponsePayload, h as ListLabelConversationsResponsePayload, l as ListLabelsResponsePayload, o as ListMessagesResponsePayload, q as ListModelsResponsePayload, x as ListSourcesResponsePayload, O as Options, R as RequestFilterable, a as TransportOptions, U as UpdateContactResponsePayload, i as UpdateConversationResponsePayload, m as UpdateLabelResponsePayload, u as UpdateNoteResponsePayload, C as default } from './index-cTKZe1yJ.cjs';
|
|
3
3
|
import 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as Authentication } from './index-
|
|
2
|
-
export { C as Client, e as CreateContactResponsePayload, r as CreateCorrectionResponsePayload, j as CreateLabelResponsePayload, s as CreateResponseResponsePayload, D as DeleteLabelResponsePayload, G as GetContactResponsePayload, f as GetConversationResponsePayload, k as GetLabelResponsePayload, p as GetModelResponsePayload, t as GetNoteResponsePayload,
|
|
1
|
+
import { A as Authentication } from './index-cTKZe1yJ.js';
|
|
2
|
+
export { C as Client, e as CreateContactResponsePayload, r as CreateCorrectionResponsePayload, j as CreateLabelResponsePayload, s as CreateResponseResponsePayload, D as DeleteLabelResponsePayload, G as GetContactResponsePayload, f as GetConversationResponsePayload, k as GetLabelResponsePayload, p as GetModelResponsePayload, t as GetNoteResponsePayload, w as GetSourceResponsePayload, L as ListActionsResponsePayload, b as ListChannelsResponsePayload, c as ListContactsResponsePayload, n as ListConversationMessagesResponsePayload, v as ListConversationNotesResponsePayload, g as ListConversationsResponsePayload, d as ListLabelContactsResponsePayload, h as ListLabelConversationsResponsePayload, l as ListLabelsResponsePayload, o as ListMessagesResponsePayload, q as ListModelsResponsePayload, x as ListSourcesResponsePayload, O as Options, R as RequestFilterable, a as TransportOptions, U as UpdateContactResponsePayload, i as UpdateConversationResponsePayload, m as UpdateLabelResponsePayload, u as UpdateNoteResponsePayload, C as default } from './index-cTKZe1yJ.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as P,b as A,c as a,d as p,e as n,f as i,g as f,h as l,i as m,j as y,k as d,l as u,m as x,n as c,o as h}from"./chunk-
|
|
1
|
+
import{a as P,b as A,c as a,d as p,e as n,f as i,g as f,h as l,i as m,j as y,k as d,l as u,m as x,n as c,o as h}from"./chunk-ALRXWW2N.js";var R={};P(R,{AuthError:()=>l,AuthenticationError:()=>m,AuthorizationError:()=>y,LogicError:()=>d,NetworkError:()=>u,SupportError:()=>f,ValidationError:()=>x});var o=class r{static DEFAULT_NAME=a;name;#e;constructor({name:e=process.env[i]??r.DEFAULT_NAME,key:s=process.env[n]}={}){if(!s)throw new Error("API Key option must be specified when using Key Authentication");this.name=e,this.#e=s}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#e)}`}}};var t=class{#e;constructor({token:e=process.env[p]}={}){if(!e)throw new Error("Access Token option must be specified when using Token Authentication");this.#e=e}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Bearer ${this.#e}`}}};export{c as Client,A as DEFAULT_SUPPORT_BASE_URL,R as Error,o as KeyAuthentication,h as PublicAuthentication,t as TokenAuthentication,c as default};
|
package/package.json
CHANGED
package/src/Client/index.ts
CHANGED
|
@@ -34,6 +34,7 @@ import GetModel from "../Model/GetModel.js";
|
|
|
34
34
|
import ListModels from "../Model/ListModels.js";
|
|
35
35
|
import CreateResponseModel from "../Model/Response/CreateResponseModel.js";
|
|
36
36
|
import GetNote from "../Note/GetNote.js";
|
|
37
|
+
import ListConversationNotes from "../Note/ListConversationNotes.js";
|
|
37
38
|
import UpdateNote from "../Note/UpdateNote.js";
|
|
38
39
|
import RequestStandardHeaders from "../Request/RequestStandardHeaders.js";
|
|
39
40
|
import GetSource from "../Source/GetSource.js";
|
|
@@ -96,6 +97,9 @@ export default class Client {
|
|
|
96
97
|
message: {
|
|
97
98
|
list: new ListConversationMessages(this._transport),
|
|
98
99
|
},
|
|
100
|
+
note: {
|
|
101
|
+
list: new ListConversationNotes(this._transport),
|
|
102
|
+
},
|
|
99
103
|
};
|
|
100
104
|
}
|
|
101
105
|
|
|
@@ -0,0 +1,45 @@
|
|
|
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 ListConversationNotes {
|
|
18
|
+
constructor(protected _transport: FetchTransport) {}
|
|
19
|
+
|
|
20
|
+
public async send({ id, request = {} }: Options) {
|
|
21
|
+
return this._transport
|
|
22
|
+
.send("v1/conversations/" + encodeURIComponent(id) + "/notes", {
|
|
23
|
+
...request,
|
|
24
|
+
method: "GET",
|
|
25
|
+
})
|
|
26
|
+
.then((response) => new ListConversationNotesResponse(response));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export type ListConversationNotesResponsePayload = {
|
|
31
|
+
notes: {
|
|
32
|
+
id: string;
|
|
33
|
+
content: string;
|
|
34
|
+
createdAt: string;
|
|
35
|
+
updatedAt: string;
|
|
36
|
+
}[];
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export class ListConversationNotesResponse {
|
|
40
|
+
constructor(public response: Response) {}
|
|
41
|
+
|
|
42
|
+
public async result(): Promise<ListConversationNotesResponsePayload> {
|
|
43
|
+
return this.response.json();
|
|
44
|
+
}
|
|
45
|
+
}
|