@great-detail/support-sdk 0.18.12 → 0.18.14

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.
@@ -53,6 +53,7 @@ declare class FetchTransport implements Transport {
53
53
  limitQuery(limit?: number): [string, string][];
54
54
  includeQuery(include?: IncludeQueryOptions): [string, string][];
55
55
  queryQuery(input?: string): [string, string][];
56
+ filterQuery(name: string, input?: string): [string, string][];
56
57
  send<T = unknown>(url: string, request?: SendOptions): {
57
58
  response: () => Promise<ky.KyResponse<T>>;
58
59
  json: () => Promise<T>;
@@ -317,6 +318,7 @@ type ConversationSettings = {
317
318
  id: ConversationSettingsID;
318
319
  defaultName?: Nullable<string>;
319
320
  enableAutoResponse?: Nullable<boolean>;
321
+ autoResponseAge?: Nullable<number>;
320
322
  responseDuration?: Nullable<string>;
321
323
  resolveDuration?: Nullable<string>;
322
324
  enableAutoLabel?: Nullable<boolean>;
@@ -354,47 +356,6 @@ type GetAccountConversationSettingsResponse = {
354
356
  };
355
357
  };
356
358
 
357
- /**
358
- * Great Detail Support System.
359
- *
360
- * @copyright 2025 Great Detail Ltd
361
- * @author Great Detail Ltd <info@greatdetail.com>
362
- * @author Dom Webber <dom.webber@greatdetail.com>
363
- * @see https://greatdetail.com
364
- */
365
-
366
- type UpdateAccountConversationSettingsPayload = {
367
- conversationSettings: {
368
- defaultName?: Nullable<string>;
369
- enableAutoResponse?: boolean;
370
- responseDuration?: Nullable<string>;
371
- resolveDuration?: Nullable<string>;
372
- enableAutoLabel?: Nullable<boolean>;
373
- };
374
- };
375
- interface UpdateAccountConversationSettingsOptions {
376
- body: UpdateAccountConversationSettingsPayload;
377
- request?: SendOptions;
378
- }
379
- type UpdateAccountConversationSettingsResponse = {
380
- data: {
381
- accountConversationSettings: AccountConversationSettings;
382
- };
383
- };
384
-
385
- declare class AccountConversationSettingsAPI {
386
- protected _transport: FetchTransport;
387
- constructor(_transport: FetchTransport);
388
- get(account: CurrentAccountID | AccountID, { request }?: GetAccountConversationSettingsOptions): {
389
- response: () => Promise<ky.KyResponse<GetAccountConversationSettingsResponse>>;
390
- json: () => Promise<GetAccountConversationSettingsResponse>;
391
- };
392
- update(account: CurrentAccountID | AccountID, { body, request }: UpdateAccountConversationSettingsOptions): {
393
- response: () => Promise<ky.KyResponse<UpdateAccountConversationSettingsResponse>>;
394
- json: () => Promise<UpdateAccountConversationSettingsResponse>;
395
- };
396
- }
397
-
398
359
  /**
399
360
  * Great Detail Support System.
400
361
  *
@@ -451,10 +412,12 @@ type Channel = {
451
412
 
452
413
  type ContactID = `cnt${string}` | (string & NonNullable<unknown>);
453
414
  type ContactType = "ConsumerContact" | "RepresentativeContact" | "AssistantContact";
415
+ type ContactStatus = "ActiveContact" | "BannedContact";
454
416
  type ContactCustomMetadata = Record<string, Nullable<string | number>>;
455
417
  type Contact = {
456
418
  id: ContactID;
457
419
  type: ContactType;
420
+ status: ContactStatus;
458
421
  name?: Nullable<string>;
459
422
  birthDate?: Nullable<string>;
460
423
  emailAddress?: Nullable<string>;
@@ -465,6 +428,49 @@ type Contact = {
465
428
  channel?: Nullable<ChannelID>;
466
429
  } & ResponseTimestamp;
467
430
 
431
+ /**
432
+ * Great Detail Support System.
433
+ *
434
+ * @copyright 2025 Great Detail Ltd
435
+ * @author Great Detail Ltd <info@greatdetail.com>
436
+ * @author Dom Webber <dom.webber@greatdetail.com>
437
+ * @see https://greatdetail.com
438
+ */
439
+
440
+ type UpdateAccountConversationSettingsPayload = {
441
+ conversationSettings: {
442
+ defaultName?: Nullable<string>;
443
+ enableAutoResponse?: boolean;
444
+ autoResponseAge?: Nullable<number>;
445
+ responseDuration?: Nullable<string>;
446
+ resolveDuration?: Nullable<string>;
447
+ enableAutoLabel?: Nullable<boolean>;
448
+ assistantContact?: Nullable<ContactID>;
449
+ };
450
+ };
451
+ interface UpdateAccountConversationSettingsOptions {
452
+ body: UpdateAccountConversationSettingsPayload;
453
+ request?: SendOptions;
454
+ }
455
+ type UpdateAccountConversationSettingsResponse = {
456
+ data: {
457
+ accountConversationSettings: AccountConversationSettings;
458
+ };
459
+ };
460
+
461
+ declare class AccountConversationSettingsAPI {
462
+ protected _transport: FetchTransport;
463
+ constructor(_transport: FetchTransport);
464
+ get(account: CurrentAccountID | AccountID, { request }?: GetAccountConversationSettingsOptions): {
465
+ response: () => Promise<ky.KyResponse<GetAccountConversationSettingsResponse>>;
466
+ json: () => Promise<GetAccountConversationSettingsResponse>;
467
+ };
468
+ update(account: CurrentAccountID | AccountID, { body, request }: UpdateAccountConversationSettingsOptions): {
469
+ response: () => Promise<ky.KyResponse<UpdateAccountConversationSettingsResponse>>;
470
+ json: () => Promise<UpdateAccountConversationSettingsResponse>;
471
+ };
472
+ }
473
+
468
474
  /**
469
475
  * Great Detail Support System.
470
476
  *
@@ -1207,9 +1213,11 @@ type UpdateChannelConversationSettingsPayload = {
1207
1213
  conversationSettings: {
1208
1214
  defaultName?: Nullable<string>;
1209
1215
  enableAutoResponse?: Nullable<boolean>;
1216
+ autoResponseAge?: Nullable<number>;
1210
1217
  responseDuration?: Nullable<string>;
1211
1218
  resolveDuration?: Nullable<string>;
1212
1219
  enableAutoLabel?: Nullable<boolean>;
1220
+ assistantContact?: Nullable<ContactID>;
1213
1221
  };
1214
1222
  };
1215
1223
  interface UpdateChannelConversationSettingsOptions {
@@ -1493,11 +1501,10 @@ interface GetContactVCFOptions {
1493
1501
  * @see https://greatdetail.com
1494
1502
  */
1495
1503
 
1496
- type ListContactsFilterOptions = "consumer" | "representative" | "assistant";
1497
1504
  interface ListContactsOptions {
1498
1505
  query?: string;
1499
1506
  limit?: number;
1500
- filter?: ListContactsFilterOptions;
1507
+ type?: ContactType;
1501
1508
  request?: SendOptions;
1502
1509
  }
1503
1510
  type ListContactsResponse = {
@@ -1535,6 +1542,7 @@ type ListLabelContactsResponse = {
1535
1542
  */
1536
1543
 
1537
1544
  type UpdateContactPayload = {
1545
+ status?: ContactStatus;
1538
1546
  name?: string;
1539
1547
  emailAddress?: Nullable<string>;
1540
1548
  telephoneNumber?: Nullable<string>;
@@ -1563,7 +1571,7 @@ declare class ContactAPI {
1563
1571
  response: () => Promise<ky.KyResponse<unknown>>;
1564
1572
  json: () => Promise<unknown>;
1565
1573
  };
1566
- list({ limit, query, filter, request }?: ListContactsOptions): {
1574
+ list({ limit, query, type, request }?: ListContactsOptions): {
1567
1575
  response: () => Promise<ky.KyResponse<ListContactsResponse>>;
1568
1576
  json: () => Promise<ListContactsResponse>;
1569
1577
  };
@@ -3428,4 +3436,4 @@ declare class Client {
3428
3436
  static getBaseURL(): string;
3429
3437
  }
3430
3438
 
3431
- export { type BoilerplateCategoryID as $, type Account as A, type ActionID as B, Client as C, type DeleteAccountAccessTokenPayload as D, type ListActionsOptions as E, type ListActionsResponse as F, type GetAccountOptions as G, type BoilerplateContent as H, type BoilerplateContentID as I, type CreateBoilerplateContentPayload as J, type CreateBoilerplateContentOptions as K, type ListAccountAccessTokensOptions as L, type CreateBoilerplateContentResponse as M, type GetBoilerplateContentOptions as N, type Options as O, type GetBoilerplateContentResponse as P, type ListBoilerplateCategoryBoilerplateContentsOptions as Q, type RequestFilterable as R, type SortOptions as S, type ListBoilerplateCategoryBoilerplateContentsResponse as T, type UpdateAccountPayload as U, type ListBoilerplateContentsOptions as V, type ListBoilerplateContentsResponse as W, type UpdateBoilerplateContentPayload as X, type UpdateBoilerplateContentOptions as Y, type UpdateBoilerplateContentResponse as Z, type BoilerplateCategory as _, type Options$4 as a, type DeleteContactOptions as a$, type CreateBoilerplateCategoryPayload as a0, type CreateBoilerplateCategoryOptions as a1, type CreateBoilerplateCategoryResponse as a2, type GetBoilerplateCategoryOptions as a3, type GetBoilerplateCategoryResponse as a4, type ListBoilerplateCategoriesIncludeOptions as a5, type ListBoilerplateCategoriesOptions as a6, type ListBoilerplateCategoriesResponse as a7, type UpdateBoilerplateCategoryPayload as a8, type UpdateBoilerplateCategoryOptions as a9, type CreateCompositionSectionPayload as aA, type CreateCompositionSectionOptions as aB, type CreateCompositionSectionResponse as aC, type GetCompositionSectionOptions as aD, type GetCompositionSectionResponse as aE, type ListChannelCompositionSectionsOptions as aF, type ListChannelCompositionSectionsResponse as aG, type ListCompositionSectionsOptions as aH, type ListCompositionSectionsResponse as aI, type UpdateCompositionSectionPayload as aJ, type UpdateCompositionSectionOptions as aK, type UpdateCompositionSectionResponse as aL, type Escalation as aM, type CreateEscalationPayload as aN, type CreateEscalationOptions as aO, type CreateEscalationResponse as aP, type GetEscalationOptions as aQ, type GetEscalationResponse as aR, type ListEscalationsOptions as aS, type ListEscalationsResponse as aT, type Contact as aU, type ContactID as aV, type ContactType as aW, type ContactCustomMetadata as aX, type CreateContactPayload as aY, type CreateContactOptions as aZ, type CreateContactResponse as a_, type UpdateBoilerplateCategoryResponse as aa, type Channel as ab, type ChannelID as ac, type CreateChannelPayload as ad, type CreateChannelOptions as ae, type CreateChannelResponse as af, type GetChannelOptions as ag, type GetChannelResponse as ah, type ListChannelsOptions as ai, type ListChannelsResponse as aj, type MetaWhatsappChannelGetBusinessProfileOptions as ak, type MetaWhatsappChannelGetBusinessProfileResponse as al, type TwilioSendChannelSyncPayload as am, type TwilioSendgridChannelSyncOptions as an, type TwilioSendgridChannelSyncResponse as ao, type UpdateChannelPayload as ap, type UpdateChannelOptions as aq, type UpdateChannelResponse as ar, type ChannelConversationSettings as as, type GetChannelConversationSettingsOptions as at, type GetChannelConversationSettingsResponse as au, type UpdateChannelConversationSettingsPayload as av, type UpdateChannelConversationSettingsOptions as aw, type UpdateChannelConversationSettingsResponse as ax, type CompositionSection as ay, type CompositionSectionID as az, type CurrentAccountID as b, type ListContactLabelsResponse as b$, type DeleteContactResponse as b0, type GetContactIncludeOptions as b1, type GetContactOptions as b2, type GetContactResponse as b3, type GetContactVCFOptions as b4, type ListContactsFilterOptions as b5, type ListContactsOptions as b6, type ListContactsResponse as b7, type ListLabelContactsOptions as b8, type ListLabelContactsResponse as b9, type ListLabelConversationsResponse as bA, type UpdateConversationPayload as bB, type UpdateConversationOptions as bC, type UpdateConversationResponse as bD, type ConversationSettings as bE, type ConversationFeedback as bF, type CreateConversationFeedbackPayload as bG, type CreateConversationFeedbackOptions as bH, type CreateConversationFeedbackResponse as bI, type DeleteConversationFeedbackOptions as bJ, type DeleteConversationFeedbackResponse as bK, type GetConversationFeedbackOptions as bL, type GetConversationFeedbackResponse as bM, type ListConversationConversationFeedbackOptions as bN, type ListConversationConversationFeedbackResponse as bO, type ListConversationFeedbackOptions as bP, type ListConversationFeedbackResponse as bQ, type Label as bR, type CreateLabelPayload as bS, type CreateLabelOptions as bT, type CreateLabelResponse as bU, type DeleteLabelOptions as bV, type DeleteLabelResponse as bW, type GetLabelOptions as bX, type GetLabelResponse as bY, type LabelID as bZ, type ListContactLabelsOptions as b_, type UpdateContactPayload as ba, type UpdateContactOptions as bb, type UpdateContactResponse as bc, type Conversation as bd, type ConversationID as be, type ConversationCustomMetadata as bf, type ActiveConversationStatus as bg, type ConcludedConversationStatus as bh, type ConversationStatus as bi, type CreateConversationPayload as bj, type CreateConversationOptions as bk, type CreateConversationResponse as bl, type DeleteConversationOptions as bm, type DeleteConversationResponse as bn, type GetConversationIncludeOptions as bo, type GetConversationOptions as bp, type GetConversationResponse as bq, type ListChannelConversationsOptions as br, type ListChannelConversationsResponse as bs, type ListContactConversationsOptions as bt, type ListContactConversationsResponse as bu, type ListConversationsIncludeOptions as bv, type ListConversationsFilterOptions as bw, type ListConversationOptions as bx, type ListConversationsResponse as by, type ListLabelConversationsOptions as bz, type AccountID as c, type CreateUploadResponse as c$, type ListConversationLabelsOptions as c0, type ListConversationLabelsResponse as c1, type ListLabelsIncludeOptions as c2, type ListLabelsOptions as c3, type ListLabelsResponse as c4, type UpdateLabelPayload as c5, type UpdateLabelOptions as c6, type UpdateLabelResponse as c7, type Message as c8, type CreateMessagePayload as c9, type GetModelOptions as cA, type GetModelResponse as cB, type ListModelsOptions as cC, type ListModelsResponse as cD, type ModelID as cE, type Note as cF, type CreateNotePayload as cG, type CreateNoteOptions as cH, type CreateNoteResponse as cI, type GetNoteOptions as cJ, type GetNoteResponse as cK, type ListContactNotesOptions as cL, type ListContactNotesResponse as cM, type ListConversationNotesOptions as cN, type ListConversationNotesResponse as cO, type NoteID as cP, type UpdateNotePayload as cQ, type UpdateNoteOptions as cR, type UpdateNoteResponse as cS, type Source as cT, type GetSourceOptions as cU, type GetSourceResponse as cV, type ListSourcesOptions as cW, type ListSourcesResponse as cX, type SourceID as cY, type Upload as cZ, type CreateUploadOptions as c_, type CreateMessageOptions as ca, type CreateMessageResponse as cb, type DeleteMessageOptions as cc, type DeleteMessageResponse as cd, type GetMessageOptions as ce, type GetMessageResponse as cf, type ListChannelMessagesIncludeOptions as cg, type ListChannelMessagesOptions as ch, type ListChannelMessagesResponse as ci, type ListConversationMessagesIncludeOptions as cj, type ListConversationMessagesOptions as ck, type ListConversationMessagesResponse as cl, type ListMessagesIncludeOptions as cm, type ListMessagesOptions as cn, type ListMessagesResponse as co, type MessageID as cp, type MessageRole as cq, type MessageStatus as cr, type MessageEventType as cs, type Model as ct, type CreateCorrectionModelPayload as cu, type CreateCorrectionModelOptions as cv, type CreateCorrectionResponse as cw, type CreateResponseModelPayload as cx, type CreateResponseModelOptions as cy, type CreateResponseResponse as cz, type CreateAccountPayload as d, type DeleteUploadOptions as d0, type DeleteUploadResponse as d1, type GetUploadOptions as d2, type GetUploadResponse as d3, type ListUploadsOptions as d4, type ListUploadsResponse as d5, type UploadID as d6, type User as d7, type GetUserOptions as d8, type GetUserResponse as d9, type UserID as da, type EventWebhookOptions as db, eventWebhookSchema as dc, type WebhookEventType as dd, type AccountWebhookWebhookEventType as de, type AccountAccessTokenWebhookEventType as df, type ContactWebhookEventType as dg, type ConversationWebhookEventType as dh, type MessageWebhookEventType as di, type WebhookSubscriptionWebhookEventType as dj, type WebhookEventPayload as dk, type WebhookResponse as dl, type WebhookSubscription as dm, type CreateWebhookSubscriptionPayload as dn, type CreateWebhookSubscriptionOptions as dp, type CreateWebhookSubscriptionResponse as dq, type DeleteWebhookSubscriptionOptions as dr, type DeleteWebhookSubscriptionResponse as ds, type GetWebhookSubscriptionOptions as dt, type GetWebhookSubscriptionResponse as du, type ListWebhookSubscriptionsOptions as dv, type ListWebhookSubscriptionsResponse as dw, type TestWebhookSubscriptionOptions as dx, type TestWebhookSubscriptionResponse as dy, type WebhookSubscriptionID as dz, type CreateAccountOptions as e, type CreateAccountResponse as f, type GetAccountResponse as g, type UpdateAccountOptions as h, type UpdateAccountResponse as i, type AccountAccessToken as j, type AccountAccessTokenID as k, type CreateAccountAccessTokenPayload as l, type CreateAccountAccessTokenOptions as m, type CreateAccountAccessTokenResponse as n, type DeleteAccountAccessTokenOptions as o, type DeleteAccountAccessTokenResponse as p, type GetAccountAccessTokenOptions as q, type GetAccountAccessTokenResponse as r, type ListAccountAccessTokensResponse as s, type AccountConversationSettings as t, type GetAccountConversationSettingsOptions as u, type GetAccountConversationSettingsResponse as v, type UpdateAccountConversationSettingsPayload as w, type UpdateAccountConversationSettingsOptions as x, type UpdateAccountConversationSettingsResponse as y, type Action as z };
3439
+ export { type BoilerplateCategoryID as $, type Account as A, type ActionID as B, Client as C, type DeleteAccountAccessTokenPayload as D, type ListActionsOptions as E, type ListActionsResponse as F, type GetAccountOptions as G, type BoilerplateContent as H, type BoilerplateContentID as I, type CreateBoilerplateContentPayload as J, type CreateBoilerplateContentOptions as K, type ListAccountAccessTokensOptions as L, type CreateBoilerplateContentResponse as M, type GetBoilerplateContentOptions as N, type Options as O, type GetBoilerplateContentResponse as P, type ListBoilerplateCategoryBoilerplateContentsOptions as Q, type RequestFilterable as R, type SortOptions as S, type ListBoilerplateCategoryBoilerplateContentsResponse as T, type UpdateAccountPayload as U, type ListBoilerplateContentsOptions as V, type ListBoilerplateContentsResponse as W, type UpdateBoilerplateContentPayload as X, type UpdateBoilerplateContentOptions as Y, type UpdateBoilerplateContentResponse as Z, type BoilerplateCategory as _, type Options$4 as a, type CreateContactResponse as a$, type CreateBoilerplateCategoryPayload as a0, type CreateBoilerplateCategoryOptions as a1, type CreateBoilerplateCategoryResponse as a2, type GetBoilerplateCategoryOptions as a3, type GetBoilerplateCategoryResponse as a4, type ListBoilerplateCategoriesIncludeOptions as a5, type ListBoilerplateCategoriesOptions as a6, type ListBoilerplateCategoriesResponse as a7, type UpdateBoilerplateCategoryPayload as a8, type UpdateBoilerplateCategoryOptions as a9, type CreateCompositionSectionPayload as aA, type CreateCompositionSectionOptions as aB, type CreateCompositionSectionResponse as aC, type GetCompositionSectionOptions as aD, type GetCompositionSectionResponse as aE, type ListChannelCompositionSectionsOptions as aF, type ListChannelCompositionSectionsResponse as aG, type ListCompositionSectionsOptions as aH, type ListCompositionSectionsResponse as aI, type UpdateCompositionSectionPayload as aJ, type UpdateCompositionSectionOptions as aK, type UpdateCompositionSectionResponse as aL, type Escalation as aM, type CreateEscalationPayload as aN, type CreateEscalationOptions as aO, type CreateEscalationResponse as aP, type GetEscalationOptions as aQ, type GetEscalationResponse as aR, type ListEscalationsOptions as aS, type ListEscalationsResponse as aT, type Contact as aU, type ContactID as aV, type ContactType as aW, type ContactStatus as aX, type ContactCustomMetadata as aY, type CreateContactPayload as aZ, type CreateContactOptions as a_, type UpdateBoilerplateCategoryResponse as aa, type Channel as ab, type ChannelID as ac, type CreateChannelPayload as ad, type CreateChannelOptions as ae, type CreateChannelResponse as af, type GetChannelOptions as ag, type GetChannelResponse as ah, type ListChannelsOptions as ai, type ListChannelsResponse as aj, type MetaWhatsappChannelGetBusinessProfileOptions as ak, type MetaWhatsappChannelGetBusinessProfileResponse as al, type TwilioSendChannelSyncPayload as am, type TwilioSendgridChannelSyncOptions as an, type TwilioSendgridChannelSyncResponse as ao, type UpdateChannelPayload as ap, type UpdateChannelOptions as aq, type UpdateChannelResponse as ar, type ChannelConversationSettings as as, type GetChannelConversationSettingsOptions as at, type GetChannelConversationSettingsResponse as au, type UpdateChannelConversationSettingsPayload as av, type UpdateChannelConversationSettingsOptions as aw, type UpdateChannelConversationSettingsResponse as ax, type CompositionSection as ay, type CompositionSectionID as az, type CurrentAccountID as b, type ListContactLabelsResponse as b$, type DeleteContactOptions as b0, type DeleteContactResponse as b1, type GetContactIncludeOptions as b2, type GetContactOptions as b3, type GetContactResponse as b4, type GetContactVCFOptions as b5, type ListContactsOptions as b6, type ListContactsResponse as b7, type ListLabelContactsOptions as b8, type ListLabelContactsResponse as b9, type ListLabelConversationsResponse as bA, type UpdateConversationPayload as bB, type UpdateConversationOptions as bC, type UpdateConversationResponse as bD, type ConversationSettings as bE, type ConversationFeedback as bF, type CreateConversationFeedbackPayload as bG, type CreateConversationFeedbackOptions as bH, type CreateConversationFeedbackResponse as bI, type DeleteConversationFeedbackOptions as bJ, type DeleteConversationFeedbackResponse as bK, type GetConversationFeedbackOptions as bL, type GetConversationFeedbackResponse as bM, type ListConversationConversationFeedbackOptions as bN, type ListConversationConversationFeedbackResponse as bO, type ListConversationFeedbackOptions as bP, type ListConversationFeedbackResponse as bQ, type Label as bR, type CreateLabelPayload as bS, type CreateLabelOptions as bT, type CreateLabelResponse as bU, type DeleteLabelOptions as bV, type DeleteLabelResponse as bW, type GetLabelOptions as bX, type GetLabelResponse as bY, type LabelID as bZ, type ListContactLabelsOptions as b_, type UpdateContactPayload as ba, type UpdateContactOptions as bb, type UpdateContactResponse as bc, type Conversation as bd, type ConversationID as be, type ConversationCustomMetadata as bf, type ActiveConversationStatus as bg, type ConcludedConversationStatus as bh, type ConversationStatus as bi, type CreateConversationPayload as bj, type CreateConversationOptions as bk, type CreateConversationResponse as bl, type DeleteConversationOptions as bm, type DeleteConversationResponse as bn, type GetConversationIncludeOptions as bo, type GetConversationOptions as bp, type GetConversationResponse as bq, type ListChannelConversationsOptions as br, type ListChannelConversationsResponse as bs, type ListContactConversationsOptions as bt, type ListContactConversationsResponse as bu, type ListConversationsIncludeOptions as bv, type ListConversationsFilterOptions as bw, type ListConversationOptions as bx, type ListConversationsResponse as by, type ListLabelConversationsOptions as bz, type AccountID as c, type CreateUploadResponse as c$, type ListConversationLabelsOptions as c0, type ListConversationLabelsResponse as c1, type ListLabelsIncludeOptions as c2, type ListLabelsOptions as c3, type ListLabelsResponse as c4, type UpdateLabelPayload as c5, type UpdateLabelOptions as c6, type UpdateLabelResponse as c7, type Message as c8, type CreateMessagePayload as c9, type GetModelOptions as cA, type GetModelResponse as cB, type ListModelsOptions as cC, type ListModelsResponse as cD, type ModelID as cE, type Note as cF, type CreateNotePayload as cG, type CreateNoteOptions as cH, type CreateNoteResponse as cI, type GetNoteOptions as cJ, type GetNoteResponse as cK, type ListContactNotesOptions as cL, type ListContactNotesResponse as cM, type ListConversationNotesOptions as cN, type ListConversationNotesResponse as cO, type NoteID as cP, type UpdateNotePayload as cQ, type UpdateNoteOptions as cR, type UpdateNoteResponse as cS, type Source as cT, type GetSourceOptions as cU, type GetSourceResponse as cV, type ListSourcesOptions as cW, type ListSourcesResponse as cX, type SourceID as cY, type Upload as cZ, type CreateUploadOptions as c_, type CreateMessageOptions as ca, type CreateMessageResponse as cb, type DeleteMessageOptions as cc, type DeleteMessageResponse as cd, type GetMessageOptions as ce, type GetMessageResponse as cf, type ListChannelMessagesIncludeOptions as cg, type ListChannelMessagesOptions as ch, type ListChannelMessagesResponse as ci, type ListConversationMessagesIncludeOptions as cj, type ListConversationMessagesOptions as ck, type ListConversationMessagesResponse as cl, type ListMessagesIncludeOptions as cm, type ListMessagesOptions as cn, type ListMessagesResponse as co, type MessageID as cp, type MessageRole as cq, type MessageStatus as cr, type MessageEventType as cs, type Model as ct, type CreateCorrectionModelPayload as cu, type CreateCorrectionModelOptions as cv, type CreateCorrectionResponse as cw, type CreateResponseModelPayload as cx, type CreateResponseModelOptions as cy, type CreateResponseResponse as cz, type CreateAccountPayload as d, type DeleteUploadOptions as d0, type DeleteUploadResponse as d1, type GetUploadOptions as d2, type GetUploadResponse as d3, type ListUploadsOptions as d4, type ListUploadsResponse as d5, type UploadID as d6, type User as d7, type GetUserOptions as d8, type GetUserResponse as d9, type UserID as da, type EventWebhookOptions as db, eventWebhookSchema as dc, type WebhookEventType as dd, type AccountWebhookWebhookEventType as de, type AccountAccessTokenWebhookEventType as df, type ContactWebhookEventType as dg, type ConversationWebhookEventType as dh, type MessageWebhookEventType as di, type WebhookSubscriptionWebhookEventType as dj, type WebhookEventPayload as dk, type WebhookResponse as dl, type WebhookSubscription as dm, type CreateWebhookSubscriptionPayload as dn, type CreateWebhookSubscriptionOptions as dp, type CreateWebhookSubscriptionResponse as dq, type DeleteWebhookSubscriptionOptions as dr, type DeleteWebhookSubscriptionResponse as ds, type GetWebhookSubscriptionOptions as dt, type GetWebhookSubscriptionResponse as du, type ListWebhookSubscriptionsOptions as dv, type ListWebhookSubscriptionsResponse as dw, type TestWebhookSubscriptionOptions as dx, type TestWebhookSubscriptionResponse as dy, type WebhookSubscriptionID as dz, type CreateAccountOptions as e, type CreateAccountResponse as f, type GetAccountResponse as g, type UpdateAccountOptions as h, type UpdateAccountResponse as i, type AccountAccessToken as j, type AccountAccessTokenID as k, type CreateAccountAccessTokenPayload as l, type CreateAccountAccessTokenOptions as m, type CreateAccountAccessTokenResponse as n, type DeleteAccountAccessTokenOptions as o, type DeleteAccountAccessTokenResponse as p, type GetAccountAccessTokenOptions as q, type GetAccountAccessTokenResponse as r, type ListAccountAccessTokensResponse as s, type AccountConversationSettings as t, type GetAccountConversationSettingsOptions as u, type GetAccountConversationSettingsResponse as v, type UpdateAccountConversationSettingsPayload as w, type UpdateAccountConversationSettingsOptions as x, type UpdateAccountConversationSettingsResponse as y, type Action as z };
@@ -53,6 +53,7 @@ declare class FetchTransport implements Transport {
53
53
  limitQuery(limit?: number): [string, string][];
54
54
  includeQuery(include?: IncludeQueryOptions): [string, string][];
55
55
  queryQuery(input?: string): [string, string][];
56
+ filterQuery(name: string, input?: string): [string, string][];
56
57
  send<T = unknown>(url: string, request?: SendOptions): {
57
58
  response: () => Promise<ky.KyResponse<T>>;
58
59
  json: () => Promise<T>;
@@ -317,6 +318,7 @@ type ConversationSettings = {
317
318
  id: ConversationSettingsID;
318
319
  defaultName?: Nullable<string>;
319
320
  enableAutoResponse?: Nullable<boolean>;
321
+ autoResponseAge?: Nullable<number>;
320
322
  responseDuration?: Nullable<string>;
321
323
  resolveDuration?: Nullable<string>;
322
324
  enableAutoLabel?: Nullable<boolean>;
@@ -354,47 +356,6 @@ type GetAccountConversationSettingsResponse = {
354
356
  };
355
357
  };
356
358
 
357
- /**
358
- * Great Detail Support System.
359
- *
360
- * @copyright 2025 Great Detail Ltd
361
- * @author Great Detail Ltd <info@greatdetail.com>
362
- * @author Dom Webber <dom.webber@greatdetail.com>
363
- * @see https://greatdetail.com
364
- */
365
-
366
- type UpdateAccountConversationSettingsPayload = {
367
- conversationSettings: {
368
- defaultName?: Nullable<string>;
369
- enableAutoResponse?: boolean;
370
- responseDuration?: Nullable<string>;
371
- resolveDuration?: Nullable<string>;
372
- enableAutoLabel?: Nullable<boolean>;
373
- };
374
- };
375
- interface UpdateAccountConversationSettingsOptions {
376
- body: UpdateAccountConversationSettingsPayload;
377
- request?: SendOptions;
378
- }
379
- type UpdateAccountConversationSettingsResponse = {
380
- data: {
381
- accountConversationSettings: AccountConversationSettings;
382
- };
383
- };
384
-
385
- declare class AccountConversationSettingsAPI {
386
- protected _transport: FetchTransport;
387
- constructor(_transport: FetchTransport);
388
- get(account: CurrentAccountID | AccountID, { request }?: GetAccountConversationSettingsOptions): {
389
- response: () => Promise<ky.KyResponse<GetAccountConversationSettingsResponse>>;
390
- json: () => Promise<GetAccountConversationSettingsResponse>;
391
- };
392
- update(account: CurrentAccountID | AccountID, { body, request }: UpdateAccountConversationSettingsOptions): {
393
- response: () => Promise<ky.KyResponse<UpdateAccountConversationSettingsResponse>>;
394
- json: () => Promise<UpdateAccountConversationSettingsResponse>;
395
- };
396
- }
397
-
398
359
  /**
399
360
  * Great Detail Support System.
400
361
  *
@@ -451,10 +412,12 @@ type Channel = {
451
412
 
452
413
  type ContactID = `cnt${string}` | (string & NonNullable<unknown>);
453
414
  type ContactType = "ConsumerContact" | "RepresentativeContact" | "AssistantContact";
415
+ type ContactStatus = "ActiveContact" | "BannedContact";
454
416
  type ContactCustomMetadata = Record<string, Nullable<string | number>>;
455
417
  type Contact = {
456
418
  id: ContactID;
457
419
  type: ContactType;
420
+ status: ContactStatus;
458
421
  name?: Nullable<string>;
459
422
  birthDate?: Nullable<string>;
460
423
  emailAddress?: Nullable<string>;
@@ -465,6 +428,49 @@ type Contact = {
465
428
  channel?: Nullable<ChannelID>;
466
429
  } & ResponseTimestamp;
467
430
 
431
+ /**
432
+ * Great Detail Support System.
433
+ *
434
+ * @copyright 2025 Great Detail Ltd
435
+ * @author Great Detail Ltd <info@greatdetail.com>
436
+ * @author Dom Webber <dom.webber@greatdetail.com>
437
+ * @see https://greatdetail.com
438
+ */
439
+
440
+ type UpdateAccountConversationSettingsPayload = {
441
+ conversationSettings: {
442
+ defaultName?: Nullable<string>;
443
+ enableAutoResponse?: boolean;
444
+ autoResponseAge?: Nullable<number>;
445
+ responseDuration?: Nullable<string>;
446
+ resolveDuration?: Nullable<string>;
447
+ enableAutoLabel?: Nullable<boolean>;
448
+ assistantContact?: Nullable<ContactID>;
449
+ };
450
+ };
451
+ interface UpdateAccountConversationSettingsOptions {
452
+ body: UpdateAccountConversationSettingsPayload;
453
+ request?: SendOptions;
454
+ }
455
+ type UpdateAccountConversationSettingsResponse = {
456
+ data: {
457
+ accountConversationSettings: AccountConversationSettings;
458
+ };
459
+ };
460
+
461
+ declare class AccountConversationSettingsAPI {
462
+ protected _transport: FetchTransport;
463
+ constructor(_transport: FetchTransport);
464
+ get(account: CurrentAccountID | AccountID, { request }?: GetAccountConversationSettingsOptions): {
465
+ response: () => Promise<ky.KyResponse<GetAccountConversationSettingsResponse>>;
466
+ json: () => Promise<GetAccountConversationSettingsResponse>;
467
+ };
468
+ update(account: CurrentAccountID | AccountID, { body, request }: UpdateAccountConversationSettingsOptions): {
469
+ response: () => Promise<ky.KyResponse<UpdateAccountConversationSettingsResponse>>;
470
+ json: () => Promise<UpdateAccountConversationSettingsResponse>;
471
+ };
472
+ }
473
+
468
474
  /**
469
475
  * Great Detail Support System.
470
476
  *
@@ -1207,9 +1213,11 @@ type UpdateChannelConversationSettingsPayload = {
1207
1213
  conversationSettings: {
1208
1214
  defaultName?: Nullable<string>;
1209
1215
  enableAutoResponse?: Nullable<boolean>;
1216
+ autoResponseAge?: Nullable<number>;
1210
1217
  responseDuration?: Nullable<string>;
1211
1218
  resolveDuration?: Nullable<string>;
1212
1219
  enableAutoLabel?: Nullable<boolean>;
1220
+ assistantContact?: Nullable<ContactID>;
1213
1221
  };
1214
1222
  };
1215
1223
  interface UpdateChannelConversationSettingsOptions {
@@ -1493,11 +1501,10 @@ interface GetContactVCFOptions {
1493
1501
  * @see https://greatdetail.com
1494
1502
  */
1495
1503
 
1496
- type ListContactsFilterOptions = "consumer" | "representative" | "assistant";
1497
1504
  interface ListContactsOptions {
1498
1505
  query?: string;
1499
1506
  limit?: number;
1500
- filter?: ListContactsFilterOptions;
1507
+ type?: ContactType;
1501
1508
  request?: SendOptions;
1502
1509
  }
1503
1510
  type ListContactsResponse = {
@@ -1535,6 +1542,7 @@ type ListLabelContactsResponse = {
1535
1542
  */
1536
1543
 
1537
1544
  type UpdateContactPayload = {
1545
+ status?: ContactStatus;
1538
1546
  name?: string;
1539
1547
  emailAddress?: Nullable<string>;
1540
1548
  telephoneNumber?: Nullable<string>;
@@ -1563,7 +1571,7 @@ declare class ContactAPI {
1563
1571
  response: () => Promise<ky.KyResponse<unknown>>;
1564
1572
  json: () => Promise<unknown>;
1565
1573
  };
1566
- list({ limit, query, filter, request }?: ListContactsOptions): {
1574
+ list({ limit, query, type, request }?: ListContactsOptions): {
1567
1575
  response: () => Promise<ky.KyResponse<ListContactsResponse>>;
1568
1576
  json: () => Promise<ListContactsResponse>;
1569
1577
  };
@@ -3428,4 +3436,4 @@ declare class Client {
3428
3436
  static getBaseURL(): string;
3429
3437
  }
3430
3438
 
3431
- export { type BoilerplateCategoryID as $, type Account as A, type ActionID as B, Client as C, type DeleteAccountAccessTokenPayload as D, type ListActionsOptions as E, type ListActionsResponse as F, type GetAccountOptions as G, type BoilerplateContent as H, type BoilerplateContentID as I, type CreateBoilerplateContentPayload as J, type CreateBoilerplateContentOptions as K, type ListAccountAccessTokensOptions as L, type CreateBoilerplateContentResponse as M, type GetBoilerplateContentOptions as N, type Options as O, type GetBoilerplateContentResponse as P, type ListBoilerplateCategoryBoilerplateContentsOptions as Q, type RequestFilterable as R, type SortOptions as S, type ListBoilerplateCategoryBoilerplateContentsResponse as T, type UpdateAccountPayload as U, type ListBoilerplateContentsOptions as V, type ListBoilerplateContentsResponse as W, type UpdateBoilerplateContentPayload as X, type UpdateBoilerplateContentOptions as Y, type UpdateBoilerplateContentResponse as Z, type BoilerplateCategory as _, type Options$4 as a, type DeleteContactOptions as a$, type CreateBoilerplateCategoryPayload as a0, type CreateBoilerplateCategoryOptions as a1, type CreateBoilerplateCategoryResponse as a2, type GetBoilerplateCategoryOptions as a3, type GetBoilerplateCategoryResponse as a4, type ListBoilerplateCategoriesIncludeOptions as a5, type ListBoilerplateCategoriesOptions as a6, type ListBoilerplateCategoriesResponse as a7, type UpdateBoilerplateCategoryPayload as a8, type UpdateBoilerplateCategoryOptions as a9, type CreateCompositionSectionPayload as aA, type CreateCompositionSectionOptions as aB, type CreateCompositionSectionResponse as aC, type GetCompositionSectionOptions as aD, type GetCompositionSectionResponse as aE, type ListChannelCompositionSectionsOptions as aF, type ListChannelCompositionSectionsResponse as aG, type ListCompositionSectionsOptions as aH, type ListCompositionSectionsResponse as aI, type UpdateCompositionSectionPayload as aJ, type UpdateCompositionSectionOptions as aK, type UpdateCompositionSectionResponse as aL, type Escalation as aM, type CreateEscalationPayload as aN, type CreateEscalationOptions as aO, type CreateEscalationResponse as aP, type GetEscalationOptions as aQ, type GetEscalationResponse as aR, type ListEscalationsOptions as aS, type ListEscalationsResponse as aT, type Contact as aU, type ContactID as aV, type ContactType as aW, type ContactCustomMetadata as aX, type CreateContactPayload as aY, type CreateContactOptions as aZ, type CreateContactResponse as a_, type UpdateBoilerplateCategoryResponse as aa, type Channel as ab, type ChannelID as ac, type CreateChannelPayload as ad, type CreateChannelOptions as ae, type CreateChannelResponse as af, type GetChannelOptions as ag, type GetChannelResponse as ah, type ListChannelsOptions as ai, type ListChannelsResponse as aj, type MetaWhatsappChannelGetBusinessProfileOptions as ak, type MetaWhatsappChannelGetBusinessProfileResponse as al, type TwilioSendChannelSyncPayload as am, type TwilioSendgridChannelSyncOptions as an, type TwilioSendgridChannelSyncResponse as ao, type UpdateChannelPayload as ap, type UpdateChannelOptions as aq, type UpdateChannelResponse as ar, type ChannelConversationSettings as as, type GetChannelConversationSettingsOptions as at, type GetChannelConversationSettingsResponse as au, type UpdateChannelConversationSettingsPayload as av, type UpdateChannelConversationSettingsOptions as aw, type UpdateChannelConversationSettingsResponse as ax, type CompositionSection as ay, type CompositionSectionID as az, type CurrentAccountID as b, type ListContactLabelsResponse as b$, type DeleteContactResponse as b0, type GetContactIncludeOptions as b1, type GetContactOptions as b2, type GetContactResponse as b3, type GetContactVCFOptions as b4, type ListContactsFilterOptions as b5, type ListContactsOptions as b6, type ListContactsResponse as b7, type ListLabelContactsOptions as b8, type ListLabelContactsResponse as b9, type ListLabelConversationsResponse as bA, type UpdateConversationPayload as bB, type UpdateConversationOptions as bC, type UpdateConversationResponse as bD, type ConversationSettings as bE, type ConversationFeedback as bF, type CreateConversationFeedbackPayload as bG, type CreateConversationFeedbackOptions as bH, type CreateConversationFeedbackResponse as bI, type DeleteConversationFeedbackOptions as bJ, type DeleteConversationFeedbackResponse as bK, type GetConversationFeedbackOptions as bL, type GetConversationFeedbackResponse as bM, type ListConversationConversationFeedbackOptions as bN, type ListConversationConversationFeedbackResponse as bO, type ListConversationFeedbackOptions as bP, type ListConversationFeedbackResponse as bQ, type Label as bR, type CreateLabelPayload as bS, type CreateLabelOptions as bT, type CreateLabelResponse as bU, type DeleteLabelOptions as bV, type DeleteLabelResponse as bW, type GetLabelOptions as bX, type GetLabelResponse as bY, type LabelID as bZ, type ListContactLabelsOptions as b_, type UpdateContactPayload as ba, type UpdateContactOptions as bb, type UpdateContactResponse as bc, type Conversation as bd, type ConversationID as be, type ConversationCustomMetadata as bf, type ActiveConversationStatus as bg, type ConcludedConversationStatus as bh, type ConversationStatus as bi, type CreateConversationPayload as bj, type CreateConversationOptions as bk, type CreateConversationResponse as bl, type DeleteConversationOptions as bm, type DeleteConversationResponse as bn, type GetConversationIncludeOptions as bo, type GetConversationOptions as bp, type GetConversationResponse as bq, type ListChannelConversationsOptions as br, type ListChannelConversationsResponse as bs, type ListContactConversationsOptions as bt, type ListContactConversationsResponse as bu, type ListConversationsIncludeOptions as bv, type ListConversationsFilterOptions as bw, type ListConversationOptions as bx, type ListConversationsResponse as by, type ListLabelConversationsOptions as bz, type AccountID as c, type CreateUploadResponse as c$, type ListConversationLabelsOptions as c0, type ListConversationLabelsResponse as c1, type ListLabelsIncludeOptions as c2, type ListLabelsOptions as c3, type ListLabelsResponse as c4, type UpdateLabelPayload as c5, type UpdateLabelOptions as c6, type UpdateLabelResponse as c7, type Message as c8, type CreateMessagePayload as c9, type GetModelOptions as cA, type GetModelResponse as cB, type ListModelsOptions as cC, type ListModelsResponse as cD, type ModelID as cE, type Note as cF, type CreateNotePayload as cG, type CreateNoteOptions as cH, type CreateNoteResponse as cI, type GetNoteOptions as cJ, type GetNoteResponse as cK, type ListContactNotesOptions as cL, type ListContactNotesResponse as cM, type ListConversationNotesOptions as cN, type ListConversationNotesResponse as cO, type NoteID as cP, type UpdateNotePayload as cQ, type UpdateNoteOptions as cR, type UpdateNoteResponse as cS, type Source as cT, type GetSourceOptions as cU, type GetSourceResponse as cV, type ListSourcesOptions as cW, type ListSourcesResponse as cX, type SourceID as cY, type Upload as cZ, type CreateUploadOptions as c_, type CreateMessageOptions as ca, type CreateMessageResponse as cb, type DeleteMessageOptions as cc, type DeleteMessageResponse as cd, type GetMessageOptions as ce, type GetMessageResponse as cf, type ListChannelMessagesIncludeOptions as cg, type ListChannelMessagesOptions as ch, type ListChannelMessagesResponse as ci, type ListConversationMessagesIncludeOptions as cj, type ListConversationMessagesOptions as ck, type ListConversationMessagesResponse as cl, type ListMessagesIncludeOptions as cm, type ListMessagesOptions as cn, type ListMessagesResponse as co, type MessageID as cp, type MessageRole as cq, type MessageStatus as cr, type MessageEventType as cs, type Model as ct, type CreateCorrectionModelPayload as cu, type CreateCorrectionModelOptions as cv, type CreateCorrectionResponse as cw, type CreateResponseModelPayload as cx, type CreateResponseModelOptions as cy, type CreateResponseResponse as cz, type CreateAccountPayload as d, type DeleteUploadOptions as d0, type DeleteUploadResponse as d1, type GetUploadOptions as d2, type GetUploadResponse as d3, type ListUploadsOptions as d4, type ListUploadsResponse as d5, type UploadID as d6, type User as d7, type GetUserOptions as d8, type GetUserResponse as d9, type UserID as da, type EventWebhookOptions as db, eventWebhookSchema as dc, type WebhookEventType as dd, type AccountWebhookWebhookEventType as de, type AccountAccessTokenWebhookEventType as df, type ContactWebhookEventType as dg, type ConversationWebhookEventType as dh, type MessageWebhookEventType as di, type WebhookSubscriptionWebhookEventType as dj, type WebhookEventPayload as dk, type WebhookResponse as dl, type WebhookSubscription as dm, type CreateWebhookSubscriptionPayload as dn, type CreateWebhookSubscriptionOptions as dp, type CreateWebhookSubscriptionResponse as dq, type DeleteWebhookSubscriptionOptions as dr, type DeleteWebhookSubscriptionResponse as ds, type GetWebhookSubscriptionOptions as dt, type GetWebhookSubscriptionResponse as du, type ListWebhookSubscriptionsOptions as dv, type ListWebhookSubscriptionsResponse as dw, type TestWebhookSubscriptionOptions as dx, type TestWebhookSubscriptionResponse as dy, type WebhookSubscriptionID as dz, type CreateAccountOptions as e, type CreateAccountResponse as f, type GetAccountResponse as g, type UpdateAccountOptions as h, type UpdateAccountResponse as i, type AccountAccessToken as j, type AccountAccessTokenID as k, type CreateAccountAccessTokenPayload as l, type CreateAccountAccessTokenOptions as m, type CreateAccountAccessTokenResponse as n, type DeleteAccountAccessTokenOptions as o, type DeleteAccountAccessTokenResponse as p, type GetAccountAccessTokenOptions as q, type GetAccountAccessTokenResponse as r, type ListAccountAccessTokensResponse as s, type AccountConversationSettings as t, type GetAccountConversationSettingsOptions as u, type GetAccountConversationSettingsResponse as v, type UpdateAccountConversationSettingsPayload as w, type UpdateAccountConversationSettingsOptions as x, type UpdateAccountConversationSettingsResponse as y, type Action as z };
3439
+ export { type BoilerplateCategoryID as $, type Account as A, type ActionID as B, Client as C, type DeleteAccountAccessTokenPayload as D, type ListActionsOptions as E, type ListActionsResponse as F, type GetAccountOptions as G, type BoilerplateContent as H, type BoilerplateContentID as I, type CreateBoilerplateContentPayload as J, type CreateBoilerplateContentOptions as K, type ListAccountAccessTokensOptions as L, type CreateBoilerplateContentResponse as M, type GetBoilerplateContentOptions as N, type Options as O, type GetBoilerplateContentResponse as P, type ListBoilerplateCategoryBoilerplateContentsOptions as Q, type RequestFilterable as R, type SortOptions as S, type ListBoilerplateCategoryBoilerplateContentsResponse as T, type UpdateAccountPayload as U, type ListBoilerplateContentsOptions as V, type ListBoilerplateContentsResponse as W, type UpdateBoilerplateContentPayload as X, type UpdateBoilerplateContentOptions as Y, type UpdateBoilerplateContentResponse as Z, type BoilerplateCategory as _, type Options$4 as a, type CreateContactResponse as a$, type CreateBoilerplateCategoryPayload as a0, type CreateBoilerplateCategoryOptions as a1, type CreateBoilerplateCategoryResponse as a2, type GetBoilerplateCategoryOptions as a3, type GetBoilerplateCategoryResponse as a4, type ListBoilerplateCategoriesIncludeOptions as a5, type ListBoilerplateCategoriesOptions as a6, type ListBoilerplateCategoriesResponse as a7, type UpdateBoilerplateCategoryPayload as a8, type UpdateBoilerplateCategoryOptions as a9, type CreateCompositionSectionPayload as aA, type CreateCompositionSectionOptions as aB, type CreateCompositionSectionResponse as aC, type GetCompositionSectionOptions as aD, type GetCompositionSectionResponse as aE, type ListChannelCompositionSectionsOptions as aF, type ListChannelCompositionSectionsResponse as aG, type ListCompositionSectionsOptions as aH, type ListCompositionSectionsResponse as aI, type UpdateCompositionSectionPayload as aJ, type UpdateCompositionSectionOptions as aK, type UpdateCompositionSectionResponse as aL, type Escalation as aM, type CreateEscalationPayload as aN, type CreateEscalationOptions as aO, type CreateEscalationResponse as aP, type GetEscalationOptions as aQ, type GetEscalationResponse as aR, type ListEscalationsOptions as aS, type ListEscalationsResponse as aT, type Contact as aU, type ContactID as aV, type ContactType as aW, type ContactStatus as aX, type ContactCustomMetadata as aY, type CreateContactPayload as aZ, type CreateContactOptions as a_, type UpdateBoilerplateCategoryResponse as aa, type Channel as ab, type ChannelID as ac, type CreateChannelPayload as ad, type CreateChannelOptions as ae, type CreateChannelResponse as af, type GetChannelOptions as ag, type GetChannelResponse as ah, type ListChannelsOptions as ai, type ListChannelsResponse as aj, type MetaWhatsappChannelGetBusinessProfileOptions as ak, type MetaWhatsappChannelGetBusinessProfileResponse as al, type TwilioSendChannelSyncPayload as am, type TwilioSendgridChannelSyncOptions as an, type TwilioSendgridChannelSyncResponse as ao, type UpdateChannelPayload as ap, type UpdateChannelOptions as aq, type UpdateChannelResponse as ar, type ChannelConversationSettings as as, type GetChannelConversationSettingsOptions as at, type GetChannelConversationSettingsResponse as au, type UpdateChannelConversationSettingsPayload as av, type UpdateChannelConversationSettingsOptions as aw, type UpdateChannelConversationSettingsResponse as ax, type CompositionSection as ay, type CompositionSectionID as az, type CurrentAccountID as b, type ListContactLabelsResponse as b$, type DeleteContactOptions as b0, type DeleteContactResponse as b1, type GetContactIncludeOptions as b2, type GetContactOptions as b3, type GetContactResponse as b4, type GetContactVCFOptions as b5, type ListContactsOptions as b6, type ListContactsResponse as b7, type ListLabelContactsOptions as b8, type ListLabelContactsResponse as b9, type ListLabelConversationsResponse as bA, type UpdateConversationPayload as bB, type UpdateConversationOptions as bC, type UpdateConversationResponse as bD, type ConversationSettings as bE, type ConversationFeedback as bF, type CreateConversationFeedbackPayload as bG, type CreateConversationFeedbackOptions as bH, type CreateConversationFeedbackResponse as bI, type DeleteConversationFeedbackOptions as bJ, type DeleteConversationFeedbackResponse as bK, type GetConversationFeedbackOptions as bL, type GetConversationFeedbackResponse as bM, type ListConversationConversationFeedbackOptions as bN, type ListConversationConversationFeedbackResponse as bO, type ListConversationFeedbackOptions as bP, type ListConversationFeedbackResponse as bQ, type Label as bR, type CreateLabelPayload as bS, type CreateLabelOptions as bT, type CreateLabelResponse as bU, type DeleteLabelOptions as bV, type DeleteLabelResponse as bW, type GetLabelOptions as bX, type GetLabelResponse as bY, type LabelID as bZ, type ListContactLabelsOptions as b_, type UpdateContactPayload as ba, type UpdateContactOptions as bb, type UpdateContactResponse as bc, type Conversation as bd, type ConversationID as be, type ConversationCustomMetadata as bf, type ActiveConversationStatus as bg, type ConcludedConversationStatus as bh, type ConversationStatus as bi, type CreateConversationPayload as bj, type CreateConversationOptions as bk, type CreateConversationResponse as bl, type DeleteConversationOptions as bm, type DeleteConversationResponse as bn, type GetConversationIncludeOptions as bo, type GetConversationOptions as bp, type GetConversationResponse as bq, type ListChannelConversationsOptions as br, type ListChannelConversationsResponse as bs, type ListContactConversationsOptions as bt, type ListContactConversationsResponse as bu, type ListConversationsIncludeOptions as bv, type ListConversationsFilterOptions as bw, type ListConversationOptions as bx, type ListConversationsResponse as by, type ListLabelConversationsOptions as bz, type AccountID as c, type CreateUploadResponse as c$, type ListConversationLabelsOptions as c0, type ListConversationLabelsResponse as c1, type ListLabelsIncludeOptions as c2, type ListLabelsOptions as c3, type ListLabelsResponse as c4, type UpdateLabelPayload as c5, type UpdateLabelOptions as c6, type UpdateLabelResponse as c7, type Message as c8, type CreateMessagePayload as c9, type GetModelOptions as cA, type GetModelResponse as cB, type ListModelsOptions as cC, type ListModelsResponse as cD, type ModelID as cE, type Note as cF, type CreateNotePayload as cG, type CreateNoteOptions as cH, type CreateNoteResponse as cI, type GetNoteOptions as cJ, type GetNoteResponse as cK, type ListContactNotesOptions as cL, type ListContactNotesResponse as cM, type ListConversationNotesOptions as cN, type ListConversationNotesResponse as cO, type NoteID as cP, type UpdateNotePayload as cQ, type UpdateNoteOptions as cR, type UpdateNoteResponse as cS, type Source as cT, type GetSourceOptions as cU, type GetSourceResponse as cV, type ListSourcesOptions as cW, type ListSourcesResponse as cX, type SourceID as cY, type Upload as cZ, type CreateUploadOptions as c_, type CreateMessageOptions as ca, type CreateMessageResponse as cb, type DeleteMessageOptions as cc, type DeleteMessageResponse as cd, type GetMessageOptions as ce, type GetMessageResponse as cf, type ListChannelMessagesIncludeOptions as cg, type ListChannelMessagesOptions as ch, type ListChannelMessagesResponse as ci, type ListConversationMessagesIncludeOptions as cj, type ListConversationMessagesOptions as ck, type ListConversationMessagesResponse as cl, type ListMessagesIncludeOptions as cm, type ListMessagesOptions as cn, type ListMessagesResponse as co, type MessageID as cp, type MessageRole as cq, type MessageStatus as cr, type MessageEventType as cs, type Model as ct, type CreateCorrectionModelPayload as cu, type CreateCorrectionModelOptions as cv, type CreateCorrectionResponse as cw, type CreateResponseModelPayload as cx, type CreateResponseModelOptions as cy, type CreateResponseResponse as cz, type CreateAccountPayload as d, type DeleteUploadOptions as d0, type DeleteUploadResponse as d1, type GetUploadOptions as d2, type GetUploadResponse as d3, type ListUploadsOptions as d4, type ListUploadsResponse as d5, type UploadID as d6, type User as d7, type GetUserOptions as d8, type GetUserResponse as d9, type UserID as da, type EventWebhookOptions as db, eventWebhookSchema as dc, type WebhookEventType as dd, type AccountWebhookWebhookEventType as de, type AccountAccessTokenWebhookEventType as df, type ContactWebhookEventType as dg, type ConversationWebhookEventType as dh, type MessageWebhookEventType as di, type WebhookSubscriptionWebhookEventType as dj, type WebhookEventPayload as dk, type WebhookResponse as dl, type WebhookSubscription as dm, type CreateWebhookSubscriptionPayload as dn, type CreateWebhookSubscriptionOptions as dp, type CreateWebhookSubscriptionResponse as dq, type DeleteWebhookSubscriptionOptions as dr, type DeleteWebhookSubscriptionResponse as ds, type GetWebhookSubscriptionOptions as dt, type GetWebhookSubscriptionResponse as du, type ListWebhookSubscriptionsOptions as dv, type ListWebhookSubscriptionsResponse as dw, type TestWebhookSubscriptionOptions as dx, type TestWebhookSubscriptionResponse as dy, type WebhookSubscriptionID as dz, type CreateAccountOptions as e, type CreateAccountResponse as f, type GetAccountResponse as g, type UpdateAccountOptions as h, type UpdateAccountResponse as i, type AccountAccessToken as j, type AccountAccessTokenID as k, type CreateAccountAccessTokenPayload as l, type CreateAccountAccessTokenOptions as m, type CreateAccountAccessTokenResponse as n, type DeleteAccountAccessTokenOptions as o, type DeleteAccountAccessTokenResponse as p, type GetAccountAccessTokenOptions as q, type GetAccountAccessTokenResponse as r, type ListAccountAccessTokensResponse as s, type AccountConversationSettings as t, type GetAccountConversationSettingsOptions as u, type GetAccountConversationSettingsResponse as v, type UpdateAccountConversationSettingsPayload as w, type UpdateAccountConversationSettingsOptions as x, type UpdateAccountConversationSettingsResponse as y, type Action as z };
@@ -1 +1 @@
1
- import{b as j,f as F}from"./chunk-2CFCCPDQ.js";import{Command as A}from"commander";import{Command as b}from"commander";import{oraPromise as I}from"ora";function r({client:t,ora:s}){let o=new b("actions").description("Actions");return o.addCommand(new b("list").description("List actions").action(async()=>{let n=await I(()=>t.action.list().json(),{...s,text:"Finding actions"});console.log(n)})),o}import{Command as v}from"commander";import{oraPromise as S}from"ora";function c({client:t,ora:s}){let o=new v("channels").description("Channels");return o.addCommand(new v("list").description("List channels").action(async()=>{let n=await S(()=>t.channel.list().json(),{...s,text:"Finding channels"});console.log(n)})),o}import{Command as a}from"commander";import{oraPromise as d}from"ora";function p({client:t,ora:s}){let o=new a("contacts").description("Contacts");return o.addCommand(new a("get").description("Find contact").argument("<contact>","Contact ID").action(async n=>{let i=await d(()=>t.contact.get(n).json(),{...s,text:"Finding contact"});console.log(i)})),o.addCommand(new a("list").description("List contacts").action(async()=>{let n=await d(()=>t.contact.list().json(),{...s,text:"Finding contacts"});console.log(n)})),o.addCommand(new a("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async n=>{let i=await d(()=>t.contact.getVCF(n).response(),{...s,text:"Exporting contact"});console.log(i)})),o}import{Command as l}from"commander";import{oraPromise as L}from"ora";function u({client:t,ora:s}){let o=new l("conversations").description("Conversations");return o.addCommand(new l("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let i=await L(()=>t.conversation.get(n).json(),{...s,text:"Finding conversation"});console.log(i)})),o.addCommand(new l("list").description("List conversations").action(async()=>{let n=await L(()=>t.conversation.list().json(),{...s,text:"Finding conversations"});console.log(n)})),o}import{Command as m}from"commander";import{oraPromise as C}from"ora";function g({client:t,ora:s}){let o=new m("labels").description("Labels");return o.addCommand(new m("get").description("Find label").argument("<label>","Label ID").action(async n=>{let i=await C(()=>t.label.get(n).json(),{...s,text:"Finding label"});console.log(i)})),o.addCommand(new m("list").description("List labels").action(async()=>{let n=await C(()=>t.label.list().json(),{...s,text:"Finding labels"});console.log(n)})),o.addCommand(new m("conversations").description("Find label conversations").argument("<label>","Label ID").action(async n=>{let i=await C(()=>t.conversation.listByLabel(n).json(),{...s,text:"Finding conversations"});console.log(i)})),o}import{Command as D}from"commander";import{oraPromise as M}from"ora";function f({client:t,ora:s}){let o=new D("messages").description("Messages");return o.addCommand(new D("list").description("List messages").action(async()=>{let n=await M(()=>t.message.list().json(),{...s,text:"Finding messages"});console.log(n)})),o}import{Command as O}from"commander";import{oraPromise as P}from"ora";function x({client:t,ora:s}){let o=new O("models").description("Models");return o.addCommand(new O("get").description("Find model").argument("<model>","Model ID").action(async n=>{let i=await P(()=>t.model.get(n).json(),{...s,text:"Finding model"});console.log(i)})),o.addCommand(new O("list").description("List models").action(async()=>{let n=await P(()=>t.model.list().json(),{...s,text:"Finding models"});console.log(n)})),o}import{Command as w}from"commander";import{oraPromise as h}from"ora";function y({client:t,ora:s}){let o=new w("sources").description("Sources");return o.addCommand(new w("get").description("Find source").argument("<source>","Source ID").action(async n=>{let i=await h(()=>t.source.get(n).json(),{...s,text:"Finding source"});console.log(i)})),o.addCommand(new w("list").description("List sources").action(async()=>{let n=await h(()=>t.source.list().json(),{...s,text:"Finding sources"});console.log(n)})),o}var e={ora:{spinner:"simpleDotsScrolling"},client:new F(new j)},E=new A("gds").description("Great Detail Support System").addCommand(r(e)).addCommand(c(e)).addCommand(p(e)).addCommand(u(e)).addCommand(g(e)).addCommand(f(e)).addCommand(x(e)).addCommand(y(e)),fo=E;export{fo as a};
1
+ import{b as j,f as F}from"./chunk-T7UH3U2U.js";import{Command as A}from"commander";import{Command as b}from"commander";import{oraPromise as I}from"ora";function r({client:t,ora:s}){let o=new b("actions").description("Actions");return o.addCommand(new b("list").description("List actions").action(async()=>{let n=await I(()=>t.action.list().json(),{...s,text:"Finding actions"});console.log(n)})),o}import{Command as v}from"commander";import{oraPromise as S}from"ora";function c({client:t,ora:s}){let o=new v("channels").description("Channels");return o.addCommand(new v("list").description("List channels").action(async()=>{let n=await S(()=>t.channel.list().json(),{...s,text:"Finding channels"});console.log(n)})),o}import{Command as a}from"commander";import{oraPromise as d}from"ora";function p({client:t,ora:s}){let o=new a("contacts").description("Contacts");return o.addCommand(new a("get").description("Find contact").argument("<contact>","Contact ID").action(async n=>{let i=await d(()=>t.contact.get(n).json(),{...s,text:"Finding contact"});console.log(i)})),o.addCommand(new a("list").description("List contacts").action(async()=>{let n=await d(()=>t.contact.list().json(),{...s,text:"Finding contacts"});console.log(n)})),o.addCommand(new a("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async n=>{let i=await d(()=>t.contact.getVCF(n).response(),{...s,text:"Exporting contact"});console.log(i)})),o}import{Command as l}from"commander";import{oraPromise as L}from"ora";function u({client:t,ora:s}){let o=new l("conversations").description("Conversations");return o.addCommand(new l("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let i=await L(()=>t.conversation.get(n).json(),{...s,text:"Finding conversation"});console.log(i)})),o.addCommand(new l("list").description("List conversations").action(async()=>{let n=await L(()=>t.conversation.list().json(),{...s,text:"Finding conversations"});console.log(n)})),o}import{Command as m}from"commander";import{oraPromise as C}from"ora";function g({client:t,ora:s}){let o=new m("labels").description("Labels");return o.addCommand(new m("get").description("Find label").argument("<label>","Label ID").action(async n=>{let i=await C(()=>t.label.get(n).json(),{...s,text:"Finding label"});console.log(i)})),o.addCommand(new m("list").description("List labels").action(async()=>{let n=await C(()=>t.label.list().json(),{...s,text:"Finding labels"});console.log(n)})),o.addCommand(new m("conversations").description("Find label conversations").argument("<label>","Label ID").action(async n=>{let i=await C(()=>t.conversation.listByLabel(n).json(),{...s,text:"Finding conversations"});console.log(i)})),o}import{Command as D}from"commander";import{oraPromise as M}from"ora";function f({client:t,ora:s}){let o=new D("messages").description("Messages");return o.addCommand(new D("list").description("List messages").action(async()=>{let n=await M(()=>t.message.list().json(),{...s,text:"Finding messages"});console.log(n)})),o}import{Command as O}from"commander";import{oraPromise as P}from"ora";function x({client:t,ora:s}){let o=new O("models").description("Models");return o.addCommand(new O("get").description("Find model").argument("<model>","Model ID").action(async n=>{let i=await P(()=>t.model.get(n).json(),{...s,text:"Finding model"});console.log(i)})),o.addCommand(new O("list").description("List models").action(async()=>{let n=await P(()=>t.model.list().json(),{...s,text:"Finding models"});console.log(n)})),o}import{Command as w}from"commander";import{oraPromise as h}from"ora";function y({client:t,ora:s}){let o=new w("sources").description("Sources");return o.addCommand(new w("get").description("Find source").argument("<source>","Source ID").action(async n=>{let i=await h(()=>t.source.get(n).json(),{...s,text:"Finding source"});console.log(i)})),o.addCommand(new w("list").description("List sources").action(async()=>{let n=await h(()=>t.source.list().json(),{...s,text:"Finding sources"});console.log(n)})),o}var e={ora:{spinner:"simpleDotsScrolling"},client:new F(new j)},E=new A("gds").description("Great Detail Support System").addCommand(r(e)).addCommand(c(e)).addCommand(p(e)).addCommand(u(e)).addCommand(g(e)).addCommand(f(e)).addCommand(x(e)).addCommand(y(e)),fo=E;export{fo as a};
@@ -0,0 +1 @@
1
+ var K=Object.defineProperty;var $=(n,t)=>{for(var e in t)K(n,e,{get:t[e],enumerable:!0})};var p=class{getHeaders(){return{}}};var x="SUPPORT_ACCESS_TOKEN",W="SUPPORT_KEY_NAME",N="SUPPORT_KEY_PASSWORD",w="SUPPORT_SIGNING_KEY",Q="SUPPORT_BASE_URL";var c=class{name;#t;constructor({name:t=process.env[W],password:e=process.env[N]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var m=class{#t;constructor({token:t=process.env[x]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var j="https://api.support.greatdetail.com",H={"X-Powered-By":"GDSupport/JavaScript"};var B=class extends Error{constructor(e,o){super("Support Error",{cause:o});this.response=e}};import{z as i}from"zod";var V=i.object({data:i.object({event:i.object({id:i.string(),type:i.string(),payload:i.record(i.string()),createdAt:i.string().datetime()})})});var l=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/accounts",{...e,method:"POST",json:t})}};var d=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}delete(t,e,{body:o,request:s={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...s,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var u=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var h=class{constructor(t){this._transport=t}list({limit:t,sort:e,request:o={}}={}){return this._transport.send("v1/actions",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var C=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var f=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByCategory=this.listByBoilerplateCategory;listByBoilerplateCategory(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t)+"/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var R=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/channels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}metaWhatsappGetBusinessProfile(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/meta-whatsapp/business-profile",{...e,method:"GET"})}twilioSendgridChannelSync(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/twilio-sendgrid/sync",{...o,method:"POST",json:e})}};var b=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var v=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var g=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}getRelativeVCFURL(t,{vcf:e={}}={}){let o=e.variant??"vcard",s=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(s)}getVCFURL(t,e={}){return this._transport.getURL(this.getRelativeVCFURL(t,e))}getVCF(t,e={}){return this._transport.send(this.getVCFURL(t,e),{method:"GET"})}list({limit:t,query:e,type:o,request:s={}}={}){return this._transport.send("v1/contacts",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.filterQuery("type",o)]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var O=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}list({query:t,limit:e,filter:o,include:s,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.limitQuery(e),...this._transport.filterQuery("filter",o),...this._transport.includeQuery(s??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var _=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/feedback/conversation",{...t,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/feedback",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/feedback/conversation",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var I=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/escalations/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/escalations",{...t,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/escalations",{...e,method:"POST",json:t})}};var T=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,include:o,request:s={}}={}){return this._transport.send("v1/labels",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByConversation(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var L=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}listByConversation(t,{limit:e,include:o,request:s={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:s={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o)]})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var y=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}createResponse(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,json:e})}createCorrection(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",json:e})}};var A=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}listByContact(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/notes",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var U=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=H;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var S=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}list({featured:t,category:e,request:o={}}={}){let s=[];if(e){let r=Array.isArray(e)?e:[e];for(let a of r)s.push(["category",a])}return t!==void 0&&s.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:s})}};var E=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};import Y from"is-network-error";import z,{HTTPError as J}from"ky";var D=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=z.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let s of this.options.requestFilterables){let r=s.getHeaders();for(let[a,q]of Object.entries(r))o.headers.has(a)||o.headers.set(a,q)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,s]of Object.entries(t))s!==void 0&&e.push(["sort",s+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}filterQuery(t,e){let o=[];return e===void 0||o.push([t,e]),o}send(t,e={}){let o=this.client(t,e).catch(async s=>{throw Y(s)?new Error("A network error occurred",{cause:s}):s instanceof J?new B(s.response,s):s});return{response:()=>o,json:async()=>(await o).json()}}};var G=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,request:e={}}){let o=new FormData;for(let s of t)o.append("file",s);return this._transport.send("v1/uploads",{...e,method:"POST",body:o})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var k=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var P=class{constructor(t){this._transport=t}async event({key:t=process.env[w],maxSignatures:e=3,request:o}){let s=o.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+w);if(!s)throw new Error("Missing signature header");if(!this._verifySignature(t,o.body,Array.isArray(s)?s.slice(0,e):[s]))throw new Error("Untrusted signature")}let{data:r}=V.parse(o.body);return{event:r.event}}async _verifySignature(t,e,o){let s=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let r of o)if(await crypto.subtle.verify("HMAC",s,new TextEncoder().encode(atob(r)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var F=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/webhooks/subscriptions",{...t,method:"GET"})}test(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t)+"/test",{...e,method:"POST"})}create({body:t,request:e={}}){return this._transport.send("v1/webhooks/subscriptions",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var M=class n{static DEFAULT_BASE_URL=j;static PublicAuthentication=p;static BasicAuthentication=c;static BearerAuthentication=m;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;channelConversationSettings;compositionSection;contact;conversation;conversationFeedback;escalation;label;message;model;note;source;statistics;upload;user;webhook;webhookSubscription;constructor(t,{baseURL:e,...o}={}){this._transport=new D({requestFilterables:[new U,t],...o,baseURL:e?.toString()??n.getBaseURL()}),this.account=new l(this._transport),this.accountAccessToken=new d(this._transport),this.accountConversationSettings=new u(this._transport),this.action=new h(this._transport),this.boilerplateCategory=new C(this._transport),this.boilerplateContent=new f(this._transport),this.channel=new R(this._transport),this.channelConversationSettings=new b(this._transport),this.compositionSection=new v(this._transport),this.contact=new g(this._transport),this.conversation=new O(this._transport),this.conversationFeedback=new _(this._transport),this.escalation=new I(this._transport),this.label=new T(this._transport),this.message=new L(this._transport),this.model=new y(this._transport),this.note=new A(this._transport),this.source=new S(this._transport),this.statistics=new E(this._transport),this.upload=new G(this._transport),this.user=new k(this._transport),this.webhook=new P(this._transport),this.webhookSubscription=new F(this._transport)}static getBaseURL(){return process.env[Q]??this.DEFAULT_BASE_URL}};export{$ as a,p as b,j as c,B as d,V as e,M as f};
@@ -1 +1 @@
1
- "use strict";var _t=Object.create;var W=Object.defineProperty;var Tt=Object.getOwnPropertyDescriptor;var Lt=Object.getOwnPropertyNames;var At=Object.getPrototypeOf,St=Object.prototype.hasOwnProperty;var Ut=(s,t)=>{for(var e in t)W(s,e,{get:t[e],enumerable:!0})},ct=(s,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Lt(t))!St.call(s,n)&&n!==e&&W(s,n,{get:()=>t[n],enumerable:!(o=Tt(t,n))||o.enumerable});return s};var mt=(s,t,e)=>(e=s!=null?_t(At(s)):{},ct(t||!s||!s.__esModule?W(e,"default",{value:s,enumerable:!0}):e,s)),Et=s=>ct(W({},"__esModule",{value:!0}),s);var kt={};Ut(kt,{default:()=>Gt});module.exports=Et(kt);var It=require("commander");var p=class{getHeaders(){return{}}};var m=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/accounts",{...e,method:"POST",json:t})}};var d=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}delete(t,e,{body:o,request:n={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...n,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var l=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var u=class{constructor(t){this._transport=t}list({limit:t,sort:e,request:o={}}={}){return this._transport.send("v1/actions",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var dt="SUPPORT_ACCESS_TOKEN",lt="SUPPORT_KEY_NAME",ut="SUPPORT_KEY_PASSWORD",Y="SUPPORT_SIGNING_KEY",Ct="SUPPORT_BASE_URL";var C=class{name;#t;constructor({name:t=process.env[lt],password:e=process.env[ut]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var h=class{#t;constructor({token:t=process.env[dt]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var f=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var b=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByCategory=this.listByBoilerplateCategory;listByBoilerplateCategory(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t)+"/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var g=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/channels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}metaWhatsappGetBusinessProfile(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/meta-whatsapp/business-profile",{...e,method:"GET"})}twilioSendgridChannelSync(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/twilio-sendgrid/sync",{...o,method:"POST",json:e})}};var v=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var R=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var ht="https://api.support.greatdetail.com",ft={"X-Powered-By":"GDSupport/JavaScript"};var O=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}getRelativeVCFURL(t,{vcf:e={}}={}){let o=e.variant??"vcard",n=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(n)}getVCFURL(t,e={}){return this._transport.getURL(this.getRelativeVCFURL(t,e))}getVCF(t,e={}){return this._transport.send(this.getVCFURL(t,e),{method:"GET"})}list({limit:t,query:e,filter:o,request:n={}}={}){return this._transport.send("v1/contacts",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...o?[["filter",o]]:[]]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var I=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}list({query:t,limit:e,filter:o,include:n,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.limitQuery(e),...o?[["filter",o]]:[],...this._transport.includeQuery(n??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var y=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/feedback/conversation",{...t,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/feedback",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/feedback/conversation",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var _=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/escalations/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/escalations",{...t,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/escalations",{...e,method:"POST",json:t})}};var T=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,include:o,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByConversation(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var L=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}listByConversation(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o)]})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var A=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}createResponse(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,json:e})}createCorrection(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",json:e})}};var S=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}listByContact(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/notes",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var U=class s{constructor(t=s.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=ft;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var E=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}list({featured:t,category:e,request:o={}}={}){let n=[];if(e){let r=Array.isArray(e)?e:[e];for(let c of r)n.push(["category",c])}return t!==void 0&&n.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:n})}};var D=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};var bt=mt(require("is-network-error"),1),N=mt(require("ky"),1);var j=class extends Error{constructor(e,o){super("Support Error",{cause:o});this.response=e}};var G=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=N.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let n of this.options.requestFilterables){let r=n.getHeaders();for(let[c,yt]of Object.entries(r))o.headers.has(c)||o.headers.set(c,yt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,n]of Object.entries(t))n!==void 0&&e.push(["sort",n+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let o=this.client(t,e).catch(async n=>{throw(0,bt.default)(n)?new Error("A network error occurred",{cause:n}):n instanceof N.HTTPError?new j(n.response,n):n});return{response:()=>o,json:async()=>(await o).json()}}};var k=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,request:e={}}){let o=new FormData;for(let n of t)o.append("file",n);return this._transport.send("v1/uploads",{...e,method:"POST",body:o})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var w=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var i=require("zod"),gt=i.z.object({data:i.z.object({event:i.z.object({id:i.z.string(),type:i.z.string(),payload:i.z.record(i.z.string()),createdAt:i.z.string().datetime()})})});var F=class{constructor(t){this._transport=t}async event({key:t=process.env[Y],maxSignatures:e=3,request:o}){let n=o.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+Y);if(!n)throw new Error("Missing signature header");if(!this._verifySignature(t,o.body,Array.isArray(n)?n.slice(0,e):[n]))throw new Error("Untrusted signature")}let{data:r}=gt.parse(o.body);return{event:r.event}}async _verifySignature(t,e,o){let n=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let r of o)if(await crypto.subtle.verify("HMAC",n,new TextEncoder().encode(atob(r)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var x=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/webhooks/subscriptions",{...t,method:"GET"})}test(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t)+"/test",{...e,method:"POST"})}create({body:t,request:e={}}){return this._transport.send("v1/webhooks/subscriptions",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var P=class s{static DEFAULT_BASE_URL=ht;static PublicAuthentication=p;static BasicAuthentication=C;static BearerAuthentication=h;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;channelConversationSettings;compositionSection;contact;conversation;conversationFeedback;escalation;label;message;model;note;source;statistics;upload;user;webhook;webhookSubscription;constructor(t,{baseURL:e,...o}={}){this._transport=new G({requestFilterables:[new U,t],...o,baseURL:e?.toString()??s.getBaseURL()}),this.account=new m(this._transport),this.accountAccessToken=new d(this._transport),this.accountConversationSettings=new l(this._transport),this.action=new u(this._transport),this.boilerplateCategory=new f(this._transport),this.boilerplateContent=new b(this._transport),this.channel=new g(this._transport),this.channelConversationSettings=new v(this._transport),this.compositionSection=new R(this._transport),this.contact=new O(this._transport),this.conversation=new I(this._transport),this.conversationFeedback=new y(this._transport),this.escalation=new _(this._transport),this.label=new T(this._transport),this.message=new L(this._transport),this.model=new A(this._transport),this.note=new S(this._transport),this.source=new E(this._transport),this.statistics=new D(this._transport),this.upload=new k(this._transport),this.user=new w(this._transport),this.webhook=new F(this._transport),this.webhookSubscription=new x(this._transport)}static getBaseURL(){return process.env[Ct]??this.DEFAULT_BASE_URL}};var z=require("commander"),vt=require("ora");function J({client:s,ora:t}){let e=new z.Command("actions").description("Actions");return e.addCommand(new z.Command("list").description("List actions").action(async()=>{let o=await(0,vt.oraPromise)(()=>s.action.list().json(),{...t,text:"Finding actions"});console.log(o)})),e}var $=require("commander"),Rt=require("ora");function X({client:s,ora:t}){let e=new $.Command("channels").description("Channels");return e.addCommand(new $.Command("list").description("List channels").action(async()=>{let o=await(0,Rt.oraPromise)(()=>s.channel.list().json(),{...t,text:"Finding channels"});console.log(o)})),e}var B=require("commander"),Q=require("ora");function Z({client:s,ora:t}){let e=new B.Command("contacts").description("Contacts");return e.addCommand(new B.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async o=>{let n=await(0,Q.oraPromise)(()=>s.contact.get(o).json(),{...t,text:"Finding contact"});console.log(n)})),e.addCommand(new B.Command("list").description("List contacts").action(async()=>{let o=await(0,Q.oraPromise)(()=>s.contact.list().json(),{...t,text:"Finding contacts"});console.log(o)})),e.addCommand(new B.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async o=>{let n=await(0,Q.oraPromise)(()=>s.contact.getVCF(o).response(),{...t,text:"Exporting contact"});console.log(n)})),e}var H=require("commander"),tt=require("ora");function et({client:s,ora:t}){let e=new H.Command("conversations").description("Conversations");return e.addCommand(new H.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async o=>{let n=await(0,tt.oraPromise)(()=>s.conversation.get(o).json(),{...t,text:"Finding conversation"});console.log(n)})),e.addCommand(new H.Command("list").description("List conversations").action(async()=>{let o=await(0,tt.oraPromise)(()=>s.conversation.list().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var M=require("commander"),V=require("ora");function ot({client:s,ora:t}){let e=new M.Command("labels").description("Labels");return e.addCommand(new M.Command("get").description("Find label").argument("<label>","Label ID").action(async o=>{let n=await(0,V.oraPromise)(()=>s.label.get(o).json(),{...t,text:"Finding label"});console.log(n)})),e.addCommand(new M.Command("list").description("List labels").action(async()=>{let o=await(0,V.oraPromise)(()=>s.label.list().json(),{...t,text:"Finding labels"});console.log(o)})),e.addCommand(new M.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async o=>{let n=await(0,V.oraPromise)(()=>s.conversation.listByLabel(o).json(),{...t,text:"Finding conversations"});console.log(n)})),e}var st=require("commander"),Ot=require("ora");function nt({client:s,ora:t}){let e=new st.Command("messages").description("Messages");return e.addCommand(new st.Command("list").description("List messages").action(async()=>{let o=await(0,Ot.oraPromise)(()=>s.message.list().json(),{...t,text:"Finding messages"});console.log(o)})),e}var q=require("commander"),rt=require("ora");function it({client:s,ora:t}){let e=new q.Command("models").description("Models");return e.addCommand(new q.Command("get").description("Find model").argument("<model>","Model ID").action(async o=>{let n=await(0,rt.oraPromise)(()=>s.model.get(o).json(),{...t,text:"Finding model"});console.log(n)})),e.addCommand(new q.Command("list").description("List models").action(async()=>{let o=await(0,rt.oraPromise)(()=>s.model.list().json(),{...t,text:"Finding models"});console.log(o)})),e}var K=require("commander"),at=require("ora");function pt({client:s,ora:t}){let e=new K.Command("sources").description("Sources");return e.addCommand(new K.Command("get").description("Find source").argument("<source>","Source ID").action(async o=>{let n=await(0,at.oraPromise)(()=>s.source.get(o).json(),{...t,text:"Finding source"});console.log(n)})),e.addCommand(new K.Command("list").description("List sources").action(async()=>{let o=await(0,at.oraPromise)(()=>s.source.list().json(),{...t,text:"Finding sources"});console.log(o)})),e}var a={ora:{spinner:"simpleDotsScrolling"},client:new P(new p)},Dt=new It.Command("gds").description("Great Detail Support System").addCommand(J(a)).addCommand(X(a)).addCommand(Z(a)).addCommand(et(a)).addCommand(ot(a)).addCommand(nt(a)).addCommand(it(a)).addCommand(pt(a)),Gt=Dt;
1
+ "use strict";var _t=Object.create;var W=Object.defineProperty;var Tt=Object.getOwnPropertyDescriptor;var Lt=Object.getOwnPropertyNames;var At=Object.getPrototypeOf,St=Object.prototype.hasOwnProperty;var Ut=(s,t)=>{for(var e in t)W(s,e,{get:t[e],enumerable:!0})},ct=(s,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Lt(t))!St.call(s,n)&&n!==e&&W(s,n,{get:()=>t[n],enumerable:!(o=Tt(t,n))||o.enumerable});return s};var mt=(s,t,e)=>(e=s!=null?_t(At(s)):{},ct(t||!s||!s.__esModule?W(e,"default",{value:s,enumerable:!0}):e,s)),Et=s=>ct(W({},"__esModule",{value:!0}),s);var kt={};Ut(kt,{default:()=>Gt});module.exports=Et(kt);var yt=require("commander");var p=class{getHeaders(){return{}}};var m=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/accounts",{...e,method:"POST",json:t})}};var d=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}delete(t,e,{body:o,request:n={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...n,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var l=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var u=class{constructor(t){this._transport=t}list({limit:t,sort:e,request:o={}}={}){return this._transport.send("v1/actions",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var dt="SUPPORT_ACCESS_TOKEN",lt="SUPPORT_KEY_NAME",ut="SUPPORT_KEY_PASSWORD",Y="SUPPORT_SIGNING_KEY",Ct="SUPPORT_BASE_URL";var C=class{name;#t;constructor({name:t=process.env[lt],password:e=process.env[ut]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var h=class{#t;constructor({token:t=process.env[dt]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var f=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var g=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByCategory=this.listByBoilerplateCategory;listByBoilerplateCategory(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t)+"/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var b=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/channels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}metaWhatsappGetBusinessProfile(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/meta-whatsapp/business-profile",{...e,method:"GET"})}twilioSendgridChannelSync(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/twilio-sendgrid/sync",{...o,method:"POST",json:e})}};var v=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var R=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var ht="https://api.support.greatdetail.com",ft={"X-Powered-By":"GDSupport/JavaScript"};var O=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}getRelativeVCFURL(t,{vcf:e={}}={}){let o=e.variant??"vcard",n=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(n)}getVCFURL(t,e={}){return this._transport.getURL(this.getRelativeVCFURL(t,e))}getVCF(t,e={}){return this._transport.send(this.getVCFURL(t,e),{method:"GET"})}list({limit:t,query:e,type:o,request:n={}}={}){return this._transport.send("v1/contacts",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.filterQuery("type",o)]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var y=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}list({query:t,limit:e,filter:o,include:n,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.limitQuery(e),...this._transport.filterQuery("filter",o),...this._transport.includeQuery(n??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var I=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/feedback/conversation",{...t,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/feedback",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/feedback/conversation",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var _=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/escalations/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/escalations",{...t,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/escalations",{...e,method:"POST",json:t})}};var T=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,include:o,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByConversation(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var L=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}listByConversation(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o)]})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var A=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}createResponse(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,json:e})}createCorrection(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",json:e})}};var S=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}listByContact(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/notes",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var U=class s{constructor(t=s.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=ft;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var E=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}list({featured:t,category:e,request:o={}}={}){let n=[];if(e){let r=Array.isArray(e)?e:[e];for(let c of r)n.push(["category",c])}return t!==void 0&&n.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:n})}};var D=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};var gt=mt(require("is-network-error"),1),N=mt(require("ky"),1);var j=class extends Error{constructor(e,o){super("Support Error",{cause:o});this.response=e}};var G=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=N.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let n of this.options.requestFilterables){let r=n.getHeaders();for(let[c,It]of Object.entries(r))o.headers.has(c)||o.headers.set(c,It)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,n]of Object.entries(t))n!==void 0&&e.push(["sort",n+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}filterQuery(t,e){let o=[];return e===void 0||o.push([t,e]),o}send(t,e={}){let o=this.client(t,e).catch(async n=>{throw(0,gt.default)(n)?new Error("A network error occurred",{cause:n}):n instanceof N.HTTPError?new j(n.response,n):n});return{response:()=>o,json:async()=>(await o).json()}}};var k=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,request:e={}}){let o=new FormData;for(let n of t)o.append("file",n);return this._transport.send("v1/uploads",{...e,method:"POST",body:o})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var w=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var i=require("zod"),bt=i.z.object({data:i.z.object({event:i.z.object({id:i.z.string(),type:i.z.string(),payload:i.z.record(i.z.string()),createdAt:i.z.string().datetime()})})});var F=class{constructor(t){this._transport=t}async event({key:t=process.env[Y],maxSignatures:e=3,request:o}){let n=o.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+Y);if(!n)throw new Error("Missing signature header");if(!this._verifySignature(t,o.body,Array.isArray(n)?n.slice(0,e):[n]))throw new Error("Untrusted signature")}let{data:r}=bt.parse(o.body);return{event:r.event}}async _verifySignature(t,e,o){let n=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let r of o)if(await crypto.subtle.verify("HMAC",n,new TextEncoder().encode(atob(r)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var x=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/webhooks/subscriptions",{...t,method:"GET"})}test(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t)+"/test",{...e,method:"POST"})}create({body:t,request:e={}}){return this._transport.send("v1/webhooks/subscriptions",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var P=class s{static DEFAULT_BASE_URL=ht;static PublicAuthentication=p;static BasicAuthentication=C;static BearerAuthentication=h;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;channelConversationSettings;compositionSection;contact;conversation;conversationFeedback;escalation;label;message;model;note;source;statistics;upload;user;webhook;webhookSubscription;constructor(t,{baseURL:e,...o}={}){this._transport=new G({requestFilterables:[new U,t],...o,baseURL:e?.toString()??s.getBaseURL()}),this.account=new m(this._transport),this.accountAccessToken=new d(this._transport),this.accountConversationSettings=new l(this._transport),this.action=new u(this._transport),this.boilerplateCategory=new f(this._transport),this.boilerplateContent=new g(this._transport),this.channel=new b(this._transport),this.channelConversationSettings=new v(this._transport),this.compositionSection=new R(this._transport),this.contact=new O(this._transport),this.conversation=new y(this._transport),this.conversationFeedback=new I(this._transport),this.escalation=new _(this._transport),this.label=new T(this._transport),this.message=new L(this._transport),this.model=new A(this._transport),this.note=new S(this._transport),this.source=new E(this._transport),this.statistics=new D(this._transport),this.upload=new k(this._transport),this.user=new w(this._transport),this.webhook=new F(this._transport),this.webhookSubscription=new x(this._transport)}static getBaseURL(){return process.env[Ct]??this.DEFAULT_BASE_URL}};var z=require("commander"),vt=require("ora");function J({client:s,ora:t}){let e=new z.Command("actions").description("Actions");return e.addCommand(new z.Command("list").description("List actions").action(async()=>{let o=await(0,vt.oraPromise)(()=>s.action.list().json(),{...t,text:"Finding actions"});console.log(o)})),e}var $=require("commander"),Rt=require("ora");function X({client:s,ora:t}){let e=new $.Command("channels").description("Channels");return e.addCommand(new $.Command("list").description("List channels").action(async()=>{let o=await(0,Rt.oraPromise)(()=>s.channel.list().json(),{...t,text:"Finding channels"});console.log(o)})),e}var B=require("commander"),Q=require("ora");function Z({client:s,ora:t}){let e=new B.Command("contacts").description("Contacts");return e.addCommand(new B.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async o=>{let n=await(0,Q.oraPromise)(()=>s.contact.get(o).json(),{...t,text:"Finding contact"});console.log(n)})),e.addCommand(new B.Command("list").description("List contacts").action(async()=>{let o=await(0,Q.oraPromise)(()=>s.contact.list().json(),{...t,text:"Finding contacts"});console.log(o)})),e.addCommand(new B.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async o=>{let n=await(0,Q.oraPromise)(()=>s.contact.getVCF(o).response(),{...t,text:"Exporting contact"});console.log(n)})),e}var H=require("commander"),tt=require("ora");function et({client:s,ora:t}){let e=new H.Command("conversations").description("Conversations");return e.addCommand(new H.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async o=>{let n=await(0,tt.oraPromise)(()=>s.conversation.get(o).json(),{...t,text:"Finding conversation"});console.log(n)})),e.addCommand(new H.Command("list").description("List conversations").action(async()=>{let o=await(0,tt.oraPromise)(()=>s.conversation.list().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var M=require("commander"),V=require("ora");function ot({client:s,ora:t}){let e=new M.Command("labels").description("Labels");return e.addCommand(new M.Command("get").description("Find label").argument("<label>","Label ID").action(async o=>{let n=await(0,V.oraPromise)(()=>s.label.get(o).json(),{...t,text:"Finding label"});console.log(n)})),e.addCommand(new M.Command("list").description("List labels").action(async()=>{let o=await(0,V.oraPromise)(()=>s.label.list().json(),{...t,text:"Finding labels"});console.log(o)})),e.addCommand(new M.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async o=>{let n=await(0,V.oraPromise)(()=>s.conversation.listByLabel(o).json(),{...t,text:"Finding conversations"});console.log(n)})),e}var st=require("commander"),Ot=require("ora");function nt({client:s,ora:t}){let e=new st.Command("messages").description("Messages");return e.addCommand(new st.Command("list").description("List messages").action(async()=>{let o=await(0,Ot.oraPromise)(()=>s.message.list().json(),{...t,text:"Finding messages"});console.log(o)})),e}var q=require("commander"),rt=require("ora");function it({client:s,ora:t}){let e=new q.Command("models").description("Models");return e.addCommand(new q.Command("get").description("Find model").argument("<model>","Model ID").action(async o=>{let n=await(0,rt.oraPromise)(()=>s.model.get(o).json(),{...t,text:"Finding model"});console.log(n)})),e.addCommand(new q.Command("list").description("List models").action(async()=>{let o=await(0,rt.oraPromise)(()=>s.model.list().json(),{...t,text:"Finding models"});console.log(o)})),e}var K=require("commander"),at=require("ora");function pt({client:s,ora:t}){let e=new K.Command("sources").description("Sources");return e.addCommand(new K.Command("get").description("Find source").argument("<source>","Source ID").action(async o=>{let n=await(0,at.oraPromise)(()=>s.source.get(o).json(),{...t,text:"Finding source"});console.log(n)})),e.addCommand(new K.Command("list").description("List sources").action(async()=>{let o=await(0,at.oraPromise)(()=>s.source.list().json(),{...t,text:"Finding sources"});console.log(o)})),e}var a={ora:{spinner:"simpleDotsScrolling"},client:new P(new p)},Dt=new yt.Command("gds").description("Great Detail Support System").addCommand(J(a)).addCommand(X(a)).addCommand(Z(a)).addCommand(et(a)).addCommand(ot(a)).addCommand(nt(a)).addCommand(it(a)).addCommand(pt(a)),Gt=Dt;
@@ -1,5 +1,5 @@
1
1
  import { Command } from 'commander';
2
- import { C as Client } from '../Client-CEPzVrEi.cjs';
2
+ import { C as Client } from '../Client-CZh_BK9W.cjs';
3
3
  import { Options as Options$1 } from 'ora';
4
4
  import 'ky';
5
5
  import 'zod';
@@ -1,5 +1,5 @@
1
1
  import { Command } from 'commander';
2
- import { C as Client } from '../Client-CEPzVrEi.js';
2
+ import { C as Client } from '../Client-CZh_BK9W.js';
3
3
  import { Options as Options$1 } from 'ora';
4
4
  import 'ky';
5
5
  import 'zod';
package/dist/cli/index.js CHANGED
@@ -1 +1 @@
1
- import{a}from"../chunk-PWVVJXB3.js";import"../chunk-2CFCCPDQ.js";export{a as default};
1
+ import{a}from"../chunk-4DMFJV5X.js";import"../chunk-T7UH3U2U.js";export{a as default};
package/dist/cli.cjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var _t=Object.create;var pt=Object.defineProperty;var Tt=Object.getOwnPropertyDescriptor;var Lt=Object.getOwnPropertyNames;var At=Object.getPrototypeOf,St=Object.prototype.hasOwnProperty;var Ut=(s,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Lt(t))!St.call(s,n)&&n!==e&&pt(s,n,{get:()=>t[n],enumerable:!(o=Tt(t,n))||o.enumerable});return s};var ct=(s,t,e)=>(e=s!=null?_t(At(s)):{},Ut(t||!s||!s.__esModule?pt(e,"default",{value:s,enumerable:!0}):e,s));var Ot=require("commander");var p=class{getHeaders(){return{}}};var m=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/accounts",{...e,method:"POST",json:t})}};var d=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}delete(t,e,{body:o,request:n={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...n,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var l=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var u=class{constructor(t){this._transport=t}list({limit:t,sort:e,request:o={}}={}){return this._transport.send("v1/actions",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var mt="SUPPORT_ACCESS_TOKEN",dt="SUPPORT_KEY_NAME",lt="SUPPORT_KEY_PASSWORD",K="SUPPORT_SIGNING_KEY",ut="SUPPORT_BASE_URL";var C=class{name;#t;constructor({name:t=process.env[dt],password:e=process.env[lt]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var h=class{#t;constructor({token:t=process.env[mt]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var f=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var b=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByCategory=this.listByBoilerplateCategory;listByBoilerplateCategory(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t)+"/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var v=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/channels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}metaWhatsappGetBusinessProfile(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/meta-whatsapp/business-profile",{...e,method:"GET"})}twilioSendgridChannelSync(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/twilio-sendgrid/sync",{...o,method:"POST",json:e})}};var g=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var R=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var Ct="https://api.support.greatdetail.com",ht={"X-Powered-By":"GDSupport/JavaScript"};var O=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}getRelativeVCFURL(t,{vcf:e={}}={}){let o=e.variant??"vcard",n=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(n)}getVCFURL(t,e={}){return this._transport.getURL(this.getRelativeVCFURL(t,e))}getVCF(t,e={}){return this._transport.send(this.getVCFURL(t,e),{method:"GET"})}list({limit:t,query:e,filter:o,request:n={}}={}){return this._transport.send("v1/contacts",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...o?[["filter",o]]:[]]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var I=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}list({query:t,limit:e,filter:o,include:n,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.limitQuery(e),...o?[["filter",o]]:[],...this._transport.includeQuery(n??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var y=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/feedback/conversation",{...t,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/feedback",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/feedback/conversation",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var _=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/escalations/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/escalations",{...t,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/escalations",{...e,method:"POST",json:t})}};var T=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,include:o,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByConversation(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var L=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}listByConversation(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o)]})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var A=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}createResponse(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,json:e})}createCorrection(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",json:e})}};var S=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}listByContact(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/notes",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var U=class s{constructor(t=s.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=ht;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var E=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}list({featured:t,category:e,request:o={}}={}){let n=[];if(e){let r=Array.isArray(e)?e:[e];for(let c of r)n.push(["category",c])}return t!==void 0&&n.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:n})}};var D=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};var ft=ct(require("is-network-error"),1),j=ct(require("ky"),1);var W=class extends Error{constructor(e,o){super("Support Error",{cause:o});this.response=e}};var G=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=j.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let n of this.options.requestFilterables){let r=n.getHeaders();for(let[c,yt]of Object.entries(r))o.headers.has(c)||o.headers.set(c,yt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,n]of Object.entries(t))n!==void 0&&e.push(["sort",n+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let o=this.client(t,e).catch(async n=>{throw(0,ft.default)(n)?new Error("A network error occurred",{cause:n}):n instanceof j.HTTPError?new W(n.response,n):n});return{response:()=>o,json:async()=>(await o).json()}}};var k=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,request:e={}}){let o=new FormData;for(let n of t)o.append("file",n);return this._transport.send("v1/uploads",{...e,method:"POST",body:o})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var w=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var i=require("zod"),bt=i.z.object({data:i.z.object({event:i.z.object({id:i.z.string(),type:i.z.string(),payload:i.z.record(i.z.string()),createdAt:i.z.string().datetime()})})});var F=class{constructor(t){this._transport=t}async event({key:t=process.env[K],maxSignatures:e=3,request:o}){let n=o.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+K);if(!n)throw new Error("Missing signature header");if(!this._verifySignature(t,o.body,Array.isArray(n)?n.slice(0,e):[n]))throw new Error("Untrusted signature")}let{data:r}=bt.parse(o.body);return{event:r.event}}async _verifySignature(t,e,o){let n=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let r of o)if(await crypto.subtle.verify("HMAC",n,new TextEncoder().encode(atob(r)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var x=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/webhooks/subscriptions",{...t,method:"GET"})}test(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t)+"/test",{...e,method:"POST"})}create({body:t,request:e={}}){return this._transport.send("v1/webhooks/subscriptions",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var P=class s{static DEFAULT_BASE_URL=Ct;static PublicAuthentication=p;static BasicAuthentication=C;static BearerAuthentication=h;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;channelConversationSettings;compositionSection;contact;conversation;conversationFeedback;escalation;label;message;model;note;source;statistics;upload;user;webhook;webhookSubscription;constructor(t,{baseURL:e,...o}={}){this._transport=new G({requestFilterables:[new U,t],...o,baseURL:e?.toString()??s.getBaseURL()}),this.account=new m(this._transport),this.accountAccessToken=new d(this._transport),this.accountConversationSettings=new l(this._transport),this.action=new u(this._transport),this.boilerplateCategory=new f(this._transport),this.boilerplateContent=new b(this._transport),this.channel=new v(this._transport),this.channelConversationSettings=new g(this._transport),this.compositionSection=new R(this._transport),this.contact=new O(this._transport),this.conversation=new I(this._transport),this.conversationFeedback=new y(this._transport),this.escalation=new _(this._transport),this.label=new T(this._transport),this.message=new L(this._transport),this.model=new A(this._transport),this.note=new S(this._transport),this.source=new E(this._transport),this.statistics=new D(this._transport),this.upload=new k(this._transport),this.user=new w(this._transport),this.webhook=new F(this._transport),this.webhookSubscription=new x(this._transport)}static getBaseURL(){return process.env[ut]??this.DEFAULT_BASE_URL}};var Y=require("commander"),vt=require("ora");function z({client:s,ora:t}){let e=new Y.Command("actions").description("Actions");return e.addCommand(new Y.Command("list").description("List actions").action(async()=>{let o=await(0,vt.oraPromise)(()=>s.action.list().json(),{...t,text:"Finding actions"});console.log(o)})),e}var J=require("commander"),gt=require("ora");function $({client:s,ora:t}){let e=new J.Command("channels").description("Channels");return e.addCommand(new J.Command("list").description("List channels").action(async()=>{let o=await(0,gt.oraPromise)(()=>s.channel.list().json(),{...t,text:"Finding channels"});console.log(o)})),e}var B=require("commander"),N=require("ora");function X({client:s,ora:t}){let e=new B.Command("contacts").description("Contacts");return e.addCommand(new B.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async o=>{let n=await(0,N.oraPromise)(()=>s.contact.get(o).json(),{...t,text:"Finding contact"});console.log(n)})),e.addCommand(new B.Command("list").description("List contacts").action(async()=>{let o=await(0,N.oraPromise)(()=>s.contact.list().json(),{...t,text:"Finding contacts"});console.log(o)})),e.addCommand(new B.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async o=>{let n=await(0,N.oraPromise)(()=>s.contact.getVCF(o).response(),{...t,text:"Exporting contact"});console.log(n)})),e}var Q=require("commander"),Z=require("ora");function tt({client:s,ora:t}){let e=new Q.Command("conversations").description("Conversations");return e.addCommand(new Q.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async o=>{let n=await(0,Z.oraPromise)(()=>s.conversation.get(o).json(),{...t,text:"Finding conversation"});console.log(n)})),e.addCommand(new Q.Command("list").description("List conversations").action(async()=>{let o=await(0,Z.oraPromise)(()=>s.conversation.list().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var M=require("commander"),H=require("ora");function et({client:s,ora:t}){let e=new M.Command("labels").description("Labels");return e.addCommand(new M.Command("get").description("Find label").argument("<label>","Label ID").action(async o=>{let n=await(0,H.oraPromise)(()=>s.label.get(o).json(),{...t,text:"Finding label"});console.log(n)})),e.addCommand(new M.Command("list").description("List labels").action(async()=>{let o=await(0,H.oraPromise)(()=>s.label.list().json(),{...t,text:"Finding labels"});console.log(o)})),e.addCommand(new M.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async o=>{let n=await(0,H.oraPromise)(()=>s.conversation.listByLabel(o).json(),{...t,text:"Finding conversations"});console.log(n)})),e}var ot=require("commander"),Rt=require("ora");function st({client:s,ora:t}){let e=new ot.Command("messages").description("Messages");return e.addCommand(new ot.Command("list").description("List messages").action(async()=>{let o=await(0,Rt.oraPromise)(()=>s.message.list().json(),{...t,text:"Finding messages"});console.log(o)})),e}var V=require("commander"),nt=require("ora");function rt({client:s,ora:t}){let e=new V.Command("models").description("Models");return e.addCommand(new V.Command("get").description("Find model").argument("<model>","Model ID").action(async o=>{let n=await(0,nt.oraPromise)(()=>s.model.get(o).json(),{...t,text:"Finding model"});console.log(n)})),e.addCommand(new V.Command("list").description("List models").action(async()=>{let o=await(0,nt.oraPromise)(()=>s.model.list().json(),{...t,text:"Finding models"});console.log(o)})),e}var q=require("commander"),it=require("ora");function at({client:s,ora:t}){let e=new q.Command("sources").description("Sources");return e.addCommand(new q.Command("get").description("Find source").argument("<source>","Source ID").action(async o=>{let n=await(0,it.oraPromise)(()=>s.source.get(o).json(),{...t,text:"Finding source"});console.log(n)})),e.addCommand(new q.Command("list").description("List sources").action(async()=>{let o=await(0,it.oraPromise)(()=>s.source.list().json(),{...t,text:"Finding sources"});console.log(o)})),e}var a={ora:{spinner:"simpleDotsScrolling"},client:new P(new p)},Et=new Ot.Command("gds").description("Great Detail Support System").addCommand(z(a)).addCommand($(a)).addCommand(X(a)).addCommand(tt(a)).addCommand(et(a)).addCommand(st(a)).addCommand(rt(a)).addCommand(at(a)),It=Et;It.parseAsync(process.argv);
2
+ "use strict";var _t=Object.create;var pt=Object.defineProperty;var Tt=Object.getOwnPropertyDescriptor;var Lt=Object.getOwnPropertyNames;var At=Object.getPrototypeOf,St=Object.prototype.hasOwnProperty;var Ut=(s,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Lt(t))!St.call(s,n)&&n!==e&&pt(s,n,{get:()=>t[n],enumerable:!(o=Tt(t,n))||o.enumerable});return s};var ct=(s,t,e)=>(e=s!=null?_t(At(s)):{},Ut(t||!s||!s.__esModule?pt(e,"default",{value:s,enumerable:!0}):e,s));var Ot=require("commander");var p=class{getHeaders(){return{}}};var m=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/accounts",{...e,method:"POST",json:t})}};var d=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}delete(t,e,{body:o,request:n={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...n,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var l=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var u=class{constructor(t){this._transport=t}list({limit:t,sort:e,request:o={}}={}){return this._transport.send("v1/actions",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var mt="SUPPORT_ACCESS_TOKEN",dt="SUPPORT_KEY_NAME",lt="SUPPORT_KEY_PASSWORD",K="SUPPORT_SIGNING_KEY",ut="SUPPORT_BASE_URL";var C=class{name;#t;constructor({name:t=process.env[dt],password:e=process.env[lt]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var h=class{#t;constructor({token:t=process.env[mt]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var f=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var g=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByCategory=this.listByBoilerplateCategory;listByBoilerplateCategory(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t)+"/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var b=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/channels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}metaWhatsappGetBusinessProfile(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/meta-whatsapp/business-profile",{...e,method:"GET"})}twilioSendgridChannelSync(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/twilio-sendgrid/sync",{...o,method:"POST",json:e})}};var v=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var R=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var Ct="https://api.support.greatdetail.com",ht={"X-Powered-By":"GDSupport/JavaScript"};var O=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}getRelativeVCFURL(t,{vcf:e={}}={}){let o=e.variant??"vcard",n=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(n)}getVCFURL(t,e={}){return this._transport.getURL(this.getRelativeVCFURL(t,e))}getVCF(t,e={}){return this._transport.send(this.getVCFURL(t,e),{method:"GET"})}list({limit:t,query:e,type:o,request:n={}}={}){return this._transport.send("v1/contacts",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.filterQuery("type",o)]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var y=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}list({query:t,limit:e,filter:o,include:n,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.limitQuery(e),...this._transport.filterQuery("filter",o),...this._transport.includeQuery(n??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var I=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/feedback/conversation",{...t,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/feedback",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/feedback/conversation",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var _=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/escalations/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/escalations",{...t,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/escalations",{...e,method:"POST",json:t})}};var T=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,include:o,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByConversation(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var L=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}listByConversation(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o)]})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var A=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}createResponse(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,json:e})}createCorrection(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",json:e})}};var S=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}listByContact(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/notes",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var U=class s{constructor(t=s.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=ht;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var E=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}list({featured:t,category:e,request:o={}}={}){let n=[];if(e){let r=Array.isArray(e)?e:[e];for(let c of r)n.push(["category",c])}return t!==void 0&&n.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:n})}};var D=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};var ft=ct(require("is-network-error"),1),j=ct(require("ky"),1);var W=class extends Error{constructor(e,o){super("Support Error",{cause:o});this.response=e}};var G=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=j.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let n of this.options.requestFilterables){let r=n.getHeaders();for(let[c,It]of Object.entries(r))o.headers.has(c)||o.headers.set(c,It)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,n]of Object.entries(t))n!==void 0&&e.push(["sort",n+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}filterQuery(t,e){let o=[];return e===void 0||o.push([t,e]),o}send(t,e={}){let o=this.client(t,e).catch(async n=>{throw(0,ft.default)(n)?new Error("A network error occurred",{cause:n}):n instanceof j.HTTPError?new W(n.response,n):n});return{response:()=>o,json:async()=>(await o).json()}}};var k=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,request:e={}}){let o=new FormData;for(let n of t)o.append("file",n);return this._transport.send("v1/uploads",{...e,method:"POST",body:o})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var w=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var i=require("zod"),gt=i.z.object({data:i.z.object({event:i.z.object({id:i.z.string(),type:i.z.string(),payload:i.z.record(i.z.string()),createdAt:i.z.string().datetime()})})});var F=class{constructor(t){this._transport=t}async event({key:t=process.env[K],maxSignatures:e=3,request:o}){let n=o.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+K);if(!n)throw new Error("Missing signature header");if(!this._verifySignature(t,o.body,Array.isArray(n)?n.slice(0,e):[n]))throw new Error("Untrusted signature")}let{data:r}=gt.parse(o.body);return{event:r.event}}async _verifySignature(t,e,o){let n=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let r of o)if(await crypto.subtle.verify("HMAC",n,new TextEncoder().encode(atob(r)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var x=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/webhooks/subscriptions",{...t,method:"GET"})}test(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t)+"/test",{...e,method:"POST"})}create({body:t,request:e={}}){return this._transport.send("v1/webhooks/subscriptions",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var P=class s{static DEFAULT_BASE_URL=Ct;static PublicAuthentication=p;static BasicAuthentication=C;static BearerAuthentication=h;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;channelConversationSettings;compositionSection;contact;conversation;conversationFeedback;escalation;label;message;model;note;source;statistics;upload;user;webhook;webhookSubscription;constructor(t,{baseURL:e,...o}={}){this._transport=new G({requestFilterables:[new U,t],...o,baseURL:e?.toString()??s.getBaseURL()}),this.account=new m(this._transport),this.accountAccessToken=new d(this._transport),this.accountConversationSettings=new l(this._transport),this.action=new u(this._transport),this.boilerplateCategory=new f(this._transport),this.boilerplateContent=new g(this._transport),this.channel=new b(this._transport),this.channelConversationSettings=new v(this._transport),this.compositionSection=new R(this._transport),this.contact=new O(this._transport),this.conversation=new y(this._transport),this.conversationFeedback=new I(this._transport),this.escalation=new _(this._transport),this.label=new T(this._transport),this.message=new L(this._transport),this.model=new A(this._transport),this.note=new S(this._transport),this.source=new E(this._transport),this.statistics=new D(this._transport),this.upload=new k(this._transport),this.user=new w(this._transport),this.webhook=new F(this._transport),this.webhookSubscription=new x(this._transport)}static getBaseURL(){return process.env[ut]??this.DEFAULT_BASE_URL}};var Y=require("commander"),bt=require("ora");function z({client:s,ora:t}){let e=new Y.Command("actions").description("Actions");return e.addCommand(new Y.Command("list").description("List actions").action(async()=>{let o=await(0,bt.oraPromise)(()=>s.action.list().json(),{...t,text:"Finding actions"});console.log(o)})),e}var J=require("commander"),vt=require("ora");function $({client:s,ora:t}){let e=new J.Command("channels").description("Channels");return e.addCommand(new J.Command("list").description("List channels").action(async()=>{let o=await(0,vt.oraPromise)(()=>s.channel.list().json(),{...t,text:"Finding channels"});console.log(o)})),e}var B=require("commander"),N=require("ora");function X({client:s,ora:t}){let e=new B.Command("contacts").description("Contacts");return e.addCommand(new B.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async o=>{let n=await(0,N.oraPromise)(()=>s.contact.get(o).json(),{...t,text:"Finding contact"});console.log(n)})),e.addCommand(new B.Command("list").description("List contacts").action(async()=>{let o=await(0,N.oraPromise)(()=>s.contact.list().json(),{...t,text:"Finding contacts"});console.log(o)})),e.addCommand(new B.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async o=>{let n=await(0,N.oraPromise)(()=>s.contact.getVCF(o).response(),{...t,text:"Exporting contact"});console.log(n)})),e}var Q=require("commander"),Z=require("ora");function tt({client:s,ora:t}){let e=new Q.Command("conversations").description("Conversations");return e.addCommand(new Q.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async o=>{let n=await(0,Z.oraPromise)(()=>s.conversation.get(o).json(),{...t,text:"Finding conversation"});console.log(n)})),e.addCommand(new Q.Command("list").description("List conversations").action(async()=>{let o=await(0,Z.oraPromise)(()=>s.conversation.list().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var M=require("commander"),H=require("ora");function et({client:s,ora:t}){let e=new M.Command("labels").description("Labels");return e.addCommand(new M.Command("get").description("Find label").argument("<label>","Label ID").action(async o=>{let n=await(0,H.oraPromise)(()=>s.label.get(o).json(),{...t,text:"Finding label"});console.log(n)})),e.addCommand(new M.Command("list").description("List labels").action(async()=>{let o=await(0,H.oraPromise)(()=>s.label.list().json(),{...t,text:"Finding labels"});console.log(o)})),e.addCommand(new M.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async o=>{let n=await(0,H.oraPromise)(()=>s.conversation.listByLabel(o).json(),{...t,text:"Finding conversations"});console.log(n)})),e}var ot=require("commander"),Rt=require("ora");function st({client:s,ora:t}){let e=new ot.Command("messages").description("Messages");return e.addCommand(new ot.Command("list").description("List messages").action(async()=>{let o=await(0,Rt.oraPromise)(()=>s.message.list().json(),{...t,text:"Finding messages"});console.log(o)})),e}var V=require("commander"),nt=require("ora");function rt({client:s,ora:t}){let e=new V.Command("models").description("Models");return e.addCommand(new V.Command("get").description("Find model").argument("<model>","Model ID").action(async o=>{let n=await(0,nt.oraPromise)(()=>s.model.get(o).json(),{...t,text:"Finding model"});console.log(n)})),e.addCommand(new V.Command("list").description("List models").action(async()=>{let o=await(0,nt.oraPromise)(()=>s.model.list().json(),{...t,text:"Finding models"});console.log(o)})),e}var q=require("commander"),it=require("ora");function at({client:s,ora:t}){let e=new q.Command("sources").description("Sources");return e.addCommand(new q.Command("get").description("Find source").argument("<source>","Source ID").action(async o=>{let n=await(0,it.oraPromise)(()=>s.source.get(o).json(),{...t,text:"Finding source"});console.log(n)})),e.addCommand(new q.Command("list").description("List sources").action(async()=>{let o=await(0,it.oraPromise)(()=>s.source.list().json(),{...t,text:"Finding sources"});console.log(o)})),e}var a={ora:{spinner:"simpleDotsScrolling"},client:new P(new p)},Et=new Ot.Command("gds").description("Great Detail Support System").addCommand(z(a)).addCommand($(a)).addCommand(X(a)).addCommand(tt(a)).addCommand(et(a)).addCommand(st(a)).addCommand(rt(a)).addCommand(at(a)),yt=Et;yt.parseAsync(process.argv);
package/dist/cli.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{a as r}from"./chunk-PWVVJXB3.js";import"./chunk-2CFCCPDQ.js";r.parseAsync(process.argv);
2
+ import{a as r}from"./chunk-4DMFJV5X.js";import"./chunk-T7UH3U2U.js";r.parseAsync(process.argv);
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var tt=Object.create;var w=Object.defineProperty;var et=Object.getOwnPropertyDescriptor;var ot=Object.getOwnPropertyNames;var st=Object.getPrototypeOf,nt=Object.prototype.hasOwnProperty;var H=(s,t)=>{for(var e in t)w(s,e,{get:t[e],enumerable:!0})},V=(s,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ot(t))!nt.call(s,n)&&n!==e&&w(s,n,{get:()=>t[n],enumerable:!(o=et(t,n))||o.enumerable});return s};var q=(s,t,e)=>(e=s!=null?tt(st(s)):{},V(t||!s||!s.__esModule?w(e,"default",{value:s,enumerable:!0}):e,s)),rt=s=>V(w({},"__esModule",{value:!0}),s);var it={};H(it,{Client:()=>c,DEFAULT_SUPPORT_BASE_URL:()=>M,Error:()=>j,SupportError:()=>a,default:()=>c,eventWebhookSchema:()=>Q});module.exports=rt(it);var M="https://api.support.greatdetail.com",K={"X-Powered-By":"GDSupport/JavaScript"};var m=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/accounts",{...e,method:"POST",json:t})}};var l=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}delete(t,e,{body:o,request:n={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...n,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var d=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var u=class{constructor(t){this._transport=t}list({limit:t,sort:e,request:o={}}={}){return this._transport.send("v1/actions",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var Y="SUPPORT_ACCESS_TOKEN",z="SUPPORT_KEY_NAME",J="SUPPORT_KEY_PASSWORD",N="SUPPORT_SIGNING_KEY",$="SUPPORT_BASE_URL";var h=class{name;#t;constructor({name:t=process.env[z],password:e=process.env[J]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var C=class{#t;constructor({token:t=process.env[Y]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var f=class{getHeaders(){return{}}};var R=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var b=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByCategory=this.listByBoilerplateCategory;listByBoilerplateCategory(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t)+"/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var v=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/channels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}metaWhatsappGetBusinessProfile(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/meta-whatsapp/business-profile",{...e,method:"GET"})}twilioSendgridChannelSync(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/twilio-sendgrid/sync",{...o,method:"POST",json:e})}};var O=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var g=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var x=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}getRelativeVCFURL(t,{vcf:e={}}={}){let o=e.variant??"vcard",n=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(n)}getVCFURL(t,e={}){return this._transport.getURL(this.getRelativeVCFURL(t,e))}getVCF(t,e={}){return this._transport.send(this.getVCFURL(t,e),{method:"GET"})}list({limit:t,query:e,filter:o,request:n={}}={}){return this._transport.send("v1/contacts",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...o?[["filter",o]]:[]]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var T=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}list({query:t,limit:e,filter:o,include:n,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.limitQuery(e),...o?[["filter",o]]:[],...this._transport.includeQuery(n??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var _=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/feedback/conversation",{...t,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/feedback",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/feedback/conversation",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var I=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/escalations/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/escalations",{...t,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/escalations",{...e,method:"POST",json:t})}};var y=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,include:o,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByConversation(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var L=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}listByConversation(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o)]})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var A=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}createResponse(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,json:e})}createCorrection(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",json:e})}};var U=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}listByContact(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/notes",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var S=class s{constructor(t=s.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=K;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var E=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}list({featured:t,category:e,request:o={}}={}){let n=[];if(e){let r=Array.isArray(e)?e:[e];for(let p of r)n.push(["category",p])}return t!==void 0&&n.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:n})}};var D=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};var X=q(require("is-network-error"),1),W=q(require("ky"),1);var a=class extends Error{constructor(e,o){super("Support Error",{cause:o});this.response=e}};var G=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=W.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let n of this.options.requestFilterables){let r=n.getHeaders();for(let[p,Z]of Object.entries(r))o.headers.has(p)||o.headers.set(p,Z)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,n]of Object.entries(t))n!==void 0&&e.push(["sort",n+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let o=this.client(t,e).catch(async n=>{throw(0,X.default)(n)?new Error("A network error occurred",{cause:n}):n instanceof W.HTTPError?new a(n.response,n):n});return{response:()=>o,json:async()=>(await o).json()}}};var k=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,request:e={}}){let o=new FormData;for(let n of t)o.append("file",n);return this._transport.send("v1/uploads",{...e,method:"POST",body:o})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var P=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var i=require("zod"),Q=i.z.object({data:i.z.object({event:i.z.object({id:i.z.string(),type:i.z.string(),payload:i.z.record(i.z.string()),createdAt:i.z.string().datetime()})})});var F=class{constructor(t){this._transport=t}async event({key:t=process.env[N],maxSignatures:e=3,request:o}){let n=o.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+N);if(!n)throw new Error("Missing signature header");if(!this._verifySignature(t,o.body,Array.isArray(n)?n.slice(0,e):[n]))throw new Error("Untrusted signature")}let{data:r}=Q.parse(o.body);return{event:r.event}}async _verifySignature(t,e,o){let n=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let r of o)if(await crypto.subtle.verify("HMAC",n,new TextEncoder().encode(atob(r)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var B=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/webhooks/subscriptions",{...t,method:"GET"})}test(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t)+"/test",{...e,method:"POST"})}create({body:t,request:e={}}){return this._transport.send("v1/webhooks/subscriptions",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var c=class s{static DEFAULT_BASE_URL=M;static PublicAuthentication=f;static BasicAuthentication=h;static BearerAuthentication=C;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;channelConversationSettings;compositionSection;contact;conversation;conversationFeedback;escalation;label;message;model;note;source;statistics;upload;user;webhook;webhookSubscription;constructor(t,{baseURL:e,...o}={}){this._transport=new G({requestFilterables:[new S,t],...o,baseURL:e?.toString()??s.getBaseURL()}),this.account=new m(this._transport),this.accountAccessToken=new l(this._transport),this.accountConversationSettings=new d(this._transport),this.action=new u(this._transport),this.boilerplateCategory=new R(this._transport),this.boilerplateContent=new b(this._transport),this.channel=new v(this._transport),this.channelConversationSettings=new O(this._transport),this.compositionSection=new g(this._transport),this.contact=new x(this._transport),this.conversation=new T(this._transport),this.conversationFeedback=new _(this._transport),this.escalation=new I(this._transport),this.label=new y(this._transport),this.message=new L(this._transport),this.model=new A(this._transport),this.note=new U(this._transport),this.source=new E(this._transport),this.statistics=new D(this._transport),this.upload=new k(this._transport),this.user=new P(this._transport),this.webhook=new F(this._transport),this.webhookSubscription=new B(this._transport)}static getBaseURL(){return process.env[$]??this.DEFAULT_BASE_URL}};var j={};H(j,{SupportError:()=>a});0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,Error,SupportError,eventWebhookSchema});
1
+ "use strict";var tt=Object.create;var w=Object.defineProperty;var et=Object.getOwnPropertyDescriptor;var ot=Object.getOwnPropertyNames;var st=Object.getPrototypeOf,nt=Object.prototype.hasOwnProperty;var H=(s,t)=>{for(var e in t)w(s,e,{get:t[e],enumerable:!0})},V=(s,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ot(t))!nt.call(s,n)&&n!==e&&w(s,n,{get:()=>t[n],enumerable:!(o=et(t,n))||o.enumerable});return s};var q=(s,t,e)=>(e=s!=null?tt(st(s)):{},V(t||!s||!s.__esModule?w(e,"default",{value:s,enumerable:!0}):e,s)),rt=s=>V(w({},"__esModule",{value:!0}),s);var it={};H(it,{Client:()=>c,DEFAULT_SUPPORT_BASE_URL:()=>M,Error:()=>j,SupportError:()=>a,default:()=>c,eventWebhookSchema:()=>Q});module.exports=rt(it);var M="https://api.support.greatdetail.com",K={"X-Powered-By":"GDSupport/JavaScript"};var m=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/accounts",{...e,method:"POST",json:t})}};var l=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}delete(t,e,{body:o,request:n={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...n,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var d=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var u=class{constructor(t){this._transport=t}list({limit:t,sort:e,request:o={}}={}){return this._transport.send("v1/actions",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var Y="SUPPORT_ACCESS_TOKEN",z="SUPPORT_KEY_NAME",J="SUPPORT_KEY_PASSWORD",N="SUPPORT_SIGNING_KEY",$="SUPPORT_BASE_URL";var h=class{name;#t;constructor({name:t=process.env[z],password:e=process.env[J]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var C=class{#t;constructor({token:t=process.env[Y]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var f=class{getHeaders(){return{}}};var R=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var b=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByCategory=this.listByBoilerplateCategory;listByBoilerplateCategory(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t)+"/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var v=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/channels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}metaWhatsappGetBusinessProfile(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/meta-whatsapp/business-profile",{...e,method:"GET"})}twilioSendgridChannelSync(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/twilio-sendgrid/sync",{...o,method:"POST",json:e})}};var g=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var O=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var x=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}getRelativeVCFURL(t,{vcf:e={}}={}){let o=e.variant??"vcard",n=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(n)}getVCFURL(t,e={}){return this._transport.getURL(this.getRelativeVCFURL(t,e))}getVCF(t,e={}){return this._transport.send(this.getVCFURL(t,e),{method:"GET"})}list({limit:t,query:e,type:o,request:n={}}={}){return this._transport.send("v1/contacts",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.filterQuery("type",o)]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var _=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}list({query:t,limit:e,filter:o,include:n,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.limitQuery(e),...this._transport.filterQuery("filter",o),...this._transport.includeQuery(n??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var T=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/feedback/conversation",{...t,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/feedback",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/feedback/conversation",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var I=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/escalations/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/escalations",{...t,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/escalations",{...e,method:"POST",json:t})}};var y=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,include:o,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByConversation(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var L=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}listByConversation(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o)]})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var A=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}createResponse(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,json:e})}createCorrection(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",json:e})}};var U=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}listByContact(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/notes",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var S=class s{constructor(t=s.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=K;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var E=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}list({featured:t,category:e,request:o={}}={}){let n=[];if(e){let r=Array.isArray(e)?e:[e];for(let p of r)n.push(["category",p])}return t!==void 0&&n.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:n})}};var D=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};var X=q(require("is-network-error"),1),W=q(require("ky"),1);var a=class extends Error{constructor(e,o){super("Support Error",{cause:o});this.response=e}};var G=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=W.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let n of this.options.requestFilterables){let r=n.getHeaders();for(let[p,Z]of Object.entries(r))o.headers.has(p)||o.headers.set(p,Z)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,n]of Object.entries(t))n!==void 0&&e.push(["sort",n+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}filterQuery(t,e){let o=[];return e===void 0||o.push([t,e]),o}send(t,e={}){let o=this.client(t,e).catch(async n=>{throw(0,X.default)(n)?new Error("A network error occurred",{cause:n}):n instanceof W.HTTPError?new a(n.response,n):n});return{response:()=>o,json:async()=>(await o).json()}}};var k=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,request:e={}}){let o=new FormData;for(let n of t)o.append("file",n);return this._transport.send("v1/uploads",{...e,method:"POST",body:o})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var P=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var i=require("zod"),Q=i.z.object({data:i.z.object({event:i.z.object({id:i.z.string(),type:i.z.string(),payload:i.z.record(i.z.string()),createdAt:i.z.string().datetime()})})});var F=class{constructor(t){this._transport=t}async event({key:t=process.env[N],maxSignatures:e=3,request:o}){let n=o.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+N);if(!n)throw new Error("Missing signature header");if(!this._verifySignature(t,o.body,Array.isArray(n)?n.slice(0,e):[n]))throw new Error("Untrusted signature")}let{data:r}=Q.parse(o.body);return{event:r.event}}async _verifySignature(t,e,o){let n=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let r of o)if(await crypto.subtle.verify("HMAC",n,new TextEncoder().encode(atob(r)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var B=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/webhooks/subscriptions",{...t,method:"GET"})}test(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t)+"/test",{...e,method:"POST"})}create({body:t,request:e={}}){return this._transport.send("v1/webhooks/subscriptions",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var c=class s{static DEFAULT_BASE_URL=M;static PublicAuthentication=f;static BasicAuthentication=h;static BearerAuthentication=C;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;channelConversationSettings;compositionSection;contact;conversation;conversationFeedback;escalation;label;message;model;note;source;statistics;upload;user;webhook;webhookSubscription;constructor(t,{baseURL:e,...o}={}){this._transport=new G({requestFilterables:[new S,t],...o,baseURL:e?.toString()??s.getBaseURL()}),this.account=new m(this._transport),this.accountAccessToken=new l(this._transport),this.accountConversationSettings=new d(this._transport),this.action=new u(this._transport),this.boilerplateCategory=new R(this._transport),this.boilerplateContent=new b(this._transport),this.channel=new v(this._transport),this.channelConversationSettings=new g(this._transport),this.compositionSection=new O(this._transport),this.contact=new x(this._transport),this.conversation=new _(this._transport),this.conversationFeedback=new T(this._transport),this.escalation=new I(this._transport),this.label=new y(this._transport),this.message=new L(this._transport),this.model=new A(this._transport),this.note=new U(this._transport),this.source=new E(this._transport),this.statistics=new D(this._transport),this.upload=new k(this._transport),this.user=new P(this._transport),this.webhook=new F(this._transport),this.webhookSubscription=new B(this._transport)}static getBaseURL(){return process.env[$]??this.DEFAULT_BASE_URL}};var j={};H(j,{SupportError:()=>a});0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,Error,SupportError,eventWebhookSchema});
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as Account, j as AccountAccessToken, k as AccountAccessTokenID, df as AccountAccessTokenWebhookEventType, t as AccountConversationSettings, c as AccountID, de as AccountWebhookWebhookEventType, z as Action, B as ActionID, bg as ActiveConversationStatus, _ as BoilerplateCategory, $ as BoilerplateCategoryID, H as BoilerplateContent, I as BoilerplateContentID, ab as Channel, as as ChannelConversationSettings, ac as ChannelID, C as Client, ay as CompositionSection, az as CompositionSectionID, bh as ConcludedConversationStatus, aU as Contact, aX as ContactCustomMetadata, aV as ContactID, aW as ContactType, dg as ContactWebhookEventType, bd as Conversation, bf as ConversationCustomMetadata, bF as ConversationFeedback, be as ConversationID, bE as ConversationSettings, bi as ConversationStatus, dh as ConversationWebhookEventType, m as CreateAccountAccessTokenOptions, l as CreateAccountAccessTokenPayload, n as CreateAccountAccessTokenResponse, e as CreateAccountOptions, d as CreateAccountPayload, f as CreateAccountResponse, a1 as CreateBoilerplateCategoryOptions, a0 as CreateBoilerplateCategoryPayload, a2 as CreateBoilerplateCategoryResponse, K as CreateBoilerplateContentOptions, J as CreateBoilerplateContentPayload, M as CreateBoilerplateContentResponse, ae as CreateChannelOptions, ad as CreateChannelPayload, af as CreateChannelResponse, aB as CreateCompositionSectionOptions, aA as CreateCompositionSectionPayload, aC as CreateCompositionSectionResponse, aZ as CreateContactOptions, aY as CreateContactPayload, a_ as CreateContactResponse, bH as CreateConversationFeedbackOptions, bG as CreateConversationFeedbackPayload, bI as CreateConversationFeedbackResponse, bk as CreateConversationOptions, bj as CreateConversationPayload, bl as CreateConversationResponse, cv as CreateCorrectionModelOptions, cu as CreateCorrectionModelPayload, cw as CreateCorrectionResponse, aO as CreateEscalationOptions, aN as CreateEscalationPayload, aP as CreateEscalationResponse, bT as CreateLabelOptions, bS as CreateLabelPayload, bU as CreateLabelResponse, ca as CreateMessageOptions, c9 as CreateMessagePayload, cb as CreateMessageResponse, cH as CreateNoteOptions, cG as CreateNotePayload, cI as CreateNoteResponse, cy as CreateResponseModelOptions, cx as CreateResponseModelPayload, cz as CreateResponseResponse, c_ as CreateUploadOptions, c$ as CreateUploadResponse, dp as CreateWebhookSubscriptionOptions, dn as CreateWebhookSubscriptionPayload, dq as CreateWebhookSubscriptionResponse, b as CurrentAccountID, o as DeleteAccountAccessTokenOptions, D as DeleteAccountAccessTokenPayload, p as DeleteAccountAccessTokenResponse, a$ as DeleteContactOptions, b0 as DeleteContactResponse, bJ as DeleteConversationFeedbackOptions, bK as DeleteConversationFeedbackResponse, bm as DeleteConversationOptions, bn as DeleteConversationResponse, bV as DeleteLabelOptions, bW as DeleteLabelResponse, cc as DeleteMessageOptions, cd as DeleteMessageResponse, d0 as DeleteUploadOptions, d1 as DeleteUploadResponse, dr as DeleteWebhookSubscriptionOptions, ds as DeleteWebhookSubscriptionResponse, aM as Escalation, db as EventWebhookOptions, q as GetAccountAccessTokenOptions, r as GetAccountAccessTokenResponse, u as GetAccountConversationSettingsOptions, v as GetAccountConversationSettingsResponse, G as GetAccountOptions, g as GetAccountResponse, a3 as GetBoilerplateCategoryOptions, a4 as GetBoilerplateCategoryResponse, N as GetBoilerplateContentOptions, P as GetBoilerplateContentResponse, at as GetChannelConversationSettingsOptions, au as GetChannelConversationSettingsResponse, ag as GetChannelOptions, ah as GetChannelResponse, aD as GetCompositionSectionOptions, aE as GetCompositionSectionResponse, b1 as GetContactIncludeOptions, b2 as GetContactOptions, b3 as GetContactResponse, b4 as GetContactVCFOptions, bL as GetConversationFeedbackOptions, bM as GetConversationFeedbackResponse, bo as GetConversationIncludeOptions, bp as GetConversationOptions, bq as GetConversationResponse, aQ as GetEscalationOptions, aR as GetEscalationResponse, bX as GetLabelOptions, bY as GetLabelResponse, ce as GetMessageOptions, cf as GetMessageResponse, cA as GetModelOptions, cB as GetModelResponse, cJ as GetNoteOptions, cK as GetNoteResponse, cU as GetSourceOptions, cV as GetSourceResponse, d2 as GetUploadOptions, d3 as GetUploadResponse, d8 as GetUserOptions, d9 as GetUserResponse, dt as GetWebhookSubscriptionOptions, du as GetWebhookSubscriptionResponse, bR as Label, bZ as LabelID, L as ListAccountAccessTokensOptions, s as ListAccountAccessTokensResponse, E as ListActionsOptions, F as ListActionsResponse, a5 as ListBoilerplateCategoriesIncludeOptions, a6 as ListBoilerplateCategoriesOptions, a7 as ListBoilerplateCategoriesResponse, Q as ListBoilerplateCategoryBoilerplateContentsOptions, T as ListBoilerplateCategoryBoilerplateContentsResponse, V as ListBoilerplateContentsOptions, W as ListBoilerplateContentsResponse, aF as ListChannelCompositionSectionsOptions, aG as ListChannelCompositionSectionsResponse, br as ListChannelConversationsOptions, bs as ListChannelConversationsResponse, cg as ListChannelMessagesIncludeOptions, ch as ListChannelMessagesOptions, ci as ListChannelMessagesResponse, ai as ListChannelsOptions, aj as ListChannelsResponse, aH as ListCompositionSectionsOptions, aI as ListCompositionSectionsResponse, bt as ListContactConversationsOptions, bu as ListContactConversationsResponse, b_ as ListContactLabelsOptions, b$ as ListContactLabelsResponse, cL as ListContactNotesOptions, cM as ListContactNotesResponse, b5 as ListContactsFilterOptions, b6 as ListContactsOptions, b7 as ListContactsResponse, bN as ListConversationConversationFeedbackOptions, bO as ListConversationConversationFeedbackResponse, bP as ListConversationFeedbackOptions, bQ as ListConversationFeedbackResponse, c0 as ListConversationLabelsOptions, c1 as ListConversationLabelsResponse, cj as ListConversationMessagesIncludeOptions, ck as ListConversationMessagesOptions, cl as ListConversationMessagesResponse, cN as ListConversationNotesOptions, cO as ListConversationNotesResponse, bx as ListConversationOptions, bw as ListConversationsFilterOptions, bv as ListConversationsIncludeOptions, by as ListConversationsResponse, aS as ListEscalationsOptions, aT as ListEscalationsResponse, b8 as ListLabelContactsOptions, b9 as ListLabelContactsResponse, bz as ListLabelConversationsOptions, bA as ListLabelConversationsResponse, c2 as ListLabelsIncludeOptions, c3 as ListLabelsOptions, c4 as ListLabelsResponse, cm as ListMessagesIncludeOptions, cn as ListMessagesOptions, co as ListMessagesResponse, cC as ListModelsOptions, cD as ListModelsResponse, cW as ListSourcesOptions, cX as ListSourcesResponse, d4 as ListUploadsOptions, d5 as ListUploadsResponse, dv as ListWebhookSubscriptionsOptions, dw as ListWebhookSubscriptionsResponse, c8 as Message, cs as MessageEventType, cp as MessageID, cq as MessageRole, cr as MessageStatus, di as MessageWebhookEventType, ak as MetaWhatsappChannelGetBusinessProfileOptions, al as MetaWhatsappChannelGetBusinessProfileResponse, ct as Model, cE as ModelID, cF as Note, cP as NoteID, O as Options, R as RequestFilterable, S as SortOptions, cT as Source, cY as SourceID, dx as TestWebhookSubscriptionOptions, dy as TestWebhookSubscriptionResponse, a as TransportOptions, am as TwilioSendChannelSyncPayload, an as TwilioSendgridChannelSyncOptions, ao as TwilioSendgridChannelSyncResponse, x as UpdateAccountConversationSettingsOptions, w as UpdateAccountConversationSettingsPayload, y as UpdateAccountConversationSettingsResponse, h as UpdateAccountOptions, U as UpdateAccountPayload, i as UpdateAccountResponse, a9 as UpdateBoilerplateCategoryOptions, a8 as UpdateBoilerplateCategoryPayload, aa as UpdateBoilerplateCategoryResponse, Y as UpdateBoilerplateContentOptions, X as UpdateBoilerplateContentPayload, Z as UpdateBoilerplateContentResponse, aw as UpdateChannelConversationSettingsOptions, av as UpdateChannelConversationSettingsPayload, ax as UpdateChannelConversationSettingsResponse, aq as UpdateChannelOptions, ap as UpdateChannelPayload, ar as UpdateChannelResponse, aK as UpdateCompositionSectionOptions, aJ as UpdateCompositionSectionPayload, aL as UpdateCompositionSectionResponse, bb as UpdateContactOptions, ba as UpdateContactPayload, bc as UpdateContactResponse, bC as UpdateConversationOptions, bB as UpdateConversationPayload, bD as UpdateConversationResponse, c6 as UpdateLabelOptions, c5 as UpdateLabelPayload, c7 as UpdateLabelResponse, cR as UpdateNoteOptions, cQ as UpdateNotePayload, cS as UpdateNoteResponse, cZ as Upload, d6 as UploadID, d7 as User, da as UserID, dk as WebhookEventPayload, dd as WebhookEventType, dl as WebhookResponse, dm as WebhookSubscription, dz as WebhookSubscriptionID, dj as WebhookSubscriptionWebhookEventType, C as default, dc as eventWebhookSchema } from './Client-CEPzVrEi.cjs';
1
+ export { A as Account, j as AccountAccessToken, k as AccountAccessTokenID, df as AccountAccessTokenWebhookEventType, t as AccountConversationSettings, c as AccountID, de as AccountWebhookWebhookEventType, z as Action, B as ActionID, bg as ActiveConversationStatus, _ as BoilerplateCategory, $ as BoilerplateCategoryID, H as BoilerplateContent, I as BoilerplateContentID, ab as Channel, as as ChannelConversationSettings, ac as ChannelID, C as Client, ay as CompositionSection, az as CompositionSectionID, bh as ConcludedConversationStatus, aU as Contact, aY as ContactCustomMetadata, aV as ContactID, aX as ContactStatus, aW as ContactType, dg as ContactWebhookEventType, bd as Conversation, bf as ConversationCustomMetadata, bF as ConversationFeedback, be as ConversationID, bE as ConversationSettings, bi as ConversationStatus, dh as ConversationWebhookEventType, m as CreateAccountAccessTokenOptions, l as CreateAccountAccessTokenPayload, n as CreateAccountAccessTokenResponse, e as CreateAccountOptions, d as CreateAccountPayload, f as CreateAccountResponse, a1 as CreateBoilerplateCategoryOptions, a0 as CreateBoilerplateCategoryPayload, a2 as CreateBoilerplateCategoryResponse, K as CreateBoilerplateContentOptions, J as CreateBoilerplateContentPayload, M as CreateBoilerplateContentResponse, ae as CreateChannelOptions, ad as CreateChannelPayload, af as CreateChannelResponse, aB as CreateCompositionSectionOptions, aA as CreateCompositionSectionPayload, aC as CreateCompositionSectionResponse, a_ as CreateContactOptions, aZ as CreateContactPayload, a$ as CreateContactResponse, bH as CreateConversationFeedbackOptions, bG as CreateConversationFeedbackPayload, bI as CreateConversationFeedbackResponse, bk as CreateConversationOptions, bj as CreateConversationPayload, bl as CreateConversationResponse, cv as CreateCorrectionModelOptions, cu as CreateCorrectionModelPayload, cw as CreateCorrectionResponse, aO as CreateEscalationOptions, aN as CreateEscalationPayload, aP as CreateEscalationResponse, bT as CreateLabelOptions, bS as CreateLabelPayload, bU as CreateLabelResponse, ca as CreateMessageOptions, c9 as CreateMessagePayload, cb as CreateMessageResponse, cH as CreateNoteOptions, cG as CreateNotePayload, cI as CreateNoteResponse, cy as CreateResponseModelOptions, cx as CreateResponseModelPayload, cz as CreateResponseResponse, c_ as CreateUploadOptions, c$ as CreateUploadResponse, dp as CreateWebhookSubscriptionOptions, dn as CreateWebhookSubscriptionPayload, dq as CreateWebhookSubscriptionResponse, b as CurrentAccountID, o as DeleteAccountAccessTokenOptions, D as DeleteAccountAccessTokenPayload, p as DeleteAccountAccessTokenResponse, b0 as DeleteContactOptions, b1 as DeleteContactResponse, bJ as DeleteConversationFeedbackOptions, bK as DeleteConversationFeedbackResponse, bm as DeleteConversationOptions, bn as DeleteConversationResponse, bV as DeleteLabelOptions, bW as DeleteLabelResponse, cc as DeleteMessageOptions, cd as DeleteMessageResponse, d0 as DeleteUploadOptions, d1 as DeleteUploadResponse, dr as DeleteWebhookSubscriptionOptions, ds as DeleteWebhookSubscriptionResponse, aM as Escalation, db as EventWebhookOptions, q as GetAccountAccessTokenOptions, r as GetAccountAccessTokenResponse, u as GetAccountConversationSettingsOptions, v as GetAccountConversationSettingsResponse, G as GetAccountOptions, g as GetAccountResponse, a3 as GetBoilerplateCategoryOptions, a4 as GetBoilerplateCategoryResponse, N as GetBoilerplateContentOptions, P as GetBoilerplateContentResponse, at as GetChannelConversationSettingsOptions, au as GetChannelConversationSettingsResponse, ag as GetChannelOptions, ah as GetChannelResponse, aD as GetCompositionSectionOptions, aE as GetCompositionSectionResponse, b2 as GetContactIncludeOptions, b3 as GetContactOptions, b4 as GetContactResponse, b5 as GetContactVCFOptions, bL as GetConversationFeedbackOptions, bM as GetConversationFeedbackResponse, bo as GetConversationIncludeOptions, bp as GetConversationOptions, bq as GetConversationResponse, aQ as GetEscalationOptions, aR as GetEscalationResponse, bX as GetLabelOptions, bY as GetLabelResponse, ce as GetMessageOptions, cf as GetMessageResponse, cA as GetModelOptions, cB as GetModelResponse, cJ as GetNoteOptions, cK as GetNoteResponse, cU as GetSourceOptions, cV as GetSourceResponse, d2 as GetUploadOptions, d3 as GetUploadResponse, d8 as GetUserOptions, d9 as GetUserResponse, dt as GetWebhookSubscriptionOptions, du as GetWebhookSubscriptionResponse, bR as Label, bZ as LabelID, L as ListAccountAccessTokensOptions, s as ListAccountAccessTokensResponse, E as ListActionsOptions, F as ListActionsResponse, a5 as ListBoilerplateCategoriesIncludeOptions, a6 as ListBoilerplateCategoriesOptions, a7 as ListBoilerplateCategoriesResponse, Q as ListBoilerplateCategoryBoilerplateContentsOptions, T as ListBoilerplateCategoryBoilerplateContentsResponse, V as ListBoilerplateContentsOptions, W as ListBoilerplateContentsResponse, aF as ListChannelCompositionSectionsOptions, aG as ListChannelCompositionSectionsResponse, br as ListChannelConversationsOptions, bs as ListChannelConversationsResponse, cg as ListChannelMessagesIncludeOptions, ch as ListChannelMessagesOptions, ci as ListChannelMessagesResponse, ai as ListChannelsOptions, aj as ListChannelsResponse, aH as ListCompositionSectionsOptions, aI as ListCompositionSectionsResponse, bt as ListContactConversationsOptions, bu as ListContactConversationsResponse, b_ as ListContactLabelsOptions, b$ as ListContactLabelsResponse, cL as ListContactNotesOptions, cM as ListContactNotesResponse, b6 as ListContactsOptions, b7 as ListContactsResponse, bN as ListConversationConversationFeedbackOptions, bO as ListConversationConversationFeedbackResponse, bP as ListConversationFeedbackOptions, bQ as ListConversationFeedbackResponse, c0 as ListConversationLabelsOptions, c1 as ListConversationLabelsResponse, cj as ListConversationMessagesIncludeOptions, ck as ListConversationMessagesOptions, cl as ListConversationMessagesResponse, cN as ListConversationNotesOptions, cO as ListConversationNotesResponse, bx as ListConversationOptions, bw as ListConversationsFilterOptions, bv as ListConversationsIncludeOptions, by as ListConversationsResponse, aS as ListEscalationsOptions, aT as ListEscalationsResponse, b8 as ListLabelContactsOptions, b9 as ListLabelContactsResponse, bz as ListLabelConversationsOptions, bA as ListLabelConversationsResponse, c2 as ListLabelsIncludeOptions, c3 as ListLabelsOptions, c4 as ListLabelsResponse, cm as ListMessagesIncludeOptions, cn as ListMessagesOptions, co as ListMessagesResponse, cC as ListModelsOptions, cD as ListModelsResponse, cW as ListSourcesOptions, cX as ListSourcesResponse, d4 as ListUploadsOptions, d5 as ListUploadsResponse, dv as ListWebhookSubscriptionsOptions, dw as ListWebhookSubscriptionsResponse, c8 as Message, cs as MessageEventType, cp as MessageID, cq as MessageRole, cr as MessageStatus, di as MessageWebhookEventType, ak as MetaWhatsappChannelGetBusinessProfileOptions, al as MetaWhatsappChannelGetBusinessProfileResponse, ct as Model, cE as ModelID, cF as Note, cP as NoteID, O as Options, R as RequestFilterable, S as SortOptions, cT as Source, cY as SourceID, dx as TestWebhookSubscriptionOptions, dy as TestWebhookSubscriptionResponse, a as TransportOptions, am as TwilioSendChannelSyncPayload, an as TwilioSendgridChannelSyncOptions, ao as TwilioSendgridChannelSyncResponse, x as UpdateAccountConversationSettingsOptions, w as UpdateAccountConversationSettingsPayload, y as UpdateAccountConversationSettingsResponse, h as UpdateAccountOptions, U as UpdateAccountPayload, i as UpdateAccountResponse, a9 as UpdateBoilerplateCategoryOptions, a8 as UpdateBoilerplateCategoryPayload, aa as UpdateBoilerplateCategoryResponse, Y as UpdateBoilerplateContentOptions, X as UpdateBoilerplateContentPayload, Z as UpdateBoilerplateContentResponse, aw as UpdateChannelConversationSettingsOptions, av as UpdateChannelConversationSettingsPayload, ax as UpdateChannelConversationSettingsResponse, aq as UpdateChannelOptions, ap as UpdateChannelPayload, ar as UpdateChannelResponse, aK as UpdateCompositionSectionOptions, aJ as UpdateCompositionSectionPayload, aL as UpdateCompositionSectionResponse, bb as UpdateContactOptions, ba as UpdateContactPayload, bc as UpdateContactResponse, bC as UpdateConversationOptions, bB as UpdateConversationPayload, bD as UpdateConversationResponse, c6 as UpdateLabelOptions, c5 as UpdateLabelPayload, c7 as UpdateLabelResponse, cR as UpdateNoteOptions, cQ as UpdateNotePayload, cS as UpdateNoteResponse, cZ as Upload, d6 as UploadID, d7 as User, da as UserID, dk as WebhookEventPayload, dd as WebhookEventType, dl as WebhookResponse, dm as WebhookSubscription, dz as WebhookSubscriptionID, dj as WebhookSubscriptionWebhookEventType, C as default, dc as eventWebhookSchema } from './Client-CZh_BK9W.cjs';
2
2
  import { KyResponse } from 'ky';
