@great-detail/support-sdk 0.4.8 → 0.4.9

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.
@@ -29,34 +29,34 @@ interface RequestFilterable {
29
29
  * @see https://greatdetail.com
30
30
  */
31
31
 
32
- interface Options$L {
32
+ interface Options$M {
33
33
  requestFilterables: RequestFilterable[];
34
34
  }
35
35
  interface Transport {
36
36
  getURL(url: string): string;
37
37
  }
38
38
 
39
- interface InputOptions extends Options$L {
39
+ interface InputOptions extends Options$M {
40
40
  baseURL: string;
41
41
  }
42
- interface Options$K extends Options$L {
42
+ interface Options$L extends Options$M {
43
43
  baseURL: string;
44
44
  }
45
45
  declare class FetchTransport implements Transport {
46
46
  client: KyInstance;
47
- options: Options$K;
47
+ options: Options$L;
48
48
  constructor({ baseURL, ...options }: InputOptions);
49
49
  getURL(url: string): string;
50
50
  send<T = unknown>(url: string, request: RequestInit): Promise<ky.KyResponse<T>>;
51
51
  }
52
52
 
53
- interface Options$J {
53
+ interface Options$K {
54
54
  request?: RequestInit;
55
55
  }
56
56
  type ListActionsResponse = {
57
57
  actions: {
58
58
  id: string;
59
- actionStatus: string;
59
+ status: string;
60
60
  message: string;
61
61
  name: string;
62
62
  object?: string;
@@ -70,7 +70,7 @@ type ListActionsResponse = {
70
70
  declare class ListActions {
71
71
  protected _transport: FetchTransport;
72
72
  constructor(_transport: FetchTransport);
73
- send({ request }?: Options$J): Promise<ky.KyResponse<ListActionsResponse>>;
73
+ send({ request }?: Options$K): Promise<ky.KyResponse<ListActionsResponse>>;
74
74
  }
75
75
 
76
76
  /**
@@ -84,7 +84,7 @@ declare class ListActions {
84
84
 
85
85
  type Authentication = RequestFilterable;
86
86
 
87
- interface Options$I {
87
+ interface Options$J {
88
88
  id: string;
89
89
  body: z.infer<typeof CreateBoilerplateCategoryBoilerplate.SCHEMA>;
90
90
  request?: RequestInit;
@@ -115,10 +115,10 @@ declare class CreateBoilerplateCategoryBoilerplate {
115
115
  account: string;
116
116
  }>;
117
117
  constructor(_transport: FetchTransport);
118
- send({ id, body, request }: Options$I): Promise<ky.KyResponse<CreateBoilerplateCategoryBoilerplateResponse>>;
118
+ send({ id, body, request }: Options$J): Promise<ky.KyResponse<CreateBoilerplateCategoryBoilerplateResponse>>;
119
119
  }
120
120
 
121
- interface Options$H {
121
+ interface Options$I {
122
122
  id: string;
123
123
  request?: RequestInit;
124
124
  }
@@ -136,17 +136,17 @@ type GetBoilerplateResponse = {
136
136
  declare class GetBoilerplate {
137
137
  protected _transport: FetchTransport;
138
138
  constructor(_transport: FetchTransport);
139
- send({ id, request }: Options$H): Promise<ky.KyResponse<GetBoilerplateResponse>>;
139
+ send({ id, request }: Options$I): Promise<ky.KyResponse<GetBoilerplateResponse>>;
140
140
  }
141
141
 
142
- interface Options$G {
142
+ interface Options$H {
143
143
  id: string;
144
144
  request?: RequestInit;
145
145
  }
146
146
  declare class ListBoilerplateCategoryBoilerplates {
147
147
  protected _transport: FetchTransport;
148
148
  constructor(_transport: FetchTransport);
149
- send({ id, request }: Options$G): Promise<ky.KyResponse<ListBoilerplateCategoryBoilerplatesResponse>>;
149
+ send({ id, request }: Options$H): Promise<ky.KyResponse<ListBoilerplateCategoryBoilerplatesResponse>>;
150
150
  }
151
151
  type ListBoilerplateCategoryBoilerplatesResponse = {
152
152
  boilerplates: {
@@ -160,7 +160,7 @@ type ListBoilerplateCategoryBoilerplatesResponse = {
160
160
  }[];
161
161
  };
162
162
 
163
- interface Options$F {
163
+ interface Options$G {
164
164
  query?: string;
165
165
  request?: RequestInit;
166
166
  }
@@ -178,10 +178,10 @@ type ListBoilerplatesResponse = {
178
178
  declare class ListBoilerplates {
179
179
  protected _transport: FetchTransport;
180
180
  constructor(_transport: FetchTransport);
181
- send({ query, request }?: Options$F): Promise<ky.KyResponse<ListBoilerplatesResponse>>;
181
+ send({ query, request }?: Options$G): Promise<ky.KyResponse<ListBoilerplatesResponse>>;
182
182
  }
183
183
 
184
- interface Options$E {
184
+ interface Options$F {
185
185
  id: string;
186
186
  body: z.infer<typeof UpdateBoilerplate.SCHEMA>;
187
187
  request?: RequestInit;
@@ -210,10 +210,10 @@ declare class UpdateBoilerplate {
210
210
  content?: string | undefined;
211
211
  }>;
212
212
  constructor(_transport: FetchTransport);
213
- send({ id, body, request }: Options$E): Promise<ky.KyResponse<UpdateBoilerplateResponse>>;
213
+ send({ id, body, request }: Options$F): Promise<ky.KyResponse<UpdateBoilerplateResponse>>;
214
214
  }
215
215
 
216
- interface Options$D {
216
+ interface Options$E {
217
217
  body: z.infer<typeof CreateBoilerplateCategory.SCHEMA>;
218
218
  request?: RequestInit;
219
219
  }
@@ -243,10 +243,10 @@ declare class CreateBoilerplateCategory {
243
243
  description?: string | undefined;
244
244
  }>;
245
245
  constructor(_transport: FetchTransport);
246
- send({ body, request }: Options$D): Promise<ky.KyResponse<CreateBoilerplateCategoryResponse>>;
246
+ send({ body, request }: Options$E): Promise<ky.KyResponse<CreateBoilerplateCategoryResponse>>;
247
247
  }
248
248
 
249
- interface Options$C {
249
+ interface Options$D {
250
250
  id: string;
251
251
  request?: RequestInit;
252
252
  }
@@ -263,10 +263,10 @@ type GetBoilerplateCategoryResponse = {
263
263
  declare class GetBoilerplateCategory {
264
264
  protected _transport: FetchTransport;
265
265
  constructor(_transport: FetchTransport);
266
- send({ id, request }: Options$C): Promise<ky.KyResponse<GetBoilerplateCategoryResponse>>;
266
+ send({ id, request }: Options$D): Promise<ky.KyResponse<GetBoilerplateCategoryResponse>>;
267
267
  }
268
268
 
269
- interface Options$B {
269
+ interface Options$C {
270
270
  request?: RequestInit;
271
271
  }
272
272
  type ListBoilerplateCategoriesResponse = {
@@ -282,10 +282,10 @@ type ListBoilerplateCategoriesResponse = {
282
282
  declare class ListBoilerplateCategories {
283
283
  protected _transport: FetchTransport;
284
284
  constructor(_transport: FetchTransport);
285
- send({ request }?: Options$B): Promise<ky.KyResponse<ListBoilerplateCategoriesResponse>>;
285
+ send({ request }?: Options$C): Promise<ky.KyResponse<ListBoilerplateCategoriesResponse>>;
286
286
  }
287
287
 
288
- interface Options$A {
288
+ interface Options$B {
289
289
  id: string;
290
290
  body: z.infer<typeof UpdateBoilerplateCategory.SCHEMA>;
291
291
  request?: RequestInit;
@@ -313,17 +313,17 @@ declare class UpdateBoilerplateCategory {
313
313
  description?: string | undefined;
314
314
  }>;
315
315
  constructor(_transport: FetchTransport);
316
- send({ id, body, request }: Options$A): Promise<ky.KyResponse<UpdateBoilerplateCategoryResponse>>;
316
+ send({ id, body, request }: Options$B): Promise<ky.KyResponse<UpdateBoilerplateCategoryResponse>>;
317
317
  }
318
318
 
319
- interface Options$z {
319
+ interface Options$A {
320
320
  request?: RequestInit;
321
321
  }
322
322
  type ListChannelsResponse = {
323
323
  channels: ({
324
324
  id: string;
325
325
  name?: string;
326
- channelStatus: "ActiveChannelStatus" | "PotentialChannelStatus";
326
+ status: "ActiveChannelStatus" | "PotentialChannelStatus";
327
327
  account: string;
328
328
  createdAt: string;
329
329
  updatedAt?: string;
@@ -346,7 +346,7 @@ type ListChannelsResponse = {
346
346
  declare class ListChannels {
347
347
  protected _transport: FetchTransport;
348
348
  constructor(_transport: FetchTransport);
349
- send({ request }?: Options$z): Promise<ky.KyResponse<ListChannelsResponse>>;
349
+ send({ request }?: Options$A): Promise<ky.KyResponse<ListChannelsResponse>>;
350
350
  }
351
351
 
352
352
  /**
@@ -358,7 +358,7 @@ declare class ListChannels {
358
358
  * @see https://greatdetail.com
359
359
  */
360
360
 
361
- interface Options$y {
361
+ interface Options$z {
362
362
  id: string;
363
363
  vcf?: {
364
364
  variant?: "vcard";
@@ -371,11 +371,11 @@ interface Options$y {
371
371
  declare class GetContactVCFURL {
372
372
  protected _transport: FetchTransport;
373
373
  constructor(_transport: FetchTransport);
374
- getRelativeURL({ id, vcf }: Options$y): string;
375
- getURL(options: Options$y): string;
374
+ getRelativeURL({ id, vcf }: Options$z): string;
375
+ getURL(options: Options$z): string;
376
376
  }
377
377
 
378
- interface Options$x {
378
+ interface Options$y {
379
379
  body: z.infer<typeof CreateContact.SCHEMA>;
380
380
  request?: RequestInit;
381
381
  }
@@ -409,10 +409,10 @@ declare class CreateContact {
409
409
  telephoneNumber?: string | undefined;
410
410
  }>;
411
411
  constructor(_transport: FetchTransport);
412
- send({ body, request }: Options$x): Promise<ky.KyResponse<CreateContactResponse>>;
412
+ send({ body, request }: Options$y): Promise<ky.KyResponse<CreateContactResponse>>;
413
413
  }
414
414
 
415
- interface Options$w {
415
+ interface Options$x {
416
416
  id: string;
417
417
  request?: RequestInit;
418
418
  }
@@ -430,10 +430,10 @@ type GetContactResponse = {
430
430
  declare class GetContact {
431
431
  protected _transport: FetchTransport;
432
432
  constructor(_transport: FetchTransport);
433
- send({ id, request }: Options$w): Promise<ky.KyResponse<GetContactResponse>>;
433
+ send({ id, request }: Options$x): Promise<ky.KyResponse<GetContactResponse>>;
434
434
  }
435
435
 
436
- interface Options$v {
436
+ interface Options$w {
437
437
  request?: RequestInit;
438
438
  }
439
439
  type ListContactsResponse = {
@@ -450,10 +450,10 @@ type ListContactsResponse = {
450
450
  declare class ListContacts {
451
451
  protected _transport: FetchTransport;
452
452
  constructor(_transport: FetchTransport);
453
- send({ request }?: Options$v): Promise<ky.KyResponse<ListContactsResponse>>;
453
+ send({ request }?: Options$w): Promise<ky.KyResponse<ListContactsResponse>>;
454
454
  }
455
455
 
456
- interface Options$u {
456
+ interface Options$v {
457
457
  id: string;
458
458
  request?: RequestInit;
459
459
  }
@@ -471,10 +471,10 @@ type ListLabelContactsResponse = {
471
471
  declare class ListLabelContacts {
472
472
  protected _transport: FetchTransport;
473
473
  constructor(_transport: FetchTransport);
474
- send({ id, request }: Options$u): Promise<ky.KyResponse<ListLabelContactsResponse>>;
474
+ send({ id, request }: Options$v): Promise<ky.KyResponse<ListLabelContactsResponse>>;
475
475
  }
476
476
 
477
- interface Options$t {
477
+ interface Options$u {
478
478
  id: string;
479
479
  body: z.infer<typeof UpdateContact.SCHEMA>;
480
480
  request?: RequestInit;
@@ -506,10 +506,10 @@ declare class UpdateContact {
506
506
  telephoneNumber?: string | undefined;
507
507
  }>;
508
508
  constructor(_transport: FetchTransport);
509
- send({ id, body, request }: Options$t): Promise<ky.KyResponse<UpdateContactResponse>>;
509
+ send({ id, body, request }: Options$u): Promise<ky.KyResponse<UpdateContactResponse>>;
510
510
  }
511
511
 
512
- interface Options$s {
512
+ interface Options$t {
513
513
  id: string;
514
514
  request?: RequestInit;
515
515
  }
@@ -518,7 +518,7 @@ type GetConversationResponse = {
518
518
  id: string;
519
519
  name?: string;
520
520
  hasEnded: boolean;
521
- conversationStatus: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
521
+ status: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
522
522
  accountChannel: string;
523
523
  createdAt: string;
524
524
  updatedAt: string;
@@ -527,10 +527,10 @@ type GetConversationResponse = {
527
527
  declare class GetConversation {
528
528
  protected _transport: FetchTransport;
529
529
  constructor(_transport: FetchTransport);
530
- send({ id, request }: Options$s): Promise<ky.KyResponse<GetConversationResponse>>;
530
+ send({ id, request }: Options$t): Promise<ky.KyResponse<GetConversationResponse>>;
531
531
  }
532
532
 
533
- interface Options$r {
533
+ interface Options$s {
534
534
  id: string;
535
535
  request?: RequestInit;
536
536
  }
@@ -539,7 +539,7 @@ type ListContactConversationsResponse = {
539
539
  id: string;
540
540
  name?: string;
541
541
  hasEnded: boolean;
542
- conversationStatus: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
542
+ status: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
543
543
  accountChannel: string;
544
544
  createdAt: string;
545
545
  updatedAt: string;
@@ -548,10 +548,10 @@ type ListContactConversationsResponse = {
548
548
  declare class ListContactConversations {
549
549
  protected _transport: FetchTransport;
550
550
  constructor(_transport: FetchTransport);
551
- send({ id, request }: Options$r): Promise<ky.KyResponse<ListContactConversationsResponse>>;
551
+ send({ id, request }: Options$s): Promise<ky.KyResponse<ListContactConversationsResponse>>;
552
552
  }
553
553
 
554
- interface Options$q {
554
+ interface Options$r {
555
555
  request?: RequestInit;
556
556
  }
557
557
  type ListConversationsResponse = {
@@ -559,7 +559,7 @@ type ListConversationsResponse = {
559
559
  id: string;
560
560
  name?: string;
561
561
  hasEnded: boolean;
562
- conversationStatus: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
562
+ status: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
563
563
  accountChannel: string;
564
564
  createdAt: string;
565
565
  updatedAt: string;
@@ -568,10 +568,10 @@ type ListConversationsResponse = {
568
568
  declare class ListConversations {
569
569
  protected _transport: FetchTransport;
570
570
  constructor(_transport: FetchTransport);
571
- send({ request }?: Options$q): Promise<ky.KyResponse<ListConversationsResponse>>;
571
+ send({ request }?: Options$r): Promise<ky.KyResponse<ListConversationsResponse>>;
572
572
  }
573
573
 
574
- interface Options$p {
574
+ interface Options$q {
575
575
  id: string;
576
576
  request?: RequestInit;
577
577
  }
@@ -580,7 +580,7 @@ type ListLabelConversationsResponse = {
580
580
  id: string;
581
581
  name?: string;
582
582
  hasEnded: boolean;
583
- conversationStatus: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
583
+ status: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
584
584
  accountChannel: string;
585
585
  createdAt: string;
586
586
  updatedAt: string;
@@ -589,10 +589,10 @@ type ListLabelConversationsResponse = {
589
589
  declare class ListLabelConversations {
590
590
  protected _transport: FetchTransport;
591
591
  constructor(_transport: FetchTransport);
592
- send({ id, request }: Options$p): Promise<ky.KyResponse<ListLabelConversationsResponse>>;
592
+ send({ id, request }: Options$q): Promise<ky.KyResponse<ListLabelConversationsResponse>>;
593
593
  }
594
594
 
595
- interface Options$o {
595
+ interface Options$p {
596
596
  id: string;
597
597
  body: z.infer<typeof UpdateConversation.SCHEMA>;
598
598
  request?: RequestInit;
@@ -602,7 +602,7 @@ type UpdateConversationResponse = {
602
602
  id: string;
603
603
  name?: string;
604
604
  hasEnded: boolean;
605
- conversationStatus: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
605
+ status: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
606
606
  accountChannel: string;
607
607
  createdAt: string;
608
608
  updatedAt: string;
@@ -621,10 +621,10 @@ declare class UpdateConversation {
621
621
  hasEnded?: boolean | undefined;
622
622
  }>;
623
623
  constructor(_transport: FetchTransport);
624
- send({ id, body, request }: Options$o): Promise<ky.KyResponse<UpdateConversationResponse>>;
624
+ send({ id, body, request }: Options$p): Promise<ky.KyResponse<UpdateConversationResponse>>;
625
625
  }
626
626
 
627
- interface Options$n {
627
+ interface Options$o {
628
628
  body: z.infer<typeof CreateLabel.SCHEMA>;
629
629
  request?: RequestInit;
630
630
  }
@@ -654,10 +654,10 @@ declare class CreateLabel {
654
654
  description?: string | undefined;
655
655
  }>;
656
656
  constructor(_transport: FetchTransport);
657
- send({ body, request }: Options$n): Promise<ky.KyResponse<CreateLabelResponse>>;
657
+ send({ body, request }: Options$o): Promise<ky.KyResponse<CreateLabelResponse>>;
658
658
  }
659
659
 
660
- interface Options$m {
660
+ interface Options$n {
661
661
  id: string;
662
662
  request?: RequestInit;
663
663
  }
@@ -665,10 +665,10 @@ type DeleteLabelResponse = Record<string, never>;
665
665
  declare class DeleteLabel {
666
666
  protected _transport: FetchTransport;
667
667
  constructor(_transport: FetchTransport);
668
- send({ id, request }: Options$m): Promise<ky.KyResponse<DeleteLabelResponse>>;
668
+ send({ id, request }: Options$n): Promise<ky.KyResponse<DeleteLabelResponse>>;
669
669
  }
670
670
 
671
- interface Options$l {
671
+ interface Options$m {
672
672
  id: string;
673
673
  request?: RequestInit;
674
674
  }
@@ -685,10 +685,10 @@ type GetLabelResponse = {
685
685
  declare class GetLabel {
686
686
  protected _transport: FetchTransport;
687
687
  constructor(_transport: FetchTransport);
688
- send({ id, request }: Options$l): Promise<ky.KyResponse<GetLabelResponse>>;
688
+ send({ id, request }: Options$m): Promise<ky.KyResponse<GetLabelResponse>>;
689
689
  }
690
690
 
691
- interface Options$k {
691
+ interface Options$l {
692
692
  request?: RequestInit;
693
693
  }
694
694
  type ListLabelsResponse = {
@@ -704,10 +704,10 @@ type ListLabelsResponse = {
704
704
  declare class ListLabels {
705
705
  protected _transport: FetchTransport;
706
706
  constructor(_transport: FetchTransport);
707
- send({ request }?: Options$k): Promise<ky.KyResponse<ListLabelsResponse>>;
707
+ send({ request }?: Options$l): Promise<ky.KyResponse<ListLabelsResponse>>;
708
708
  }
709
709
 
710
- interface Options$j {
710
+ interface Options$k {
711
711
  id: string;
712
712
  body: z.infer<typeof UpdateLabel.SCHEMA>;
713
713
  request?: RequestInit;
@@ -735,7 +735,36 @@ declare class UpdateLabel {
735
735
  description?: string | undefined;
736
736
  }>;
737
737
  constructor(_transport: FetchTransport);
738
- send({ id, body, request }: Options$j): Promise<ky.KyResponse<UpdateLabelResponse>>;
738
+ send({ id, body, request }: Options$k): Promise<ky.KyResponse<UpdateLabelResponse>>;
739
+ }
740
+
741
+ interface Options$j {
742
+ id: string;
743
+ request?: RequestInit;
744
+ }
745
+ type ListChannelMessagesResponse = {
746
+ messages: {
747
+ id: string;
748
+ role: "user" | "assistant";
749
+ status: string;
750
+ externalIdentifier?: string;
751
+ conversation: string;
752
+ contact: string;
753
+ messageEvents: {
754
+ id: string;
755
+ messageEventType: string;
756
+ triggeredAt: string;
757
+ createdAt: string;
758
+ updatedAt?: string;
759
+ }[];
760
+ createdAt: string;
761
+ updatedAt: string;
762
+ }[];
763
+ };
764
+ declare class ListChannelMessages {
765
+ protected _transport: FetchTransport;
766
+ constructor(_transport: FetchTransport);
767
+ send({ id, request }: Options$j): Promise<ky.KyResponse<ListChannelMessagesResponse>>;
739
768
  }
740
769
 
741
770
  interface Options$i {
@@ -746,7 +775,7 @@ type ListConversationMessagesResponse = {
746
775
  messages: {
747
776
  id: string;
748
777
  role: "user" | "assistant";
749
- messageStatus: string;
778
+ status: string;
750
779
  externalIdentifier?: string;
751
780
  conversation: string;
752
781
  contact: string;
@@ -774,7 +803,7 @@ type ListMessagesResponse = {
774
803
  messages: {
775
804
  id: string;
776
805
  role: "user" | "assistant";
777
- messageStatus: string;
806
+ status: string;
778
807
  externalIdentifier?: string;
779
808
  conversation: string;
780
809
  contact: string;
@@ -1270,6 +1299,9 @@ declare class Client {
1270
1299
  };
1271
1300
  get channel(): {
1272
1301
  list: ListChannels;
1302
+ message: {
1303
+ list: ListChannelMessages;
1304
+ };
1273
1305
  };
1274
1306
  get contact(): {
1275
1307
  get: GetContact;
@@ -1344,4 +1376,4 @@ declare class Client {
1344
1376
  get webhook(): Webhook;
1345
1377
  }
1346
1378
 
1347
- export { type Authentication as A, type ListModelsResponse as B, Client as C, type DeleteLabelResponse as D, type CreateCorrectionResponse as E, type CreateResponseResponse as F, type GetBoilerplateResponse as G, type CreateContactNoteResponse as H, type CreateConversationNoteResponse as I, type GetNoteResponse as J, type ListContactNotesResponse as K, type ListActionsResponse as L, type ListConversationNotesResponse as M, type UpdateNoteResponse as N, type Options as O, type GetSourceResponse as P, type ListSourcesResponse as Q, type RequestFilterable as R, type CreateContactNotificationSubscriptionResponse as S, type CreateUploadResponse as T, type UpdateBoilerplateResponse as U, type GetUploadResponse as V, type WebhookResponse as W, type Options$L as a, type CreateBoilerplateCategoryBoilerplateResponse as b, type ListBoilerplateCategoryBoilerplatesResponse as c, type ListBoilerplatesResponse as d, type CreateBoilerplateCategoryResponse as e, type GetBoilerplateCategoryResponse as f, type ListBoilerplateCategoriesResponse as g, type UpdateBoilerplateCategoryResponse as h, type ListChannelsResponse as i, type CreateContactResponse as j, type GetContactResponse as k, type ListContactsResponse as l, type ListLabelContactsResponse as m, type UpdateContactResponse as n, type GetConversationResponse as o, type ListConversationsResponse as p, type ListLabelConversationsResponse as q, type UpdateConversationResponse as r, type ListContactConversationsResponse as s, type CreateLabelResponse as t, type GetLabelResponse as u, type ListLabelsResponse as v, type UpdateLabelResponse as w, type ListConversationMessagesResponse as x, type ListMessagesResponse as y, type GetModelResponse as z };
1379
+ export { type Authentication as A, type GetModelResponse as B, Client as C, type DeleteLabelResponse as D, type ListModelsResponse as E, type CreateCorrectionResponse as F, type GetBoilerplateResponse as G, type CreateResponseResponse as H, type CreateContactNoteResponse as I, type CreateConversationNoteResponse as J, type GetNoteResponse as K, type ListActionsResponse as L, type ListContactNotesResponse as M, type ListConversationNotesResponse as N, type Options as O, type UpdateNoteResponse as P, type GetSourceResponse as Q, type RequestFilterable as R, type ListSourcesResponse as S, type CreateContactNotificationSubscriptionResponse as T, type UpdateBoilerplateResponse as U, type CreateUploadResponse as V, type WebhookResponse as W, type GetUploadResponse as X, type Options$M as a, type CreateBoilerplateCategoryBoilerplateResponse as b, type ListBoilerplateCategoryBoilerplatesResponse as c, type ListBoilerplatesResponse as d, type CreateBoilerplateCategoryResponse as e, type GetBoilerplateCategoryResponse as f, type ListBoilerplateCategoriesResponse as g, type UpdateBoilerplateCategoryResponse as h, type ListChannelsResponse as i, type CreateContactResponse as j, type GetContactResponse as k, type ListContactsResponse as l, type ListLabelContactsResponse as m, type UpdateContactResponse as n, type GetConversationResponse as o, type ListConversationsResponse as p, type ListLabelConversationsResponse as q, type UpdateConversationResponse as r, type ListContactConversationsResponse as s, type CreateLabelResponse as t, type GetLabelResponse as u, type ListLabelsResponse as v, type UpdateLabelResponse as w, type ListConversationMessagesResponse as x, type ListMessagesResponse as y, type ListChannelMessagesResponse as z };
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var Pt=Object.create;var Ct=Object.defineProperty;var Dt=Object.getOwnPropertyDescriptor;var kt=Object.getOwnPropertyNames;var Vt=Object.getPrototypeOf,Jt=Object.prototype.hasOwnProperty;var Ut=(r,t)=>{for(var e in t)Ct(r,e,{get:t[e],enumerable:!0})},wt=(r,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of kt(t))!Jt.call(r,o)&&o!==e&&Ct(r,o,{get:()=>t[o],enumerable:!(s=Dt(t,o))||s.enumerable});return r};var It=(r,t,e)=>(e=r!=null?Pt(Vt(r)):{},wt(t||!r||!r.__esModule?Ct(e,"default",{value:r,enumerable:!0}):e,r)),Kt=r=>wt(Ct({},"__esModule",{value:!0}),r);var Yt={};Ut(Yt,{Client:()=>h,DEFAULT_SUPPORT_BASE_URL:()=>Rt,Error:()=>Ot,KeyAuthentication:()=>ft,PublicAuthentication:()=>bt,TokenAuthentication:()=>ht,default:()=>h});module.exports=Kt(Yt);var Rt="https://api.support.greatdetail.com",qt={"X-Powered-By":"GDSupport/JavaScript"},Lt="api-key";var b=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var C=require("zod"),R=class r{constructor(t){this._transport=t}static SCHEMA=C.z.object({title:C.z.string(),content:C.z.string(),account:C.z.string()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var A=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var y=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var x=class{constructor(t){this._transport=t}async send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates"+(t?"?query="+encodeURIComponent(t):""),{...e,method:"GET"})}};var At=require("zod"),T=class r{constructor(t){this._transport=t}static SCHEMA=At.z.object({title:At.z.string().optional(),content:At.z.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var _=require("zod"),E=class r{constructor(t){this._transport=t}static SCHEMA=_.z.object({title:_.z.string(),description:_.z.string().optional(),account:_.z.string()});async send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(t))})}};var S=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var v=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/boilerplate-categories",{...t,method:"GET"})}};var yt=require("zod"),O=class r{constructor(t){this._transport=t}static SCHEMA=yt.z.object({title:yt.z.string().optional(),description:yt.z.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var F=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var Ht="SUPPORT_ACCESS_TOKEN",Nt="SUPPORT_API_KEY",Mt="SUPPORT_KEY_NAME",Gt="SUPPORT_BASE_URL";var U=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let s=e.variant??"vcard",o=e.format??(e.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 m=require("zod"),w=class r{constructor(t){this._transport=t}static SCHEMA=m.z.object({name:m.z.string(),account:m.z.string(),emailAddress:m.z.string().email().optional(),telephoneNumber:m.z.string().optional()});async send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(t))})}};var I=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"GET"})}};var q=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/contacts",{...t,method:"GET"})}};var L=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var H=require("zod"),N=class r{constructor(t){this._transport=t}static SCHEMA=H.z.object({name:H.z.string().optional(),emailAddress:H.z.string().email().optional(),telephoneNumber:H.z.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var M=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"GET"})}};var G=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var B=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/conversations",{...t,method:"GET"})}};var j=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var xt=require("zod"),z=class r{constructor(t){this._transport=t}static SCHEMA=xt.z.object({conversationStatus:xt.z.enum(["AwaitingContactConversationStatus","AwaitingAgentConversationStatus","ResolvedConversationStatus","ClosedConversationStatus"]).optional(),hasEnded:xt.z.boolean().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var P=require("zod"),D=class r{constructor(t){this._transport=t}static SCHEMA=P.z.object({title:P.z.string(),description:P.z.string().optional(),account:P.z.string()});async send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(t))})}};var k=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var V=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var J=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/labels",{...t,method:"GET"})}};var Tt=require("zod"),K=class r{constructor(t){this._transport=t}static SCHEMA=Tt.z.object({title:Tt.z.string().optional(),description:Tt.z.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var Y=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var $=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var W=require("zod"),X=class r{constructor(t){this._transport=t}static SCHEMA=W.z.object({input:W.z.string().max(65536),original:W.z.string().max(65536),correction:W.z.string().max(65536)});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var Q=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var Z=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var tt=require("zod"),et=class r{constructor(t){this._transport=t}static SCHEMA=tt.z.array(tt.z.object({role:tt.z.enum(["user","assistant"]),content:tt.z.string().max(65536).nullable()})).min(1);async send({id:t,body:e,request:s={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var Et=require("zod"),rt=class r{constructor(t){this._transport=t}static SCHEMA=Et.z.object({content:Et.z.string()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var St=require("zod"),f=class r{constructor(t){this._transport=t}static SCHEMA=St.z.object({content:St.z.string()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var st=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var ot=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var nt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var vt=require("zod"),it=class r{constructor(t){this._transport=t}static SCHEMA=vt.z.object({content:vt.z.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var p=require("zod"),at=class r{constructor(t){this._transport=t}static SCHEMA=p.z.discriminatedUnion("type",[p.z.object({type:p.z.literal("vapid"),endpoint:p.z.string().url(),keys:p.z.object({p256dh:p.z.string(),auth:p.z.string()})})]);async send({id:t,body:e,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var pt=class r{constructor(t=r.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=qt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var ct=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var dt=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/sources",{...t,method:"GET"})}};var Bt=It(require("is-network-error"),1),_t=It(require("ky"),1);var n=class extends Error{};var a=class extends n{};var d=class extends a{static unauthenticated(){return new this("An unauthenticated request occurred")}};var u=class extends a{static forbidden(){return new this("A forbidden request occurred")}};var c=class extends n{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}};var l=class extends n{};var g=class extends n{static badRequest(){return new this("Bad request")}};var ut=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=_t.default.create({prefixUrl:this.options.baseURL,hooks:{beforeRequest:[s=>{for(let o of this.options.requestFilterables){let jt=o.getHeaders();for(let[Ft,zt]of Object.entries(jt))s.headers.has(Ft)||s.headers.set(Ft,zt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}async send(t,e){return await this.client(t,e).catch(s=>{if((0,Bt.default)(s))throw new l("A network error occurred",{cause:s});if(s instanceof _t.HTTPError){let o=s.response.status;switch(console.error(JSON.stringify(s.response)),o){case 400:throw g.badRequest();case 401:throw d.unauthenticated();case 403:throw u.forbidden();case 404:throw c.notFound(t);case 405:throw c.forbiddenMethod(t,e.method??"GET")}}throw s})}};var lt=class{constructor(t){this._transport=t}async send({files:t,request:e={}}){let s=new FormData;for(let o of t)s.append("file",o);return this._transport.send("v1/uploads",{...e,method:"POST",body:s})}};var gt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var i=require("zod"),mt=class r{constructor(t){this._client=t}static SCHEMA=i.z.object({event:i.z.intersection(i.z.object({id:i.z.string(),createdAt:i.z.string().datetime()}),i.z.discriminatedUnion("type",[i.z.object({type:i.z.literal("contact.created"),contact:i.z.string()}),i.z.object({type:i.z.literal("message.created"),message:i.z.string()})]))});async event({request:t}){let{event:e}=r.SCHEMA.parse(t.body);return{event:e}}};var h=class r{static DEFAULT_BASE_URL=Rt;_transport;constructor(t,{baseURL:e,...s}={}){this._transport=new ut({requestFilterables:[new pt,t],...s,baseURL:e?.toString()??r.getBaseURL()})}static getBaseURL(){return process.env[Gt]??this.DEFAULT_BASE_URL}get action(){return{list:new b(this._transport)}}get boilerplate(){return{get:new A(this._transport),list:new x(this._transport),update:new T(this._transport)}}get boilerplateCategory(){return{get:new S(this._transport),list:new v(this._transport),create:new E(this._transport),update:new O(this._transport),boilerplate:{list:new y(this._transport),create:new R(this._transport)}}}get channel(){return{list:new F(this._transport)}}get contact(){return{get:new I(this._transport),list:new q(this._transport),update:new N(this._transport),create:new w(this._transport),conversation:{list:new G(this._transport)},note:{list:new ot(this._transport),create:new rt(this._transport)},notificationSubscription:{create:new at(this._transport)},vcf:{get:new U(this._transport)}}}get conversation(){return{get:new M(this._transport),list:new B(this._transport),update:new z(this._transport),create:new f(this._transport),message:{list:new Y(this._transport)},note:{list:new nt(this._transport),create:new f(this._transport)}}}get label(){return{create:new D(this._transport),get:new V(this._transport),list:new J(this._transport),update:new K(this._transport),delete:new k(this._transport),contact:{list:new L(this._transport)},conversation:{list:new j(this._transport)}}}get message(){return{list:new $(this._transport)}}get model(){return{get:new Q(this._transport),list:new Z(this._transport),response:{create:new et(this._transport)},correction:{create:new X(this._transport)}}}get note(){return{get:new st(this._transport),update:new it(this._transport)}}get source(){return{get:new ct(this._transport),list:new dt(this._transport)}}get upload(){return{get:new gt(this._transport),create:new lt(this._transport)}}get webhook(){return new mt(this)}};var Ot={};Ut(Ot,{AuthError:()=>a,AuthenticationError:()=>d,AuthorizationError:()=>u,LogicError:()=>c,NetworkError:()=>l,SupportError:()=>n,ValidationError:()=>g});var ft=class r{static DEFAULT_NAME=Lt;name;#t;constructor({name:t=process.env[Mt]??r.DEFAULT_NAME,key:e=process.env[Nt]}={}){if(!e)throw new Error("API Key option must be specified when using Key Authentication");this.name=t,this.#t=e}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var ht=class{#t;constructor({token:t=process.env[Ht]}={}){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 bt=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 Rt=Object.defineProperty;var kt=Object.getOwnPropertyDescriptor;var Vt=Object.getOwnPropertyNames;var Jt=Object.getPrototypeOf,Kt=Object.prototype.hasOwnProperty;var wt=(r,t)=>{for(var e in t)Rt(r,e,{get:t[e],enumerable:!0})},It=(r,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Vt(t))!Kt.call(r,n)&&n!==e&&Rt(r,n,{get:()=>t[n],enumerable:!(s=kt(t,n))||s.enumerable});return r};var qt=(r,t,e)=>(e=r!=null?Dt(Jt(r)):{},It(t||!r||!r.__esModule?Rt(e,"default",{value:r,enumerable:!0}):e,r)),Yt=r=>It(Rt({},"__esModule",{value:!0}),r);var $t={};wt($t,{Client:()=>h,DEFAULT_SUPPORT_BASE_URL:()=>At,Error:()=>Ft,KeyAuthentication:()=>ht,PublicAuthentication:()=>Ct,TokenAuthentication:()=>bt,default:()=>h});module.exports=Yt($t);var At="https://api.support.greatdetail.com",Lt={"X-Powered-By":"GDSupport/JavaScript"},Ht="api-key";var b=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var C=require("zod"),R=class r{constructor(t){this._transport=t}static SCHEMA=C.z.object({title:C.z.string(),content:C.z.string(),account:C.z.string()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var A=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var y=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var x=class{constructor(t){this._transport=t}async send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates"+(t?"?query="+encodeURIComponent(t):""),{...e,method:"GET"})}};var yt=require("zod"),T=class r{constructor(t){this._transport=t}static SCHEMA=yt.z.object({title:yt.z.string().optional(),content:yt.z.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var _=require("zod"),E=class r{constructor(t){this._transport=t}static SCHEMA=_.z.object({title:_.z.string(),description:_.z.string().optional(),account:_.z.string()});async send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(t))})}};var O=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var S=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/boilerplate-categories",{...t,method:"GET"})}};var xt=require("zod"),v=class r{constructor(t){this._transport=t}static SCHEMA=xt.z.object({title:xt.z.string().optional(),description:xt.z.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var F=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var Nt="SUPPORT_ACCESS_TOKEN",Mt="SUPPORT_API_KEY",Gt="SUPPORT_KEY_NAME",Bt="SUPPORT_BASE_URL";var U=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let s=e.variant??"vcard",n=e.format??(e.variant==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(s)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}};var m=require("zod"),w=class r{constructor(t){this._transport=t}static SCHEMA=m.z.object({name:m.z.string(),account:m.z.string(),emailAddress:m.z.string().email().optional(),telephoneNumber:m.z.string().optional()});async send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(t))})}};var I=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"GET"})}};var q=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/contacts",{...t,method:"GET"})}};var L=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var H=require("zod"),N=class r{constructor(t){this._transport=t}static SCHEMA=H.z.object({name:H.z.string().optional(),emailAddress:H.z.string().email().optional(),telephoneNumber:H.z.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var M=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"GET"})}};var G=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var B=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/conversations",{...t,method:"GET"})}};var j=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var Tt=require("zod"),z=class r{constructor(t){this._transport=t}static SCHEMA=Tt.z.object({conversationStatus:Tt.z.enum(["AwaitingContactConversationStatus","AwaitingAgentConversationStatus","ResolvedConversationStatus","ClosedConversationStatus"]).optional(),hasEnded:Tt.z.boolean().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var P=require("zod"),D=class r{constructor(t){this._transport=t}static SCHEMA=P.z.object({title:P.z.string(),description:P.z.string().optional(),account:P.z.string()});async send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(t))})}};var k=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var V=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var J=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/labels",{...t,method:"GET"})}};var _t=require("zod"),K=class r{constructor(t){this._transport=t}static SCHEMA=_t.z.object({title:_t.z.string().optional(),description:_t.z.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var Y=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var $=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var W=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var X=require("zod"),Q=class r{constructor(t){this._transport=t}static SCHEMA=X.z.object({input:X.z.string().max(65536),original:X.z.string().max(65536),correction:X.z.string().max(65536)});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var Z=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var tt=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var et=require("zod"),rt=class r{constructor(t){this._transport=t}static SCHEMA=et.z.array(et.z.object({role:et.z.enum(["user","assistant"]),content:et.z.string().max(65536).nullable()})).min(1);async send({id:t,body:e,request:s={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var Ot=require("zod"),st=class r{constructor(t){this._transport=t}static SCHEMA=Ot.z.object({content:Ot.z.string()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var St=require("zod"),f=class r{constructor(t){this._transport=t}static SCHEMA=St.z.object({content:St.z.string()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var nt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var ot=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var it=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var vt=require("zod"),at=class r{constructor(t){this._transport=t}static SCHEMA=vt.z.object({content:vt.z.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var p=require("zod"),pt=class r{constructor(t){this._transport=t}static SCHEMA=p.z.discriminatedUnion("type",[p.z.object({type:p.z.literal("vapid"),endpoint:p.z.string().url(),keys:p.z.object({p256dh:p.z.string(),auth:p.z.string()})})]);async send({id:t,body:e,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var ct=class r{constructor(t=r.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Lt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var dt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var ut=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/sources",{...t,method:"GET"})}};var jt=qt(require("is-network-error"),1),Et=qt(require("ky"),1);var o=class extends Error{};var a=class extends o{};var d=class extends a{static unauthenticated(){return new this("An unauthenticated request occurred")}};var u=class extends a{static forbidden(){return new this("A forbidden request occurred")}};var c=class extends o{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}};var l=class extends o{};var g=class extends o{static badRequest(){return new this("Bad request")}};var lt=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Et.default.create({prefixUrl:this.options.baseURL,hooks:{beforeRequest:[s=>{for(let n of this.options.requestFilterables){let zt=n.getHeaders();for(let[Ut,Pt]of Object.entries(zt))s.headers.has(Ut)||s.headers.set(Ut,Pt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}async send(t,e){return await this.client(t,e).catch(s=>{if((0,jt.default)(s))throw new l("A network error occurred",{cause:s});if(s instanceof Et.HTTPError){let n=s.response.status;switch(console.error(JSON.stringify(s.response)),n){case 400:throw g.badRequest();case 401:throw d.unauthenticated();case 403:throw u.forbidden();case 404:throw c.notFound(t);case 405:throw c.forbiddenMethod(t,e.method??"GET")}}throw s})}};var gt=class{constructor(t){this._transport=t}async send({files:t,request:e={}}){let s=new FormData;for(let n of t)s.append("file",n);return this._transport.send("v1/uploads",{...e,method:"POST",body:s})}};var mt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var i=require("zod"),ft=class r{constructor(t){this._client=t}static SCHEMA=i.z.object({event:i.z.intersection(i.z.object({id:i.z.string(),createdAt:i.z.string().datetime()}),i.z.discriminatedUnion("type",[i.z.object({type:i.z.literal("contact.created"),contact:i.z.string()}),i.z.object({type:i.z.literal("message.created"),message:i.z.string()})]))});async event({request:t}){let{event:e}=r.SCHEMA.parse(t.body);return{event:e}}};var h=class r{static DEFAULT_BASE_URL=At;_transport;constructor(t,{baseURL:e,...s}={}){this._transport=new lt({requestFilterables:[new ct,t],...s,baseURL:e?.toString()??r.getBaseURL()})}static getBaseURL(){return process.env[Bt]??this.DEFAULT_BASE_URL}get action(){return{list:new b(this._transport)}}get boilerplate(){return{get:new A(this._transport),list:new x(this._transport),update:new T(this._transport)}}get boilerplateCategory(){return{get:new O(this._transport),list:new S(this._transport),create:new E(this._transport),update:new v(this._transport),boilerplate:{list:new y(this._transport),create:new R(this._transport)}}}get channel(){return{list:new F(this._transport),message:{list:new Y(this._transport)}}}get contact(){return{get:new I(this._transport),list:new q(this._transport),update:new N(this._transport),create:new w(this._transport),conversation:{list:new G(this._transport)},note:{list:new ot(this._transport),create:new st(this._transport)},notificationSubscription:{create:new pt(this._transport)},vcf:{get:new U(this._transport)}}}get conversation(){return{get:new M(this._transport),list:new B(this._transport),update:new z(this._transport),create:new f(this._transport),message:{list:new $(this._transport)},note:{list:new it(this._transport),create:new f(this._transport)}}}get label(){return{create:new D(this._transport),get:new V(this._transport),list:new J(this._transport),update:new K(this._transport),delete:new k(this._transport),contact:{list:new L(this._transport)},conversation:{list:new j(this._transport)}}}get message(){return{list:new W(this._transport)}}get model(){return{get:new Z(this._transport),list:new tt(this._transport),response:{create:new rt(this._transport)},correction:{create:new Q(this._transport)}}}get note(){return{get:new nt(this._transport),update:new at(this._transport)}}get source(){return{get:new dt(this._transport),list:new ut(this._transport)}}get upload(){return{get:new mt(this._transport),create:new gt(this._transport)}}get webhook(){return new ft(this)}};var Ft={};wt(Ft,{AuthError:()=>a,AuthenticationError:()=>d,AuthorizationError:()=>u,LogicError:()=>c,NetworkError:()=>l,SupportError:()=>o,ValidationError:()=>g});var ht=class r{static DEFAULT_NAME=Ht;name;#t;constructor({name:t=process.env[Gt]??r.DEFAULT_NAME,key:e=process.env[Mt]}={}){if(!e)throw new Error("API Key option must be specified when using Key Authentication");this.name=t,this.#t=e}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var bt=class{#t;constructor({token:t=process.env[Nt]}={}){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 Ct=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-Br3bu497.cjs';
2
- export { C as Client, b as CreateBoilerplateCategoryBoilerplateResponse, e as CreateBoilerplateCategoryResponse, H as CreateContactNoteResponse, S as CreateContactNotificationSubscriptionResponse, j as CreateContactResponse, I as CreateConversationNoteResponse, E as CreateCorrectionResponse, t as CreateLabelResponse, F as CreateResponseResponse, T as CreateUploadResponse, D as DeleteLabelResponse, f as GetBoilerplateCategoryResponse, G as GetBoilerplateResponse, k as GetContactResponse, o as GetConversationResponse, u as GetLabelResponse, z as GetModelResponse, J as GetNoteResponse, P as GetSourceResponse, V as GetUploadResponse, L as ListActionsResponse, g as ListBoilerplateCategoriesResponse, c as ListBoilerplateCategoryBoilerplatesResponse, d as ListBoilerplatesResponse, i as ListChannelsResponse, s as ListContactConversationsResponse, K as ListContactNotesResponse, l as ListContactsResponse, x as ListConversationMessagesResponse, M as ListConversationNotesResponse, p as ListConversationsResponse, m as ListLabelContactsResponse, q as ListLabelConversationsResponse, v as ListLabelsResponse, y as ListMessagesResponse, B as ListModelsResponse, Q as ListSourcesResponse, O as Options, R as RequestFilterable, a as TransportOptions, h as UpdateBoilerplateCategoryResponse, U as UpdateBoilerplateResponse, n as UpdateContactResponse, r as UpdateConversationResponse, w as UpdateLabelResponse, N as UpdateNoteResponse, W as WebhookResponse, C as default } from './index-Br3bu497.cjs';
1
+ import { A as Authentication } from './index-DmPG0eRh.cjs';
2
+ export { C as Client, b as CreateBoilerplateCategoryBoilerplateResponse, e as CreateBoilerplateCategoryResponse, I as CreateContactNoteResponse, T as CreateContactNotificationSubscriptionResponse, j as CreateContactResponse, J as CreateConversationNoteResponse, F as CreateCorrectionResponse, t as CreateLabelResponse, H as CreateResponseResponse, V as CreateUploadResponse, D as DeleteLabelResponse, f as GetBoilerplateCategoryResponse, G as GetBoilerplateResponse, k as GetContactResponse, o as GetConversationResponse, u as GetLabelResponse, B as GetModelResponse, K as GetNoteResponse, Q as GetSourceResponse, X as GetUploadResponse, L as ListActionsResponse, g as ListBoilerplateCategoriesResponse, c as ListBoilerplateCategoryBoilerplatesResponse, d as ListBoilerplatesResponse, z as ListChannelMessagesResponse, i as ListChannelsResponse, s as ListContactConversationsResponse, M as ListContactNotesResponse, l as ListContactsResponse, x as ListConversationMessagesResponse, N as ListConversationNotesResponse, p as ListConversationsResponse, m as ListLabelContactsResponse, q as ListLabelConversationsResponse, v as ListLabelsResponse, y as ListMessagesResponse, E as ListModelsResponse, S as ListSourcesResponse, O as Options, R as RequestFilterable, a as TransportOptions, h as UpdateBoilerplateCategoryResponse, U as UpdateBoilerplateResponse, n as UpdateContactResponse, r as UpdateConversationResponse, w as UpdateLabelResponse, P as UpdateNoteResponse, W as WebhookResponse, C as default } from './index-DmPG0eRh.cjs';
3
3
  import 'ky';
4
4
  import 'zod';
5
5
 
@@ -217,7 +217,7 @@ type CreateConversationResponse = {
217
217
  id: string;
218
218
  name?: string;
219
219
  hasEnded: boolean;
220
- conversationStatus: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
220
+ status: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
221
221
  accountChannel: string;
222
222
  createdAt: string;
223
223
  updatedAt: string;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as Authentication } from './index-Br3bu497.js';
2
- export { C as Client, b as CreateBoilerplateCategoryBoilerplateResponse, e as CreateBoilerplateCategoryResponse, H as CreateContactNoteResponse, S as CreateContactNotificationSubscriptionResponse, j as CreateContactResponse, I as CreateConversationNoteResponse, E as CreateCorrectionResponse, t as CreateLabelResponse, F as CreateResponseResponse, T as CreateUploadResponse, D as DeleteLabelResponse, f as GetBoilerplateCategoryResponse, G as GetBoilerplateResponse, k as GetContactResponse, o as GetConversationResponse, u as GetLabelResponse, z as GetModelResponse, J as GetNoteResponse, P as GetSourceResponse, V as GetUploadResponse, L as ListActionsResponse, g as ListBoilerplateCategoriesResponse, c as ListBoilerplateCategoryBoilerplatesResponse, d as ListBoilerplatesResponse, i as ListChannelsResponse, s as ListContactConversationsResponse, K as ListContactNotesResponse, l as ListContactsResponse, x as ListConversationMessagesResponse, M as ListConversationNotesResponse, p as ListConversationsResponse, m as ListLabelContactsResponse, q as ListLabelConversationsResponse, v as ListLabelsResponse, y as ListMessagesResponse, B as ListModelsResponse, Q as ListSourcesResponse, O as Options, R as RequestFilterable, a as TransportOptions, h as UpdateBoilerplateCategoryResponse, U as UpdateBoilerplateResponse, n as UpdateContactResponse, r as UpdateConversationResponse, w as UpdateLabelResponse, N as UpdateNoteResponse, W as WebhookResponse, C as default } from './index-Br3bu497.js';
1
+ import { A as Authentication } from './index-DmPG0eRh.js';
2
+ export { C as Client, b as CreateBoilerplateCategoryBoilerplateResponse, e as CreateBoilerplateCategoryResponse, I as CreateContactNoteResponse, T as CreateContactNotificationSubscriptionResponse, j as CreateContactResponse, J as CreateConversationNoteResponse, F as CreateCorrectionResponse, t as CreateLabelResponse, H as CreateResponseResponse, V as CreateUploadResponse, D as DeleteLabelResponse, f as GetBoilerplateCategoryResponse, G as GetBoilerplateResponse, k as GetContactResponse, o as GetConversationResponse, u as GetLabelResponse, B as GetModelResponse, K as GetNoteResponse, Q as GetSourceResponse, X as GetUploadResponse, L as ListActionsResponse, g as ListBoilerplateCategoriesResponse, c as ListBoilerplateCategoryBoilerplatesResponse, d as ListBoilerplatesResponse, z as ListChannelMessagesResponse, i as ListChannelsResponse, s as ListContactConversationsResponse, M as ListContactNotesResponse, l as ListContactsResponse, x as ListConversationMessagesResponse, N as ListConversationNotesResponse, p as ListConversationsResponse, m as ListLabelContactsResponse, q as ListLabelConversationsResponse, v as ListLabelsResponse, y as ListMessagesResponse, E as ListModelsResponse, S as ListSourcesResponse, O as Options, R as RequestFilterable, a as TransportOptions, h as UpdateBoilerplateCategoryResponse, U as UpdateBoilerplateResponse, n as UpdateContactResponse, r as UpdateConversationResponse, w as UpdateLabelResponse, P as UpdateNoteResponse, W as WebhookResponse, C as default } from './index-DmPG0eRh.js';
3
3
  import 'ky';
4
4
  import 'zod';
5
5
 
@@ -217,7 +217,7 @@ type CreateConversationResponse = {
217
217
  id: string;
218
218
  name?: string;
219
219
  hasEnded: boolean;
220
- conversationStatus: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
220
+ status: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
221
221
  accountChannel: string;
222
222
  createdAt: string;
223
223
  updatedAt: string;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{a as d,b as g,c as s,d as p,e as n,f as a,g as f,h as m,i as u,j as c,k as x,l,m as h,n as A,o as _}from"./chunk-LM2GWKIZ.js";var E={};d(E,{AuthError:()=>m,AuthenticationError:()=>u,AuthorizationError:()=>c,LogicError:()=>x,NetworkError:()=>l,SupportError:()=>f,ValidationError:()=>h});var t=class o{static DEFAULT_NAME=s;name;#r;constructor({name:r=process.env[a]??o.DEFAULT_NAME,key:i=process.env[n]}={}){if(!i)throw new Error("API Key option must be specified when using Key Authentication");this.name=r,this.#r=i}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#r)}`}}};var e=class{#r;constructor({token:r=process.env[p]}={}){if(!r)throw new Error("Access Token option must be specified when using Token Authentication");this.#r=r}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Bearer ${this.#r}`}}};export{A as Client,g as DEFAULT_SUPPORT_BASE_URL,E as Error,t as KeyAuthentication,_ as PublicAuthentication,e as TokenAuthentication,A as default};
1
+ import{a as d,b as g,c as s,d as p,e as n,f as _,g as a,h as f,i as m,j as u,k as c,l as x,m as l,n as h,o as A}from"./chunk-RG2RLFZA.js";var E={};d(E,{AuthError:()=>m,AuthenticationError:()=>u,AuthorizationError:()=>c,LogicError:()=>x,NetworkError:()=>l,SupportError:()=>f,ValidationError:()=>h});var t=class o{static DEFAULT_NAME=a;name;#r;constructor({name:r=process.env[n]??o.DEFAULT_NAME,key:i=process.env[p]}={}){if(!i)throw new Error("API Key option must be specified when using Key Authentication");this.name=r,this.#r=i}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#r)}`}}};var e=class{#r;constructor({token:r=process.env[s]}={}){if(!r)throw new Error("Access Token option must be specified when using Token Authentication");this.#r=r}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Bearer ${this.#r}`}}};export{A as Client,_ as DEFAULT_SUPPORT_BASE_URL,E as Error,t as KeyAuthentication,g as PublicAuthentication,e as TokenAuthentication,A as default};