@great-detail/support-sdk 0.2.2 → 0.2.4

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.
@@ -27,7 +27,7 @@ interface RequestFilterable {
27
27
  * @see https://greatdetail.com
28
28
  */
29
29
 
30
- interface Options$t {
30
+ interface Options$x {
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$t {
46
+ interface InputOptions extends Options$x {
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$s extends Options$t {
57
+ interface Options$w extends Options$x {
58
58
  baseURL: string;
59
59
  fetch: typeof fetch;
60
60
  }
61
61
  declare class FetchTransport implements Transport {
62
- options: Options$s;
62
+ options: Options$w;
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$r {
78
+ interface Options$v {
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$r): Promise<ListActionsResponse>;
84
+ send({ request }?: Options$v): 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$q {
126
+ interface Options$u {
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$q): Promise<ListChannelsResponse>;
132
+ send({ request }?: Options$u): 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$p {
173
+ interface Options$t {
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$p): string;
187
- getURL(options: Options$p): string;
186
+ getRelativeURL({ id, vcf }: Options$t): string;
187
+ getURL(options: Options$t): 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$o {
199
+ interface Options$s {
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$o): Promise<CreateContactResponse>;
222
+ send({ body, request }: Options$s): 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$n {
250
+ interface Options$r {
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$n): Promise<GetContactResponse>;
257
+ send({ id, request }: Options$r): 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$m {
285
+ interface Options$q {
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$m): Promise<ListContactsResponse>;
291
+ send({ request }?: Options$q): 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$l {
319
+ interface Options$p {
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$l): Promise<ListLabelContactsResponse>;
326
+ send({ id, request }: Options$p): 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$k {
354
+ interface Options$o {
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$k): Promise<UpdateContactResponse>;
375
+ send({ id, body, request }: Options$o): 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$j {
403
+ interface Options$n {
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$j): Promise<GetConversationResponse>;
410
+ send({ id, request }: Options$n): 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$i {
438
+ interface Options$m {
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$i): Promise<ListConversationsResponse>;
444
+ send({ request }?: Options$m): 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$h {
472
+ interface Options$l {
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$h): Promise<ListLabelConversationsResponse>;
479
+ send({ id, request }: Options$l): 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$g {
507
+ interface Options$k {
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$g): Promise<UpdateConversationResponse>;
522
+ send({ id, body, request }: Options$k): 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$f {
550
+ interface Options$j {
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$f): Promise<CreateLabelResponse>;
570
+ send({ body, request }: Options$j): 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$e {
597
+ interface Options$i {
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$e): Promise<DeleteLabelResponse>;
604
+ send({ id, request }: Options$i): 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$d {
622
+ interface Options$h {
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$d): Promise<GetLabelResponse>;
629
+ send({ id, request }: Options$h): 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$c {
656
+ interface Options$g {
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$c): Promise<ListLabelsResponse>;
662
+ send({ request }?: Options$g): 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$b {
689
+ interface Options$f {
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$b): Promise<UpdateLabelResponse>;
707
+ send({ id, body, request }: Options$f): 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$a {
734
+ interface Options$e {
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$a): Promise<ListConversationMessagesResponse>;
741
+ send({ id, request }: Options$e): 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$9 {
777
+ interface Options$d {
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$9): Promise<ListMessagesResponse>;
783
+ send({ request }?: Options$d): 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$8 {
819
+ interface Options$c {
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$8): Promise<CreateCorrectionModelResponse>;
840
+ send({ id, body, request }: Options$c): 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$7 {
858
+ interface Options$b {
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$7): Promise<GetModelResponse>;
865
+ send({ id, request }: Options$b): 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$6 {
891
+ interface Options$a {
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$6): Promise<ListModelsResponse>;
897
+ send({ request }?: Options$a): 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$5 {
923
+ interface Options$9 {
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$5): Promise<CreateResponseModelResponse>;
941
+ send({ id, body, request }: Options$9): Promise<CreateResponseModelResponse>;
942
942
  }
943
943
  type CreateResponseResponsePayload = {
944
944
  message: string | null;
@@ -962,14 +962,94 @@ declare class CreateResponseModelResponse {
962
962
  * @see https://greatdetail.com
963
963
  */
964
964
 
965
- interface Options$4 {
965
+ interface Options$8 {
966
+ id: string;
967
+ body: z.infer<typeof CreateContactNote.SCHEMA>;
968
+ request?: RequestInit;
969
+ }
970
+ declare class CreateContactNote {
971
+ protected _transport: FetchTransport;
972
+ static SCHEMA: z.ZodObject<{
973
+ content: z.ZodString;
974
+ }, "strip", z.ZodTypeAny, {
975
+ content: string;
976
+ }, {
977
+ content: string;
978
+ }>;
979
+ constructor(_transport: FetchTransport);
980
+ send({ id, body, request }: Options$8): Promise<CreateContactNoteResponse>;
981
+ }
982
+ type CreateContactNoteResponsePayload = {
983
+ note: {
984
+ id: string;
985
+ content: string;
986
+ createdAt: string;
987
+ updatedAt: string;
988
+ };
989
+ };
990
+ declare class CreateContactNoteResponse {
991
+ response: Response;
992
+ constructor(response: Response);
993
+ result(): Promise<CreateContactNoteResponsePayload>;
994
+ }
995
+
996
+ /**
997
+ * Great Detail Support System.
998
+ *
999
+ * @copyright 2024 Great Detail Ltd
1000
+ * @author Great Detail Ltd <info@greatdetail.com>
1001
+ * @author Dom Webber <dom.webber@greatdetail.com>
1002
+ * @see https://greatdetail.com
1003
+ */
1004
+
1005
+ interface Options$7 {
1006
+ id: string;
1007
+ body: z.infer<typeof CreateConversationNote.SCHEMA>;
1008
+ request?: RequestInit;
1009
+ }
1010
+ declare class CreateConversationNote {
1011
+ protected _transport: FetchTransport;
1012
+ static SCHEMA: z.ZodObject<{
1013
+ content: z.ZodString;
1014
+ }, "strip", z.ZodTypeAny, {
1015
+ content: string;
1016
+ }, {
1017
+ content: string;
1018
+ }>;
1019
+ constructor(_transport: FetchTransport);
1020
+ send({ id, body, request }: Options$7): Promise<CreateConversationNoteResponse>;
1021
+ }
1022
+ type CreateConversationNoteResponsePayload = {
1023
+ note: {
1024
+ id: string;
1025
+ content: string;
1026
+ createdAt: string;
1027
+ updatedAt: string;
1028
+ };
1029
+ };
1030
+ declare class CreateConversationNoteResponse {
1031
+ response: Response;
1032
+ constructor(response: Response);
1033
+ result(): Promise<CreateConversationNoteResponsePayload>;
1034
+ }
1035
+
1036
+ /**
1037
+ * Great Detail Support System.
1038
+ *
1039
+ * @copyright 2024 Great Detail Ltd
1040
+ * @author Great Detail Ltd <info@greatdetail.com>
1041
+ * @author Dom Webber <dom.webber@greatdetail.com>
1042
+ * @see https://greatdetail.com
1043
+ */
1044
+
1045
+ interface Options$6 {
966
1046
  id: string;
967
1047
  request?: RequestInit;
968
1048
  }
969
1049
  declare class GetNote {
970
1050
  protected _transport: FetchTransport;
971
1051
  constructor(_transport: FetchTransport);
972
- send({ id, request }: Options$4): Promise<GetNoteResponse>;
1052
+ send({ id, request }: Options$6): Promise<GetNoteResponse>;
973
1053
  }
974
1054
  type GetNoteResponsePayload = {
975
1055
  note: {
@@ -985,6 +1065,70 @@ declare class GetNoteResponse {
985
1065
  result(): Promise<GetNoteResponsePayload>;
986
1066
  }
987
1067
 
1068
+ /**
1069
+ * Great Detail Support System.
1070
+ *
1071
+ * @copyright 2024 Great Detail Ltd
1072
+ * @author Great Detail Ltd <info@greatdetail.com>
1073
+ * @author Dom Webber <dom.webber@greatdetail.com>
1074
+ * @see https://greatdetail.com
1075
+ */
1076
+
1077
+ interface Options$5 {
1078
+ id: string;
1079
+ request?: RequestInit;
1080
+ }
1081
+ declare class ListContactNotes {
1082
+ protected _transport: FetchTransport;
1083
+ constructor(_transport: FetchTransport);
1084
+ send({ id, request }: Options$5): Promise<ListContactNotesResponse>;
1085
+ }
1086
+ type ListContactNotesResponsePayload = {
1087
+ notes: {
1088
+ id: string;
1089
+ content: string;
1090
+ createdAt: string;
1091
+ updatedAt: string;
1092
+ }[];
1093
+ };
1094
+ declare class ListContactNotesResponse {
1095
+ response: Response;
1096
+ constructor(response: Response);
1097
+ result(): Promise<ListContactNotesResponsePayload>;
1098
+ }
1099
+
1100
+ /**
1101
+ * Great Detail Support System.
1102
+ *
1103
+ * @copyright 2024 Great Detail Ltd
1104
+ * @author Great Detail Ltd <info@greatdetail.com>
1105
+ * @author Dom Webber <dom.webber@greatdetail.com>
1106
+ * @see https://greatdetail.com
1107
+ */
1108
+
1109
+ interface Options$4 {
1110
+ id: string;
1111
+ request?: RequestInit;
1112
+ }
1113
+ declare class ListConversationNotes {
1114
+ protected _transport: FetchTransport;
1115
+ constructor(_transport: FetchTransport);
1116
+ send({ id, request }: Options$4): Promise<ListConversationNotesResponse>;
1117
+ }
1118
+ type ListConversationNotesResponsePayload = {
1119
+ notes: {
1120
+ id: string;
1121
+ content: string;
1122
+ createdAt: string;
1123
+ updatedAt: string;
1124
+ }[];
1125
+ };
1126
+ declare class ListConversationNotesResponse {
1127
+ response: Response;
1128
+ constructor(response: Response);
1129
+ result(): Promise<ListConversationNotesResponsePayload>;
1130
+ }
1131
+
988
1132
  /**
989
1133
  * Great Detail Support System.
990
1134
  *
@@ -1123,6 +1267,10 @@ declare class Client {
1123
1267
  vcf: {
1124
1268
  get: GetContactVCFURL;
1125
1269
  };
1270
+ note: {
1271
+ list: ListContactNotes;
1272
+ create: CreateContactNote;
1273
+ };
1126
1274
  };
1127
1275
  get conversation(): {
1128
1276
  get: GetConversation;
@@ -1131,6 +1279,10 @@ declare class Client {
1131
1279
  message: {
1132
1280
  list: ListConversationMessages;
1133
1281
  };
1282
+ note: {
1283
+ list: ListConversationNotes;
1284
+ create: CreateConversationNote;
1285
+ };
1134
1286
  };
1135
1287
  get label(): {
1136
1288
  create: CreateLabel;
@@ -1168,4 +1320,4 @@ declare class Client {
1168
1320
  };
1169
1321
  }
1170
1322
 
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$t 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 GetSourceResponsePayload as v, type ListSourcesResponsePayload as w };
1323
+ export { type Authentication as A, type ListSourcesResponsePayload as B, 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$x 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 ListContactNotesResponsePayload as w, type CreateConversationNoteResponsePayload as x, type CreateContactNoteResponsePayload as y, type GetSourceResponsePayload as z };
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 $t=Object.create;var tt=Object.defineProperty;var Wt=Object.getOwnPropertyDescriptor;var Xt=Object.getOwnPropertyNames;var Qt=Object.getPrototypeOf,Zt=Object.prototype.hasOwnProperty;var Ht=(e,t)=>{for(var r in t)tt(e,r,{get:t[r],enumerable:!0})},Mt=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Xt(t))!Zt.call(e,o)&&o!==r&&tt(e,o,{get:()=>t[o],enumerable:!(s=Wt(t,o))||s.enumerable});return e};var te=(e,t,r)=>(r=e!=null?$t(Qt(e)):{},Mt(t||!e||!e.__esModule?tt(r,"default",{value:e,enumerable:!0}):r,e)),ee=e=>Mt(tt({},"__esModule",{value:!0}),e);var re={};Ht(re,{Client:()=>m,DEFAULT_SUPPORT_BASE_URL:()=>et,Error:()=>jt,KeyAuthentication:()=>X,PublicAuthentication:()=>Z,TokenAuthentication:()=>Q,default:()=>m});module.exports=ee(re);var et="https://api.support.greatdetail.com",Gt={"X-Powered-By":"GDSupport/JavaScript"},Dt="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 st(r))}},st=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 ot(r))}},ot=class{constructor(t){this.response=t}async result(){return this.response.json()}};var zt="SUPPORT_ACCESS_TOKEN",Vt="SUPPORT_API_KEY",Bt="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 nt(s))}},nt=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 it(s))}},it=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 at(r))}},at=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 pt(s))}},pt=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({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 ct(o))}},ct=class{constructor(t){this.response=t}async result(){return this.response.json()}};var P=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new dt(s))}},dt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var T=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/conversations",{...t,method:"GET"}).then(r=>new ut(r))}},ut=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/labels/"+encodeURIComponent(t)+"/conversations",{...r,method:"GET"}).then(s=>new lt(s))}},lt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var mt=require("zod"),E=class e{constructor(t){this._transport=t}static SCHEMA=mt.z.object({hasEnded:mt.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 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 gt(s))}},gt=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 ft(s))}},ft=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 yt(s))}},yt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var F=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/labels",{...t,method:"GET"}).then(r=>new bt(r))}},bt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var rt=require("zod"),U=class e{constructor(t){this._transport=t}static SCHEMA=rt.z.object({title:rt.z.string().optional(),description:rt.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 Rt(o))}},Rt=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 xt(s))}},xt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var I=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"}).then(r=>new At(r))}},At=class{constructor(t){this.response=t}async result(){return this.response.json()}};var q=require("zod"),N=class e{constructor(t){this._transport=t}static SCHEMA=q.z.object({input:q.z.string().max(65536),original:q.z.string().max(65536),correction:q.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 Ct(o))}},Ct=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 Pt(s))}},Pt=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 Tt(r))}},Tt=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 _t(o))}},_t=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Et=require("zod"),D=class e{constructor(t){this._transport=t}static SCHEMA=Et.z.object({content:Et.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 St(o))}},St=class{constructor(t){this.response=t}async result(){return this.response.json()}};var vt=require("zod"),z=class e{constructor(t){this._transport=t}static SCHEMA=vt.z.object({content:vt.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 Ot(o))}},Ot=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/notes/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new wt(s))}},wt=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)+"/notes",{...r,method:"GET"}).then(s=>new Ft(s))}},Ft=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)+"/notes",{...r,method:"GET"}).then(s=>new Ut(s))}},Ut=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Lt=require("zod"),K=class e{constructor(t){this._transport=t}static SCHEMA=Lt.z.object({content:Lt.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 It(o))}},It=class{constructor(t){this.response=t}async result(){return this.response.json()}};var k=class e{constructor(t=e.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Gt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var Y=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 qt(s))}},qt=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/sources",{...t,method:"GET"}).then(r=>new Nt(r))}},Nt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Kt=te(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 W=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[kt,Yt]of Object.entries(o))r.headers.set(kt,Yt)}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,Kt.default)(s)?new d("A network error occurred",{cause:s}):s})}};var m=class e{static DEFAULT_BASE_URL=et;_transport;constructor(t,{baseURL:r,...s}={}){this._transport=new W({requestFilterables:[new k,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 C(this._transport),create:new y(this._transport),vcf:{get:new f(this._transport)},note:{list:new B(this._transport),create:new D(this._transport)}}}get conversation(){return{get:new P(this._transport),list:new T(this._transport),update:new E(this._transport),message:{list:new L(this._transport)},note:{list:new J(this._transport),create:new z(this._transport)}}}get label(){return{create:new v(this._transport),get:new w(this._transport),list:new F(this._transport),update:new U(this._transport),delete:new O(this._transport),contact:{list:new x(this._transport)},conversation:{list:new _(this._transport)}}}get message(){return{list:new I(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 V(this._transport),update:new K(this._transport)}}get source(){return{get:new Y(this._transport),list:new $(this._transport)}}};var jt={};Ht(jt,{AuthError:()=>i,AuthenticationError:()=>p,AuthorizationError:()=>c,LogicError:()=>a,NetworkError:()=>d,SupportError:()=>n,ValidationError:()=>u});var X=class e{static DEFAULT_NAME=Dt;name;#t;constructor({name:t=process.env[Bt]??e.DEFAULT_NAME,key:r=process.env[Vt]}={}){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 Q=class{#t;constructor({token:t=process.env[zt]}={}){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 Z=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,Error,KeyAuthentication,PublicAuthentication,TokenAuthentication});