3
3
  import 'zod';
4
4
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as Account, j as AccountAccessToken, k as AccountAccessTokenID, df as AccountAccessTokenWebhookEventType, t as AccountConversationSettings, c as AccountID, de as AccountWebhookWebhookEventType, z as Action, B as ActionID, bg as ActiveConversationStatus, _ as BoilerplateCategory, $ as BoilerplateCategoryID, H as BoilerplateContent, I as BoilerplateContentID, ab as Channel, as as ChannelConversationSettings, ac as ChannelID, C as Client, ay as CompositionSection, az as CompositionSectionID, bh as ConcludedConversationStatus, aU as Contact, aX as ContactCustomMetadata, aV as ContactID, aW as ContactType, dg as ContactWebhookEventType, bd as Conversation, bf as ConversationCustomMetadata, bF as ConversationFeedback, be as ConversationID, bE as ConversationSettings, bi as ConversationStatus, dh as ConversationWebhookEventType, m as CreateAccountAccessTokenOptions, l as CreateAccountAccessTokenPayload, n as CreateAccountAccessTokenResponse, e as CreateAccountOptions, d as CreateAccountPayload, f as CreateAccountResponse, a1 as CreateBoilerplateCategoryOptions, a0 as CreateBoilerplateCategoryPayload, a2 as CreateBoilerplateCategoryResponse, K as CreateBoilerplateContentOptions, J as CreateBoilerplateContentPayload, M as CreateBoilerplateContentResponse, ae as CreateChannelOptions, ad as CreateChannelPayload, af as CreateChannelResponse, aB as CreateCompositionSectionOptions, aA as CreateCompositionSectionPayload, aC as CreateCompositionSectionResponse, aZ as CreateContactOptions, aY as CreateContactPayload, a_ as CreateContactResponse, bH as CreateConversationFeedbackOptions, bG as CreateConversationFeedbackPayload, bI as CreateConversationFeedbackResponse, bk as CreateConversationOptions, bj as CreateConversationPayload, bl as CreateConversationResponse, cv as CreateCorrectionModelOptions, cu as CreateCorrectionModelPayload, cw as CreateCorrectionResponse, aO as CreateEscalationOptions, aN as CreateEscalationPayload, aP as CreateEscalationResponse, bT as CreateLabelOptions, bS as CreateLabelPayload, bU as CreateLabelResponse, ca as CreateMessageOptions, c9 as CreateMessagePayload, cb as CreateMessageResponse, cH as CreateNoteOptions, cG as CreateNotePayload, cI as CreateNoteResponse, cy as CreateResponseModelOptions, cx as CreateResponseModelPayload, cz as CreateResponseResponse, c_ as CreateUploadOptions, c$ as CreateUploadResponse, dp as CreateWebhookSubscriptionOptions, dn as CreateWebhookSubscriptionPayload, dq as CreateWebhookSubscriptionResponse, b as CurrentAccountID, o as DeleteAccountAccessTokenOptions, D as DeleteAccountAccessTokenPayload, p as DeleteAccountAccessTokenResponse, a$ as DeleteContactOptions, b0 as DeleteContactResponse, bJ as DeleteConversationFeedbackOptions, bK as DeleteConversationFeedbackResponse, bm as DeleteConversationOptions, bn as DeleteConversationResponse, bV as DeleteLabelOptions, bW as DeleteLabelResponse, cc as DeleteMessageOptions, cd as DeleteMessageResponse, d0 as DeleteUploadOptions, d1 as DeleteUploadResponse, dr as DeleteWebhookSubscriptionOptions, ds as DeleteWebhookSubscriptionResponse, aM as Escalation, db as EventWebhookOptions, q as GetAccountAccessTokenOptions, r as GetAccountAccessTokenResponse, u as GetAccountConversationSettingsOptions, v as GetAccountConversationSettingsResponse, G as GetAccountOptions, g as GetAccountResponse, a3 as GetBoilerplateCategoryOptions, a4 as GetBoilerplateCategoryResponse, N as GetBoilerplateContentOptions, P as GetBoilerplateContentResponse, at as GetChannelConversationSettingsOptions, au as GetChannelConversationSettingsResponse, ag as GetChannelOptions, ah as GetChannelResponse, aD as GetCompositionSectionOptions, aE as GetCompositionSectionResponse, b1 as GetContactIncludeOptions, b2 as GetContactOptions, b3 as GetContactResponse, b4 as GetContactVCFOptions, bL as GetConversationFeedbackOptions, bM as GetConversationFeedbackResponse, bo as GetConversationIncludeOptions, bp as GetConversationOptions, bq as GetConversationResponse, aQ as GetEscalationOptions, aR as GetEscalationResponse, bX as GetLabelOptions, bY as GetLabelResponse, ce as GetMessageOptions, cf as GetMessageResponse, cA as GetModelOptions, cB as GetModelResponse, cJ as GetNoteOptions, cK as GetNoteResponse, cU as GetSourceOptions, cV as GetSourceResponse, d2 as GetUploadOptions, d3 as GetUploadResponse, d8 as GetUserOptions, d9 as GetUserResponse, dt as GetWebhookSubscriptionOptions, du as GetWebhookSubscriptionResponse, bR as Label, bZ as LabelID, L as ListAccountAccessTokensOptions, s as ListAccountAccessTokensResponse, E as ListActionsOptions, F as ListActionsResponse, a5 as ListBoilerplateCategoriesIncludeOptions, a6 as ListBoilerplateCategoriesOptions, a7 as ListBoilerplateCategoriesResponse, Q as ListBoilerplateCategoryBoilerplateContentsOptions, T as ListBoilerplateCategoryBoilerplateContentsResponse, V as ListBoilerplateContentsOptions, W as ListBoilerplateContentsResponse, aF as ListChannelCompositionSectionsOptions, aG as ListChannelCompositionSectionsResponse, br as ListChannelConversationsOptions, bs as ListChannelConversationsResponse, cg as ListChannelMessagesIncludeOptions, ch as ListChannelMessagesOptions, ci as ListChannelMessagesResponse, ai as ListChannelsOptions, aj as ListChannelsResponse, aH as ListCompositionSectionsOptions, aI as ListCompositionSectionsResponse, bt as ListContactConversationsOptions, bu as ListContactConversationsResponse, b_ as ListContactLabelsOptions, b$ as ListContactLabelsResponse, cL as ListContactNotesOptions, cM as ListContactNotesResponse, b5 as ListContactsFilterOptions, b6 as ListContactsOptions, b7 as ListContactsResponse, bN as ListConversationConversationFeedbackOptions, bO as ListConversationConversationFeedbackResponse, bP as ListConversationFeedbackOptions, bQ as ListConversationFeedbackResponse, c0 as ListConversationLabelsOptions, c1 as ListConversationLabelsResponse, cj as ListConversationMessagesIncludeOptions, ck as ListConversationMessagesOptions, cl as ListConversationMessagesResponse, cN as ListConversationNotesOptions, cO as ListConversationNotesResponse, bx as ListConversationOptions, bw as ListConversationsFilterOptions, bv as ListConversationsIncludeOptions, by as ListConversationsResponse, aS as ListEscalationsOptions, aT as ListEscalationsResponse, b8 as ListLabelContactsOptions, b9 as ListLabelContactsResponse, bz as ListLabelConversationsOptions, bA as ListLabelConversationsResponse, c2 as ListLabelsIncludeOptions, c3 as ListLabelsOptions, c4 as ListLabelsResponse, cm as ListMessagesIncludeOptions, cn as ListMessagesOptions, co as ListMessagesResponse, cC as ListModelsOptions, cD as ListModelsResponse, cW as ListSourcesOptions, cX as ListSourcesResponse, d4 as ListUploadsOptions, d5 as ListUploadsResponse, dv as ListWebhookSubscriptionsOptions, dw as ListWebhookSubscriptionsResponse, c8 as Message, cs as MessageEventType, cp as MessageID, cq as MessageRole, cr as MessageStatus, di as MessageWebhookEventType, ak as MetaWhatsappChannelGetBusinessProfileOptions, al as MetaWhatsappChannelGetBusinessProfileResponse, ct as Model, cE as ModelID, cF as Note, cP as NoteID, O as Options, R as RequestFilterable, S as SortOptions, cT as Source, cY as SourceID, dx as TestWebhookSubscriptionOptions, dy as TestWebhookSubscriptionResponse, a as TransportOptions, am as TwilioSendChannelSyncPayload, an as TwilioSendgridChannelSyncOptions, ao as TwilioSendgridChannelSyncResponse, x as UpdateAccountConversationSettingsOptions, w as UpdateAccountConversationSettingsPayload, y as UpdateAccountConversationSettingsResponse, h as UpdateAccountOptions, U as UpdateAccountPayload, i as UpdateAccountResponse, a9 as UpdateBoilerplateCategoryOptions, a8 as UpdateBoilerplateCategoryPayload, aa as UpdateBoilerplateCategoryResponse, Y as UpdateBoilerplateContentOptions, X as UpdateBoilerplateContentPayload, Z as UpdateBoilerplateContentResponse, aw as UpdateChannelConversationSettingsOptions, av as UpdateChannelConversationSettingsPayload, ax as UpdateChannelConversationSettingsResponse, aq as UpdateChannelOptions, ap as UpdateChannelPayload, ar as UpdateChannelResponse, aK as UpdateCompositionSectionOptions, aJ as UpdateCompositionSectionPayload, aL as UpdateCompositionSectionResponse, bb as UpdateContactOptions, ba as UpdateContactPayload, bc as UpdateContactResponse, bC as UpdateConversationOptions, bB as UpdateConversationPayload, bD as UpdateConversationResponse, c6 as UpdateLabelOptions, c5 as UpdateLabelPayload, c7 as UpdateLabelResponse, cR as UpdateNoteOptions, cQ as UpdateNotePayload, cS as UpdateNoteResponse, cZ as Upload, d6 as UploadID, d7 as User, da as UserID, dk as WebhookEventPayload, dd as WebhookEventType, dl as WebhookResponse, dm as WebhookSubscription, dz as WebhookSubscriptionID, dj as WebhookSubscriptionWebhookEventType, C as default, dc as eventWebhookSchema } from './Client-CEPzVrEi.js';
1
+ export { A as Account, j as AccountAccessToken, k as AccountAccessTokenID, df as AccountAccessTokenWebhookEventType, t as AccountConversationSettings, c as AccountID, de as AccountWebhookWebhookEventType, z as Action, B as ActionID, bg as ActiveConversationStatus, _ as BoilerplateCategory, $ as BoilerplateCategoryID, H as BoilerplateContent, I as BoilerplateContentID, ab as Channel, as as ChannelConversationSettings, ac as ChannelID, C as Client, ay as CompositionSection, az as CompositionSectionID, bh as ConcludedConversationStatus, aU as Contact, aY as ContactCustomMetadata, aV as ContactID, aX as ContactStatus, aW as ContactType, dg as ContactWebhookEventType, bd as Conversation, bf as ConversationCustomMetadata, bF as ConversationFeedback, be as ConversationID, bE as ConversationSettings, bi as ConversationStatus, dh as ConversationWebhookEventType, m as CreateAccountAccessTokenOptions, l as CreateAccountAccessTokenPayload, n as CreateAccountAccessTokenResponse, e as CreateAccountOptions, d as CreateAccountPayload, f as CreateAccountResponse, a1 as CreateBoilerplateCategoryOptions, a0 as CreateBoilerplateCategoryPayload, a2 as CreateBoilerplateCategoryResponse, K as CreateBoilerplateContentOptions, J as CreateBoilerplateContentPayload, M as CreateBoilerplateContentResponse, ae as CreateChannelOptions, ad as CreateChannelPayload, af as CreateChannelResponse, aB as CreateCompositionSectionOptions, aA as CreateCompositionSectionPayload, aC as CreateCompositionSectionResponse, a_ as CreateContactOptions, aZ as CreateContactPayload, a$ as CreateContactResponse, bH as CreateConversationFeedbackOptions, bG as CreateConversationFeedbackPayload, bI as CreateConversationFeedbackResponse, bk as CreateConversationOptions, bj as CreateConversationPayload, bl as CreateConversationResponse, cv as CreateCorrectionModelOptions, cu as CreateCorrectionModelPayload, cw as CreateCorrectionResponse, aO as CreateEscalationOptions, aN as CreateEscalationPayload, aP as CreateEscalationResponse, bT as CreateLabelOptions, bS as CreateLabelPayload, bU as CreateLabelResponse, ca as CreateMessageOptions, c9 as CreateMessagePayload, cb as CreateMessageResponse, cH as CreateNoteOptions, cG as CreateNotePayload, cI as CreateNoteResponse, cy as CreateResponseModelOptions, cx as CreateResponseModelPayload, cz as CreateResponseResponse, c_ as CreateUploadOptions, c$ as CreateUploadResponse, dp as CreateWebhookSubscriptionOptions, dn as CreateWebhookSubscriptionPayload, dq as CreateWebhookSubscriptionResponse, b as CurrentAccountID, o as DeleteAccountAccessTokenOptions, D as DeleteAccountAccessTokenPayload, p as DeleteAccountAccessTokenResponse, b0 as DeleteContactOptions, b1 as DeleteContactResponse, bJ as DeleteConversationFeedbackOptions, bK as DeleteConversationFeedbackResponse, bm as DeleteConversationOptions, bn as DeleteConversationResponse, bV as DeleteLabelOptions, bW as DeleteLabelResponse, cc as DeleteMessageOptions, cd as DeleteMessageResponse, d0 as DeleteUploadOptions, d1 as DeleteUploadResponse, dr as DeleteWebhookSubscriptionOptions, ds as DeleteWebhookSubscriptionResponse, aM as Escalation, db as EventWebhookOptions, q as GetAccountAccessTokenOptions, r as GetAccountAccessTokenResponse, u as GetAccountConversationSettingsOptions, v as GetAccountConversationSettingsResponse, G as GetAccountOptions, g as GetAccountResponse, a3 as GetBoilerplateCategoryOptions, a4 as GetBoilerplateCategoryResponse, N as GetBoilerplateContentOptions, P as GetBoilerplateContentResponse, at as GetChannelConversationSettingsOptions, au as GetChannelConversationSettingsResponse, ag as GetChannelOptions, ah as GetChannelResponse, aD as GetCompositionSectionOptions, aE as GetCompositionSectionResponse, b2 as GetContactIncludeOptions, b3 as GetContactOptions, b4 as GetContactResponse, b5 as GetContactVCFOptions, bL as GetConversationFeedbackOptions, bM as GetConversationFeedbackResponse, bo as GetConversationIncludeOptions, bp as GetConversationOptions, bq as GetConversationResponse, aQ as GetEscalationOptions, aR as GetEscalationResponse, bX as GetLabelOptions, bY as GetLabelResponse, ce as GetMessageOptions, cf as GetMessageResponse, cA as GetModelOptions, cB as GetModelResponse, cJ as GetNoteOptions, cK as GetNoteResponse, cU as GetSourceOptions, cV as GetSourceResponse, d2 as GetUploadOptions, d3 as GetUploadResponse, d8 as GetUserOptions, d9 as GetUserResponse, dt as GetWebhookSubscriptionOptions, du as GetWebhookSubscriptionResponse, bR as Label, bZ as LabelID, L as ListAccountAccessTokensOptions, s as ListAccountAccessTokensResponse, E as ListActionsOptions, F as ListActionsResponse, a5 as ListBoilerplateCategoriesIncludeOptions, a6 as ListBoilerplateCategoriesOptions, a7 as ListBoilerplateCategoriesResponse, Q as ListBoilerplateCategoryBoilerplateContentsOptions, T as ListBoilerplateCategoryBoilerplateContentsResponse, V as ListBoilerplateContentsOptions, W as ListBoilerplateContentsResponse, aF as ListChannelCompositionSectionsOptions, aG as ListChannelCompositionSectionsResponse, br as ListChannelConversationsOptions, bs as ListChannelConversationsResponse, cg as ListChannelMessagesIncludeOptions, ch as ListChannelMessagesOptions, ci as ListChannelMessagesResponse, ai as ListChannelsOptions, aj as ListChannelsResponse, aH as ListCompositionSectionsOptions, aI as ListCompositionSectionsResponse, bt as ListContactConversationsOptions, bu as ListContactConversationsResponse, b_ as ListContactLabelsOptions, b$ as ListContactLabelsResponse, cL as ListContactNotesOptions, cM as ListContactNotesResponse, b6 as ListContactsOptions, b7 as ListContactsResponse, bN as ListConversationConversationFeedbackOptions, bO as ListConversationConversationFeedbackResponse, bP as ListConversationFeedbackOptions, bQ as ListConversationFeedbackResponse, c0 as ListConversationLabelsOptions, c1 as ListConversationLabelsResponse, cj as ListConversationMessagesIncludeOptions, ck as ListConversationMessagesOptions, cl as ListConversationMessagesResponse, cN as ListConversationNotesOptions, cO as ListConversationNotesResponse, bx as ListConversationOptions, bw as ListConversationsFilterOptions, bv as ListConversationsIncludeOptions, by as ListConversationsResponse, aS as ListEscalationsOptions, aT as ListEscalationsResponse, b8 as ListLabelContactsOptions, b9 as ListLabelContactsResponse, bz as ListLabelConversationsOptions, bA as ListLabelConversationsResponse, c2 as ListLabelsIncludeOptions, c3 as ListLabelsOptions, c4 as ListLabelsResponse, cm as ListMessagesIncludeOptions, cn as ListMessagesOptions, co as ListMessagesResponse, cC as ListModelsOptions, cD as ListModelsResponse, cW as ListSourcesOptions, cX as ListSourcesResponse, d4 as ListUploadsOptions, d5 as ListUploadsResponse, dv as ListWebhookSubscriptionsOptions, dw as ListWebhookSubscriptionsResponse, c8 as Message, cs as MessageEventType, cp as MessageID, cq as MessageRole, cr as MessageStatus, di as MessageWebhookEventType, ak as MetaWhatsappChannelGetBusinessProfileOptions, al as MetaWhatsappChannelGetBusinessProfileResponse, ct as Model, cE as ModelID, cF as Note, cP as NoteID, O as Options, R as RequestFilterable, S as SortOptions, cT as Source, cY as SourceID, dx as TestWebhookSubscriptionOptions, dy as TestWebhookSubscriptionResponse, a as TransportOptions, am as TwilioSendChannelSyncPayload, an as TwilioSendgridChannelSyncOptions, ao as TwilioSendgridChannelSyncResponse, x as UpdateAccountConversationSettingsOptions, w as UpdateAccountConversationSettingsPayload, y as UpdateAccountConversationSettingsResponse, h as UpdateAccountOptions, U as UpdateAccountPayload, i as UpdateAccountResponse, a9 as UpdateBoilerplateCategoryOptions, a8 as UpdateBoilerplateCategoryPayload, aa as UpdateBoilerplateCategoryResponse, Y as UpdateBoilerplateContentOptions, X as UpdateBoilerplateContentPayload, Z as UpdateBoilerplateContentResponse, aw as UpdateChannelConversationSettingsOptions, av as UpdateChannelConversationSettingsPayload, ax as UpdateChannelConversationSettingsResponse, aq as UpdateChannelOptions, ap as UpdateChannelPayload, ar as UpdateChannelResponse, aK as UpdateCompositionSectionOptions, aJ as UpdateCompositionSectionPayload, aL as UpdateCompositionSectionResponse, bb as UpdateContactOptions, ba as UpdateContactPayload, bc as UpdateContactResponse, bC as UpdateConversationOptions, bB as UpdateConversationPayload, bD as UpdateConversationResponse, c6 as UpdateLabelOptions, c5 as UpdateLabelPayload, c7 as UpdateLabelResponse, cR as UpdateNoteOptions, cQ as UpdateNotePayload, cS as UpdateNoteResponse, cZ as Upload, d6 as UploadID, d7 as User, da as UserID, dk as WebhookEventPayload, dd as WebhookEventType, dl as WebhookResponse, dm as WebhookSubscription, dz as WebhookSubscriptionID, dj as WebhookSubscriptionWebhookEventType, C as default, dc as eventWebhookSchema } from './Client-CZh_BK9W.js';
2
2
  import { KyResponse } from 'ky';
