@great-detail/support-sdk 0.4.7 → 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,8 @@ type ListBoilerplateCategoryBoilerplatesResponse = {
160
160
  }[];
161
161
  };
162
162
 
163
- interface Options$F {
163
+ interface Options$G {
164
+ query?: string;
164
165
  request?: RequestInit;
165
166
  }
166
167
  type ListBoilerplatesResponse = {
@@ -177,10 +178,10 @@ type ListBoilerplatesResponse = {
177
178
  declare class ListBoilerplates {
178
179
  protected _transport: FetchTransport;
179
180
  constructor(_transport: FetchTransport);
180
- send({ request }?: Options$F): Promise<ky.KyResponse<ListBoilerplatesResponse>>;
181
+ send({ query, request }?: Options$G): Promise<ky.KyResponse<ListBoilerplatesResponse>>;
181
182
  }
182
183
 
183
- interface Options$E {
184
+ interface Options$F {
184
185
  id: string;
185
186
  body: z.infer<typeof UpdateBoilerplate.SCHEMA>;
186
187
  request?: RequestInit;
@@ -209,10 +210,10 @@ declare class UpdateBoilerplate {
209
210
  content?: string | undefined;
210
211
  }>;
211
212
  constructor(_transport: FetchTransport);
212
- send({ id, body, request }: Options$E): Promise<ky.KyResponse<UpdateBoilerplateResponse>>;
213
+ send({ id, body, request }: Options$F): Promise<ky.KyResponse<UpdateBoilerplateResponse>>;
213
214
  }
214
215
 
215
- interface Options$D {
216
+ interface Options$E {
216
217
  body: z.infer<typeof CreateBoilerplateCategory.SCHEMA>;
217
218
  request?: RequestInit;
218
219
  }
@@ -242,10 +243,10 @@ declare class CreateBoilerplateCategory {
242
243
  description?: string | undefined;
243
244
  }>;
244
245
  constructor(_transport: FetchTransport);
245
- send({ body, request }: Options$D): Promise<ky.KyResponse<CreateBoilerplateCategoryResponse>>;
246
+ send({ body, request }: Options$E): Promise<ky.KyResponse<CreateBoilerplateCategoryResponse>>;
246
247
  }
247
248
 
248
- interface Options$C {
249
+ interface Options$D {
249
250
  id: string;
250
251
  request?: RequestInit;
251
252
  }
@@ -262,10 +263,10 @@ type GetBoilerplateCategoryResponse = {
262
263
  declare class GetBoilerplateCategory {
263
264
  protected _transport: FetchTransport;
264
265
  constructor(_transport: FetchTransport);
265
- send({ id, request }: Options$C): Promise<ky.KyResponse<GetBoilerplateCategoryResponse>>;
266
+ send({ id, request }: Options$D): Promise<ky.KyResponse<GetBoilerplateCategoryResponse>>;
266
267
  }
267
268
 
268
- interface Options$B {
269
+ interface Options$C {
269
270
  request?: RequestInit;
270
271
  }
271
272
  type ListBoilerplateCategoriesResponse = {
@@ -281,10 +282,10 @@ type ListBoilerplateCategoriesResponse = {
281
282
  declare class ListBoilerplateCategories {
282
283
  protected _transport: FetchTransport;
283
284
  constructor(_transport: FetchTransport);
284
- send({ request }?: Options$B): Promise<ky.KyResponse<ListBoilerplateCategoriesResponse>>;
285
+ send({ request }?: Options$C): Promise<ky.KyResponse<ListBoilerplateCategoriesResponse>>;
285
286
  }
286
287
 
287
- interface Options$A {
288
+ interface Options$B {
288
289
  id: string;
289
290
  body: z.infer<typeof UpdateBoilerplateCategory.SCHEMA>;
290
291
  request?: RequestInit;
@@ -312,17 +313,17 @@ declare class UpdateBoilerplateCategory {
312
313
  description?: string | undefined;
313
314
  }>;
314
315
  constructor(_transport: FetchTransport);
315
- send({ id, body, request }: Options$A): Promise<ky.KyResponse<UpdateBoilerplateCategoryResponse>>;
316
+ send({ id, body, request }: Options$B): Promise<ky.KyResponse<UpdateBoilerplateCategoryResponse>>;
316
317
  }
317
318
 
318
- interface Options$z {
319
+ interface Options$A {
319
320
  request?: RequestInit;
320
321
  }
321
322
  type ListChannelsResponse = {
322
323
  channels: ({
323
324
  id: string;
324
325
  name?: string;
325
- channelStatus: "ActiveChannelStatus" | "PotentialChannelStatus";
326
+ status: "ActiveChannelStatus" | "PotentialChannelStatus";
326
327
  account: string;
327
328
  createdAt: string;
328
329
  updatedAt?: string;
@@ -345,7 +346,7 @@ type ListChannelsResponse = {
345
346
  declare class ListChannels {
346
347
  protected _transport: FetchTransport;
347
348
  constructor(_transport: FetchTransport);
348
- send({ request }?: Options$z): Promise<ky.KyResponse<ListChannelsResponse>>;
349
+ send({ request }?: Options$A): Promise<ky.KyResponse<ListChannelsResponse>>;
349
350
  }
350
351
 
351
352
  /**
@@ -357,7 +358,7 @@ declare class ListChannels {
357
358
  * @see https://greatdetail.com
358
359
  */
359
360
 
360
- interface Options$y {
361
+ interface Options$z {
361
362
  id: string;
362
363
  vcf?: {
363
364
  variant?: "vcard";
@@ -370,11 +371,11 @@ interface Options$y {
370
371
  declare class GetContactVCFURL {
371
372
  protected _transport: FetchTransport;
372
373
  constructor(_transport: FetchTransport);
373
- getRelativeURL({ id, vcf }: Options$y): string;
374
- getURL(options: Options$y): string;
374
+ getRelativeURL({ id, vcf }: Options$z): string;
375
+ getURL(options: Options$z): string;
375
376
  }
376
377
 
377
- interface Options$x {
378
+ interface Options$y {
378
379
  body: z.infer<typeof CreateContact.SCHEMA>;
379
380
  request?: RequestInit;
380
381
  }
@@ -408,10 +409,10 @@ declare class CreateContact {
408
409
  telephoneNumber?: string | undefined;
409
410
  }>;
410
411
  constructor(_transport: FetchTransport);
411
- send({ body, request }: Options$x): Promise<ky.KyResponse<CreateContactResponse>>;
412
+ send({ body, request }: Options$y): Promise<ky.KyResponse<CreateContactResponse>>;
412
413
  }
413
414
 
414
- interface Options$w {
415
+ interface Options$x {
415
416
  id: string;
416
417
  request?: RequestInit;
417
418
  }
@@ -429,10 +430,10 @@ type GetContactResponse = {
429
430
  declare class GetContact {
430
431
  protected _transport: FetchTransport;
431
432
  constructor(_transport: FetchTransport);
432
- send({ id, request }: Options$w): Promise<ky.KyResponse<GetContactResponse>>;
433
+ send({ id, request }: Options$x): Promise<ky.KyResponse<GetContactResponse>>;
433
434
  }
434
435
 
435
- interface Options$v {
436
+ interface Options$w {
436
437
  request?: RequestInit;
437
438
  }
438
439
  type ListContactsResponse = {
@@ -449,10 +450,10 @@ type ListContactsResponse = {
449
450
  declare class ListContacts {
450
451
  protected _transport: FetchTransport;
451
452
  constructor(_transport: FetchTransport);
452
- send({ request }?: Options$v): Promise<ky.KyResponse<ListContactsResponse>>;
453
+ send({ request }?: Options$w): Promise<ky.KyResponse<ListContactsResponse>>;
453
454
  }
454
455
 
455
- interface Options$u {
456
+ interface Options$v {
456
457
  id: string;
457
458
  request?: RequestInit;
458
459
  }
@@ -470,10 +471,10 @@ type ListLabelContactsResponse = {
470
471
  declare class ListLabelContacts {
471
472
  protected _transport: FetchTransport;
472
473
  constructor(_transport: FetchTransport);
473
- send({ id, request }: Options$u): Promise<ky.KyResponse<ListLabelContactsResponse>>;
474
+ send({ id, request }: Options$v): Promise<ky.KyResponse<ListLabelContactsResponse>>;
474
475
  }
475
476
 
476
- interface Options$t {
477
+ interface Options$u {
477
478
  id: string;
478
479
  body: z.infer<typeof UpdateContact.SCHEMA>;
479
480
  request?: RequestInit;
@@ -505,10 +506,10 @@ declare class UpdateContact {
505
506
  telephoneNumber?: string | undefined;
506
507
  }>;
507
508
  constructor(_transport: FetchTransport);
508
- send({ id, body, request }: Options$t): Promise<ky.KyResponse<UpdateContactResponse>>;
509
+ send({ id, body, request }: Options$u): Promise<ky.KyResponse<UpdateContactResponse>>;
509
510
  }
510
511
 
511
- interface Options$s {
512
+ interface Options$t {
512
513
  id: string;
513
514
  request?: RequestInit;
514
515
  }
@@ -517,7 +518,7 @@ type GetConversationResponse = {
517
518
  id: string;
518
519
  name?: string;
519
520
  hasEnded: boolean;
520
- conversationStatus: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
521
+ status: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
521
522
  accountChannel: string;
522
523
  createdAt: string;
523
524
  updatedAt: string;
@@ -526,10 +527,10 @@ type GetConversationResponse = {
526
527
  declare class GetConversation {
527
528
  protected _transport: FetchTransport;
528
529
  constructor(_transport: FetchTransport);
529
- send({ id, request }: Options$s): Promise<ky.KyResponse<GetConversationResponse>>;
530
+ send({ id, request }: Options$t): Promise<ky.KyResponse<GetConversationResponse>>;
530
531
  }
531
532
 
532
- interface Options$r {
533
+ interface Options$s {
533
534
  id: string;
534
535
  request?: RequestInit;
535
536
  }
@@ -538,7 +539,7 @@ type ListContactConversationsResponse = {
538
539
  id: string;
539
540
  name?: string;
540
541
  hasEnded: boolean;
541
- conversationStatus: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
542
+ status: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
542
543
  accountChannel: string;
543
544
  createdAt: string;
544
545
  updatedAt: string;
@@ -547,10 +548,10 @@ type ListContactConversationsResponse = {
547
548
  declare class ListContactConversations {
548
549
  protected _transport: FetchTransport;
549
550
  constructor(_transport: FetchTransport);
550
- send({ id, request }: Options$r): Promise<ky.KyResponse<ListContactConversationsResponse>>;
551
+ send({ id, request }: Options$s): Promise<ky.KyResponse<ListContactConversationsResponse>>;
551
552
  }
552
553
 
553
- interface Options$q {
554
+ interface Options$r {
554
555
  request?: RequestInit;
555
556
  }
556
557
  type ListConversationsResponse = {
@@ -558,7 +559,7 @@ type ListConversationsResponse = {
558
559
  id: string;
559
560
  name?: string;
560
561
  hasEnded: boolean;
561
- conversationStatus: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
562
+ status: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
562
563
  accountChannel: string;
563
564
  createdAt: string;
564
565
  updatedAt: string;
@@ -567,10 +568,10 @@ type ListConversationsResponse = {
567
568
  declare class ListConversations {
568
569
  protected _transport: FetchTransport;
569
570
  constructor(_transport: FetchTransport);
570
- send({ request }?: Options$q): Promise<ky.KyResponse<ListConversationsResponse>>;
571
+ send({ request }?: Options$r): Promise<ky.KyResponse<ListConversationsResponse>>;
571
572
  }
572
573
 
573
- interface Options$p {
574
+ interface Options$q {
574
575
  id: string;
575
576
  request?: RequestInit;
576
577
  }
@@ -579,7 +580,7 @@ type ListLabelConversationsResponse = {
579
580
  id: string;
580
581
  name?: string;
581
582
  hasEnded: boolean;
582
- conversationStatus: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
583
+ status: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
583
584
  accountChannel: string;
584
585
  createdAt: string;
585
586
  updatedAt: string;
@@ -588,10 +589,10 @@ type ListLabelConversationsResponse = {
588
589
  declare class ListLabelConversations {
589
590
  protected _transport: FetchTransport;
590
591
  constructor(_transport: FetchTransport);
591
- send({ id, request }: Options$p): Promise<ky.KyResponse<ListLabelConversationsResponse>>;
592
+ send({ id, request }: Options$q): Promise<ky.KyResponse<ListLabelConversationsResponse>>;
592
593
  }
593
594
 
594
- interface Options$o {
595
+ interface Options$p {
595
596
  id: string;
596
597
  body: z.infer<typeof UpdateConversation.SCHEMA>;
597
598
  request?: RequestInit;
@@ -601,7 +602,7 @@ type UpdateConversationResponse = {
601
602
  id: string;
602
603
  name?: string;
603
604
  hasEnded: boolean;
604
- conversationStatus: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
605
+ status: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
605
606
  accountChannel: string;
606
607
  createdAt: string;
607
608
  updatedAt: string;
@@ -620,10 +621,10 @@ declare class UpdateConversation {
620
621
  hasEnded?: boolean | undefined;
621
622
  }>;
622
623
  constructor(_transport: FetchTransport);
623
- send({ id, body, request }: Options$o): Promise<ky.KyResponse<UpdateConversationResponse>>;
624
+ send({ id, body, request }: Options$p): Promise<ky.KyResponse<UpdateConversationResponse>>;
624
625
  }
625
626
 
626
- interface Options$n {
627
+ interface Options$o {
627
628
  body: z.infer<typeof CreateLabel.SCHEMA>;
628
629
  request?: RequestInit;
629
630
  }
@@ -653,10 +654,10 @@ declare class CreateLabel {
653
654
  description?: string | undefined;
654
655
  }>;
655
656
  constructor(_transport: FetchTransport);
656
- send({ body, request }: Options$n): Promise<ky.KyResponse<CreateLabelResponse>>;
657
+ send({ body, request }: Options$o): Promise<ky.KyResponse<CreateLabelResponse>>;
657
658
  }
658
659
 
659
- interface Options$m {
660
+ interface Options$n {
660
661
  id: string;
661
662
  request?: RequestInit;
662
663
  }
@@ -664,10 +665,10 @@ type DeleteLabelResponse = Record<string, never>;
664
665
  declare class DeleteLabel {
665
666
  protected _transport: FetchTransport;
666
667
  constructor(_transport: FetchTransport);
667
- send({ id, request }: Options$m): Promise<ky.KyResponse<DeleteLabelResponse>>;
668
+ send({ id, request }: Options$n): Promise<ky.KyResponse<DeleteLabelResponse>>;
668
669
  }
669
670
 
670
- interface Options$l {
671
+ interface Options$m {
671
672
  id: string;
672
673
  request?: RequestInit;
673
674
  }
@@ -684,10 +685,10 @@ type GetLabelResponse = {
684
685
  declare class GetLabel {
685
686
  protected _transport: FetchTransport;
686
687
  constructor(_transport: FetchTransport);
687
- send({ id, request }: Options$l): Promise<ky.KyResponse<GetLabelResponse>>;
688
+ send({ id, request }: Options$m): Promise<ky.KyResponse<GetLabelResponse>>;
688
689
  }
689
690
 
690
- interface Options$k {
691
+ interface Options$l {
691
692
  request?: RequestInit;
692
693
  }
693
694
  type ListLabelsResponse = {
@@ -703,10 +704,10 @@ type ListLabelsResponse = {
703
704
  declare class ListLabels {
704
705
  protected _transport: FetchTransport;
705
706
  constructor(_transport: FetchTransport);
706
- send({ request }?: Options$k): Promise<ky.KyResponse<ListLabelsResponse>>;
707
+ send({ request }?: Options$l): Promise<ky.KyResponse<ListLabelsResponse>>;
707
708
  }
708
709
 
709
- interface Options$j {
710
+ interface Options$k {
710
711
  id: string;
711
712
  body: z.infer<typeof UpdateLabel.SCHEMA>;
712
713
  request?: RequestInit;
@@ -734,7 +735,36 @@ declare class UpdateLabel {
734
735
  description?: string | undefined;
735
736
  }>;
736
737
  constructor(_transport: FetchTransport);
737
- 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>>;
738
768
  }
739
769
 
740
770
  interface Options$i {
@@ -745,7 +775,7 @@ type ListConversationMessagesResponse = {
745
775
  messages: {
746
776
  id: string;
747
777
  role: "user" | "assistant";
748
- messageStatus: string;
778
+ status: string;
749
779
  externalIdentifier?: string;
750
780
  conversation: string;
751
781
  contact: string;
@@ -773,7 +803,7 @@ type ListMessagesResponse = {
773
803
  messages: {
774
804
  id: string;
775
805
  role: "user" | "assistant";
776
- messageStatus: string;
806
+ status: string;
777
807
  externalIdentifier?: string;
778
808
  conversation: string;
779
809
  contact: string;
@@ -1269,6 +1299,9 @@ declare class Client {
1269
1299
  };
1270
1300
  get channel(): {
1271
1301
  list: ListChannels;
1302
+ message: {
1303
+ list: ListChannelMessages;
1304
+ };
1272
1305
  };
1273
1306
  get contact(): {
1274
1307
  get: GetContact;
@@ -1343,4 +1376,4 @@ declare class Client {
1343
1376
  get webhook(): Webhook;
1344
1377
  }
1345
1378
 
1346
- 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({request:t={}}={}){return this._transport.send("v1/boilerplates",{...t,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-DNJOlCyr.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-DNJOlCyr.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-DNJOlCyr.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-DNJOlCyr.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-K37WTNB5.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};