@great-detail/support-sdk 0.18.21 → 0.18.23

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.
@@ -516,11 +516,13 @@ type MessageID = `msg${string}` | (string & NonNullable<unknown>);
516
516
  type MessageRole = "user" | "assistant";
517
517
  type MessageType = "text" | "media" | "richtext";
518
518
  type MessageStatus = "PotentialMessageStatus" | "SendingMessageStatus" | "SentMessageStatus" | "ReceivedMessageStatus" | "FailedMessageStatus";
519
+ type MessageVisibility = "visible" | "private";
519
520
  type MessageEventType = "ReadMessageEventType" | "ReceivedMessageEventType" | "SentMessageEventType";
520
521
  type Message = {
521
522
  id: MessageID;
522
523
  role: MessageRole;
523
524
  status: MessageStatus;
525
+ visibility: MessageVisibility;
524
526
  externalIdentifier?: Nullable<string>;
525
527
  conversation: ConversationID;
526
528
  account: AccountID;
@@ -2336,6 +2338,7 @@ interface ListChannelMessagesIncludeOptions {
2336
2338
  interface ListChannelMessagesOptions<C extends ListChannelMessagesIncludeOptions> {
2337
2339
  limit?: number;
2338
2340
  type?: MessageType;
2341
+ visibility?: MessageVisibility;
2339
2342
  include?: C;
2340
2343
  request?: SendOptions;
2341
2344
  }
@@ -2364,6 +2367,7 @@ interface ListConversationMessagesIncludeOptions {
2364
2367
  interface ListConversationMessagesOptions<C extends ListConversationMessagesIncludeOptions> {
2365
2368
  limit?: number;
2366
2369
  type?: MessageType;
2370
+ visibility?: MessageVisibility;
2367
2371
  include?: C;
2368
2372
  request?: SendOptions;
2369
2373
  }
@@ -2392,6 +2396,7 @@ interface ListMessagesIncludeOptions {
2392
2396
  interface ListMessagesOptions<C extends ListMessagesIncludeOptions> {
2393
2397
  limit?: number;
2394
2398
  type?: MessageType;
2399
+ visibility?: MessageVisibility;
2395
2400
  include?: C;
2396
2401
  request?: SendOptions;
2397
2402
  }
@@ -2411,15 +2416,15 @@ declare class MessageAPI {
2411
2416
  response: () => Promise<ky.KyResponse<GetMessageResponse>>;
2412
2417
  json: () => Promise<GetMessageResponse>;
2413
2418
  };
2414
- list<C extends ListMessagesIncludeOptions>({ limit, include, type, request, }?: ListMessagesOptions<C>): {
2419
+ list<C extends ListMessagesIncludeOptions>({ limit, include, type, visibility, request, }?: ListMessagesOptions<C>): {
2415
2420
  response: () => Promise<ky.KyResponse<ListMessagesResponse<C>>>;
2416
2421
  json: () => Promise<ListMessagesResponse<C>>;
2417
2422
  };
2418
- listByConversation<C extends ListConversationMessagesIncludeOptions>(id: ConversationID, { limit, include, type, request, }?: ListConversationMessagesOptions<C>): {
2423
+ listByConversation<C extends ListConversationMessagesIncludeOptions>(id: ConversationID, { limit, include, type, visibility, request, }?: ListConversationMessagesOptions<C>): {
2419
2424
  response: () => Promise<ky.KyResponse<ListConversationMessagesResponse<C>>>;
2420
2425
  json: () => Promise<ListConversationMessagesResponse<C>>;
2421
2426
  };
2422
- listByChannel<C extends ListChannelMessagesIncludeOptions>(id: ChannelID, { limit, include, type, request }?: ListChannelMessagesOptions<C>): {
2427
+ listByChannel<C extends ListChannelMessagesIncludeOptions>(id: ChannelID, { limit, include, type, visibility, request, }?: ListChannelMessagesOptions<C>): {
2423
2428
  response: () => Promise<ky.KyResponse<ListChannelMessagesResponse<C>>>;
2424
2429
  json: () => Promise<ListChannelMessagesResponse<C>>;
2425
2430
  };
@@ -3479,4 +3484,4 @@ declare class Client {
3479
3484
  static getBaseURL(): string;
3480
3485
  }
3481
3486
 
3482
- 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 CreateContactPayload 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 ListConversationEscalationsOptions as aS, type ListConversationEscalationsResponse as aT, type ListEscalationsOptions as aU, type ListEscalationsResponse as aV, type Contact as aW, type ContactID as aX, type ContactType as aY, type ContactStatus as aZ, type ContactCustomMetadata 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 LabelID as b$, type CreateContactOptions as b0, type CreateContactResponse as b1, type DeleteContactOptions as b2, type DeleteContactResponse as b3, type GetContactIncludeOptions as b4, type GetContactOptions as b5, type GetContactResponse as b6, type GetContactVCFOptions as b7, type ListContactsOptions as b8, type ListContactsResponse as b9, type ListConversationsResponse as bA, type ListLabelConversationsOptions as bB, type ListLabelConversationsResponse as bC, type UpdateConversationPayload as bD, type UpdateConversationOptions as bE, type UpdateConversationResponse as bF, type ConversationSettings as bG, type ConversationFeedback as bH, type CreateConversationFeedbackPayload as bI, type CreateConversationFeedbackOptions as bJ, type CreateConversationFeedbackResponse as bK, type DeleteConversationFeedbackOptions as bL, type DeleteConversationFeedbackResponse as bM, type GetConversationFeedbackOptions as bN, type GetConversationFeedbackResponse as bO, type ListConversationConversationFeedbackOptions as bP, type ListConversationConversationFeedbackResponse as bQ, type ListConversationFeedbackOptions as bR, type ListConversationFeedbackResponse as bS, type Label as bT, type CreateLabelPayload as bU, type CreateLabelOptions as bV, type CreateLabelResponse as bW, type DeleteLabelOptions as bX, type DeleteLabelResponse as bY, type GetLabelOptions as bZ, type GetLabelResponse as b_, type ListLabelContactsOptions as ba, type ListLabelContactsResponse as bb, type UpdateContactPayload as bc, type UpdateContactOptions as bd, type UpdateContactResponse as be, type Conversation as bf, type ConversationID as bg, type ConversationCustomMetadata as bh, type ActiveConversationStatus as bi, type ConcludedConversationStatus as bj, type ConversationStatus as bk, type CreateConversationPayload as bl, type CreateConversationOptions as bm, type CreateConversationResponse as bn, type DeleteConversationOptions as bo, type DeleteConversationResponse as bp, type GetConversationIncludeOptions as bq, type GetConversationOptions as br, type GetConversationResponse as bs, type ListChannelConversationsOptions as bt, type ListChannelConversationsResponse as bu, type ListContactConversationsOptions as bv, type ListContactConversationsResponse as bw, type ListConversationsIncludeOptions as bx, type ListConversationsFilterOptions as by, type ListConversationOptions as bz, type AccountID as c, type SourceID as c$, type ListContactLabelsOptions as c0, type ListContactLabelsResponse as c1, type ListConversationLabelsOptions as c2, type ListConversationLabelsResponse as c3, type ListLabelsIncludeOptions as c4, type ListLabelsOptions as c5, type ListLabelsResponse as c6, type UpdateLabelPayload as c7, type UpdateLabelOptions as c8, type UpdateLabelResponse as c9, type CreateResponseModelPayload as cA, type CreateResponseModelOptions as cB, type CreateResponseResponse as cC, type GetModelOptions as cD, type GetModelResponse as cE, type ListModelsOptions as cF, type ListModelsResponse as cG, type ModelID as cH, type Note as cI, type CreateNotePayload as cJ, type CreateNoteOptions as cK, type CreateNoteResponse as cL, type GetNoteOptions as cM, type GetNoteResponse as cN, type ListContactNotesOptions as cO, type ListContactNotesResponse as cP, type ListConversationNotesOptions as cQ, type ListConversationNotesResponse as cR, type NoteID as cS, type UpdateNotePayload as cT, type UpdateNoteOptions as cU, type UpdateNoteResponse as cV, type Source as cW, type GetSourceOptions as cX, type GetSourceResponse as cY, type ListSourcesOptions as cZ, type ListSourcesResponse as c_, type Message as ca, type CreateMessagePayload as cb, type CreateMessageOptions as cc, type CreateMessageResponse as cd, type DeleteMessageOptions as ce, type DeleteMessageResponse as cf, type GetMessageOptions as cg, type GetMessageResponse as ch, type ListChannelMessagesIncludeOptions as ci, type ListChannelMessagesOptions as cj, type ListChannelMessagesResponse as ck, type ListConversationMessagesIncludeOptions as cl, type ListConversationMessagesOptions as cm, type ListConversationMessagesResponse as cn, type ListMessagesIncludeOptions as co, type ListMessagesOptions as cp, type ListMessagesResponse as cq, type MessageID as cr, type MessageRole as cs, type MessageType as ct, type MessageStatus as cu, type MessageEventType as cv, type Model as cw, type CreateCorrectionModelPayload as cx, type CreateCorrectionModelOptions as cy, type CreateCorrectionResponse as cz, type CreateAccountPayload as d, type Upload as d0, type CreateUploadIncludeOptions as d1, type CreateUploadOptions as d2, type CreateUploadResponse as d3, type DeleteUploadOptions as d4, type DeleteUploadResponse as d5, type GetUploadOptions as d6, type GetUploadResponse as d7, type ListUploadsOptions as d8, type ListUploadsResponse as d9, type ListWebhookSubscriptionsResponse as dA, type TestWebhookSubscriptionOptions as dB, type TestWebhookSubscriptionResponse as dC, type WebhookSubscriptionID as dD, type UploadID as da, type User as db, type GetUserOptions as dc, type GetUserResponse as dd, type UserID as de, type EventWebhookOptions as df, eventWebhookSchema as dg, type WebhookEventType as dh, type AccountWebhookWebhookEventType as di, type AccountAccessTokenWebhookEventType as dj, type ContactWebhookEventType as dk, type ConversationWebhookEventType as dl, type MessageWebhookEventType as dm, type WebhookSubscriptionWebhookEventType as dn, type WebhookEventPayload as dp, type WebhookResponse as dq, type WebhookSubscription as dr, type CreateWebhookSubscriptionPayload as ds, type CreateWebhookSubscriptionOptions as dt, type CreateWebhookSubscriptionResponse as du, type DeleteWebhookSubscriptionOptions as dv, type DeleteWebhookSubscriptionResponse as dw, type GetWebhookSubscriptionOptions as dx, type GetWebhookSubscriptionResponse as dy, type ListWebhookSubscriptionsOptions 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 };
3487
+ 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 CreateContactPayload 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 ListConversationEscalationsOptions as aS, type ListConversationEscalationsResponse as aT, type ListEscalationsOptions as aU, type ListEscalationsResponse as aV, type Contact as aW, type ContactID as aX, type ContactType as aY, type ContactStatus as aZ, type ContactCustomMetadata 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 LabelID as b$, type CreateContactOptions as b0, type CreateContactResponse as b1, type DeleteContactOptions as b2, type DeleteContactResponse as b3, type GetContactIncludeOptions as b4, type GetContactOptions as b5, type GetContactResponse as b6, type GetContactVCFOptions as b7, type ListContactsOptions as b8, type ListContactsResponse as b9, type ListConversationsResponse as bA, type ListLabelConversationsOptions as bB, type ListLabelConversationsResponse as bC, type UpdateConversationPayload as bD, type UpdateConversationOptions as bE, type UpdateConversationResponse as bF, type ConversationSettings as bG, type ConversationFeedback as bH, type CreateConversationFeedbackPayload as bI, type CreateConversationFeedbackOptions as bJ, type CreateConversationFeedbackResponse as bK, type DeleteConversationFeedbackOptions as bL, type DeleteConversationFeedbackResponse as bM, type GetConversationFeedbackOptions as bN, type GetConversationFeedbackResponse as bO, type ListConversationConversationFeedbackOptions as bP, type ListConversationConversationFeedbackResponse as bQ, type ListConversationFeedbackOptions as bR, type ListConversationFeedbackResponse as bS, type Label as bT, type CreateLabelPayload as bU, type CreateLabelOptions as bV, type CreateLabelResponse as bW, type DeleteLabelOptions as bX, type DeleteLabelResponse as bY, type GetLabelOptions as bZ, type GetLabelResponse as b_, type ListLabelContactsOptions as ba, type ListLabelContactsResponse as bb, type UpdateContactPayload as bc, type UpdateContactOptions as bd, type UpdateContactResponse as be, type Conversation as bf, type ConversationID as bg, type ConversationCustomMetadata as bh, type ActiveConversationStatus as bi, type ConcludedConversationStatus as bj, type ConversationStatus as bk, type CreateConversationPayload as bl, type CreateConversationOptions as bm, type CreateConversationResponse as bn, type DeleteConversationOptions as bo, type DeleteConversationResponse as bp, type GetConversationIncludeOptions as bq, type GetConversationOptions as br, type GetConversationResponse as bs, type ListChannelConversationsOptions as bt, type ListChannelConversationsResponse as bu, type ListContactConversationsOptions as bv, type ListContactConversationsResponse as bw, type ListConversationsIncludeOptions as bx, type ListConversationsFilterOptions as by, type ListConversationOptions as bz, type AccountID as c, type ListSourcesResponse as c$, type ListContactLabelsOptions as c0, type ListContactLabelsResponse as c1, type ListConversationLabelsOptions as c2, type ListConversationLabelsResponse as c3, type ListLabelsIncludeOptions as c4, type ListLabelsOptions as c5, type ListLabelsResponse as c6, type UpdateLabelPayload as c7, type UpdateLabelOptions as c8, type UpdateLabelResponse as c9, type CreateCorrectionResponse as cA, type CreateResponseModelPayload as cB, type CreateResponseModelOptions as cC, type CreateResponseResponse as cD, type GetModelOptions as cE, type GetModelResponse as cF, type ListModelsOptions as cG, type ListModelsResponse as cH, type ModelID as cI, type Note as cJ, type CreateNotePayload as cK, type CreateNoteOptions as cL, type CreateNoteResponse as cM, type GetNoteOptions as cN, type GetNoteResponse as cO, type ListContactNotesOptions as cP, type ListContactNotesResponse as cQ, type ListConversationNotesOptions as cR, type ListConversationNotesResponse as cS, type NoteID as cT, type UpdateNotePayload as cU, type UpdateNoteOptions as cV, type UpdateNoteResponse as cW, type Source as cX, type GetSourceOptions as cY, type GetSourceResponse as cZ, type ListSourcesOptions as c_, type Message as ca, type CreateMessagePayload as cb, type CreateMessageOptions as cc, type CreateMessageResponse as cd, type DeleteMessageOptions as ce, type DeleteMessageResponse as cf, type GetMessageOptions as cg, type GetMessageResponse as ch, type ListChannelMessagesIncludeOptions as ci, type ListChannelMessagesOptions as cj, type ListChannelMessagesResponse as ck, type ListConversationMessagesIncludeOptions as cl, type ListConversationMessagesOptions as cm, type ListConversationMessagesResponse as cn, type ListMessagesIncludeOptions as co, type ListMessagesOptions as cp, type ListMessagesResponse as cq, type MessageID as cr, type MessageRole as cs, type MessageType as ct, type MessageStatus as cu, type MessageVisibility as cv, type MessageEventType as cw, type Model as cx, type CreateCorrectionModelPayload as cy, type CreateCorrectionModelOptions as cz, type CreateAccountPayload as d, type SourceID as d0, type Upload as d1, type CreateUploadIncludeOptions as d2, type CreateUploadOptions as d3, type CreateUploadResponse as d4, type DeleteUploadOptions as d5, type DeleteUploadResponse as d6, type GetUploadOptions as d7, type GetUploadResponse as d8, type ListUploadsOptions as d9, type ListWebhookSubscriptionsOptions as dA, type ListWebhookSubscriptionsResponse as dB, type TestWebhookSubscriptionOptions as dC, type TestWebhookSubscriptionResponse as dD, type WebhookSubscriptionID as dE, type ListUploadsResponse as da, type UploadID as db, type User as dc, type GetUserOptions as dd, type GetUserResponse as de, type UserID as df, type EventWebhookOptions as dg, eventWebhookSchema as dh, type WebhookEventType as di, type AccountWebhookWebhookEventType as dj, type AccountAccessTokenWebhookEventType as dk, type ContactWebhookEventType as dl, type ConversationWebhookEventType as dm, type MessageWebhookEventType as dn, type WebhookSubscriptionWebhookEventType as dp, type WebhookEventPayload as dq, type WebhookResponse as dr, type WebhookSubscription as ds, type CreateWebhookSubscriptionPayload as dt, type CreateWebhookSubscriptionOptions as du, type CreateWebhookSubscriptionResponse as dv, type DeleteWebhookSubscriptionOptions as dw, type DeleteWebhookSubscriptionResponse as dx, type GetWebhookSubscriptionOptions as dy, type GetWebhookSubscriptionResponse 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 };
@@ -516,11 +516,13 @@ type MessageID = `msg${string}` | (string & NonNullable<unknown>);
516
516
  type MessageRole = "user" | "assistant";
517
517
  type MessageType = "text" | "media" | "richtext";
518
518
  type MessageStatus = "PotentialMessageStatus" | "SendingMessageStatus" | "SentMessageStatus" | "ReceivedMessageStatus" | "FailedMessageStatus";
519
+ type MessageVisibility = "visible" | "private";
519
520
  type MessageEventType = "ReadMessageEventType" | "ReceivedMessageEventType" | "SentMessageEventType";
520
521
  type Message = {
521
522
  id: MessageID;
522
523
  role: MessageRole;
523
524
  status: MessageStatus;
525
+ visibility: MessageVisibility;
524
526
  externalIdentifier?: Nullable<string>;
525
527
  conversation: ConversationID;
526
528
  account: AccountID;
@@ -2336,6 +2338,7 @@ interface ListChannelMessagesIncludeOptions {
2336
2338
  interface ListChannelMessagesOptions<C extends ListChannelMessagesIncludeOptions> {
2337
2339
  limit?: number;
2338
2340
  type?: MessageType;
2341
+ visibility?: MessageVisibility;
2339
2342
  include?: C;
2340
2343
  request?: SendOptions;
2341
2344
  }
@@ -2364,6 +2367,7 @@ interface ListConversationMessagesIncludeOptions {
2364
2367
  interface ListConversationMessagesOptions<C extends ListConversationMessagesIncludeOptions> {
2365
2368
  limit?: number;
2366
2369
  type?: MessageType;
2370
+ visibility?: MessageVisibility;
2367
2371
  include?: C;
2368
2372
  request?: SendOptions;
2369
2373
  }
@@ -2392,6 +2396,7 @@ interface ListMessagesIncludeOptions {
2392
2396
  interface ListMessagesOptions<C extends ListMessagesIncludeOptions> {
2393
2397
  limit?: number;
2394
2398
  type?: MessageType;
2399
+ visibility?: MessageVisibility;
2395
2400
  include?: C;
2396
2401
  request?: SendOptions;
2397
2402
  }
@@ -2411,15 +2416,15 @@ declare class MessageAPI {
2411
2416
  response: () => Promise<ky.KyResponse<GetMessageResponse>>;
2412
2417
  json: () => Promise<GetMessageResponse>;
2413
2418
  };
2414
- list<C extends ListMessagesIncludeOptions>({ limit, include, type, request, }?: ListMessagesOptions<C>): {
2419
+ list<C extends ListMessagesIncludeOptions>({ limit, include, type, visibility, request, }?: ListMessagesOptions<C>): {
2415
2420
  response: () => Promise<ky.KyResponse<ListMessagesResponse<C>>>;
2416
2421
  json: () => Promise<ListMessagesResponse<C>>;
2417
2422
  };
2418
- listByConversation<C extends ListConversationMessagesIncludeOptions>(id: ConversationID, { limit, include, type, request, }?: ListConversationMessagesOptions<C>): {
2423
+ listByConversation<C extends ListConversationMessagesIncludeOptions>(id: ConversationID, { limit, include, type, visibility, request, }?: ListConversationMessagesOptions<C>): {
2419
2424
  response: () => Promise<ky.KyResponse<ListConversationMessagesResponse<C>>>;
2420
2425
  json: () => Promise<ListConversationMessagesResponse<C>>;
2421
2426
  };
2422
- listByChannel<C extends ListChannelMessagesIncludeOptions>(id: ChannelID, { limit, include, type, request }?: ListChannelMessagesOptions<C>): {
2427
+ listByChannel<C extends ListChannelMessagesIncludeOptions>(id: ChannelID, { limit, include, type, visibility, request, }?: ListChannelMessagesOptions<C>): {
2423
2428
  response: () => Promise<ky.KyResponse<ListChannelMessagesResponse<C>>>;
2424
2429
  json: () => Promise<ListChannelMessagesResponse<C>>;
2425
2430
  };
@@ -3479,4 +3484,4 @@ declare class Client {
3479
3484
  static getBaseURL(): string;
3480
3485
  }
3481
3486
 
3482
- 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 CreateContactPayload 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 ListConversationEscalationsOptions as aS, type ListConversationEscalationsResponse as aT, type ListEscalationsOptions as aU, type ListEscalationsResponse as aV, type Contact as aW, type ContactID as aX, type ContactType as aY, type ContactStatus as aZ, type ContactCustomMetadata 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 LabelID as b$, type CreateContactOptions as b0, type CreateContactResponse as b1, type DeleteContactOptions as b2, type DeleteContactResponse as b3, type GetContactIncludeOptions as b4, type GetContactOptions as b5, type GetContactResponse as b6, type GetContactVCFOptions as b7, type ListContactsOptions as b8, type ListContactsResponse as b9, type ListConversationsResponse as bA, type ListLabelConversationsOptions as bB, type ListLabelConversationsResponse as bC, type UpdateConversationPayload as bD, type UpdateConversationOptions as bE, type UpdateConversationResponse as bF, type ConversationSettings as bG, type ConversationFeedback as bH, type CreateConversationFeedbackPayload as bI, type CreateConversationFeedbackOptions as bJ, type CreateConversationFeedbackResponse as bK, type DeleteConversationFeedbackOptions as bL, type DeleteConversationFeedbackResponse as bM, type GetConversationFeedbackOptions as bN, type GetConversationFeedbackResponse as bO, type ListConversationConversationFeedbackOptions as bP, type ListConversationConversationFeedbackResponse as bQ, type ListConversationFeedbackOptions as bR, type ListConversationFeedbackResponse as bS, type Label as bT, type CreateLabelPayload as bU, type CreateLabelOptions as bV, type CreateLabelResponse as bW, type DeleteLabelOptions as bX, type DeleteLabelResponse as bY, type GetLabelOptions as bZ, type GetLabelResponse as b_, type ListLabelContactsOptions as ba, type ListLabelContactsResponse as bb, type UpdateContactPayload as bc, type UpdateContactOptions as bd, type UpdateContactResponse as be, type Conversation as bf, type ConversationID as bg, type ConversationCustomMetadata as bh, type ActiveConversationStatus as bi, type ConcludedConversationStatus as bj, type ConversationStatus as bk, type CreateConversationPayload as bl, type CreateConversationOptions as bm, type CreateConversationResponse as bn, type DeleteConversationOptions as bo, type DeleteConversationResponse as bp, type GetConversationIncludeOptions as bq, type GetConversationOptions as br, type GetConversationResponse as bs, type ListChannelConversationsOptions as bt, type ListChannelConversationsResponse as bu, type ListContactConversationsOptions as bv, type ListContactConversationsResponse as bw, type ListConversationsIncludeOptions as bx, type ListConversationsFilterOptions as by, type ListConversationOptions as bz, type AccountID as c, type SourceID as c$, type ListContactLabelsOptions as c0, type ListContactLabelsResponse as c1, type ListConversationLabelsOptions as c2, type ListConversationLabelsResponse as c3, type ListLabelsIncludeOptions as c4, type ListLabelsOptions as c5, type ListLabelsResponse as c6, type UpdateLabelPayload as c7, type UpdateLabelOptions as c8, type UpdateLabelResponse as c9, type CreateResponseModelPayload as cA, type CreateResponseModelOptions as cB, type CreateResponseResponse as cC, type GetModelOptions as cD, type GetModelResponse as cE, type ListModelsOptions as cF, type ListModelsResponse as cG, type ModelID as cH, type Note as cI, type CreateNotePayload as cJ, type CreateNoteOptions as cK, type CreateNoteResponse as cL, type GetNoteOptions as cM, type GetNoteResponse as cN, type ListContactNotesOptions as cO, type ListContactNotesResponse as cP, type ListConversationNotesOptions as cQ, type ListConversationNotesResponse as cR, type NoteID as cS, type UpdateNotePayload as cT, type UpdateNoteOptions as cU, type UpdateNoteResponse as cV, type Source as cW, type GetSourceOptions as cX, type GetSourceResponse as cY, type ListSourcesOptions as cZ, type ListSourcesResponse as c_, type Message as ca, type CreateMessagePayload as cb, type CreateMessageOptions as cc, type CreateMessageResponse as cd, type DeleteMessageOptions as ce, type DeleteMessageResponse as cf, type GetMessageOptions as cg, type GetMessageResponse as ch, type ListChannelMessagesIncludeOptions as ci, type ListChannelMessagesOptions as cj, type ListChannelMessagesResponse as ck, type ListConversationMessagesIncludeOptions as cl, type ListConversationMessagesOptions as cm, type ListConversationMessagesResponse as cn, type ListMessagesIncludeOptions as co, type ListMessagesOptions as cp, type ListMessagesResponse as cq, type MessageID as cr, type MessageRole as cs, type MessageType as ct, type MessageStatus as cu, type MessageEventType as cv, type Model as cw, type CreateCorrectionModelPayload as cx, type CreateCorrectionModelOptions as cy, type CreateCorrectionResponse as cz, type CreateAccountPayload as d, type Upload as d0, type CreateUploadIncludeOptions as d1, type CreateUploadOptions as d2, type CreateUploadResponse as d3, type DeleteUploadOptions as d4, type DeleteUploadResponse as d5, type GetUploadOptions as d6, type GetUploadResponse as d7, type ListUploadsOptions as d8, type ListUploadsResponse as d9, type ListWebhookSubscriptionsResponse as dA, type TestWebhookSubscriptionOptions as dB, type TestWebhookSubscriptionResponse as dC, type WebhookSubscriptionID as dD, type UploadID as da, type User as db, type GetUserOptions as dc, type GetUserResponse as dd, type UserID as de, type EventWebhookOptions as df, eventWebhookSchema as dg, type WebhookEventType as dh, type AccountWebhookWebhookEventType as di, type AccountAccessTokenWebhookEventType as dj, type ContactWebhookEventType as dk, type ConversationWebhookEventType as dl, type MessageWebhookEventType as dm, type WebhookSubscriptionWebhookEventType as dn, type WebhookEventPayload as dp, type WebhookResponse as dq, type WebhookSubscription as dr, type CreateWebhookSubscriptionPayload as ds, type CreateWebhookSubscriptionOptions as dt, type CreateWebhookSubscriptionResponse as du, type DeleteWebhookSubscriptionOptions as dv, type DeleteWebhookSubscriptionResponse as dw, type GetWebhookSubscriptionOptions as dx, type GetWebhookSubscriptionResponse as dy, type ListWebhookSubscriptionsOptions 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 };
3487
+ 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 CreateContactPayload 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 ListConversationEscalationsOptions as aS, type ListConversationEscalationsResponse as aT, type ListEscalationsOptions as aU, type ListEscalationsResponse as aV, type Contact as aW, type ContactID as aX, type ContactType as aY, type ContactStatus as aZ, type ContactCustomMetadata 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 LabelID as b$, type CreateContactOptions as b0, type CreateContactResponse as b1, type DeleteContactOptions as b2, type DeleteContactResponse as b3, type GetContactIncludeOptions as b4, type GetContactOptions as b5, type GetContactResponse as b6, type GetContactVCFOptions as b7, type ListContactsOptions as b8, type ListContactsResponse as b9, type ListConversationsResponse as bA, type ListLabelConversationsOptions as bB, type ListLabelConversationsResponse as bC, type UpdateConversationPayload as bD, type UpdateConversationOptions as bE, type UpdateConversationResponse as bF, type ConversationSettings as bG, type ConversationFeedback as bH, type CreateConversationFeedbackPayload as bI, type CreateConversationFeedbackOptions as bJ, type CreateConversationFeedbackResponse as bK, type DeleteConversationFeedbackOptions as bL, type DeleteConversationFeedbackResponse as bM, type GetConversationFeedbackOptions as bN, type GetConversationFeedbackResponse as bO, type ListConversationConversationFeedbackOptions as bP, type ListConversationConversationFeedbackResponse as bQ, type ListConversationFeedbackOptions as bR, type ListConversationFeedbackResponse as bS, type Label as bT, type CreateLabelPayload as bU, type CreateLabelOptions as bV, type CreateLabelResponse as bW, type DeleteLabelOptions as bX, type DeleteLabelResponse as bY, type GetLabelOptions as bZ, type GetLabelResponse as b_, type ListLabelContactsOptions as ba, type ListLabelContactsResponse as bb, type UpdateContactPayload as bc, type UpdateContactOptions as bd, type UpdateContactResponse as be, type Conversation as bf, type ConversationID as bg, type ConversationCustomMetadata as bh, type ActiveConversationStatus as bi, type ConcludedConversationStatus as bj, type ConversationStatus as bk, type CreateConversationPayload as bl, type CreateConversationOptions as bm, type CreateConversationResponse as bn, type DeleteConversationOptions as bo, type DeleteConversationResponse as bp, type GetConversationIncludeOptions as bq, type GetConversationOptions as br, type GetConversationResponse as bs, type ListChannelConversationsOptions as bt, type ListChannelConversationsResponse as bu, type ListContactConversationsOptions as bv, type ListContactConversationsResponse as bw, type ListConversationsIncludeOptions as bx, type ListConversationsFilterOptions as by, type ListConversationOptions as bz, type AccountID as c, type ListSourcesResponse as c$, type ListContactLabelsOptions as c0, type ListContactLabelsResponse as c1, type ListConversationLabelsOptions as c2, type ListConversationLabelsResponse as c3, type ListLabelsIncludeOptions as c4, type ListLabelsOptions as c5, type ListLabelsResponse as c6, type UpdateLabelPayload as c7, type UpdateLabelOptions as c8, type UpdateLabelResponse as c9, type CreateCorrectionResponse as cA, type CreateResponseModelPayload as cB, type CreateResponseModelOptions as cC, type CreateResponseResponse as cD, type GetModelOptions as cE, type GetModelResponse as cF, type ListModelsOptions as cG, type ListModelsResponse as cH, type ModelID as cI, type Note as cJ, type CreateNotePayload as cK, type CreateNoteOptions as cL, type CreateNoteResponse as cM, type GetNoteOptions as cN, type GetNoteResponse as cO, type ListContactNotesOptions as cP, type ListContactNotesResponse as cQ, type ListConversationNotesOptions as cR, type ListConversationNotesResponse as cS, type NoteID as cT, type UpdateNotePayload as cU, type UpdateNoteOptions as cV, type UpdateNoteResponse as cW, type Source as cX, type GetSourceOptions as cY, type GetSourceResponse as cZ, type ListSourcesOptions as c_, type Message as ca, type CreateMessagePayload as cb, type CreateMessageOptions as cc, type CreateMessageResponse as cd, type DeleteMessageOptions as ce, type DeleteMessageResponse as cf, type GetMessageOptions as cg, type GetMessageResponse as ch, type ListChannelMessagesIncludeOptions as ci, type ListChannelMessagesOptions as cj, type ListChannelMessagesResponse as ck, type ListConversationMessagesIncludeOptions as cl, type ListConversationMessagesOptions as cm, type ListConversationMessagesResponse as cn, type ListMessagesIncludeOptions as co, type ListMessagesOptions as cp, type ListMessagesResponse as cq, type MessageID as cr, type MessageRole as cs, type MessageType as ct, type MessageStatus as cu, type MessageVisibility as cv, type MessageEventType as cw, type Model as cx, type CreateCorrectionModelPayload as cy, type CreateCorrectionModelOptions as cz, type CreateAccountPayload as d, type SourceID as d0, type Upload as d1, type CreateUploadIncludeOptions as d2, type CreateUploadOptions as d3, type CreateUploadResponse as d4, type DeleteUploadOptions as d5, type DeleteUploadResponse as d6, type GetUploadOptions as d7, type GetUploadResponse as d8, type ListUploadsOptions as d9, type ListWebhookSubscriptionsOptions as dA, type ListWebhookSubscriptionsResponse as dB, type TestWebhookSubscriptionOptions as dC, type TestWebhookSubscriptionResponse as dD, type WebhookSubscriptionID as dE, type ListUploadsResponse as da, type UploadID as db, type User as dc, type GetUserOptions as dd, type GetUserResponse as de, type UserID as df, type EventWebhookOptions as dg, eventWebhookSchema as dh, type WebhookEventType as di, type AccountWebhookWebhookEventType as dj, type AccountAccessTokenWebhookEventType as dk, type ContactWebhookEventType as dl, type ConversationWebhookEventType as dm, type MessageWebhookEventType as dn, type WebhookSubscriptionWebhookEventType as dp, type WebhookEventPayload as dq, type WebhookResponse as dr, type WebhookSubscription as ds, type CreateWebhookSubscriptionPayload as dt, type CreateWebhookSubscriptionOptions as du, type CreateWebhookSubscriptionResponse as dv, type DeleteWebhookSubscriptionOptions as dw, type DeleteWebhookSubscriptionResponse as dx, type GetWebhookSubscriptionOptions as dy, type GetWebhookSubscriptionResponse 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
- 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}async getHeaders(){let t=typeof this.name=="function"?await Promise.resolve(this.name()):this.name,e=typeof this.#t=="function"?await Promise.resolve(this.#t()):this.#t;return{Authorization:`Basic ${btoa(t+":"+e)}`}}};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}async getHeaders(){return{Authorization:`Bearer ${typeof this.#t=="function"?await Promise.resolve(this.#t()):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,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 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),...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"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/escalations",{...e,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 y=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,type:o,request:s={}}={}){return this._transport.send("v1/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{}),...this._transport.filterQuery("type",o)]})}listByConversation(t,{limit:e,include:o,type:s,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{}),...this._transport.filterQuery("type",s)]})}listByChannel(t,{limit:e,include:o,type:s,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o),...this._transport.filterQuery("type",s)]})}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 L=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:[async o=>{for(let s of this.options.requestFilterables){let r=await Promise.resolve(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,include:e,request:o={}}){let s=new FormData;for(let r of t)s.append("file",r);return this._transport.send("v1/uploads",{...o,method:"POST",searchParams:[...this._transport.includeQuery(e??{})],body:s})}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 F=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 P=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 y(this._transport),this.model=new L(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 F(this._transport),this.webhookSubscription=new P(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
+ 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",Q="SUPPORT_KEY_PASSWORD",w="SUPPORT_SIGNING_KEY",N="SUPPORT_BASE_URL";var c=class{name;#t;constructor({name:t=process.env[W],password:e=process.env[Q]}={}){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}async getHeaders(){let t=typeof this.name=="function"?await Promise.resolve(this.name()):this.name,e=typeof this.#t=="function"?await Promise.resolve(this.#t()):this.#t;return{Authorization:`Basic ${btoa(t+":"+e)}`}}};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}async getHeaders(){return{Authorization:`Bearer ${typeof this.#t=="function"?await Promise.resolve(this.#t()):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 a}from"zod";var V=a.object({data:a.object({event:a.object({id:a.string(),type:a.string(),payload:a.record(a.string()),createdAt:a.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,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 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),...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"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/escalations",{...e,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: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 T=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,type:o,visibility:s,request:r={}}={}){return this._transport.send("v1/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{}),...this._transport.filterQuery("type",o),...this._transport.filterQuery("visibility",s)]})}listByConversation(t,{limit:e,include:o,type:s,visibility:r,request:i={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...i,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{}),...this._transport.filterQuery("type",s),...this._transport.filterQuery("visibility",r)]})}listByChannel(t,{limit:e,include:o,type:s,visibility:r,request:i={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...i,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o),...this._transport.filterQuery("type",s),...this._transport.filterQuery("visibility",r)]})}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 L=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 i of r)s.push(["category",i])}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:[async o=>{for(let s of this.options.requestFilterables){let r=await Promise.resolve(s.getHeaders());for(let[i,q]of Object.entries(r))o.headers.has(i)||o.headers.set(i,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,include:e,request:o={}}){let s=new FormData;for(let r of t)s.append("file",r);return this._transport.send("v1/uploads",{...o,method:"POST",searchParams:[...this._transport.includeQuery(e??{})],body:s})}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 F=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 P=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 y(this._transport),this.message=new T(this._transport),this.model=new L(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 F(this._transport),this.webhookSubscription=new P(this._transport)}static getBaseURL(){return process.env[N]??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
- import{b as j,f as F}from"./chunk-E275HCOS.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-BUKSCLYK.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 +1 @@
1
- "use strict";var _t=Object.create;var W=Object.defineProperty;var Lt=Object.getOwnPropertyDescriptor;var Tt=Object.getOwnPropertyNames;var At=Object.getPrototypeOf,Ut=Object.prototype.hasOwnProperty;var St=(n,t)=>{for(var e in t)W(n,e,{get:t[e],enumerable:!0})},ct=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Tt(t))!Ut.call(n,s)&&s!==e&&W(n,s,{get:()=>t[s],enumerable:!(o=Lt(t,s))||o.enumerable});return n};var mt=(n,t,e)=>(e=n!=null?_t(At(n)):{},ct(t||!n||!n.__esModule?W(e,"default",{value:n,enumerable:!0}):e,n)),Et=n=>ct(W({},"__esModule",{value:!0}),n);var kt={};St(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: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 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}async getHeaders(){let t=typeof this.name=="function"?await Promise.resolve(this.name()):this.name,e=typeof this.#t=="function"?await Promise.resolve(this.#t()):this.#t;return{Authorization:`Basic ${btoa(t+":"+e)}`}}};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}async getHeaders(){return{Authorization:`Bearer ${typeof this.#t=="function"?await Promise.resolve(this.#t()):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 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",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 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: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 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"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/escalations",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/escalations",{...e,method:"POST",json:t})}};var L=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 T=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,type:o,request:s={}}={}){return this._transport.send("v1/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{}),...this._transport.filterQuery("type",o)]})}listByConversation(t,{limit:e,include:o,type:s,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{}),...this._transport.filterQuery("type",s)]})}listByChannel(t,{limit:e,include:o,type:s,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o),...this._transport.filterQuery("type",s)]})}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 n{constructor(t=n.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 s=[];if(e){let r=Array.isArray(e)?e:[e];for(let c of r)s.push(["category",c])}return t!==void 0&&s.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:s})}};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:[async o=>{for(let s of this.options.requestFilterables){let r=await Promise.resolve(s.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,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(0,bt.default)(s)?new Error("A network error occurred",{cause:s}):s instanceof N.HTTPError?new j(s.response,s):s});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,include:e,request:o={}}){let s=new FormData;for(let r of t)s.append("file",r);return this._transport.send("v1/uploads",{...o,method:"POST",searchParams:[...this._transport.includeQuery(e??{})],body:s})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var F=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"),vt=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 w=class{constructor(t){this._transport=t}async event({key:t=process.env[Y],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."+Y);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}=vt.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 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 n{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 S,t],...o,baseURL:e?.toString()??n.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 y(this._transport),this.conversationFeedback=new I(this._transport),this.escalation=new _(this._transport),this.label=new L(this._transport),this.message=new T(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 F(this._transport),this.webhook=new w(this._transport),this.webhookSubscription=new x(this._transport)}static getBaseURL(){return process.env[Ct]??this.DEFAULT_BASE_URL}};var z=require("commander"),gt=require("ora");function J({client:n,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,gt.oraPromise)(()=>n.action.list().json(),{...t,text:"Finding actions"});console.log(o)})),e}var $=require("commander"),Rt=require("ora");function X({client:n,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)(()=>n.channel.list().json(),{...t,text:"Finding channels"});console.log(o)})),e}var B=require("commander"),Q=require("ora");function Z({client:n,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 s=await(0,Q.oraPromise)(()=>n.contact.get(o).json(),{...t,text:"Finding contact"});console.log(s)})),e.addCommand(new B.Command("list").description("List contacts").action(async()=>{let o=await(0,Q.oraPromise)(()=>n.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 s=await(0,Q.oraPromise)(()=>n.contact.getVCF(o).response(),{...t,text:"Exporting contact"});console.log(s)})),e}var H=require("commander"),tt=require("ora");function et({client:n,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 s=await(0,tt.oraPromise)(()=>n.conversation.get(o).json(),{...t,text:"Finding conversation"});console.log(s)})),e.addCommand(new H.Command("list").description("List conversations").action(async()=>{let o=await(0,tt.oraPromise)(()=>n.conversation.list().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var M=require("commander"),V=require("ora");function ot({client:n,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 s=await(0,V.oraPromise)(()=>n.label.get(o).json(),{...t,text:"Finding label"});console.log(s)})),e.addCommand(new M.Command("list").description("List labels").action(async()=>{let o=await(0,V.oraPromise)(()=>n.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 s=await(0,V.oraPromise)(()=>n.conversation.listByLabel(o).json(),{...t,text:"Finding conversations"});console.log(s)})),e}var nt=require("commander"),Ot=require("ora");function st({client:n,ora:t}){let e=new nt.Command("messages").description("Messages");return e.addCommand(new nt.Command("list").description("List messages").action(async()=>{let o=await(0,Ot.oraPromise)(()=>n.message.list().json(),{...t,text:"Finding messages"});console.log(o)})),e}var q=require("commander"),rt=require("ora");function it({client:n,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 s=await(0,rt.oraPromise)(()=>n.model.get(o).json(),{...t,text:"Finding model"});console.log(s)})),e.addCommand(new q.Command("list").description("List models").action(async()=>{let o=await(0,rt.oraPromise)(()=>n.model.list().json(),{...t,text:"Finding models"});console.log(o)})),e}var K=require("commander"),at=require("ora");function pt({client:n,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 s=await(0,at.oraPromise)(()=>n.source.get(o).json(),{...t,text:"Finding source"});console.log(s)})),e.addCommand(new K.Command("list").description("List sources").action(async()=>{let o=await(0,at.oraPromise)(()=>n.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(st(a)).addCommand(it(a)).addCommand(pt(a)),Gt=Dt;
1
+ "use strict";var _t=Object.create;var W=Object.defineProperty;var Lt=Object.getOwnPropertyDescriptor;var Tt=Object.getOwnPropertyNames;var At=Object.getPrototypeOf,Ut=Object.prototype.hasOwnProperty;var St=(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 Tt(t))!Ut.call(s,n)&&n!==e&&W(s,n,{get:()=>t[n],enumerable:!(o=Lt(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={};St(kt,{default:()=>Gt});module.exports=Et(kt);var yt=require("commander");var c=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}async getHeaders(){let t=typeof this.name=="function"?await Promise.resolve(this.name()):this.name,e=typeof this.#t=="function"?await Promise.resolve(this.#t()):this.#t;return{Authorization:`Basic ${btoa(t+":"+e)}`}}};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}async getHeaders(){return{Authorization:`Bearer ${typeof this.#t=="function"?await Promise.resolve(this.#t()):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 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"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/escalations",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/escalations",{...e,method:"POST",json:t})}};var L=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 T=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,type:o,visibility:n,request:r={}}={}){return this._transport.send("v1/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{}),...this._transport.filterQuery("type",o),...this._transport.filterQuery("visibility",n)]})}listByConversation(t,{limit:e,include:o,type:n,visibility:r,request:i={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...i,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{}),...this._transport.filterQuery("type",n),...this._transport.filterQuery("visibility",r)]})}listByChannel(t,{limit:e,include:o,type:n,visibility:r,request:i={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...i,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o),...this._transport.filterQuery("type",n),...this._transport.filterQuery("visibility",r)]})}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=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 i of r)n.push(["category",i])}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),Q=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=Q.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[async o=>{for(let n of this.options.requestFilterables){let r=await Promise.resolve(n.getHeaders());for(let[i,It]of Object.entries(r))o.headers.has(i)||o.headers.set(i,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,bt.default)(n)?new Error("A network error occurred",{cause:n}):n instanceof Q.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,include:e,request:o={}}){let n=new FormData;for(let r of t)n.append("file",r);return this._transport.send("v1/uploads",{...o,method:"POST",searchParams:[...this._transport.includeQuery(e??{})],body:n})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var F=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 a=require("zod"),vt=a.z.object({data:a.z.object({event:a.z.object({id:a.z.string(),type:a.z.string(),payload:a.z.record(a.z.string()),createdAt:a.z.string().datetime()})})});var w=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}=vt.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=c;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 S,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 y(this._transport),this.conversationFeedback=new I(this._transport),this.escalation=new _(this._transport),this.label=new L(this._transport),this.message=new T(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 F(this._transport),this.webhook=new w(this._transport),this.webhookSubscription=new x(this._transport)}static getBaseURL(){return process.env[Ct]??this.DEFAULT_BASE_URL}};var z=require("commander"),gt=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,gt.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"),N=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,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 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 p={ora:{spinner:"simpleDotsScrolling"},client:new P(new c)},Dt=new yt.Command("gds").description("Great Detail Support System").addCommand(J(p)).addCommand(X(p)).addCommand(Z(p)).addCommand(et(p)).addCommand(ot(p)).addCommand(nt(p)).addCommand(it(p)).addCommand(pt(p)),Gt=Dt;
@@ -1,5 +1,5 @@
1
1
  import { Command } from 'commander';
2
- import { C as Client } from '../Client-7evGaUid.cjs';
2
+ import { C as Client } from '../Client-P7zcj22n.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-7evGaUid.js';
2
+ import { C as Client } from '../Client-P7zcj22n.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-P4ARLZSL.js";import"../chunk-E275HCOS.js";export{a as default};
1
+ import{a}from"../chunk-HTBVT7JL.js";import"../chunk-BUKSCLYK.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 Lt=Object.getOwnPropertyDescriptor;var Tt=Object.getOwnPropertyNames;var At=Object.getPrototypeOf,Ut=Object.prototype.hasOwnProperty;var St=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Tt(t))!Ut.call(n,s)&&s!==e&&pt(n,s,{get:()=>t[s],enumerable:!(o=Lt(t,s))||o.enumerable});return n};var ct=(n,t,e)=>(e=n!=null?_t(At(n)):{},St(t||!n||!n.__esModule?pt(e,"default",{value:n,enumerable:!0}):e,n));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: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 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}async getHeaders(){let t=typeof this.name=="function"?await Promise.resolve(this.name()):this.name,e=typeof this.#t=="function"?await Promise.resolve(this.#t()):this.#t;return{Authorization:`Basic ${btoa(t+":"+e)}`}}};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}async getHeaders(){return{Authorization:`Bearer ${typeof this.#t=="function"?await Promise.resolve(this.#t()):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 v=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 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",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 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: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 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"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/escalations",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/escalations",{...e,method:"POST",json:t})}};var L=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 T=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,type:o,request:s={}}={}){return this._transport.send("v1/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{}),...this._transport.filterQuery("type",o)]})}listByConversation(t,{limit:e,include:o,type:s,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{}),...this._transport.filterQuery("type",s)]})}listByChannel(t,{limit:e,include:o,type:s,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o),...this._transport.filterQuery("type",s)]})}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 n{constructor(t=n.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 s=[];if(e){let r=Array.isArray(e)?e:[e];for(let c of r)s.push(["category",c])}return t!==void 0&&s.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:s})}};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:[async o=>{for(let s of this.options.requestFilterables){let r=await Promise.resolve(s.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,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(0,ft.default)(s)?new Error("A network error occurred",{cause:s}):s instanceof j.HTTPError?new W(s.response,s):s});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,include:e,request:o={}}){let s=new FormData;for(let r of t)s.append("file",r);return this._transport.send("v1/uploads",{...o,method:"POST",searchParams:[...this._transport.includeQuery(e??{})],body:s})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var F=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"),vt=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 w=class{constructor(t){this._transport=t}async event({key:t=process.env[K],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."+K);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}=vt.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 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 n{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 S,t],...o,baseURL:e?.toString()??n.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 v(this._transport),this.channel=new b(this._transport),this.channelConversationSettings=new g(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 L(this._transport),this.message=new T(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 F(this._transport),this.webhook=new w(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:n,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)(()=>n.action.list().json(),{...t,text:"Finding actions"});console.log(o)})),e}var J=require("commander"),gt=require("ora");function $({client:n,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)(()=>n.channel.list().json(),{...t,text:"Finding channels"});console.log(o)})),e}var B=require("commander"),N=require("ora");function X({client:n,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 s=await(0,N.oraPromise)(()=>n.contact.get(o).json(),{...t,text:"Finding contact"});console.log(s)})),e.addCommand(new B.Command("list").description("List contacts").action(async()=>{let o=await(0,N.oraPromise)(()=>n.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 s=await(0,N.oraPromise)(()=>n.contact.getVCF(o).response(),{...t,text:"Exporting contact"});console.log(s)})),e}var Q=require("commander"),Z=require("ora");function tt({client:n,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 s=await(0,Z.oraPromise)(()=>n.conversation.get(o).json(),{...t,text:"Finding conversation"});console.log(s)})),e.addCommand(new Q.Command("list").description("List conversations").action(async()=>{let o=await(0,Z.oraPromise)(()=>n.conversation.list().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var M=require("commander"),H=require("ora");function et({client:n,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 s=await(0,H.oraPromise)(()=>n.label.get(o).json(),{...t,text:"Finding label"});console.log(s)})),e.addCommand(new M.Command("list").description("List labels").action(async()=>{let o=await(0,H.oraPromise)(()=>n.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 s=await(0,H.oraPromise)(()=>n.conversation.listByLabel(o).json(),{...t,text:"Finding conversations"});console.log(s)})),e}var ot=require("commander"),Rt=require("ora");function nt({client:n,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)(()=>n.message.list().json(),{...t,text:"Finding messages"});console.log(o)})),e}var V=require("commander"),st=require("ora");function rt({client:n,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 s=await(0,st.oraPromise)(()=>n.model.get(o).json(),{...t,text:"Finding model"});console.log(s)})),e.addCommand(new V.Command("list").description("List models").action(async()=>{let o=await(0,st.oraPromise)(()=>n.model.list().json(),{...t,text:"Finding models"});console.log(o)})),e}var q=require("commander"),it=require("ora");function at({client:n,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 s=await(0,it.oraPromise)(()=>n.source.get(o).json(),{...t,text:"Finding source"});console.log(s)})),e.addCommand(new q.Command("list").description("List sources").action(async()=>{let o=await(0,it.oraPromise)(()=>n.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(nt(a)).addCommand(rt(a)).addCommand(at(a)),yt=Et;yt.parseAsync(process.argv);
2
+ "use strict";var _t=Object.create;var pt=Object.defineProperty;var Lt=Object.getOwnPropertyDescriptor;var Tt=Object.getOwnPropertyNames;var At=Object.getPrototypeOf,Ut=Object.prototype.hasOwnProperty;var St=(s,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Tt(t))!Ut.call(s,n)&&n!==e&&pt(s,n,{get:()=>t[n],enumerable:!(o=Lt(t,n))||o.enumerable});return s};var ct=(s,t,e)=>(e=s!=null?_t(At(s)):{},St(t||!s||!s.__esModule?pt(e,"default",{value:s,enumerable:!0}):e,s));var Ot=require("commander");var c=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}async getHeaders(){let t=typeof this.name=="function"?await Promise.resolve(this.name()):this.name,e=typeof this.#t=="function"?await Promise.resolve(this.#t()):this.#t;return{Authorization:`Basic ${btoa(t+":"+e)}`}}};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}async getHeaders(){return{Authorization:`Bearer ${typeof this.#t=="function"?await Promise.resolve(this.#t()):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 v=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 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,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"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/escalations",{...e,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/escalations",{...e,method:"POST",json:t})}};var L=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 T=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,type:o,visibility:n,request:r={}}={}){return this._transport.send("v1/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{}),...this._transport.filterQuery("type",o),...this._transport.filterQuery("visibility",n)]})}listByConversation(t,{limit:e,include:o,type:n,visibility:r,request:i={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...i,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{}),...this._transport.filterQuery("type",n),...this._transport.filterQuery("visibility",r)]})}listByChannel(t,{limit:e,include:o,type:n,visibility:r,request:i={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...i,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o),...this._transport.filterQuery("type",n),...this._transport.filterQuery("visibility",r)]})}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=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 i of r)n.push(["category",i])}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:[async o=>{for(let n of this.options.requestFilterables){let r=await Promise.resolve(n.getHeaders());for(let[i,It]of Object.entries(r))o.headers.has(i)||o.headers.set(i,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,include:e,request:o={}}){let n=new FormData;for(let r of t)n.append("file",r);return this._transport.send("v1/uploads",{...o,method:"POST",searchParams:[...this._transport.includeQuery(e??{})],body:n})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var F=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 a=require("zod"),vt=a.z.object({data:a.z.object({event:a.z.object({id:a.z.string(),type:a.z.string(),payload:a.z.record(a.z.string()),createdAt:a.z.string().datetime()})})});var w=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}=vt.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=c;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 S,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 v(this._transport),this.channel=new b(this._transport),this.channelConversationSettings=new g(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 L(this._transport),this.message=new T(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 F(this._transport),this.webhook=new w(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"),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"),Q=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,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 N=require("commander"),Z=require("ora");function tt({client:s,ora:t}){let e=new N.Command("conversations").description("Conversations");return e.addCommand(new N.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 N.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 p={ora:{spinner:"simpleDotsScrolling"},client:new P(new c)},Et=new Ot.Command("gds").description("Great Detail Support System").addCommand(z(p)).addCommand($(p)).addCommand(X(p)).addCommand(tt(p)).addCommand(et(p)).addCommand(st(p)).addCommand(rt(p)).addCommand(at(p)),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-P4ARLZSL.js";import"./chunk-E275HCOS.js";r.parseAsync(process.argv);
2
+ import{a as r}from"./chunk-HTBVT7JL.js";import"./chunk-BUKSCLYK.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=(n,t)=>{for(var e in t)w(n,e,{get:t[e],enumerable:!0})},V=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ot(t))!nt.call(n,s)&&s!==e&&w(n,s,{get:()=>t[s],enumerable:!(o=et(t,s))||o.enumerable});return n};var q=(n,t,e)=>(e=n!=null?tt(st(n)):{},V(t||!n||!n.__esModule?w(e,"default",{value:n,enumerable:!0}):e,n)),rt=n=>V(w({},"__esModule",{value:!0}),n);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: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 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}async getHeaders(){let t=typeof this.name=="function"?await Promise.resolve(this.name()):this.name,e=typeof this.#t=="function"?await Promise.resolve(this.#t()):this.#t;return{Authorization:`Basic ${btoa(t+":"+e)}`}}};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}async getHeaders(){return{Authorization:`Bearer ${typeof this.#t=="function"?await Promise.resolve(this.#t()):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",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 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: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"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/escalations",{...e,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,type:o,request:s={}}={}){return this._transport.send("v1/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{}),...this._transport.filterQuery("type",o)]})}listByConversation(t,{limit:e,include:o,type:s,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{}),...this._transport.filterQuery("type",s)]})}listByChannel(t,{limit:e,include:o,type:s,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o),...this._transport.filterQuery("type",s)]})}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 n{constructor(t=n.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 s=[];if(e){let r=Array.isArray(e)?e:[e];for(let p of r)s.push(["category",p])}return t!==void 0&&s.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:s})}};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:[async o=>{for(let s of this.options.requestFilterables){let r=await Promise.resolve(s.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,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(0,X.default)(s)?new Error("A network error occurred",{cause:s}):s instanceof W.HTTPError?new a(s.response,s):s});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,include:e,request:o={}}){let s=new FormData;for(let r of t)s.append("file",r);return this._transport.send("v1/uploads",{...o,method:"POST",searchParams:[...this._transport.includeQuery(e??{})],body:s})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var F=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 P=class{constructor(t){this._transport=t}async event({key:t=process.env[N],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."+N);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}=Q.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 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 n{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()??n.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 y(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 U(this._transport),this.source=new E(this._transport),this.statistics=new D(this._transport),this.upload=new k(this._transport),this.user=new F(this._transport),this.webhook=new P(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=(n,t)=>{for(var e in t)w(n,e,{get:t[e],enumerable:!0})},V=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ot(t))!nt.call(n,s)&&s!==e&&w(n,s,{get:()=>t[s],enumerable:!(o=et(t,s))||o.enumerable});return n};var q=(n,t,e)=>(e=n!=null?tt(st(n)):{},V(t||!n||!n.__esModule?w(e,"default",{value:n,enumerable:!0}):e,n)),rt=n=>V(w({},"__esModule",{value:!0}),n);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: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 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}async getHeaders(){let t=typeof this.name=="function"?await Promise.resolve(this.name()):this.name,e=typeof this.#t=="function"?await Promise.resolve(this.#t()):this.#t;return{Authorization:`Basic ${btoa(t+":"+e)}`}}};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}async getHeaders(){return{Authorization:`Bearer ${typeof this.#t=="function"?await Promise.resolve(this.#t()):this.#t}`}}};var f=class{getHeaders(){return{}}};var b=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 v=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 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",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 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: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"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/escalations",{...e,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,type:o,visibility:s,request:r={}}={}){return this._transport.send("v1/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{}),...this._transport.filterQuery("type",o),...this._transport.filterQuery("visibility",s)]})}listByConversation(t,{limit:e,include:o,type:s,visibility:r,request:i={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...i,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{}),...this._transport.filterQuery("type",s),...this._transport.filterQuery("visibility",r)]})}listByChannel(t,{limit:e,include:o,type:s,visibility:r,request:i={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...i,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o),...this._transport.filterQuery("type",s),...this._transport.filterQuery("visibility",r)]})}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 n{constructor(t=n.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 s=[];if(e){let r=Array.isArray(e)?e:[e];for(let i of r)s.push(["category",i])}return t!==void 0&&s.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:s})}};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:[async o=>{for(let s of this.options.requestFilterables){let r=await Promise.resolve(s.getHeaders());for(let[i,Z]of Object.entries(r))o.headers.has(i)||o.headers.set(i,Z)}}]}})}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(0,X.default)(s)?new Error("A network error occurred",{cause:s}):s instanceof W.HTTPError?new a(s.response,s):s});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,include:e,request:o={}}){let s=new FormData;for(let r of t)s.append("file",r);return this._transport.send("v1/uploads",{...o,method:"POST",searchParams:[...this._transport.includeQuery(e??{})],body:s})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var F=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=require("zod"),Q=p.z.object({data:p.z.object({event:p.z.object({id:p.z.string(),type:p.z.string(),payload:p.z.record(p.z.string()),createdAt:p.z.string().datetime()})})});var P=class{constructor(t){this._transport=t}async event({key:t=process.env[N],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."+N);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}=Q.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 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 n{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()??n.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 b(this._transport),this.boilerplateContent=new v(this._transport),this.channel=new R(this._transport),this.channelConversationSettings=new O(this._transport),this.compositionSection=new g(this._transport),this.contact=new x(this._transport),this.conversation=new y(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 U(this._transport),this.source=new E(this._transport),this.statistics=new D(this._transport),this.upload=new k(this._transport),this.user=new F(this._transport),this.webhook=new P(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, dj as AccountAccessTokenWebhookEventType, t as AccountConversationSettings, c as AccountID, di as AccountWebhookWebhookEventType, z as Action, B as ActionID, bi 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, bj as ConcludedConversationStatus, aW as Contact, a_ as ContactCustomMetadata, aX as ContactID, aZ as ContactStatus, aY as ContactType, dk as ContactWebhookEventType, bf as Conversation, bh as ConversationCustomMetadata, bH as ConversationFeedback, bg as ConversationID, bG as ConversationSettings, bk as ConversationStatus, dl 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, b0 as CreateContactOptions, a$ as CreateContactPayload, b1 as CreateContactResponse, bJ as CreateConversationFeedbackOptions, bI as CreateConversationFeedbackPayload, bK as CreateConversationFeedbackResponse, bm as CreateConversationOptions, bl as CreateConversationPayload, bn as CreateConversationResponse, cy as CreateCorrectionModelOptions, cx as CreateCorrectionModelPayload, cz as CreateCorrectionResponse, aO as CreateEscalationOptions, aN as CreateEscalationPayload, aP as CreateEscalationResponse, bV as CreateLabelOptions, bU as CreateLabelPayload, bW as CreateLabelResponse, cc as CreateMessageOptions, cb as CreateMessagePayload, cd as CreateMessageResponse, cK as CreateNoteOptions, cJ as CreateNotePayload, cL as CreateNoteResponse, cB as CreateResponseModelOptions, cA as CreateResponseModelPayload, cC as CreateResponseResponse, d1 as CreateUploadIncludeOptions, d2 as CreateUploadOptions, d3 as CreateUploadResponse, dt as CreateWebhookSubscriptionOptions, ds as CreateWebhookSubscriptionPayload, du as CreateWebhookSubscriptionResponse, b as CurrentAccountID, o as DeleteAccountAccessTokenOptions, D as DeleteAccountAccessTokenPayload, p as DeleteAccountAccessTokenResponse, b2 as DeleteContactOptions, b3 as DeleteContactResponse, bL as DeleteConversationFeedbackOptions, bM as DeleteConversationFeedbackResponse, bo as DeleteConversationOptions, bp as DeleteConversationResponse, bX as DeleteLabelOptions, bY as DeleteLabelResponse, ce as DeleteMessageOptions, cf as DeleteMessageResponse, d4 as DeleteUploadOptions, d5 as DeleteUploadResponse, dv as DeleteWebhookSubscriptionOptions, dw as DeleteWebhookSubscriptionResponse, aM as Escalation, df 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, b4 as GetContactIncludeOptions, b5 as GetContactOptions, b6 as GetContactResponse, b7 as GetContactVCFOptions, bN as GetConversationFeedbackOptions, bO as GetConversationFeedbackResponse, bq as GetConversationIncludeOptions, br as GetConversationOptions, bs as GetConversationResponse, aQ as GetEscalationOptions, aR as GetEscalationResponse, bZ as GetLabelOptions, b_ as GetLabelResponse, cg as GetMessageOptions, ch as GetMessageResponse, cD as GetModelOptions, cE as GetModelResponse, cM as GetNoteOptions, cN as GetNoteResponse, cX as GetSourceOptions, cY as GetSourceResponse, d6 as GetUploadOptions, d7 as GetUploadResponse, dc as GetUserOptions, dd as GetUserResponse, dx as GetWebhookSubscriptionOptions, dy as GetWebhookSubscriptionResponse, bT as Label, b$ 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, bt as ListChannelConversationsOptions, bu as ListChannelConversationsResponse, ci as ListChannelMessagesIncludeOptions, cj as ListChannelMessagesOptions, ck as ListChannelMessagesResponse, ai as ListChannelsOptions, aj as ListChannelsResponse, aH as ListCompositionSectionsOptions, aI as ListCompositionSectionsResponse, bv as ListContactConversationsOptions, bw as ListContactConversationsResponse, c0 as ListContactLabelsOptions, c1 as ListContactLabelsResponse, cO as ListContactNotesOptions, cP as ListContactNotesResponse, b8 as ListContactsOptions, b9 as ListContactsResponse, bP as ListConversationConversationFeedbackOptions, bQ as ListConversationConversationFeedbackResponse, aS as ListConversationEscalationsOptions, aT as ListConversationEscalationsResponse, bR as ListConversationFeedbackOptions, bS as ListConversationFeedbackResponse, c2 as ListConversationLabelsOptions, c3 as ListConversationLabelsResponse, cl as ListConversationMessagesIncludeOptions, cm as ListConversationMessagesOptions, cn as ListConversationMessagesResponse, cQ as ListConversationNotesOptions, cR as ListConversationNotesResponse, bz as ListConversationOptions, by as ListConversationsFilterOptions, bx as ListConversationsIncludeOptions, bA as ListConversationsResponse, aU as ListEscalationsOptions, aV as ListEscalationsResponse, ba as ListLabelContactsOptions, bb as ListLabelContactsResponse, bB as ListLabelConversationsOptions, bC as ListLabelConversationsResponse, c4 as ListLabelsIncludeOptions, c5 as ListLabelsOptions, c6 as ListLabelsResponse, co as ListMessagesIncludeOptions, cp as ListMessagesOptions, cq as ListMessagesResponse, cF as ListModelsOptions, cG as ListModelsResponse, cZ as ListSourcesOptions, c_ as ListSourcesResponse, d8 as ListUploadsOptions, d9 as ListUploadsResponse, dz as ListWebhookSubscriptionsOptions, dA as ListWebhookSubscriptionsResponse, ca as Message, cv as MessageEventType, cr as MessageID, cs as MessageRole, cu as MessageStatus, ct as MessageType, dm as MessageWebhookEventType, ak as MetaWhatsappChannelGetBusinessProfileOptions, al as MetaWhatsappChannelGetBusinessProfileResponse, cw as Model, cH as ModelID, cI as Note, cS as NoteID, O as Options, R as RequestFilterable, S as SortOptions, cW as Source, c$ as SourceID, dB as TestWebhookSubscriptionOptions, dC 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, bd as UpdateContactOptions, bc as UpdateContactPayload, be as UpdateContactResponse, bE as UpdateConversationOptions, bD as UpdateConversationPayload, bF as UpdateConversationResponse, c8 as UpdateLabelOptions, c7 as UpdateLabelPayload, c9 as UpdateLabelResponse, cU as UpdateNoteOptions, cT as UpdateNotePayload, cV as UpdateNoteResponse, d0 as Upload, da as UploadID, db as User, de as UserID, dp as WebhookEventPayload, dh as WebhookEventType, dq as WebhookResponse, dr as WebhookSubscription, dD as WebhookSubscriptionID, dn as WebhookSubscriptionWebhookEventType, C as default, dg as eventWebhookSchema } from './Client-7evGaUid.cjs';
1
+ export { A as Account, j as AccountAccessToken, k as AccountAccessTokenID, dk as AccountAccessTokenWebhookEventType, t as AccountConversationSettings, c as AccountID, dj as AccountWebhookWebhookEventType, z as Action, B as ActionID, bi 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, bj as ConcludedConversationStatus, aW as Contact, a_ as ContactCustomMetadata, aX as ContactID, aZ as ContactStatus, aY as ContactType, dl as ContactWebhookEventType, bf as Conversation, bh as ConversationCustomMetadata, bH as ConversationFeedback, bg as ConversationID, bG as ConversationSettings, bk as ConversationStatus, dm 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, b0 as CreateContactOptions, a$ as CreateContactPayload, b1 as CreateContactResponse, bJ as CreateConversationFeedbackOptions, bI as CreateConversationFeedbackPayload, bK as CreateConversationFeedbackResponse, bm as CreateConversationOptions, bl as CreateConversationPayload, bn as CreateConversationResponse, cz as CreateCorrectionModelOptions, cy as CreateCorrectionModelPayload, cA as CreateCorrectionResponse, aO as CreateEscalationOptions, aN as CreateEscalationPayload, aP as CreateEscalationResponse, bV as CreateLabelOptions, bU as CreateLabelPayload, bW as CreateLabelResponse, cc as CreateMessageOptions, cb as CreateMessagePayload, cd as CreateMessageResponse, cL as CreateNoteOptions, cK as CreateNotePayload, cM as CreateNoteResponse, cC as CreateResponseModelOptions, cB as CreateResponseModelPayload, cD as CreateResponseResponse, d2 as CreateUploadIncludeOptions, d3 as CreateUploadOptions, d4 as CreateUploadResponse, du as CreateWebhookSubscriptionOptions, dt as CreateWebhookSubscriptionPayload, dv as CreateWebhookSubscriptionResponse, b as CurrentAccountID, o as DeleteAccountAccessTokenOptions, D as DeleteAccountAccessTokenPayload, p as DeleteAccountAccessTokenResponse, b2 as DeleteContactOptions, b3 as DeleteContactResponse, bL as DeleteConversationFeedbackOptions, bM as DeleteConversationFeedbackResponse, bo as DeleteConversationOptions, bp as DeleteConversationResponse, bX as DeleteLabelOptions, bY as DeleteLabelResponse, ce as DeleteMessageOptions, cf as DeleteMessageResponse, d5 as DeleteUploadOptions, d6 as DeleteUploadResponse, dw as DeleteWebhookSubscriptionOptions, dx as DeleteWebhookSubscriptionResponse, aM as Escalation, dg 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, b4 as GetContactIncludeOptions, b5 as GetContactOptions, b6 as GetContactResponse, b7 as GetContactVCFOptions, bN as GetConversationFeedbackOptions, bO as GetConversationFeedbackResponse, bq as GetConversationIncludeOptions, br as GetConversationOptions, bs as GetConversationResponse, aQ as GetEscalationOptions, aR as GetEscalationResponse, bZ as GetLabelOptions, b_ as GetLabelResponse, cg as GetMessageOptions, ch as GetMessageResponse, cE as GetModelOptions, cF as GetModelResponse, cN as GetNoteOptions, cO as GetNoteResponse, cY as GetSourceOptions, cZ as GetSourceResponse, d7 as GetUploadOptions, d8 as GetUploadResponse, dd as GetUserOptions, de as GetUserResponse, dy as GetWebhookSubscriptionOptions, dz as GetWebhookSubscriptionResponse, bT as Label, b$ 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, bt as ListChannelConversationsOptions, bu as ListChannelConversationsResponse, ci as ListChannelMessagesIncludeOptions, cj as ListChannelMessagesOptions, ck as ListChannelMessagesResponse, ai as ListChannelsOptions, aj as ListChannelsResponse, aH as ListCompositionSectionsOptions, aI as ListCompositionSectionsResponse, bv as ListContactConversationsOptions, bw as ListContactConversationsResponse, c0 as ListContactLabelsOptions, c1 as ListContactLabelsResponse, cP as ListContactNotesOptions, cQ as ListContactNotesResponse, b8 as ListContactsOptions, b9 as ListContactsResponse, bP as ListConversationConversationFeedbackOptions, bQ as ListConversationConversationFeedbackResponse, aS as ListConversationEscalationsOptions, aT as ListConversationEscalationsResponse, bR as ListConversationFeedbackOptions, bS as ListConversationFeedbackResponse, c2 as ListConversationLabelsOptions, c3 as ListConversationLabelsResponse, cl as ListConversationMessagesIncludeOptions, cm as ListConversationMessagesOptions, cn as ListConversationMessagesResponse, cR as ListConversationNotesOptions, cS as ListConversationNotesResponse, bz as ListConversationOptions, by as ListConversationsFilterOptions, bx as ListConversationsIncludeOptions, bA as ListConversationsResponse, aU as ListEscalationsOptions, aV as ListEscalationsResponse, ba as ListLabelContactsOptions, bb as ListLabelContactsResponse, bB as ListLabelConversationsOptions, bC as ListLabelConversationsResponse, c4 as ListLabelsIncludeOptions, c5 as ListLabelsOptions, c6 as ListLabelsResponse, co as ListMessagesIncludeOptions, cp as ListMessagesOptions, cq as ListMessagesResponse, cG as ListModelsOptions, cH as ListModelsResponse, c_ as ListSourcesOptions, c$ as ListSourcesResponse, d9 as ListUploadsOptions, da as ListUploadsResponse, dA as ListWebhookSubscriptionsOptions, dB as ListWebhookSubscriptionsResponse, ca as Message, cw as MessageEventType, cr as MessageID, cs as MessageRole, cu as MessageStatus, ct as MessageType, cv as MessageVisibility, dn as MessageWebhookEventType, ak as MetaWhatsappChannelGetBusinessProfileOptions, al as MetaWhatsappChannelGetBusinessProfileResponse, cx as Model, cI as ModelID, cJ as Note, cT as NoteID, O as Options, R as RequestFilterable, S as SortOptions, cX as Source, d0 as SourceID, dC as TestWebhookSubscriptionOptions, dD 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, bd as UpdateContactOptions, bc as UpdateContactPayload, be as UpdateContactResponse, bE as UpdateConversationOptions, bD as UpdateConversationPayload, bF as UpdateConversationResponse, c8 as UpdateLabelOptions, c7 as UpdateLabelPayload, c9 as UpdateLabelResponse, cV as UpdateNoteOptions, cU as UpdateNotePayload, cW as UpdateNoteResponse, d1 as Upload, db as UploadID, dc as User, df as UserID, dq as WebhookEventPayload, di as WebhookEventType, dr as WebhookResponse, ds as WebhookSubscription, dE as WebhookSubscriptionID, dp as WebhookSubscriptionWebhookEventType, C as default, dh as eventWebhookSchema } from './Client-P7zcj22n.cjs';
2
2
  import { KyResponse } from 'ky';
3
3
  import 'zod';
4
4
 
@@ -32,12 +32,12 @@ declare class SupportError extends Error {
32
32
  }
33
33
  interface ErrorResponse {
34
34
  trace?: string;
35
- errors: {
36
- status?: number;
37
- code?: string;
35
+ error: {
38
36
  title: string;
39
- message?: string;
40
- }[];
37
+ status: number;
38
+ type: string;
39
+ detail?: string;
40
+ };
41
41
  }
42
42
 
43
43
  /**
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as Account, j as AccountAccessToken, k as AccountAccessTokenID, dj as AccountAccessTokenWebhookEventType, t as AccountConversationSettings, c as AccountID, di as AccountWebhookWebhookEventType, z as Action, B as ActionID, bi 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, bj as ConcludedConversationStatus, aW as Contact, a_ as ContactCustomMetadata, aX as ContactID, aZ as ContactStatus, aY as ContactType, dk as ContactWebhookEventType, bf as Conversation, bh as ConversationCustomMetadata, bH as ConversationFeedback, bg as ConversationID, bG as ConversationSettings, bk as ConversationStatus, dl 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, b0 as CreateContactOptions, a$ as CreateContactPayload, b1 as CreateContactResponse, bJ as CreateConversationFeedbackOptions, bI as CreateConversationFeedbackPayload, bK as CreateConversationFeedbackResponse, bm as CreateConversationOptions, bl as CreateConversationPayload, bn as CreateConversationResponse, cy as CreateCorrectionModelOptions, cx as CreateCorrectionModelPayload, cz as CreateCorrectionResponse, aO as CreateEscalationOptions, aN as CreateEscalationPayload, aP as CreateEscalationResponse, bV as CreateLabelOptions, bU as CreateLabelPayload, bW as CreateLabelResponse, cc as CreateMessageOptions, cb as CreateMessagePayload, cd as CreateMessageResponse, cK as CreateNoteOptions, cJ as CreateNotePayload, cL as CreateNoteResponse, cB as CreateResponseModelOptions, cA as CreateResponseModelPayload, cC as CreateResponseResponse, d1 as CreateUploadIncludeOptions, d2 as CreateUploadOptions, d3 as CreateUploadResponse, dt as CreateWebhookSubscriptionOptions, ds as CreateWebhookSubscriptionPayload, du as CreateWebhookSubscriptionResponse, b as CurrentAccountID, o as DeleteAccountAccessTokenOptions, D as DeleteAccountAccessTokenPayload, p as DeleteAccountAccessTokenResponse, b2 as DeleteContactOptions, b3 as DeleteContactResponse, bL as DeleteConversationFeedbackOptions, bM as DeleteConversationFeedbackResponse, bo as DeleteConversationOptions, bp as DeleteConversationResponse, bX as DeleteLabelOptions, bY as DeleteLabelResponse, ce as DeleteMessageOptions, cf as DeleteMessageResponse, d4 as DeleteUploadOptions, d5 as DeleteUploadResponse, dv as DeleteWebhookSubscriptionOptions, dw as DeleteWebhookSubscriptionResponse, aM as Escalation, df 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, b4 as GetContactIncludeOptions, b5 as GetContactOptions, b6 as GetContactResponse, b7 as GetContactVCFOptions, bN as GetConversationFeedbackOptions, bO as GetConversationFeedbackResponse, bq as GetConversationIncludeOptions, br as GetConversationOptions, bs as GetConversationResponse, aQ as GetEscalationOptions, aR as GetEscalationResponse, bZ as GetLabelOptions, b_ as GetLabelResponse, cg as GetMessageOptions, ch as GetMessageResponse, cD as GetModelOptions, cE as GetModelResponse, cM as GetNoteOptions, cN as GetNoteResponse, cX as GetSourceOptions, cY as GetSourceResponse, d6 as GetUploadOptions, d7 as GetUploadResponse, dc as GetUserOptions, dd as GetUserResponse, dx as GetWebhookSubscriptionOptions, dy as GetWebhookSubscriptionResponse, bT as Label, b$ 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, bt as ListChannelConversationsOptions, bu as ListChannelConversationsResponse, ci as ListChannelMessagesIncludeOptions, cj as ListChannelMessagesOptions, ck as ListChannelMessagesResponse, ai as ListChannelsOptions, aj as ListChannelsResponse, aH as ListCompositionSectionsOptions, aI as ListCompositionSectionsResponse, bv as ListContactConversationsOptions, bw as ListContactConversationsResponse, c0 as ListContactLabelsOptions, c1 as ListContactLabelsResponse, cO as ListContactNotesOptions, cP as ListContactNotesResponse, b8 as ListContactsOptions, b9 as ListContactsResponse, bP as ListConversationConversationFeedbackOptions, bQ as ListConversationConversationFeedbackResponse, aS as ListConversationEscalationsOptions, aT as ListConversationEscalationsResponse, bR as ListConversationFeedbackOptions, bS as ListConversationFeedbackResponse, c2 as ListConversationLabelsOptions, c3 as ListConversationLabelsResponse, cl as ListConversationMessagesIncludeOptions, cm as ListConversationMessagesOptions, cn as ListConversationMessagesResponse, cQ as ListConversationNotesOptions, cR as ListConversationNotesResponse, bz as ListConversationOptions, by as ListConversationsFilterOptions, bx as ListConversationsIncludeOptions, bA as ListConversationsResponse, aU as ListEscalationsOptions, aV as ListEscalationsResponse, ba as ListLabelContactsOptions, bb as ListLabelContactsResponse, bB as ListLabelConversationsOptions, bC as ListLabelConversationsResponse, c4 as ListLabelsIncludeOptions, c5 as ListLabelsOptions, c6 as ListLabelsResponse, co as ListMessagesIncludeOptions, cp as ListMessagesOptions, cq as ListMessagesResponse, cF as ListModelsOptions, cG as ListModelsResponse, cZ as ListSourcesOptions, c_ as ListSourcesResponse, d8 as ListUploadsOptions, d9 as ListUploadsResponse, dz as ListWebhookSubscriptionsOptions, dA as ListWebhookSubscriptionsResponse, ca as Message, cv as MessageEventType, cr as MessageID, cs as MessageRole, cu as MessageStatus, ct as MessageType, dm as MessageWebhookEventType, ak as MetaWhatsappChannelGetBusinessProfileOptions, al as MetaWhatsappChannelGetBusinessProfileResponse, cw as Model, cH as ModelID, cI as Note, cS as NoteID, O as Options, R as RequestFilterable, S as SortOptions, cW as Source, c$ as SourceID, dB as TestWebhookSubscriptionOptions, dC 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, bd as UpdateContactOptions, bc as UpdateContactPayload, be as UpdateContactResponse, bE as UpdateConversationOptions, bD as UpdateConversationPayload, bF as UpdateConversationResponse, c8 as UpdateLabelOptions, c7 as UpdateLabelPayload, c9 as UpdateLabelResponse, cU as UpdateNoteOptions, cT as UpdateNotePayload, cV as UpdateNoteResponse, d0 as Upload, da as UploadID, db as User, de as UserID, dp as WebhookEventPayload, dh as WebhookEventType, dq as WebhookResponse, dr as WebhookSubscription, dD as WebhookSubscriptionID, dn as WebhookSubscriptionWebhookEventType, C as default, dg as eventWebhookSchema } from './Client-7evGaUid.js';
1
+ export { A as Account, j as AccountAccessToken, k as AccountAccessTokenID, dk as AccountAccessTokenWebhookEventType, t as AccountConversationSettings, c as AccountID, dj as AccountWebhookWebhookEventType, z as Action, B as ActionID, bi 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, bj as ConcludedConversationStatus, aW as Contact, a_ as ContactCustomMetadata, aX as ContactID, aZ as ContactStatus, aY as ContactType, dl as ContactWebhookEventType, bf as Conversation, bh as ConversationCustomMetadata, bH as ConversationFeedback, bg as ConversationID, bG as ConversationSettings, bk as ConversationStatus, dm 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, b0 as CreateContactOptions, a$ as CreateContactPayload, b1 as CreateContactResponse, bJ as CreateConversationFeedbackOptions, bI as CreateConversationFeedbackPayload, bK as CreateConversationFeedbackResponse, bm as CreateConversationOptions, bl as CreateConversationPayload, bn as CreateConversationResponse, cz as CreateCorrectionModelOptions, cy as CreateCorrectionModelPayload, cA as CreateCorrectionResponse, aO as CreateEscalationOptions, aN as CreateEscalationPayload, aP as CreateEscalationResponse, bV as CreateLabelOptions, bU as CreateLabelPayload, bW as CreateLabelResponse, cc as CreateMessageOptions, cb as CreateMessagePayload, cd as CreateMessageResponse, cL as CreateNoteOptions, cK as CreateNotePayload, cM as CreateNoteResponse, cC as CreateResponseModelOptions, cB as CreateResponseModelPayload, cD as CreateResponseResponse, d2 as CreateUploadIncludeOptions, d3 as CreateUploadOptions, d4 as CreateUploadResponse, du as CreateWebhookSubscriptionOptions, dt as CreateWebhookSubscriptionPayload, dv as CreateWebhookSubscriptionResponse, b as CurrentAccountID, o as DeleteAccountAccessTokenOptions, D as DeleteAccountAccessTokenPayload, p as DeleteAccountAccessTokenResponse, b2 as DeleteContactOptions, b3 as DeleteContactResponse, bL as DeleteConversationFeedbackOptions, bM as DeleteConversationFeedbackResponse, bo as DeleteConversationOptions, bp as DeleteConversationResponse, bX as DeleteLabelOptions, bY as DeleteLabelResponse, ce as DeleteMessageOptions, cf as DeleteMessageResponse, d5 as DeleteUploadOptions, d6 as DeleteUploadResponse, dw as DeleteWebhookSubscriptionOptions, dx as DeleteWebhookSubscriptionResponse, aM as Escalation, dg 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, b4 as GetContactIncludeOptions, b5 as GetContactOptions, b6 as GetContactResponse, b7 as GetContactVCFOptions, bN as GetConversationFeedbackOptions, bO as GetConversationFeedbackResponse, bq as GetConversationIncludeOptions, br as GetConversationOptions, bs as GetConversationResponse, aQ as GetEscalationOptions, aR as GetEscalationResponse, bZ as GetLabelOptions, b_ as GetLabelResponse, cg as GetMessageOptions, ch as GetMessageResponse, cE as GetModelOptions, cF as GetModelResponse, cN as GetNoteOptions, cO as GetNoteResponse, cY as GetSourceOptions, cZ as GetSourceResponse, d7 as GetUploadOptions, d8 as GetUploadResponse, dd as GetUserOptions, de as GetUserResponse, dy as GetWebhookSubscriptionOptions, dz as GetWebhookSubscriptionResponse, bT as Label, b$ 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, bt as ListChannelConversationsOptions, bu as ListChannelConversationsResponse, ci as ListChannelMessagesIncludeOptions, cj as ListChannelMessagesOptions, ck as ListChannelMessagesResponse, ai as ListChannelsOptions, aj as ListChannelsResponse, aH as ListCompositionSectionsOptions, aI as ListCompositionSectionsResponse, bv as ListContactConversationsOptions, bw as ListContactConversationsResponse, c0 as ListContactLabelsOptions, c1 as ListContactLabelsResponse, cP as ListContactNotesOptions, cQ as ListContactNotesResponse, b8 as ListContactsOptions, b9 as ListContactsResponse, bP as ListConversationConversationFeedbackOptions, bQ as ListConversationConversationFeedbackResponse, aS as ListConversationEscalationsOptions, aT as ListConversationEscalationsResponse, bR as ListConversationFeedbackOptions, bS as ListConversationFeedbackResponse, c2 as ListConversationLabelsOptions, c3 as ListConversationLabelsResponse, cl as ListConversationMessagesIncludeOptions, cm as ListConversationMessagesOptions, cn as ListConversationMessagesResponse, cR as ListConversationNotesOptions, cS as ListConversationNotesResponse, bz as ListConversationOptions, by as ListConversationsFilterOptions, bx as ListConversationsIncludeOptions, bA as ListConversationsResponse, aU as ListEscalationsOptions, aV as ListEscalationsResponse, ba as ListLabelContactsOptions, bb as ListLabelContactsResponse, bB as ListLabelConversationsOptions, bC as ListLabelConversationsResponse, c4 as ListLabelsIncludeOptions, c5 as ListLabelsOptions, c6 as ListLabelsResponse, co as ListMessagesIncludeOptions, cp as ListMessagesOptions, cq as ListMessagesResponse, cG as ListModelsOptions, cH as ListModelsResponse, c_ as ListSourcesOptions, c$ as ListSourcesResponse, d9 as ListUploadsOptions, da as ListUploadsResponse, dA as ListWebhookSubscriptionsOptions, dB as ListWebhookSubscriptionsResponse, ca as Message, cw as MessageEventType, cr as MessageID, cs as MessageRole, cu as MessageStatus, ct as MessageType, cv as MessageVisibility, dn as MessageWebhookEventType, ak as MetaWhatsappChannelGetBusinessProfileOptions, al as MetaWhatsappChannelGetBusinessProfileResponse, cx as Model, cI as ModelID, cJ as Note, cT as NoteID, O as Options, R as RequestFilterable, S as SortOptions, cX as Source, d0 as SourceID, dC as TestWebhookSubscriptionOptions, dD 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, bd as UpdateContactOptions, bc as UpdateContactPayload, be as UpdateContactResponse, bE as UpdateConversationOptions, bD as UpdateConversationPayload, bF as UpdateConversationResponse, c8 as UpdateLabelOptions, c7 as UpdateLabelPayload, c9 as UpdateLabelResponse, cV as UpdateNoteOptions, cU as UpdateNotePayload, cW as UpdateNoteResponse, d1 as Upload, db as UploadID, dc as User, df as UserID, dq as WebhookEventPayload, di as WebhookEventType, dr as WebhookResponse, ds as WebhookSubscription, dE as WebhookSubscriptionID, dp as WebhookSubscriptionWebhookEventType, C as default, dh as eventWebhookSchema } from './Client-P7zcj22n.js';
2
2
  import { KyResponse } from 'ky';
3
3
  import 'zod';
4
4
 
@@ -32,12 +32,12 @@ declare class SupportError extends Error {
32
32
  }
33
33
  interface ErrorResponse {
34
34
  trace?: string;
35
- errors: {
36
- status?: number;
37
- code?: string;
35
+ error: {
38
36
  title: string;
39
- message?: string;
40
- }[];
37
+ status: number;
38
+ type: string;
39
+ detail?: string;
40
+ };
41
41
  }
42
42
 
43
43
  /**
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-E275HCOS.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-BUKSCLYK.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.21",
3
+ "version": "0.18.23",
4
4
  "type": "module",
5
5
  "description": "JavaScript SDK for the Great Detail Support System",
6
6
  "author": "Great Detail Ltd <info@greatdetail.com>",