3
3
  import 'zod';
4
4
 
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{a as e,c as t,d as p,e as f,f as o}from"./chunk-2CFCCPDQ.js";var r={};e(r,{SupportError:()=>p});export{o as Client,t as DEFAULT_SUPPORT_BASE_URL,r as Error,p as SupportError,o as default,f as eventWebhookSchema};
1
+ import{a as e,c as t,d as p,e as f,f as o}from"./chunk-T7UH3U2U.js";var r={};e(r,{SupportError:()=>p});export{o as Client,t as DEFAULT_SUPPORT_BASE_URL,r as Error,p as SupportError,o as default,f as eventWebhookSchema};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@great-detail/support-sdk",
3
- "version": "0.18.12",
3
+ "version": "0.18.14",
4
4
  "type": "module",
5
5
  "description": "JavaScript SDK for the Great Detail Support System",
6
6
  "author": "Great Detail Ltd <info@greatdetail.com>",
@@ -1 +0,0 @@
1
- var K=Object.defineProperty;var $=(n,t)=>{for(var e in t)K(n,e,{get:t[e],enumerable:!0})};var p=class{getHeaders(){return{}}};var x="SUPPORT_ACCESS_TOKEN",W="SUPPORT_KEY_NAME",N="SUPPORT_KEY_PASSWORD",w="SUPPORT_SIGNING_KEY",Q="SUPPORT_BASE_URL";var c=class{name;#t;constructor({name:t=process.env[W],password:e=process.env[N]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var m=class{#t;constructor({token:t=process.env[x]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var j="https://api.support.greatdetail.com",H={"X-Powered-By":"GDSupport/JavaScript"};var B=class extends Error{constructor(e,o){super("Support Error",{cause:o});this.response=e}};import{z as i}from"zod";var V=i.object({data:i.object({event:i.object({id:i.string(),type:i.string(),payload:i.record(i.string()),createdAt:i.string().datetime()})})});var l=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/accounts",{...e,method:"POST",json:t})}};var d=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}delete(t,e,{body:o,request:s={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...s,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var u=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var h=class{constructor(t){this._transport=t}list({limit:t,sort:e,request:o={}}={}){return this._transport.send("v1/actions",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var C=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var f=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByCategory=this.listByBoilerplateCategory;listByBoilerplateCategory(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t)+"/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var R=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/channels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}metaWhatsappGetBusinessProfile(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/meta-whatsapp/business-profile",{...e,method:"GET"})}twilioSendgridChannelSync(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/twilio-sendgrid/sync",{...o,method:"POST",json:e})}};var b=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var v=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var O=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}getRelativeVCFURL(t,{vcf:e={}}={}){let o=e.variant??"vcard",s=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(s)}getVCFURL(t,e={}){return this._transport.getURL(this.getRelativeVCFURL(t,e))}getVCF(t,e={}){return this._transport.send(this.getVCFURL(t,e),{method:"GET"})}list({limit:t,query:e,filter:o,request:s={}}={}){return this._transport.send("v1/contacts",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...o?[["filter",o]]:[]]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var g=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}list({query:t,limit:e,filter:o,include:s,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.limitQuery(e),...o?[["filter",o]]:[],...this._transport.includeQuery(s??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var _=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/feedback/conversation",{...t,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/feedback",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/feedback/conversation",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var I=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/escalations/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/escalations",{...t,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/escalations",{...e,method:"POST",json:t})}};var T=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,include:o,request:s={}}={}){return this._transport.send("v1/labels",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByConversation(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var L=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}listByConversation(t,{limit:e,include:o,request:s={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:s={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o)]})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var A=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}createResponse(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,json:e})}createCorrection(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",json:e})}};var y=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}listByContact(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/notes",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var U=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=H;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var S=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}list({featured:t,category:e,request:o={}}={}){let s=[];if(e){let r=Array.isArray(e)?e:[e];for(let a of r)s.push(["category",a])}return t!==void 0&&s.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:s})}};var E=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};import Y from"is-network-error";import z,{HTTPError as J}from"ky";var D=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=z.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let s of this.options.requestFilterables){let r=s.getHeaders();for(let[a,q]of Object.entries(r))o.headers.has(a)||o.headers.set(a,q)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,s]of Object.entries(t))s!==void 0&&e.push(["sort",s+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let o=this.client(t,e).catch(async s=>{throw Y(s)?new Error("A network error occurred",{cause:s}):s instanceof J?new B(s.response,s):s});return{response:()=>o,json:async()=>(await o).json()}}};var G=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,request:e={}}){let o=new FormData;for(let s of t)o.append("file",s);return this._transport.send("v1/uploads",{...e,method:"POST",body:o})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var k=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var P=class{constructor(t){this._transport=t}async event({key:t=process.env[w],maxSignatures:e=3,request:o}){let s=o.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+w);if(!s)throw new Error("Missing signature header");if(!this._verifySignature(t,o.body,Array.isArray(s)?s.slice(0,e):[s]))throw new Error("Untrusted signature")}let{data:r}=V.parse(o.body);return{event:r.event}}async _verifySignature(t,e,o){let s=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let r of o)if(await crypto.subtle.verify("HMAC",s,new TextEncoder().encode(atob(r)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var F=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/webhooks/subscriptions",{...t,method:"GET"})}test(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t)+"/test",{...e,method:"POST"})}create({body:t,request:e={}}){return this._transport.send("v1/webhooks/subscriptions",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var M=class n{static DEFAULT_BASE_URL=j;static PublicAuthentication=p;static BasicAuthentication=c;static BearerAuthentication=m;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;channelConversationSettings;compositionSection;contact;conversation;conversationFeedback;escalation;label;message;model;note;source;statistics;upload;user;webhook;webhookSubscription;constructor(t,{baseURL:e,...o}={}){this._transport=new D({requestFilterables:[new U,t],...o,baseURL:e?.toString()??n.getBaseURL()}),this.account=new l(this._transport),this.accountAccessToken=new d(this._transport),this.accountConversationSettings=new u(this._transport),this.action=new h(this._transport),this.boilerplateCategory=new C(this._transport),this.boilerplateContent=new f(this._transport),this.channel=new R(this._transport),this.channelConversationSettings=new b(this._transport),this.compositionSection=new v(this._transport),this.contact=new O(this._transport),this.conversation=new g(this._transport),this.conversationFeedback=new _(this._transport),this.escalation=new I(this._transport),this.label=new T(this._transport),this.message=new L(this._transport),this.model=new A(this._transport),this.note=new y(this._transport),this.source=new S(this._transport),this.statistics=new E(this._transport),this.upload=new G(this._transport),this.user=new k(this._transport),this.webhook=new P(this._transport),this.webhookSubscription=new F(this._transport)}static getBaseURL(){return process.env[Q]??this.DEFAULT_BASE_URL}};export{$ as a,p as b,j as c,B as d,V as e,M as f};