@great-detail/support-sdk 0.18.2 → 0.18.3

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.
@@ -1795,6 +1795,76 @@ declare class ConversationAPI {
1795
1795
  };
1796
1796
  }
1797
1797
 
1798
+ /**
1799
+ * Great Detail Support System.
1800
+ *
1801
+ * @copyright 2025 Great Detail Ltd
1802
+ * @author Great Detail Ltd <info@greatdetail.com>
1803
+ * @author Dom Webber <dom.webber@greatdetail.com>
1804
+ * @see https://greatdetail.com
1805
+ */
1806
+
1807
+ type EscalationID = `esc${string}` | (string & NonNullable<unknown>);
1808
+ type Escalation = {
1809
+ id: EscalationID;
1810
+ conversation: ConversationID;
1811
+ reason?: Nullable<string>;
1812
+ } & ResponseTimestamp;
1813
+
1814
+ /**
1815
+ * Great Detail Support System.
1816
+ *
1817
+ * @copyright 2025 Great Detail Ltd
1818
+ * @author Great Detail Ltd <info@greatdetail.com>
1819
+ * @author Dom Webber <dom.webber@greatdetail.com>
1820
+ * @see https://greatdetail.com
1821
+ */
1822
+
1823
+ type CreateEscalationPayload = {
1824
+ conversation: ConversationID;
1825
+ reason?: Nullable<string>;
1826
+ };
1827
+ interface CreateEscalationOptions {
1828
+ body: CreateEscalationPayload;
1829
+ request?: SendOptions;
1830
+ }
1831
+ type CreateEscalationResponse = {
1832
+ data: {
1833
+ escalation: Escalation;
1834
+ };
1835
+ };
1836
+
1837
+ /**
1838
+ * Great Detail Support System.
1839
+ *
1840
+ * @copyright 2025 Great Detail Ltd
1841
+ * @author Great Detail Ltd <info@greatdetail.com>
1842
+ * @author Dom Webber <dom.webber@greatdetail.com>
1843
+ * @see https://greatdetail.com
1844
+ */
1845
+
1846
+ interface ListEscalationsOptions {
1847
+ request?: SendOptions;
1848
+ }
1849
+ type ListEscalationsResponse = {
1850
+ data: {
1851
+ escalation: Escalation;
1852
+ }[];
1853
+ };
1854
+
1855
+ declare class EscalationAPI {
1856
+ protected _transport: FetchTransport;
1857
+ constructor(_transport: FetchTransport);
1858
+ list({ request }?: ListEscalationsOptions): {
1859
+ response: () => Promise<ky.KyResponse<ListEscalationsResponse>>;
1860
+ json: () => Promise<ListEscalationsResponse>;
1861
+ };
1862
+ create({ body, request }: CreateEscalationOptions): {
1863
+ response: () => Promise<ky.KyResponse<CreateEscalationResponse>>;
1864
+ json: () => Promise<CreateEscalationResponse>;
1865
+ };
1866
+ }
1867
+
1798
1868
  /**
1799
1869
  * Great Detail Support System.
1800
1870
  *
@@ -3172,6 +3242,7 @@ declare class Client {
3172
3242
  compositionSection: CompositionSectionAPI;
3173
3243
  contact: ContactAPI;
3174
3244
  conversation: ConversationAPI;
3245
+ escalation: EscalationAPI;
3175
3246
  label: LabelAPI;
3176
3247
  message: MessageAPI;
3177
3248
  model: ModelAPI;
@@ -3186,4 +3257,4 @@ declare class Client {
3186
3257
  static getBaseURL(): string;
3187
3258
  }
3188
3259
 
3189
- export { type UpdateBoilerplateContentPayload as $, type Account as A, type UpdateAccountConversationSettingsResponse as B, Client as C, type DeleteAccountAccessTokenPayload as D, type Action as E, type ActionID as F, type GetAccountOptions as G, type SortOptions as H, type ListActionsOptions as I, type ListActionsResponse as J, type BoilerplateContent as K, type ListAccountAccessTokensOptions as L, type BoilerplateContentID as M, type Nullable as N, type Options as O, type CreateBoilerplateContentPayload as P, type CreateBoilerplateContentOptions as Q, type ResponseTimestamp as R, type SendOptions as S, type CreateBoilerplateContentResponse as T, type UpdateAccountPayload as U, type GetBoilerplateContentOptions as V, type GetBoilerplateContentResponse as W, type ListBoilerplateCategoryBoilerplateContentsOptions as X, type ListBoilerplateCategoryBoilerplateContentsResponse as Y, type ListBoilerplateContentsOptions as Z, type ListBoilerplateContentsResponse as _, type ConversationID as a, type GetContactVCFOptions as a$, type UpdateBoilerplateContentOptions as a0, type UpdateBoilerplateContentResponse as a1, type BoilerplateCategory as a2, type BoilerplateCategoryID as a3, type CreateBoilerplateCategoryPayload as a4, type CreateBoilerplateCategoryOptions as a5, type CreateBoilerplateCategoryResponse as a6, type GetBoilerplateCategoryOptions as a7, type GetBoilerplateCategoryResponse as a8, type ListBoilerplateCategoriesIncludeOptions as a9, type UpdateChannelConversationSettingsOptions as aA, type UpdateChannelConversationSettingsResponse as aB, type CompositionSection as aC, type CompositionSectionID as aD, type CreateCompositionSectionPayload as aE, type CreateCompositionSectionOptions as aF, type CreateCompositionSectionResponse as aG, type GetCompositionSectionOptions as aH, type GetCompositionSectionResponse as aI, type ListChannelCompositionSectionsOptions as aJ, type ListChannelCompositionSectionsResponse as aK, type ListCompositionSectionsOptions as aL, type ListCompositionSectionsResponse as aM, type UpdateCompositionSectionPayload as aN, type UpdateCompositionSectionOptions as aO, type UpdateCompositionSectionResponse as aP, type Contact as aQ, type ContactID as aR, type ContactCustomMetadata as aS, type CreateContactPayload as aT, type CreateContactOptions as aU, type CreateContactResponse as aV, type DeleteContactOptions as aW, type DeleteContactResponse as aX, type GetContactIncludeOptions as aY, type GetContactOptions as aZ, type GetContactResponse as a_, type ListBoilerplateCategoriesOptions as aa, type ListBoilerplateCategoriesResponse as ab, type UpdateBoilerplateCategoryPayload as ac, type UpdateBoilerplateCategoryOptions as ad, type UpdateBoilerplateCategoryResponse as ae, type Channel as af, type ChannelID as ag, type CreateChannelPayload as ah, type CreateChannelOptions as ai, type CreateChannelResponse as aj, type GetChannelOptions as ak, type GetChannelResponse as al, type ListChannelsOptions as am, type ListChannelsResponse as an, type MetaWhatsappChannelGetBusinessProfileOptions as ao, type MetaWhatsappChannelGetBusinessProfileResponse as ap, type TwilioSendChannelSyncPayload as aq, type TwilioSendgridChannelSyncOptions as ar, type TwilioSendgridChannelSyncResponse as as, type UpdateChannelPayload as at, type UpdateChannelOptions as au, type UpdateChannelResponse as av, type ChannelConversationSettings as aw, type GetChannelConversationSettingsOptions as ax, type GetChannelConversationSettingsResponse as ay, type UpdateChannelConversationSettingsPayload as az, type RequestFilterable as b, type ListChannelMessagesResponse as b$, type ListContactsOptions as b0, type ListContactsResponse as b1, type ListLabelContactsOptions as b2, type ListLabelContactsResponse as b3, type UpdateContactPayload as b4, type UpdateContactOptions as b5, type UpdateContactResponse as b6, type Conversation as b7, type ConversationCustomMetadata as b8, type ActiveConversationStatus as b9, type CreateLabelOptions as bA, type CreateLabelResponse as bB, type DeleteLabelOptions as bC, type DeleteLabelResponse as bD, type GetLabelOptions as bE, type GetLabelResponse as bF, type LabelID as bG, type ListContactLabelsOptions as bH, type ListContactLabelsResponse as bI, type ListConversationLabelsOptions as bJ, type ListConversationLabelsResponse as bK, type ListLabelsIncludeOptions as bL, type ListLabelsOptions as bM, type ListLabelsResponse as bN, type UpdateLabelPayload as bO, type UpdateLabelOptions as bP, type UpdateLabelResponse as bQ, type Message as bR, type CreateMessagePayload as bS, type CreateMessageOptions as bT, type CreateMessageResponse as bU, type DeleteMessageOptions as bV, type DeleteMessageResponse as bW, type GetMessageOptions as bX, type GetMessageResponse as bY, type ListChannelMessagesIncludeOptions as bZ, type ListChannelMessagesOptions as b_, type ConcludedConversationStatus as ba, type ConversationStatus as bb, type CreateConversationPayload as bc, type CreateConversationOptions as bd, type CreateConversationResponse as be, type DeleteConversationOptions as bf, type DeleteConversationResponse as bg, type GetConversationIncludeOptions as bh, type GetConversationOptions as bi, type GetConversationResponse as bj, type ListChannelConversationsOptions as bk, type ListChannelConversationsResponse as bl, type ListContactConversationsOptions as bm, type ListContactConversationsResponse as bn, type ListConversationsIncludeOptions as bo, type FilterOptions as bp, type ListConversationOptions as bq, type ListConversationsResponse as br, type ListLabelConversationsOptions as bs, type ListLabelConversationsResponse as bt, type UpdateConversationPayload as bu, type UpdateConversationOptions as bv, type UpdateConversationResponse as bw, type ConversationSettings as bx, type Label as by, type CreateLabelPayload as bz, type Options$4 as c, type MessageWebhookEventType as c$, type ListConversationMessagesIncludeOptions as c0, type ListConversationMessagesOptions as c1, type ListConversationMessagesResponse as c2, type ListMessagesIncludeOptions as c3, type ListMessagesOptions as c4, type ListMessagesResponse as c5, type MessageID as c6, type MessageRole as c7, type MessageStatus as c8, type MessageEventType as c9, type Source as cA, type GetSourceOptions as cB, type GetSourceResponse as cC, type ListSourcesOptions as cD, type ListSourcesResponse as cE, type SourceID as cF, type Upload as cG, type CreateUploadOptions as cH, type CreateUploadResponse as cI, type DeleteUploadOptions as cJ, type DeleteUploadResponse as cK, type GetUploadOptions as cL, type GetUploadResponse as cM, type ListUploadsOptions as cN, type ListUploadsResponse as cO, type UploadID as cP, type User as cQ, type GetUserOptions as cR, type GetUserResponse as cS, type UserID as cT, type EventWebhookOptions as cU, eventWebhookSchema as cV, type WebhookEventType as cW, type AccountWebhookWebhookEventType as cX, type AccountAccessTokenWebhookEventType as cY, type ContactWebhookEventType as cZ, type ConversationWebhookEventType as c_, type Model as ca, type CreateCorrectionModelPayload as cb, type CreateCorrectionModelOptions as cc, type CreateCorrectionResponse as cd, type CreateResponseModelPayload as ce, type CreateResponseModelOptions as cf, type CreateResponseResponse as cg, type GetModelOptions as ch, type GetModelResponse as ci, type ListModelsOptions as cj, type ListModelsResponse as ck, type ModelID as cl, type Note as cm, type CreateNotePayload as cn, type CreateNoteOptions as co, type CreateNoteResponse as cp, type GetNoteOptions as cq, type GetNoteResponse as cr, type ListContactNotesOptions as cs, type ListContactNotesResponse as ct, type ListConversationNotesOptions as cu, type ListConversationNotesResponse as cv, type NoteID as cw, type UpdateNotePayload as cx, type UpdateNoteOptions as cy, type UpdateNoteResponse as cz, type CurrentAccountID as d, type WebhookSubscriptionWebhookEventType as d0, type WebhookEventPayload as d1, type WebhookResponse as d2, type WebhookSubscription as d3, type CreateWebhookSubscriptionPayload as d4, type CreateWebhookSubscriptionOptions as d5, type CreateWebhookSubscriptionResponse as d6, type DeleteWebhookSubscriptionOptions as d7, type DeleteWebhookSubscriptionResponse as d8, type GetWebhookSubscriptionOptions as d9, type GetWebhookSubscriptionResponse as da, type ListWebhookSubscriptionsOptions as db, type ListWebhookSubscriptionsResponse as dc, type TestWebhookSubscriptionOptions as dd, type TestWebhookSubscriptionResponse as de, type WebhookSubscriptionID as df, type AccountID as e, type CreateAccountPayload as f, type CreateAccountOptions as g, type CreateAccountResponse as h, type GetAccountResponse as i, type UpdateAccountOptions as j, type UpdateAccountResponse as k, type AccountAccessToken as l, type AccountAccessTokenID as m, type CreateAccountAccessTokenPayload as n, type CreateAccountAccessTokenOptions as o, type CreateAccountAccessTokenResponse as p, type DeleteAccountAccessTokenOptions as q, type DeleteAccountAccessTokenResponse as r, type GetAccountAccessTokenOptions as s, type GetAccountAccessTokenResponse as t, type ListAccountAccessTokensResponse as u, type AccountConversationSettings as v, type GetAccountConversationSettingsOptions as w, type GetAccountConversationSettingsResponse as x, type UpdateAccountConversationSettingsPayload as y, type UpdateAccountConversationSettingsOptions as z };
3260
+ 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 GetContactOptions 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 ListEscalationsOptions as aQ, type ListEscalationsResponse as aR, type Contact as aS, type ContactID as aT, type ContactCustomMetadata as aU, type CreateContactPayload as aV, type CreateContactOptions as aW, type CreateContactResponse as aX, type DeleteContactOptions as aY, type DeleteContactResponse as aZ, type GetContactIncludeOptions 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 GetMessageResponse as b$, type GetContactResponse as b0, type GetContactVCFOptions as b1, type ListContactsOptions as b2, type ListContactsResponse as b3, type ListLabelContactsOptions as b4, type ListLabelContactsResponse as b5, type UpdateContactPayload as b6, type UpdateContactOptions as b7, type UpdateContactResponse as b8, type Conversation as b9, type ConversationSettings as bA, type Label as bB, type CreateLabelPayload as bC, type CreateLabelOptions as bD, type CreateLabelResponse as bE, type DeleteLabelOptions as bF, type DeleteLabelResponse as bG, type GetLabelOptions as bH, type GetLabelResponse as bI, type LabelID as bJ, type ListContactLabelsOptions as bK, type ListContactLabelsResponse as bL, type ListConversationLabelsOptions as bM, type ListConversationLabelsResponse as bN, type ListLabelsIncludeOptions as bO, type ListLabelsOptions as bP, type ListLabelsResponse as bQ, type UpdateLabelPayload as bR, type UpdateLabelOptions as bS, type UpdateLabelResponse as bT, type Message as bU, type CreateMessagePayload as bV, type CreateMessageOptions as bW, type CreateMessageResponse as bX, type DeleteMessageOptions as bY, type DeleteMessageResponse as bZ, type GetMessageOptions as b_, type ConversationID as ba, type ConversationCustomMetadata as bb, type ActiveConversationStatus as bc, type ConcludedConversationStatus as bd, type ConversationStatus as be, type CreateConversationPayload as bf, type CreateConversationOptions as bg, type CreateConversationResponse as bh, type DeleteConversationOptions as bi, type DeleteConversationResponse as bj, type GetConversationIncludeOptions as bk, type GetConversationOptions as bl, type GetConversationResponse as bm, type ListChannelConversationsOptions as bn, type ListChannelConversationsResponse as bo, type ListContactConversationsOptions as bp, type ListContactConversationsResponse as bq, type ListConversationsIncludeOptions as br, type FilterOptions as bs, type ListConversationOptions as bt, type ListConversationsResponse as bu, type ListLabelConversationsOptions as bv, type ListLabelConversationsResponse as bw, type UpdateConversationPayload as bx, type UpdateConversationOptions as by, type UpdateConversationResponse as bz, type AccountID as c, type AccountAccessTokenWebhookEventType as c$, type ListChannelMessagesIncludeOptions as c0, type ListChannelMessagesOptions as c1, type ListChannelMessagesResponse as c2, type ListConversationMessagesIncludeOptions as c3, type ListConversationMessagesOptions as c4, type ListConversationMessagesResponse as c5, type ListMessagesIncludeOptions as c6, type ListMessagesOptions as c7, type ListMessagesResponse as c8, type MessageID as c9, type UpdateNotePayload as cA, type UpdateNoteOptions as cB, type UpdateNoteResponse as cC, type Source as cD, type GetSourceOptions as cE, type GetSourceResponse as cF, type ListSourcesOptions as cG, type ListSourcesResponse as cH, type SourceID as cI, type Upload as cJ, type CreateUploadOptions as cK, type CreateUploadResponse as cL, type DeleteUploadOptions as cM, type DeleteUploadResponse as cN, type GetUploadOptions as cO, type GetUploadResponse as cP, type ListUploadsOptions as cQ, type ListUploadsResponse as cR, type UploadID as cS, type User as cT, type GetUserOptions as cU, type GetUserResponse as cV, type UserID as cW, type EventWebhookOptions as cX, eventWebhookSchema as cY, type WebhookEventType as cZ, type AccountWebhookWebhookEventType as c_, type MessageRole as ca, type MessageStatus as cb, type MessageEventType as cc, type Model as cd, type CreateCorrectionModelPayload as ce, type CreateCorrectionModelOptions as cf, type CreateCorrectionResponse as cg, type CreateResponseModelPayload as ch, type CreateResponseModelOptions as ci, type CreateResponseResponse as cj, type GetModelOptions as ck, type GetModelResponse as cl, type ListModelsOptions as cm, type ListModelsResponse as cn, type ModelID as co, type Note as cp, type CreateNotePayload as cq, type CreateNoteOptions as cr, type CreateNoteResponse as cs, type GetNoteOptions as ct, type GetNoteResponse as cu, type ListContactNotesOptions as cv, type ListContactNotesResponse as cw, type ListConversationNotesOptions as cx, type ListConversationNotesResponse as cy, type NoteID as cz, type CreateAccountPayload as d, type ContactWebhookEventType as d0, type ConversationWebhookEventType as d1, type MessageWebhookEventType as d2, type WebhookSubscriptionWebhookEventType as d3, type WebhookEventPayload as d4, type WebhookResponse as d5, type WebhookSubscription as d6, type CreateWebhookSubscriptionPayload as d7, type CreateWebhookSubscriptionOptions as d8, type CreateWebhookSubscriptionResponse as d9, type DeleteWebhookSubscriptionOptions as da, type DeleteWebhookSubscriptionResponse as db, type GetWebhookSubscriptionOptions as dc, type GetWebhookSubscriptionResponse as dd, type ListWebhookSubscriptionsOptions as de, type ListWebhookSubscriptionsResponse as df, type TestWebhookSubscriptionOptions as dg, type TestWebhookSubscriptionResponse as dh, type WebhookSubscriptionID as di, 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 };
@@ -1795,6 +1795,76 @@ declare class ConversationAPI {
1795
1795
  };
1796
1796
  }
1797
1797
 
1798
+ /**
1799
+ * Great Detail Support System.
1800
+ *
1801
+ * @copyright 2025 Great Detail Ltd
1802
+ * @author Great Detail Ltd <info@greatdetail.com>
1803
+ * @author Dom Webber <dom.webber@greatdetail.com>
1804
+ * @see https://greatdetail.com
1805
+ */
1806
+
1807
+ type EscalationID = `esc${string}` | (string & NonNullable<unknown>);
1808
+ type Escalation = {
1809
+ id: EscalationID;
1810
+ conversation: ConversationID;
1811
+ reason?: Nullable<string>;
1812
+ } & ResponseTimestamp;
1813
+
1814
+ /**
1815
+ * Great Detail Support System.
1816
+ *
1817
+ * @copyright 2025 Great Detail Ltd
1818
+ * @author Great Detail Ltd <info@greatdetail.com>
1819
+ * @author Dom Webber <dom.webber@greatdetail.com>
1820
+ * @see https://greatdetail.com
1821
+ */
1822
+
1823
+ type CreateEscalationPayload = {
1824
+ conversation: ConversationID;
1825
+ reason?: Nullable<string>;
1826
+ };
1827
+ interface CreateEscalationOptions {
1828
+ body: CreateEscalationPayload;
1829
+ request?: SendOptions;
1830
+ }
1831
+ type CreateEscalationResponse = {
1832
+ data: {
1833
+ escalation: Escalation;
1834
+ };
1835
+ };
1836
+
1837
+ /**
1838
+ * Great Detail Support System.
1839
+ *
1840
+ * @copyright 2025 Great Detail Ltd
1841
+ * @author Great Detail Ltd <info@greatdetail.com>
1842
+ * @author Dom Webber <dom.webber@greatdetail.com>
1843
+ * @see https://greatdetail.com
1844
+ */
1845
+
1846
+ interface ListEscalationsOptions {
1847
+ request?: SendOptions;
1848
+ }
1849
+ type ListEscalationsResponse = {
1850
+ data: {
1851
+ escalation: Escalation;
1852
+ }[];
1853
+ };
1854
+
1855
+ declare class EscalationAPI {
1856
+ protected _transport: FetchTransport;
1857
+ constructor(_transport: FetchTransport);
1858
+ list({ request }?: ListEscalationsOptions): {
1859
+ response: () => Promise<ky.KyResponse<ListEscalationsResponse>>;
1860
+ json: () => Promise<ListEscalationsResponse>;
1861
+ };
1862
+ create({ body, request }: CreateEscalationOptions): {
1863
+ response: () => Promise<ky.KyResponse<CreateEscalationResponse>>;
1864
+ json: () => Promise<CreateEscalationResponse>;
1865
+ };
1866
+ }
1867
+
1798
1868
  /**
1799
1869
  * Great Detail Support System.
1800
1870
  *
@@ -3172,6 +3242,7 @@ declare class Client {
3172
3242
  compositionSection: CompositionSectionAPI;
3173
3243
  contact: ContactAPI;
3174
3244
  conversation: ConversationAPI;
3245
+ escalation: EscalationAPI;
3175
3246
  label: LabelAPI;
3176
3247
  message: MessageAPI;
3177
3248
  model: ModelAPI;
@@ -3186,4 +3257,4 @@ declare class Client {
3186
3257
  static getBaseURL(): string;
3187
3258
  }
3188
3259
 
3189
- export { type UpdateBoilerplateContentPayload as $, type Account as A, type UpdateAccountConversationSettingsResponse as B, Client as C, type DeleteAccountAccessTokenPayload as D, type Action as E, type ActionID as F, type GetAccountOptions as G, type SortOptions as H, type ListActionsOptions as I, type ListActionsResponse as J, type BoilerplateContent as K, type ListAccountAccessTokensOptions as L, type BoilerplateContentID as M, type Nullable as N, type Options as O, type CreateBoilerplateContentPayload as P, type CreateBoilerplateContentOptions as Q, type ResponseTimestamp as R, type SendOptions as S, type CreateBoilerplateContentResponse as T, type UpdateAccountPayload as U, type GetBoilerplateContentOptions as V, type GetBoilerplateContentResponse as W, type ListBoilerplateCategoryBoilerplateContentsOptions as X, type ListBoilerplateCategoryBoilerplateContentsResponse as Y, type ListBoilerplateContentsOptions as Z, type ListBoilerplateContentsResponse as _, type ConversationID as a, type GetContactVCFOptions as a$, type UpdateBoilerplateContentOptions as a0, type UpdateBoilerplateContentResponse as a1, type BoilerplateCategory as a2, type BoilerplateCategoryID as a3, type CreateBoilerplateCategoryPayload as a4, type CreateBoilerplateCategoryOptions as a5, type CreateBoilerplateCategoryResponse as a6, type GetBoilerplateCategoryOptions as a7, type GetBoilerplateCategoryResponse as a8, type ListBoilerplateCategoriesIncludeOptions as a9, type UpdateChannelConversationSettingsOptions as aA, type UpdateChannelConversationSettingsResponse as aB, type CompositionSection as aC, type CompositionSectionID as aD, type CreateCompositionSectionPayload as aE, type CreateCompositionSectionOptions as aF, type CreateCompositionSectionResponse as aG, type GetCompositionSectionOptions as aH, type GetCompositionSectionResponse as aI, type ListChannelCompositionSectionsOptions as aJ, type ListChannelCompositionSectionsResponse as aK, type ListCompositionSectionsOptions as aL, type ListCompositionSectionsResponse as aM, type UpdateCompositionSectionPayload as aN, type UpdateCompositionSectionOptions as aO, type UpdateCompositionSectionResponse as aP, type Contact as aQ, type ContactID as aR, type ContactCustomMetadata as aS, type CreateContactPayload as aT, type CreateContactOptions as aU, type CreateContactResponse as aV, type DeleteContactOptions as aW, type DeleteContactResponse as aX, type GetContactIncludeOptions as aY, type GetContactOptions as aZ, type GetContactResponse as a_, type ListBoilerplateCategoriesOptions as aa, type ListBoilerplateCategoriesResponse as ab, type UpdateBoilerplateCategoryPayload as ac, type UpdateBoilerplateCategoryOptions as ad, type UpdateBoilerplateCategoryResponse as ae, type Channel as af, type ChannelID as ag, type CreateChannelPayload as ah, type CreateChannelOptions as ai, type CreateChannelResponse as aj, type GetChannelOptions as ak, type GetChannelResponse as al, type ListChannelsOptions as am, type ListChannelsResponse as an, type MetaWhatsappChannelGetBusinessProfileOptions as ao, type MetaWhatsappChannelGetBusinessProfileResponse as ap, type TwilioSendChannelSyncPayload as aq, type TwilioSendgridChannelSyncOptions as ar, type TwilioSendgridChannelSyncResponse as as, type UpdateChannelPayload as at, type UpdateChannelOptions as au, type UpdateChannelResponse as av, type ChannelConversationSettings as aw, type GetChannelConversationSettingsOptions as ax, type GetChannelConversationSettingsResponse as ay, type UpdateChannelConversationSettingsPayload as az, type RequestFilterable as b, type ListChannelMessagesResponse as b$, type ListContactsOptions as b0, type ListContactsResponse as b1, type ListLabelContactsOptions as b2, type ListLabelContactsResponse as b3, type UpdateContactPayload as b4, type UpdateContactOptions as b5, type UpdateContactResponse as b6, type Conversation as b7, type ConversationCustomMetadata as b8, type ActiveConversationStatus as b9, type CreateLabelOptions as bA, type CreateLabelResponse as bB, type DeleteLabelOptions as bC, type DeleteLabelResponse as bD, type GetLabelOptions as bE, type GetLabelResponse as bF, type LabelID as bG, type ListContactLabelsOptions as bH, type ListContactLabelsResponse as bI, type ListConversationLabelsOptions as bJ, type ListConversationLabelsResponse as bK, type ListLabelsIncludeOptions as bL, type ListLabelsOptions as bM, type ListLabelsResponse as bN, type UpdateLabelPayload as bO, type UpdateLabelOptions as bP, type UpdateLabelResponse as bQ, type Message as bR, type CreateMessagePayload as bS, type CreateMessageOptions as bT, type CreateMessageResponse as bU, type DeleteMessageOptions as bV, type DeleteMessageResponse as bW, type GetMessageOptions as bX, type GetMessageResponse as bY, type ListChannelMessagesIncludeOptions as bZ, type ListChannelMessagesOptions as b_, type ConcludedConversationStatus as ba, type ConversationStatus as bb, type CreateConversationPayload as bc, type CreateConversationOptions as bd, type CreateConversationResponse as be, type DeleteConversationOptions as bf, type DeleteConversationResponse as bg, type GetConversationIncludeOptions as bh, type GetConversationOptions as bi, type GetConversationResponse as bj, type ListChannelConversationsOptions as bk, type ListChannelConversationsResponse as bl, type ListContactConversationsOptions as bm, type ListContactConversationsResponse as bn, type ListConversationsIncludeOptions as bo, type FilterOptions as bp, type ListConversationOptions as bq, type ListConversationsResponse as br, type ListLabelConversationsOptions as bs, type ListLabelConversationsResponse as bt, type UpdateConversationPayload as bu, type UpdateConversationOptions as bv, type UpdateConversationResponse as bw, type ConversationSettings as bx, type Label as by, type CreateLabelPayload as bz, type Options$4 as c, type MessageWebhookEventType as c$, type ListConversationMessagesIncludeOptions as c0, type ListConversationMessagesOptions as c1, type ListConversationMessagesResponse as c2, type ListMessagesIncludeOptions as c3, type ListMessagesOptions as c4, type ListMessagesResponse as c5, type MessageID as c6, type MessageRole as c7, type MessageStatus as c8, type MessageEventType as c9, type Source as cA, type GetSourceOptions as cB, type GetSourceResponse as cC, type ListSourcesOptions as cD, type ListSourcesResponse as cE, type SourceID as cF, type Upload as cG, type CreateUploadOptions as cH, type CreateUploadResponse as cI, type DeleteUploadOptions as cJ, type DeleteUploadResponse as cK, type GetUploadOptions as cL, type GetUploadResponse as cM, type ListUploadsOptions as cN, type ListUploadsResponse as cO, type UploadID as cP, type User as cQ, type GetUserOptions as cR, type GetUserResponse as cS, type UserID as cT, type EventWebhookOptions as cU, eventWebhookSchema as cV, type WebhookEventType as cW, type AccountWebhookWebhookEventType as cX, type AccountAccessTokenWebhookEventType as cY, type ContactWebhookEventType as cZ, type ConversationWebhookEventType as c_, type Model as ca, type CreateCorrectionModelPayload as cb, type CreateCorrectionModelOptions as cc, type CreateCorrectionResponse as cd, type CreateResponseModelPayload as ce, type CreateResponseModelOptions as cf, type CreateResponseResponse as cg, type GetModelOptions as ch, type GetModelResponse as ci, type ListModelsOptions as cj, type ListModelsResponse as ck, type ModelID as cl, type Note as cm, type CreateNotePayload as cn, type CreateNoteOptions as co, type CreateNoteResponse as cp, type GetNoteOptions as cq, type GetNoteResponse as cr, type ListContactNotesOptions as cs, type ListContactNotesResponse as ct, type ListConversationNotesOptions as cu, type ListConversationNotesResponse as cv, type NoteID as cw, type UpdateNotePayload as cx, type UpdateNoteOptions as cy, type UpdateNoteResponse as cz, type CurrentAccountID as d, type WebhookSubscriptionWebhookEventType as d0, type WebhookEventPayload as d1, type WebhookResponse as d2, type WebhookSubscription as d3, type CreateWebhookSubscriptionPayload as d4, type CreateWebhookSubscriptionOptions as d5, type CreateWebhookSubscriptionResponse as d6, type DeleteWebhookSubscriptionOptions as d7, type DeleteWebhookSubscriptionResponse as d8, type GetWebhookSubscriptionOptions as d9, type GetWebhookSubscriptionResponse as da, type ListWebhookSubscriptionsOptions as db, type ListWebhookSubscriptionsResponse as dc, type TestWebhookSubscriptionOptions as dd, type TestWebhookSubscriptionResponse as de, type WebhookSubscriptionID as df, type AccountID as e, type CreateAccountPayload as f, type CreateAccountOptions as g, type CreateAccountResponse as h, type GetAccountResponse as i, type UpdateAccountOptions as j, type UpdateAccountResponse as k, type AccountAccessToken as l, type AccountAccessTokenID as m, type CreateAccountAccessTokenPayload as n, type CreateAccountAccessTokenOptions as o, type CreateAccountAccessTokenResponse as p, type DeleteAccountAccessTokenOptions as q, type DeleteAccountAccessTokenResponse as r, type GetAccountAccessTokenOptions as s, type GetAccountAccessTokenResponse as t, type ListAccountAccessTokensResponse as u, type AccountConversationSettings as v, type GetAccountConversationSettingsOptions as w, type GetAccountConversationSettingsResponse as x, type UpdateAccountConversationSettingsPayload as y, type UpdateAccountConversationSettingsOptions as z };
3260
+ 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 GetContactOptions 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 ListEscalationsOptions as aQ, type ListEscalationsResponse as aR, type Contact as aS, type ContactID as aT, type ContactCustomMetadata as aU, type CreateContactPayload as aV, type CreateContactOptions as aW, type CreateContactResponse as aX, type DeleteContactOptions as aY, type DeleteContactResponse as aZ, type GetContactIncludeOptions 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 GetMessageResponse as b$, type GetContactResponse as b0, type GetContactVCFOptions as b1, type ListContactsOptions as b2, type ListContactsResponse as b3, type ListLabelContactsOptions as b4, type ListLabelContactsResponse as b5, type UpdateContactPayload as b6, type UpdateContactOptions as b7, type UpdateContactResponse as b8, type Conversation as b9, type ConversationSettings as bA, type Label as bB, type CreateLabelPayload as bC, type CreateLabelOptions as bD, type CreateLabelResponse as bE, type DeleteLabelOptions as bF, type DeleteLabelResponse as bG, type GetLabelOptions as bH, type GetLabelResponse as bI, type LabelID as bJ, type ListContactLabelsOptions as bK, type ListContactLabelsResponse as bL, type ListConversationLabelsOptions as bM, type ListConversationLabelsResponse as bN, type ListLabelsIncludeOptions as bO, type ListLabelsOptions as bP, type ListLabelsResponse as bQ, type UpdateLabelPayload as bR, type UpdateLabelOptions as bS, type UpdateLabelResponse as bT, type Message as bU, type CreateMessagePayload as bV, type CreateMessageOptions as bW, type CreateMessageResponse as bX, type DeleteMessageOptions as bY, type DeleteMessageResponse as bZ, type GetMessageOptions as b_, type ConversationID as ba, type ConversationCustomMetadata as bb, type ActiveConversationStatus as bc, type ConcludedConversationStatus as bd, type ConversationStatus as be, type CreateConversationPayload as bf, type CreateConversationOptions as bg, type CreateConversationResponse as bh, type DeleteConversationOptions as bi, type DeleteConversationResponse as bj, type GetConversationIncludeOptions as bk, type GetConversationOptions as bl, type GetConversationResponse as bm, type ListChannelConversationsOptions as bn, type ListChannelConversationsResponse as bo, type ListContactConversationsOptions as bp, type ListContactConversationsResponse as bq, type ListConversationsIncludeOptions as br, type FilterOptions as bs, type ListConversationOptions as bt, type ListConversationsResponse as bu, type ListLabelConversationsOptions as bv, type ListLabelConversationsResponse as bw, type UpdateConversationPayload as bx, type UpdateConversationOptions as by, type UpdateConversationResponse as bz, type AccountID as c, type AccountAccessTokenWebhookEventType as c$, type ListChannelMessagesIncludeOptions as c0, type ListChannelMessagesOptions as c1, type ListChannelMessagesResponse as c2, type ListConversationMessagesIncludeOptions as c3, type ListConversationMessagesOptions as c4, type ListConversationMessagesResponse as c5, type ListMessagesIncludeOptions as c6, type ListMessagesOptions as c7, type ListMessagesResponse as c8, type MessageID as c9, type UpdateNotePayload as cA, type UpdateNoteOptions as cB, type UpdateNoteResponse as cC, type Source as cD, type GetSourceOptions as cE, type GetSourceResponse as cF, type ListSourcesOptions as cG, type ListSourcesResponse as cH, type SourceID as cI, type Upload as cJ, type CreateUploadOptions as cK, type CreateUploadResponse as cL, type DeleteUploadOptions as cM, type DeleteUploadResponse as cN, type GetUploadOptions as cO, type GetUploadResponse as cP, type ListUploadsOptions as cQ, type ListUploadsResponse as cR, type UploadID as cS, type User as cT, type GetUserOptions as cU, type GetUserResponse as cV, type UserID as cW, type EventWebhookOptions as cX, eventWebhookSchema as cY, type WebhookEventType as cZ, type AccountWebhookWebhookEventType as c_, type MessageRole as ca, type MessageStatus as cb, type MessageEventType as cc, type Model as cd, type CreateCorrectionModelPayload as ce, type CreateCorrectionModelOptions as cf, type CreateCorrectionResponse as cg, type CreateResponseModelPayload as ch, type CreateResponseModelOptions as ci, type CreateResponseResponse as cj, type GetModelOptions as ck, type GetModelResponse as cl, type ListModelsOptions as cm, type ListModelsResponse as cn, type ModelID as co, type Note as cp, type CreateNotePayload as cq, type CreateNoteOptions as cr, type CreateNoteResponse as cs, type GetNoteOptions as ct, type GetNoteResponse as cu, type ListContactNotesOptions as cv, type ListContactNotesResponse as cw, type ListConversationNotesOptions as cx, type ListConversationNotesResponse as cy, type NoteID as cz, type CreateAccountPayload as d, type ContactWebhookEventType as d0, type ConversationWebhookEventType as d1, type MessageWebhookEventType as d2, type WebhookSubscriptionWebhookEventType as d3, type WebhookEventPayload as d4, type WebhookResponse as d5, type WebhookSubscription as d6, type CreateWebhookSubscriptionPayload as d7, type CreateWebhookSubscriptionOptions as d8, type CreateWebhookSubscriptionResponse as d9, type DeleteWebhookSubscriptionOptions as da, type DeleteWebhookSubscriptionResponse as db, type GetWebhookSubscriptionOptions as dc, type GetWebhookSubscriptionResponse as dd, type ListWebhookSubscriptionsOptions as de, type ListWebhookSubscriptionsResponse as df, type TestWebhookSubscriptionOptions as dg, type TestWebhookSubscriptionResponse as dh, type WebhookSubscriptionID as di, 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 };
@@ -0,0 +1 @@
1
+ var q=Object.defineProperty;var J=(n,t)=>{for(var e in t)q(n,e,{get:t[e],enumerable:!0})};var a=class{getHeaders(){return{}}};var x="SUPPORT_ACCESS_TOKEN",F="SUPPORT_KEY_NAME",W="SUPPORT_KEY_PASSWORD",w="SUPPORT_SIGNING_KEY",N="SUPPORT_BASE_URL";var c=class{name;#t;constructor({name:t=process.env[F],password:e=process.env[W]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var m=class{#t;constructor({token:t=process.env[x]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var Q="https://api.support.greatdetail.com",j={"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 H=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 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 v=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,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var O=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}list({query:t,limit:e,filter:o,include:s,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.limitQuery(e),...o?[["filter",o]]:[],...this._transport.includeQuery(s??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var _=class{constructor(t){this._transport=t}list({request:t={}}={}){return this._transport.send("v1/escalations",{...t,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/escalations",{...e,method:"POST",json:t})}};var T=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,include:o,request:s={}}={}){return this._transport.send("v1/labels",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByConversation(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var I=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}listByConversation(t,{limit:e,include:o,request:s={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:s={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o)]})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var 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 y=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=j;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var U=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 S=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 K from"is-network-error";import Y,{HTTPError as z}from"ky";var E=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Y.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let s of this.options.requestFilterables){let r=s.getHeaders();for(let[p,V]of Object.entries(r))o.headers.has(p)||o.headers.set(p,V)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,s]of Object.entries(t))s!==void 0&&e.push(["sort",s+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let o=this.client(t,e).catch(async s=>{throw K(s)?new Error("A network error occurred",{cause:s}):s instanceof z?new B(s.response,s):s});return{response:()=>o,json:async()=>(await o).json()}}};var D=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,request:e={}}){let o=new FormData;for(let s of t)o.append("file",s);return this._transport.send("v1/uploads",{...e,method:"POST",body:o})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var G=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 k=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}=H.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=Q;static PublicAuthentication=a;static BasicAuthentication=c;static BearerAuthentication=m;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;channelConversationSettings;compositionSection;contact;conversation;escalation;label;message;model;note;source;statistics;upload;user;webhook;webhookSubscription;constructor(t,{baseURL:e,...o}={}){this._transport=new E({requestFilterables:[new y,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 g(this._transport),this.contact=new v(this._transport),this.conversation=new O(this._transport),this.escalation=new _(this._transport),this.label=new T(this._transport),this.message=new I(this._transport),this.model=new L(this._transport),this.note=new A(this._transport),this.source=new U(this._transport),this.statistics=new S(this._transport),this.upload=new D(this._transport),this.user=new G(this._transport),this.webhook=new k(this._transport),this.webhookSubscription=new P(this._transport)}static getBaseURL(){return process.env[N]??this.DEFAULT_BASE_URL}};export{J as a,a as b,Q as c,B as d,H as e,M as f};
@@ -1 +1 @@
1
- import{b as j,f as F}from"./chunk-WIUEWWCB.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-MKJLSHH7.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 yt=Object.create;var B=Object.defineProperty;var It=Object.getOwnPropertyDescriptor;var _t=Object.getOwnPropertyNames;var Tt=Object.getPrototypeOf,Lt=Object.prototype.hasOwnProperty;var At=(s,t)=>{for(var e in t)B(s,e,{get:t[e],enumerable:!0})},at=(s,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of _t(t))!Lt.call(s,n)&&n!==e&&B(s,n,{get:()=>t[n],enumerable:!(o=It(t,n))||o.enumerable});return s};var pt=(s,t,e)=>(e=s!=null?yt(Tt(s)):{},at(t||!s||!s.__esModule?B(e,"default",{value:s,enumerable:!0}):e,s)),St=s=>at(B({},"__esModule",{value:!0}),s);var Et={};At(Et,{default:()=>Dt});module.exports=St(Et);var bt=require("commander");var p=class{getHeaders(){return{}}};var m=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/accounts",{...e,method:"POST",json:t})}};var d=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}delete(t,e,{body:o,request:n={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...n,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var l=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var u=class{constructor(t){this._transport=t}list({limit:t,sort:e,request:o={}}={}){return this._transport.send("v1/actions",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var ct="SUPPORT_ACCESS_TOKEN",mt="SUPPORT_KEY_NAME",dt="SUPPORT_KEY_PASSWORD",q="SUPPORT_SIGNING_KEY",lt="SUPPORT_BASE_URL";var h=class{name;#t;constructor({name:t=process.env[mt],password:e=process.env[dt]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var C=class{#t;constructor({token:t=process.env[ct]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var f=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var g=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByCategory=this.listByBoilerplateCategory;listByBoilerplateCategory(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t)+"/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var 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 b=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 ut="https://api.support.greatdetail.com",ht={"X-Powered-By":"GDSupport/JavaScript"};var v=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,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}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),...o?[["filter",o]]:[],...this._transport.includeQuery(n??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var I=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 _=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}listByConversation(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o)]})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var T=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 L=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 A=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 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 n=[];if(e){let r=Array.isArray(e)?e:[e];for(let c of r)n.push(["category",c])}return t!==void 0&&n.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:n})}};var U=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 Ct=pt(require("is-network-error"),1),W=pt(require("ky"),1);var M=class extends Error{constructor(e,o){super("Support Error",{cause:o});this.response=e}};var D=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=W.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let n of this.options.requestFilterables){let r=n.getHeaders();for(let[c,vt]of Object.entries(r))o.headers.has(c)||o.headers.set(c,vt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,n]of Object.entries(t))n!==void 0&&e.push(["sort",n+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let o=this.client(t,e).catch(async n=>{throw(0,Ct.default)(n)?new Error("A network error occurred",{cause:n}):n instanceof W.HTTPError?new M(n.response,n):n});return{response:()=>o,json:async()=>(await o).json()}}};var E=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,request:e={}}){let o=new FormData;for(let n of t)o.append("file",n);return this._transport.send("v1/uploads",{...e,method:"POST",body:o})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var G=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"),ft=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[q],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."+q);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}=ft.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 k=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 x=class s{static DEFAULT_BASE_URL=ut;static PublicAuthentication=p;static BasicAuthentication=h;static BearerAuthentication=C;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;channelConversationSettings;compositionSection;contact;conversation;label;message;model;note;source;statistics;upload;user;webhook;webhookSubscription;constructor(t,{baseURL:e,...o}={}){this._transport=new D({requestFilterables:[new A,t],...o,baseURL:e?.toString()??s.getBaseURL()}),this.account=new m(this._transport),this.accountAccessToken=new d(this._transport),this.accountConversationSettings=new l(this._transport),this.action=new u(this._transport),this.boilerplateCategory=new f(this._transport),this.boilerplateContent=new g(this._transport),this.channel=new R(this._transport),this.channelConversationSettings=new O(this._transport),this.compositionSection=new b(this._transport),this.contact=new v(this._transport),this.conversation=new y(this._transport),this.label=new I(this._transport),this.message=new _(this._transport),this.model=new T(this._transport),this.note=new L(this._transport),this.source=new S(this._transport),this.statistics=new U(this._transport),this.upload=new E(this._transport),this.user=new G(this._transport),this.webhook=new w(this._transport),this.webhookSubscription=new k(this._transport)}static getBaseURL(){return process.env[lt]??this.DEFAULT_BASE_URL}};var K=require("commander"),gt=require("ora");function Y({client:s,ora:t}){let e=new K.Command("actions").description("Actions");return e.addCommand(new K.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 z=require("commander"),Rt=require("ora");function J({client:s,ora:t}){let e=new z.Command("channels").description("Channels");return e.addCommand(new z.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 P=require("commander"),j=require("ora");function $({client:s,ora:t}){let e=new P.Command("contacts").description("Contacts");return e.addCommand(new P.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async o=>{let n=await(0,j.oraPromise)(()=>s.contact.get(o).json(),{...t,text:"Finding contact"});console.log(n)})),e.addCommand(new P.Command("list").description("List contacts").action(async()=>{let o=await(0,j.oraPromise)(()=>s.contact.list().json(),{...t,text:"Finding contacts"});console.log(o)})),e.addCommand(new P.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async o=>{let n=await(0,j.oraPromise)(()=>s.contact.getVCF(o).response(),{...t,text:"Exporting contact"});console.log(n)})),e}var N=require("commander"),X=require("ora");function Z({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,X.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,X.oraPromise)(()=>s.conversation.list().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var F=require("commander"),Q=require("ora");function tt({client:s,ora:t}){let e=new F.Command("labels").description("Labels");return e.addCommand(new F.Command("get").description("Find label").argument("<label>","Label ID").action(async o=>{let n=await(0,Q.oraPromise)(()=>s.label.get(o).json(),{...t,text:"Finding label"});console.log(n)})),e.addCommand(new F.Command("list").description("List labels").action(async()=>{let o=await(0,Q.oraPromise)(()=>s.label.list().json(),{...t,text:"Finding labels"});console.log(o)})),e.addCommand(new F.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async o=>{let n=await(0,Q.oraPromise)(()=>s.conversation.listByLabel(o).json(),{...t,text:"Finding conversations"});console.log(n)})),e}var et=require("commander"),Ot=require("ora");function ot({client:s,ora:t}){let e=new et.Command("messages").description("Messages");return e.addCommand(new et.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 H=require("commander"),st=require("ora");function nt({client:s,ora:t}){let e=new H.Command("models").description("Models");return e.addCommand(new H.Command("get").description("Find model").argument("<model>","Model ID").action(async o=>{let n=await(0,st.oraPromise)(()=>s.model.get(o).json(),{...t,text:"Finding model"});console.log(n)})),e.addCommand(new H.Command("list").description("List models").action(async()=>{let o=await(0,st.oraPromise)(()=>s.model.list().json(),{...t,text:"Finding models"});console.log(o)})),e}var V=require("commander"),rt=require("ora");function it({client:s,ora:t}){let e=new V.Command("sources").description("Sources");return e.addCommand(new V.Command("get").description("Find source").argument("<source>","Source ID").action(async o=>{let n=await(0,rt.oraPromise)(()=>s.source.get(o).json(),{...t,text:"Finding source"});console.log(n)})),e.addCommand(new V.Command("list").description("List sources").action(async()=>{let o=await(0,rt.oraPromise)(()=>s.source.list().json(),{...t,text:"Finding sources"});console.log(o)})),e}var a={ora:{spinner:"simpleDotsScrolling"},client:new x(new p)},Ut=new bt.Command("gds").description("Great Detail Support System").addCommand(Y(a)).addCommand(J(a)).addCommand($(a)).addCommand(Z(a)).addCommand(tt(a)).addCommand(ot(a)).addCommand(nt(a)).addCommand(it(a)),Dt=Ut;
1
+ "use strict";var It=Object.create;var M=Object.defineProperty;var _t=Object.getOwnPropertyDescriptor;var Tt=Object.getOwnPropertyNames;var Lt=Object.getPrototypeOf,At=Object.prototype.hasOwnProperty;var St=(s,t)=>{for(var e in t)M(s,e,{get:t[e],enumerable:!0})},pt=(s,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Tt(t))!At.call(s,n)&&n!==e&&M(s,n,{get:()=>t[n],enumerable:!(o=_t(t,n))||o.enumerable});return s};var ct=(s,t,e)=>(e=s!=null?It(Lt(s)):{},pt(t||!s||!s.__esModule?M(e,"default",{value:s,enumerable:!0}):e,s)),Ut=s=>pt(M({},"__esModule",{value:!0}),s);var Gt={};St(Gt,{default:()=>Et});module.exports=Ut(Gt);var vt=require("commander");var p=class{getHeaders(){return{}}};var m=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/accounts",{...e,method:"POST",json:t})}};var d=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}delete(t,e,{body:o,request:n={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...n,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var l=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var u=class{constructor(t){this._transport=t}list({limit:t,sort:e,request:o={}}={}){return this._transport.send("v1/actions",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var mt="SUPPORT_ACCESS_TOKEN",dt="SUPPORT_KEY_NAME",lt="SUPPORT_KEY_PASSWORD",K="SUPPORT_SIGNING_KEY",ut="SUPPORT_BASE_URL";var h=class{name;#t;constructor({name:t=process.env[dt],password:e=process.env[lt]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var C=class{#t;constructor({token:t=process.env[mt]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var f=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var g=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByCategory=this.listByBoilerplateCategory;listByBoilerplateCategory(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t)+"/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var 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 b=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",Ct={"X-Powered-By":"GDSupport/JavaScript"};var v=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,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}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),...o?[["filter",o]]:[],...this._transport.includeQuery(n??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var I=class{constructor(t){this._transport=t}list({request:t={}}={}){return this._transport.send("v1/escalations",{...t,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/escalations",{...e,method:"POST",json:t})}};var _=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,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}listByConversation(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o)]})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var 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 S=class s{constructor(t=s.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Ct;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var U=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}list({featured:t,category:e,request:o={}}={}){let n=[];if(e){let r=Array.isArray(e)?e:[e];for(let c of r)n.push(["category",c])}return t!==void 0&&n.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:n})}};var D=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};var ft=ct(require("is-network-error"),1),j=ct(require("ky"),1);var W=class extends Error{constructor(e,o){super("Support Error",{cause:o});this.response=e}};var E=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=j.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let n of this.options.requestFilterables){let r=n.getHeaders();for(let[c,yt]of Object.entries(r))o.headers.has(c)||o.headers.set(c,yt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,n]of Object.entries(t))n!==void 0&&e.push(["sort",n+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let o=this.client(t,e).catch(async n=>{throw(0,ft.default)(n)?new Error("A network error occurred",{cause:n}):n instanceof j.HTTPError?new W(n.response,n):n});return{response:()=>o,json:async()=>(await o).json()}}};var G=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,request:e={}}){let o=new FormData;for(let n of t)o.append("file",n);return this._transport.send("v1/uploads",{...e,method:"POST",body:o})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var w=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var i=require("zod"),gt=i.z.object({data:i.z.object({event:i.z.object({id:i.z.string(),type:i.z.string(),payload:i.z.record(i.z.string()),createdAt:i.z.string().datetime()})})});var k=class{constructor(t){this._transport=t}async event({key:t=process.env[K],maxSignatures:e=3,request:o}){let n=o.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+K);if(!n)throw new Error("Missing signature header");if(!this._verifySignature(t,o.body,Array.isArray(n)?n.slice(0,e):[n]))throw new Error("Untrusted signature")}let{data:r}=gt.parse(o.body);return{event:r.event}}async _verifySignature(t,e,o){let n=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let r of o)if(await crypto.subtle.verify("HMAC",n,new TextEncoder().encode(atob(r)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var x=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/webhooks/subscriptions",{...t,method:"GET"})}test(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t)+"/test",{...e,method:"POST"})}create({body:t,request:e={}}){return this._transport.send("v1/webhooks/subscriptions",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var P=class s{static DEFAULT_BASE_URL=ht;static PublicAuthentication=p;static BasicAuthentication=h;static BearerAuthentication=C;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;channelConversationSettings;compositionSection;contact;conversation;escalation;label;message;model;note;source;statistics;upload;user;webhook;webhookSubscription;constructor(t,{baseURL:e,...o}={}){this._transport=new E({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 g(this._transport),this.channel=new R(this._transport),this.channelConversationSettings=new O(this._transport),this.compositionSection=new b(this._transport),this.contact=new v(this._transport),this.conversation=new y(this._transport),this.escalation=new I(this._transport),this.label=new _(this._transport),this.message=new T(this._transport),this.model=new L(this._transport),this.note=new A(this._transport),this.source=new U(this._transport),this.statistics=new D(this._transport),this.upload=new G(this._transport),this.user=new w(this._transport),this.webhook=new k(this._transport),this.webhookSubscription=new x(this._transport)}static getBaseURL(){return process.env[ut]??this.DEFAULT_BASE_URL}};var Y=require("commander"),Rt=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,Rt.oraPromise)(()=>s.action.list().json(),{...t,text:"Finding actions"});console.log(o)})),e}var J=require("commander"),Ot=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,Ot.oraPromise)(()=>s.channel.list().json(),{...t,text:"Finding channels"});console.log(o)})),e}var F=require("commander"),N=require("ora");function X({client:s,ora:t}){let e=new F.Command("contacts").description("Contacts");return e.addCommand(new F.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 F.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 F.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async o=>{let n=await(0,N.oraPromise)(()=>s.contact.getVCF(o).response(),{...t,text:"Exporting contact"});console.log(n)})),e}var Q=require("commander"),Z=require("ora");function tt({client:s,ora:t}){let e=new Q.Command("conversations").description("Conversations");return e.addCommand(new Q.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async o=>{let n=await(0,Z.oraPromise)(()=>s.conversation.get(o).json(),{...t,text:"Finding conversation"});console.log(n)})),e.addCommand(new Q.Command("list").description("List conversations").action(async()=>{let o=await(0,Z.oraPromise)(()=>s.conversation.list().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var B=require("commander"),H=require("ora");function et({client:s,ora:t}){let e=new B.Command("labels").description("Labels");return e.addCommand(new B.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 B.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 B.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"),bt=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,bt.oraPromise)(()=>s.message.list().json(),{...t,text:"Finding messages"});console.log(o)})),e}var V=require("commander"),nt=require("ora");function rt({client:s,ora:t}){let e=new V.Command("models").description("Models");return e.addCommand(new V.Command("get").description("Find model").argument("<model>","Model ID").action(async o=>{let n=await(0,nt.oraPromise)(()=>s.model.get(o).json(),{...t,text:"Finding model"});console.log(n)})),e.addCommand(new V.Command("list").description("List models").action(async()=>{let o=await(0,nt.oraPromise)(()=>s.model.list().json(),{...t,text:"Finding models"});console.log(o)})),e}var q=require("commander"),it=require("ora");function at({client:s,ora:t}){let e=new q.Command("sources").description("Sources");return e.addCommand(new q.Command("get").description("Find source").argument("<source>","Source ID").action(async o=>{let n=await(0,it.oraPromise)(()=>s.source.get(o).json(),{...t,text:"Finding source"});console.log(n)})),e.addCommand(new q.Command("list").description("List sources").action(async()=>{let o=await(0,it.oraPromise)(()=>s.source.list().json(),{...t,text:"Finding sources"});console.log(o)})),e}var a={ora:{spinner:"simpleDotsScrolling"},client:new P(new p)},Dt=new vt.Command("gds").description("Great Detail Support System").addCommand(z(a)).addCommand($(a)).addCommand(X(a)).addCommand(tt(a)).addCommand(et(a)).addCommand(st(a)).addCommand(rt(a)).addCommand(at(a)),Et=Dt;
@@ -1,5 +1,5 @@
1
1
  import { Command } from 'commander';
2
- import { C as Client } from '../Client-DZnura3y.cjs';
2
+ import { C as Client } from '../Client-C5zIfdYu.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-DZnura3y.js';
2
+ import { C as Client } from '../Client-C5zIfdYu.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-NPU3T2UQ.js";import"../chunk-WIUEWWCB.js";export{a as default};
1
+ import{a}from"../chunk-ORNBEVRV.js";import"../chunk-MKJLSHH7.js";export{a as default};
package/dist/cli.cjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var yt=Object.create;var it=Object.defineProperty;var It=Object.getOwnPropertyDescriptor;var _t=Object.getOwnPropertyNames;var Tt=Object.getPrototypeOf,Lt=Object.prototype.hasOwnProperty;var At=(s,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of _t(t))!Lt.call(s,n)&&n!==e&&it(s,n,{get:()=>t[n],enumerable:!(o=It(t,n))||o.enumerable});return s};var at=(s,t,e)=>(e=s!=null?yt(Tt(s)):{},At(t||!s||!s.__esModule?it(e,"default",{value:s,enumerable:!0}):e,s));var Ot=require("commander");var p=class{getHeaders(){return{}}};var m=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/accounts",{...e,method:"POST",json:t})}};var d=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}delete(t,e,{body:o,request:n={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...n,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var l=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var u=class{constructor(t){this._transport=t}list({limit:t,sort:e,request:o={}}={}){return this._transport.send("v1/actions",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var pt="SUPPORT_ACCESS_TOKEN",ct="SUPPORT_KEY_NAME",mt="SUPPORT_KEY_PASSWORD",V="SUPPORT_SIGNING_KEY",dt="SUPPORT_BASE_URL";var h=class{name;#t;constructor({name:t=process.env[ct],password:e=process.env[mt]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var C=class{#t;constructor({token:t=process.env[pt]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var f=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var g=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByCategory=this.listByBoilerplateCategory;listByBoilerplateCategory(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t)+"/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var 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 b=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 lt="https://api.support.greatdetail.com",ut={"X-Powered-By":"GDSupport/JavaScript"};var v=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,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}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),...o?[["filter",o]]:[],...this._transport.includeQuery(n??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var I=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 _=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}listByConversation(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o)]})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var T=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 L=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 A=class s{constructor(t=s.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=ut;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 n=[];if(e){let r=Array.isArray(e)?e:[e];for(let c of r)n.push(["category",c])}return t!==void 0&&n.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:n})}};var U=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 ht=at(require("is-network-error"),1),M=at(require("ky"),1);var B=class extends Error{constructor(e,o){super("Support Error",{cause:o});this.response=e}};var D=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=M.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let n of this.options.requestFilterables){let r=n.getHeaders();for(let[c,vt]of Object.entries(r))o.headers.has(c)||o.headers.set(c,vt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,n]of Object.entries(t))n!==void 0&&e.push(["sort",n+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let o=this.client(t,e).catch(async n=>{throw(0,ht.default)(n)?new Error("A network error occurred",{cause:n}):n instanceof M.HTTPError?new B(n.response,n):n});return{response:()=>o,json:async()=>(await o).json()}}};var E=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,request:e={}}){let o=new FormData;for(let n of t)o.append("file",n);return this._transport.send("v1/uploads",{...e,method:"POST",body:o})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var G=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"),Ct=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[V],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."+V);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}=Ct.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 k=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 x=class s{static DEFAULT_BASE_URL=lt;static PublicAuthentication=p;static BasicAuthentication=h;static BearerAuthentication=C;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;channelConversationSettings;compositionSection;contact;conversation;label;message;model;note;source;statistics;upload;user;webhook;webhookSubscription;constructor(t,{baseURL:e,...o}={}){this._transport=new D({requestFilterables:[new A,t],...o,baseURL:e?.toString()??s.getBaseURL()}),this.account=new m(this._transport),this.accountAccessToken=new d(this._transport),this.accountConversationSettings=new l(this._transport),this.action=new u(this._transport),this.boilerplateCategory=new f(this._transport),this.boilerplateContent=new g(this._transport),this.channel=new R(this._transport),this.channelConversationSettings=new O(this._transport),this.compositionSection=new b(this._transport),this.contact=new v(this._transport),this.conversation=new y(this._transport),this.label=new I(this._transport),this.message=new _(this._transport),this.model=new T(this._transport),this.note=new L(this._transport),this.source=new S(this._transport),this.statistics=new U(this._transport),this.upload=new E(this._transport),this.user=new G(this._transport),this.webhook=new w(this._transport),this.webhookSubscription=new k(this._transport)}static getBaseURL(){return process.env[dt]??this.DEFAULT_BASE_URL}};var q=require("commander"),ft=require("ora");function K({client:s,ora:t}){let e=new q.Command("actions").description("Actions");return e.addCommand(new q.Command("list").description("List actions").action(async()=>{let o=await(0,ft.oraPromise)(()=>s.action.list().json(),{...t,text:"Finding actions"});console.log(o)})),e}var Y=require("commander"),gt=require("ora");function z({client:s,ora:t}){let e=new Y.Command("channels").description("Channels");return e.addCommand(new Y.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 P=require("commander"),W=require("ora");function J({client:s,ora:t}){let e=new P.Command("contacts").description("Contacts");return e.addCommand(new P.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async o=>{let n=await(0,W.oraPromise)(()=>s.contact.get(o).json(),{...t,text:"Finding contact"});console.log(n)})),e.addCommand(new P.Command("list").description("List contacts").action(async()=>{let o=await(0,W.oraPromise)(()=>s.contact.list().json(),{...t,text:"Finding contacts"});console.log(o)})),e.addCommand(new P.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async o=>{let n=await(0,W.oraPromise)(()=>s.contact.getVCF(o).response(),{...t,text:"Exporting contact"});console.log(n)})),e}var j=require("commander"),$=require("ora");function X({client:s,ora:t}){let e=new j.Command("conversations").description("Conversations");return e.addCommand(new j.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async o=>{let n=await(0,$.oraPromise)(()=>s.conversation.get(o).json(),{...t,text:"Finding conversation"});console.log(n)})),e.addCommand(new j.Command("list").description("List conversations").action(async()=>{let o=await(0,$.oraPromise)(()=>s.conversation.list().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var F=require("commander"),N=require("ora");function Z({client:s,ora:t}){let e=new F.Command("labels").description("Labels");return e.addCommand(new F.Command("get").description("Find label").argument("<label>","Label ID").action(async o=>{let n=await(0,N.oraPromise)(()=>s.label.get(o).json(),{...t,text:"Finding label"});console.log(n)})),e.addCommand(new F.Command("list").description("List labels").action(async()=>{let o=await(0,N.oraPromise)(()=>s.label.list().json(),{...t,text:"Finding labels"});console.log(o)})),e.addCommand(new F.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async o=>{let n=await(0,N.oraPromise)(()=>s.conversation.listByLabel(o).json(),{...t,text:"Finding conversations"});console.log(n)})),e}var tt=require("commander"),Rt=require("ora");function et({client:s,ora:t}){let e=new tt.Command("messages").description("Messages");return e.addCommand(new tt.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 Q=require("commander"),ot=require("ora");function st({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,ot.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,ot.oraPromise)(()=>s.model.list().json(),{...t,text:"Finding models"});console.log(o)})),e}var H=require("commander"),nt=require("ora");function rt({client:s,ora:t}){let e=new H.Command("sources").description("Sources");return e.addCommand(new H.Command("get").description("Find source").argument("<source>","Source ID").action(async o=>{let n=await(0,nt.oraPromise)(()=>s.source.get(o).json(),{...t,text:"Finding source"});console.log(n)})),e.addCommand(new H.Command("list").description("List sources").action(async()=>{let o=await(0,nt.oraPromise)(()=>s.source.list().json(),{...t,text:"Finding sources"});console.log(o)})),e}var a={ora:{spinner:"simpleDotsScrolling"},client:new x(new p)},St=new Ot.Command("gds").description("Great Detail Support System").addCommand(K(a)).addCommand(z(a)).addCommand(J(a)).addCommand(X(a)).addCommand(Z(a)).addCommand(et(a)).addCommand(st(a)).addCommand(rt(a)),bt=St;bt.parseAsync(process.argv);
2
+ "use strict";var It=Object.create;var at=Object.defineProperty;var _t=Object.getOwnPropertyDescriptor;var Tt=Object.getOwnPropertyNames;var Lt=Object.getPrototypeOf,At=Object.prototype.hasOwnProperty;var St=(s,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Tt(t))!At.call(s,n)&&n!==e&&at(s,n,{get:()=>t[n],enumerable:!(o=_t(t,n))||o.enumerable});return s};var pt=(s,t,e)=>(e=s!=null?It(Lt(s)):{},St(t||!s||!s.__esModule?at(e,"default",{value:s,enumerable:!0}):e,s));var bt=require("commander");var p=class{getHeaders(){return{}}};var m=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/accounts",{...e,method:"POST",json:t})}};var d=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}delete(t,e,{body:o,request:n={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...n,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var l=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var u=class{constructor(t){this._transport=t}list({limit:t,sort:e,request:o={}}={}){return this._transport.send("v1/actions",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var ct="SUPPORT_ACCESS_TOKEN",mt="SUPPORT_KEY_NAME",dt="SUPPORT_KEY_PASSWORD",q="SUPPORT_SIGNING_KEY",lt="SUPPORT_BASE_URL";var h=class{name;#t;constructor({name:t=process.env[mt],password:e=process.env[dt]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var C=class{#t;constructor({token:t=process.env[ct]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var f=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var g=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByCategory=this.listByBoilerplateCategory;listByBoilerplateCategory(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t)+"/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var 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 b=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 ut="https://api.support.greatdetail.com",ht={"X-Powered-By":"GDSupport/JavaScript"};var v=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,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}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),...o?[["filter",o]]:[],...this._transport.includeQuery(n??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var I=class{constructor(t){this._transport=t}list({request:t={}}={}){return this._transport.send("v1/escalations",{...t,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/escalations",{...e,method:"POST",json:t})}};var _=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,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}listByConversation(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o)]})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var 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 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 U=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}list({featured:t,category:e,request:o={}}={}){let n=[];if(e){let r=Array.isArray(e)?e:[e];for(let c of r)n.push(["category",c])}return t!==void 0&&n.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:n})}};var D=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};var Ct=pt(require("is-network-error"),1),W=pt(require("ky"),1);var M=class extends Error{constructor(e,o){super("Support Error",{cause:o});this.response=e}};var E=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=W.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let n of this.options.requestFilterables){let r=n.getHeaders();for(let[c,yt]of Object.entries(r))o.headers.has(c)||o.headers.set(c,yt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,n]of Object.entries(t))n!==void 0&&e.push(["sort",n+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let o=this.client(t,e).catch(async n=>{throw(0,Ct.default)(n)?new Error("A network error occurred",{cause:n}):n instanceof W.HTTPError?new M(n.response,n):n});return{response:()=>o,json:async()=>(await o).json()}}};var G=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,request:e={}}){let o=new FormData;for(let n of t)o.append("file",n);return this._transport.send("v1/uploads",{...e,method:"POST",body:o})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var w=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/users/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var i=require("zod"),ft=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 k=class{constructor(t){this._transport=t}async event({key:t=process.env[q],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."+q);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}=ft.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=ut;static PublicAuthentication=p;static BasicAuthentication=h;static BearerAuthentication=C;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;channelConversationSettings;compositionSection;contact;conversation;escalation;label;message;model;note;source;statistics;upload;user;webhook;webhookSubscription;constructor(t,{baseURL:e,...o}={}){this._transport=new E({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 g(this._transport),this.channel=new R(this._transport),this.channelConversationSettings=new O(this._transport),this.compositionSection=new b(this._transport),this.contact=new v(this._transport),this.conversation=new y(this._transport),this.escalation=new I(this._transport),this.label=new _(this._transport),this.message=new T(this._transport),this.model=new L(this._transport),this.note=new A(this._transport),this.source=new U(this._transport),this.statistics=new D(this._transport),this.upload=new G(this._transport),this.user=new w(this._transport),this.webhook=new k(this._transport),this.webhookSubscription=new x(this._transport)}static getBaseURL(){return process.env[lt]??this.DEFAULT_BASE_URL}};var K=require("commander"),gt=require("ora");function Y({client:s,ora:t}){let e=new K.Command("actions").description("Actions");return e.addCommand(new K.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 z=require("commander"),Rt=require("ora");function J({client:s,ora:t}){let e=new z.Command("channels").description("Channels");return e.addCommand(new z.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 F=require("commander"),j=require("ora");function $({client:s,ora:t}){let e=new F.Command("contacts").description("Contacts");return e.addCommand(new F.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async o=>{let n=await(0,j.oraPromise)(()=>s.contact.get(o).json(),{...t,text:"Finding contact"});console.log(n)})),e.addCommand(new F.Command("list").description("List contacts").action(async()=>{let o=await(0,j.oraPromise)(()=>s.contact.list().json(),{...t,text:"Finding contacts"});console.log(o)})),e.addCommand(new F.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async o=>{let n=await(0,j.oraPromise)(()=>s.contact.getVCF(o).response(),{...t,text:"Exporting contact"});console.log(n)})),e}var N=require("commander"),X=require("ora");function Z({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,X.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,X.oraPromise)(()=>s.conversation.list().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var B=require("commander"),Q=require("ora");function tt({client:s,ora:t}){let e=new B.Command("labels").description("Labels");return e.addCommand(new B.Command("get").description("Find label").argument("<label>","Label ID").action(async o=>{let n=await(0,Q.oraPromise)(()=>s.label.get(o).json(),{...t,text:"Finding label"});console.log(n)})),e.addCommand(new B.Command("list").description("List labels").action(async()=>{let o=await(0,Q.oraPromise)(()=>s.label.list().json(),{...t,text:"Finding labels"});console.log(o)})),e.addCommand(new B.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async o=>{let n=await(0,Q.oraPromise)(()=>s.conversation.listByLabel(o).json(),{...t,text:"Finding conversations"});console.log(n)})),e}var et=require("commander"),Ot=require("ora");function ot({client:s,ora:t}){let e=new et.Command("messages").description("Messages");return e.addCommand(new et.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 H=require("commander"),st=require("ora");function nt({client:s,ora:t}){let e=new H.Command("models").description("Models");return e.addCommand(new H.Command("get").description("Find model").argument("<model>","Model ID").action(async o=>{let n=await(0,st.oraPromise)(()=>s.model.get(o).json(),{...t,text:"Finding model"});console.log(n)})),e.addCommand(new H.Command("list").description("List models").action(async()=>{let o=await(0,st.oraPromise)(()=>s.model.list().json(),{...t,text:"Finding models"});console.log(o)})),e}var V=require("commander"),rt=require("ora");function it({client:s,ora:t}){let e=new V.Command("sources").description("Sources");return e.addCommand(new V.Command("get").description("Find source").argument("<source>","Source ID").action(async o=>{let n=await(0,rt.oraPromise)(()=>s.source.get(o).json(),{...t,text:"Finding source"});console.log(n)})),e.addCommand(new V.Command("list").description("List sources").action(async()=>{let o=await(0,rt.oraPromise)(()=>s.source.list().json(),{...t,text:"Finding sources"});console.log(o)})),e}var a={ora:{spinner:"simpleDotsScrolling"},client:new P(new p)},Ut=new bt.Command("gds").description("Great Detail Support System").addCommand(Y(a)).addCommand(J(a)).addCommand($(a)).addCommand(Z(a)).addCommand(tt(a)).addCommand(ot(a)).addCommand(nt(a)).addCommand(it(a)),vt=Ut;vt.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-NPU3T2UQ.js";import"./chunk-WIUEWWCB.js";r.parseAsync(process.argv);
2
+ import{a as r}from"./chunk-ORNBEVRV.js";import"./chunk-MKJLSHH7.js";r.parseAsync(process.argv);
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var X=Object.create;var B=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var tt=Object.getOwnPropertyNames;var et=Object.getPrototypeOf,ot=Object.prototype.hasOwnProperty;var Q=(s,t)=>{for(var e in t)B(s,e,{get:t[e],enumerable:!0})},j=(s,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of tt(t))!ot.call(s,n)&&n!==e&&B(s,n,{get:()=>t[n],enumerable:!(o=Z(t,n))||o.enumerable});return s};var H=(s,t,e)=>(e=s!=null?X(et(s)):{},j(t||!s||!s.__esModule?B(e,"default",{value:s,enumerable:!0}):e,s)),st=s=>j(B({},"__esModule",{value:!0}),s);var nt={};Q(nt,{Client:()=>c,DEFAULT_SUPPORT_BASE_URL:()=>w,Error:()=>N,SupportError:()=>a,default:()=>c,eventWebhookSchema:()=>W});module.exports=st(nt);var w="https://api.support.greatdetail.com",V={"X-Powered-By":"GDSupport/JavaScript"};var m=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/accounts",{...e,method:"POST",json:t})}};var l=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}delete(t,e,{body:o,request:n={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...n,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var d=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var u=class{constructor(t){this._transport=t}list({limit:t,sort:e,request:o={}}={}){return this._transport.send("v1/actions",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var q="SUPPORT_ACCESS_TOKEN",K="SUPPORT_KEY_NAME",Y="SUPPORT_KEY_PASSWORD",F="SUPPORT_SIGNING_KEY",z="SUPPORT_BASE_URL";var h=class{name;#t;constructor({name:t=process.env[K],password:e=process.env[Y]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var C=class{#t;constructor({token:t=process.env[q]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var f=class{getHeaders(){return{}}};var R=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var b=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByCategory=this.listByBoilerplateCategory;listByBoilerplateCategory(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t)+"/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var g=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/channels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}metaWhatsappGetBusinessProfile(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/meta-whatsapp/business-profile",{...e,method:"GET"})}twilioSendgridChannelSync(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/twilio-sendgrid/sync",{...o,method:"POST",json:e})}};var v=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var O=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var x=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}getRelativeVCFURL(t,{vcf:e={}}={}){let o=e.variant??"vcard",n=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(n)}getVCFURL(t,e={}){return this._transport.getURL(this.getRelativeVCFURL(t,e))}getVCF(t,e={}){return this._transport.send(this.getVCFURL(t,e),{method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var T=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}list({query:t,limit:e,filter:o,include:n,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.limitQuery(e),...o?[["filter",o]]:[],...this._transport.includeQuery(n??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var _=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/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 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,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}listByConversation(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o)]})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var I=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 L=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 A=class s{constructor(t=s.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=V;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 n=[];if(e){let r=Array.isArray(e)?e:[e];for(let p of r)n.push(["category",p])}return t!==void 0&&n.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:n})}};var U=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 J=H(require("is-network-error"),1),M=H(require("ky"),1);var a=class extends Error{constructor(e,o){super("Support Error",{cause:o});this.response=e}};var E=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=M.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let n of this.options.requestFilterables){let r=n.getHeaders();for(let[p,$]of Object.entries(r))o.headers.has(p)||o.headers.set(p,$)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,n]of Object.entries(t))n!==void 0&&e.push(["sort",n+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let o=this.client(t,e).catch(async n=>{throw(0,J.default)(n)?new Error("A network error occurred",{cause:n}):n instanceof M.HTTPError?new a(n.response,n):n});return{response:()=>o,json:async()=>(await o).json()}}};var D=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,request:e={}}){let o=new FormData;for(let n of t)o.append("file",n);return this._transport.send("v1/uploads",{...e,method:"POST",body:o})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var G=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"),W=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 k=class{constructor(t){this._transport=t}async event({key:t=process.env[F],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."+F);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}=W.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 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 c=class s{static DEFAULT_BASE_URL=w;static PublicAuthentication=f;static BasicAuthentication=h;static BearerAuthentication=C;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;channelConversationSettings;compositionSection;contact;conversation;label;message;model;note;source;statistics;upload;user;webhook;webhookSubscription;constructor(t,{baseURL:e,...o}={}){this._transport=new E({requestFilterables:[new A,t],...o,baseURL:e?.toString()??s.getBaseURL()}),this.account=new m(this._transport),this.accountAccessToken=new l(this._transport),this.accountConversationSettings=new d(this._transport),this.action=new u(this._transport),this.boilerplateCategory=new R(this._transport),this.boilerplateContent=new b(this._transport),this.channel=new g(this._transport),this.channelConversationSettings=new v(this._transport),this.compositionSection=new O(this._transport),this.contact=new x(this._transport),this.conversation=new T(this._transport),this.label=new _(this._transport),this.message=new y(this._transport),this.model=new I(this._transport),this.note=new L(this._transport),this.source=new S(this._transport),this.statistics=new U(this._transport),this.upload=new D(this._transport),this.user=new G(this._transport),this.webhook=new k(this._transport),this.webhookSubscription=new P(this._transport)}static getBaseURL(){return process.env[z]??this.DEFAULT_BASE_URL}};var N={};Q(N,{SupportError:()=>a});0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,Error,SupportError,eventWebhookSchema});
1
+ "use strict";var Z=Object.create;var w=Object.defineProperty;var tt=Object.getOwnPropertyDescriptor;var et=Object.getOwnPropertyNames;var ot=Object.getPrototypeOf,st=Object.prototype.hasOwnProperty;var j=(s,t)=>{for(var e in t)w(s,e,{get:t[e],enumerable:!0})},H=(s,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of et(t))!st.call(s,n)&&n!==e&&w(s,n,{get:()=>t[n],enumerable:!(o=tt(t,n))||o.enumerable});return s};var V=(s,t,e)=>(e=s!=null?Z(ot(s)):{},H(t||!s||!s.__esModule?w(e,"default",{value:s,enumerable:!0}):e,s)),nt=s=>H(w({},"__esModule",{value:!0}),s);var rt={};j(rt,{Client:()=>c,DEFAULT_SUPPORT_BASE_URL:()=>M,Error:()=>Q,SupportError:()=>a,default:()=>c,eventWebhookSchema:()=>N});module.exports=nt(rt);var M="https://api.support.greatdetail.com",q={"X-Powered-By":"GDSupport/JavaScript"};var m=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/accounts",{...e,method:"POST",json:t})}};var l=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}delete(t,e,{body:o,request:n={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...n,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var d=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var u=class{constructor(t){this._transport=t}list({limit:t,sort:e,request:o={}}={}){return this._transport.send("v1/actions",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var K="SUPPORT_ACCESS_TOKEN",Y="SUPPORT_KEY_NAME",z="SUPPORT_KEY_PASSWORD",W="SUPPORT_SIGNING_KEY",J="SUPPORT_BASE_URL";var h=class{name;#t;constructor({name:t=process.env[Y],password:e=process.env[z]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var C=class{#t;constructor({token:t=process.env[K]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var f=class{getHeaders(){return{}}};var R=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var b=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByCategory=this.listByBoilerplateCategory;listByBoilerplateCategory(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t)+"/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var g=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/channels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}metaWhatsappGetBusinessProfile(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/meta-whatsapp/business-profile",{...e,method:"GET"})}twilioSendgridChannelSync(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/twilio-sendgrid/sync",{...o,method:"POST",json:e})}};var v=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var O=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var x=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}getRelativeVCFURL(t,{vcf:e={}}={}){let o=e.variant??"vcard",n=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(n)}getVCFURL(t,e={}){return this._transport.getURL(this.getRelativeVCFURL(t,e))}getVCF(t,e={}){return this._transport.send(this.getVCFURL(t,e),{method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var T=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}list({query:t,limit:e,filter:o,include:n,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.limitQuery(e),...o?[["filter",o]]:[],...this._transport.includeQuery(n??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var _=class{constructor(t){this._transport=t}list({request:t={}}={}){return this._transport.send("v1/escalations",{...t,method:"GET"})}create({body:t,request:e={}}){return this._transport.send("v1/escalations",{...e,method:"POST",json:t})}};var y=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,include:o,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByConversation(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var I=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}listByConversation(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o)]})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var 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 S=class s{constructor(t=s.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=q;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var U=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}list({featured:t,category:e,request:o={}}={}){let n=[];if(e){let r=Array.isArray(e)?e:[e];for(let p of r)n.push(["category",p])}return t!==void 0&&n.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:n})}};var 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"})}};var $=V(require("is-network-error"),1),F=V(require("ky"),1);var a=class extends Error{constructor(e,o){super("Support Error",{cause:o});this.response=e}};var D=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=F.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let n of this.options.requestFilterables){let r=n.getHeaders();for(let[p,X]of Object.entries(r))o.headers.has(p)||o.headers.set(p,X)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,n]of Object.entries(t))n!==void 0&&e.push(["sort",n+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let o=this.client(t,e).catch(async n=>{throw(0,$.default)(n)?new Error("A network error occurred",{cause:n}):n instanceof F.HTTPError?new a(n.response,n):n});return{response:()=>o,json:async()=>(await o).json()}}};var G=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,request:e={}}){let o=new FormData;for(let n of t)o.append("file",n);return this._transport.send("v1/uploads",{...e,method:"POST",body:o})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var 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 i=require("zod"),N=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[W],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."+W);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}=N.parse(o.body);return{event:r.event}}async _verifySignature(t,e,o){let n=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let r of o)if(await crypto.subtle.verify("HMAC",n,new TextEncoder().encode(atob(r)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var B=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/webhooks/subscriptions",{...t,method:"GET"})}test(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t)+"/test",{...e,method:"POST"})}create({body:t,request:e={}}){return this._transport.send("v1/webhooks/subscriptions",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var c=class s{static DEFAULT_BASE_URL=M;static PublicAuthentication=f;static BasicAuthentication=h;static BearerAuthentication=C;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;channelConversationSettings;compositionSection;contact;conversation;escalation;label;message;model;note;source;statistics;upload;user;webhook;webhookSubscription;constructor(t,{baseURL:e,...o}={}){this._transport=new D({requestFilterables:[new S,t],...o,baseURL:e?.toString()??s.getBaseURL()}),this.account=new m(this._transport),this.accountAccessToken=new l(this._transport),this.accountConversationSettings=new d(this._transport),this.action=new u(this._transport),this.boilerplateCategory=new R(this._transport),this.boilerplateContent=new b(this._transport),this.channel=new g(this._transport),this.channelConversationSettings=new v(this._transport),this.compositionSection=new O(this._transport),this.contact=new x(this._transport),this.conversation=new T(this._transport),this.escalation=new _(this._transport),this.label=new y(this._transport),this.message=new I(this._transport),this.model=new L(this._transport),this.note=new A(this._transport),this.source=new U(this._transport),this.statistics=new E(this._transport),this.upload=new G(this._transport),this.user=new k(this._transport),this.webhook=new P(this._transport),this.webhookSubscription=new B(this._transport)}static getBaseURL(){return process.env[J]??this.DEFAULT_BASE_URL}};var Q={};j(Q,{SupportError:()=>a});0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,Error,SupportError,eventWebhookSchema});
package/dist/index.d.cts CHANGED
@@ -1,5 +1,4 @@
1
- import { a as ConversationID, N as Nullable, R as ResponseTimestamp, S as SendOptions } from './Client-DZnura3y.cjs';
2
- export { A as Account, l as AccountAccessToken, m as AccountAccessTokenID, cY as AccountAccessTokenWebhookEventType, v as AccountConversationSettings, e as AccountID, cX as AccountWebhookWebhookEventType, E as Action, F as ActionID, b9 as ActiveConversationStatus, a2 as BoilerplateCategory, a3 as BoilerplateCategoryID, K as BoilerplateContent, M as BoilerplateContentID, af as Channel, aw as ChannelConversationSettings, ag as ChannelID, C as Client, aC as CompositionSection, aD as CompositionSectionID, ba as ConcludedConversationStatus, aQ as Contact, aS as ContactCustomMetadata, aR as ContactID, cZ as ContactWebhookEventType, b7 as Conversation, b8 as ConversationCustomMetadata, bx as ConversationSettings, bb as ConversationStatus, c_ as ConversationWebhookEventType, o as CreateAccountAccessTokenOptions, n as CreateAccountAccessTokenPayload, p as CreateAccountAccessTokenResponse, g as CreateAccountOptions, f as CreateAccountPayload, h as CreateAccountResponse, a5 as CreateBoilerplateCategoryOptions, a4 as CreateBoilerplateCategoryPayload, a6 as CreateBoilerplateCategoryResponse, Q as CreateBoilerplateContentOptions, P as CreateBoilerplateContentPayload, T as CreateBoilerplateContentResponse, ai as CreateChannelOptions, ah as CreateChannelPayload, aj as CreateChannelResponse, aF as CreateCompositionSectionOptions, aE as CreateCompositionSectionPayload, aG as CreateCompositionSectionResponse, aU as CreateContactOptions, aT as CreateContactPayload, aV as CreateContactResponse, bd as CreateConversationOptions, bc as CreateConversationPayload, be as CreateConversationResponse, cc as CreateCorrectionModelOptions, cb as CreateCorrectionModelPayload, cd as CreateCorrectionResponse, bA as CreateLabelOptions, bz as CreateLabelPayload, bB as CreateLabelResponse, bT as CreateMessageOptions, bS as CreateMessagePayload, bU as CreateMessageResponse, co as CreateNoteOptions, cn as CreateNotePayload, cp as CreateNoteResponse, cf as CreateResponseModelOptions, ce as CreateResponseModelPayload, cg as CreateResponseResponse, cH as CreateUploadOptions, cI as CreateUploadResponse, d5 as CreateWebhookSubscriptionOptions, d4 as CreateWebhookSubscriptionPayload, d6 as CreateWebhookSubscriptionResponse, d as CurrentAccountID, q as DeleteAccountAccessTokenOptions, D as DeleteAccountAccessTokenPayload, r as DeleteAccountAccessTokenResponse, aW as DeleteContactOptions, aX as DeleteContactResponse, bf as DeleteConversationOptions, bg as DeleteConversationResponse, bC as DeleteLabelOptions, bD as DeleteLabelResponse, bV as DeleteMessageOptions, bW as DeleteMessageResponse, cJ as DeleteUploadOptions, cK as DeleteUploadResponse, d7 as DeleteWebhookSubscriptionOptions, d8 as DeleteWebhookSubscriptionResponse, cU as EventWebhookOptions, bp as FilterOptions, s as GetAccountAccessTokenOptions, t as GetAccountAccessTokenResponse, w as GetAccountConversationSettingsOptions, x as GetAccountConversationSettingsResponse, G as GetAccountOptions, i as GetAccountResponse, a7 as GetBoilerplateCategoryOptions, a8 as GetBoilerplateCategoryResponse, V as GetBoilerplateContentOptions, W as GetBoilerplateContentResponse, ax as GetChannelConversationSettingsOptions, ay as GetChannelConversationSettingsResponse, ak as GetChannelOptions, al as GetChannelResponse, aH as GetCompositionSectionOptions, aI as GetCompositionSectionResponse, aY as GetContactIncludeOptions, aZ as GetContactOptions, a_ as GetContactResponse, a$ as GetContactVCFOptions, bh as GetConversationIncludeOptions, bi as GetConversationOptions, bj as GetConversationResponse, bE as GetLabelOptions, bF as GetLabelResponse, bX as GetMessageOptions, bY as GetMessageResponse, ch as GetModelOptions, ci as GetModelResponse, cq as GetNoteOptions, cr as GetNoteResponse, cB as GetSourceOptions, cC as GetSourceResponse, cL as GetUploadOptions, cM as GetUploadResponse, cR as GetUserOptions, cS as GetUserResponse, d9 as GetWebhookSubscriptionOptions, da as GetWebhookSubscriptionResponse, by as Label, bG as LabelID, L as ListAccountAccessTokensOptions, u as ListAccountAccessTokensResponse, I as ListActionsOptions, J as ListActionsResponse, a9 as ListBoilerplateCategoriesIncludeOptions, aa as ListBoilerplateCategoriesOptions, ab as ListBoilerplateCategoriesResponse, X as ListBoilerplateCategoryBoilerplateContentsOptions, Y as ListBoilerplateCategoryBoilerplateContentsResponse, Z as ListBoilerplateContentsOptions, _ as ListBoilerplateContentsResponse, aJ as ListChannelCompositionSectionsOptions, aK as ListChannelCompositionSectionsResponse, bk as ListChannelConversationsOptions, bl as ListChannelConversationsResponse, bZ as ListChannelMessagesIncludeOptions, b_ as ListChannelMessagesOptions, b$ as ListChannelMessagesResponse, am as ListChannelsOptions, an as ListChannelsResponse, aL as ListCompositionSectionsOptions, aM as ListCompositionSectionsResponse, bm as ListContactConversationsOptions, bn as ListContactConversationsResponse, bH as ListContactLabelsOptions, bI as ListContactLabelsResponse, cs as ListContactNotesOptions, ct as ListContactNotesResponse, b0 as ListContactsOptions, b1 as ListContactsResponse, bJ as ListConversationLabelsOptions, bK as ListConversationLabelsResponse, c0 as ListConversationMessagesIncludeOptions, c1 as ListConversationMessagesOptions, c2 as ListConversationMessagesResponse, cu as ListConversationNotesOptions, cv as ListConversationNotesResponse, bq as ListConversationOptions, bo as ListConversationsIncludeOptions, br as ListConversationsResponse, b2 as ListLabelContactsOptions, b3 as ListLabelContactsResponse, bs as ListLabelConversationsOptions, bt as ListLabelConversationsResponse, bL as ListLabelsIncludeOptions, bM as ListLabelsOptions, bN as ListLabelsResponse, c3 as ListMessagesIncludeOptions, c4 as ListMessagesOptions, c5 as ListMessagesResponse, cj as ListModelsOptions, ck as ListModelsResponse, cD as ListSourcesOptions, cE as ListSourcesResponse, cN as ListUploadsOptions, cO as ListUploadsResponse, db as ListWebhookSubscriptionsOptions, dc as ListWebhookSubscriptionsResponse, bR as Message, c9 as MessageEventType, c6 as MessageID, c7 as MessageRole, c8 as MessageStatus, c$ as MessageWebhookEventType, ao as MetaWhatsappChannelGetBusinessProfileOptions, ap as MetaWhatsappChannelGetBusinessProfileResponse, ca as Model, cl as ModelID, cm as Note, cw as NoteID, O as Options, b as RequestFilterable, H as SortOptions, cA as Source, cF as SourceID, dd as TestWebhookSubscriptionOptions, de as TestWebhookSubscriptionResponse, c as TransportOptions, aq as TwilioSendChannelSyncPayload, ar as TwilioSendgridChannelSyncOptions, as as TwilioSendgridChannelSyncResponse, z as UpdateAccountConversationSettingsOptions, y as UpdateAccountConversationSettingsPayload, B as UpdateAccountConversationSettingsResponse, j as UpdateAccountOptions, U as UpdateAccountPayload, k as UpdateAccountResponse, ad as UpdateBoilerplateCategoryOptions, ac as UpdateBoilerplateCategoryPayload, ae as UpdateBoilerplateCategoryResponse, a0 as UpdateBoilerplateContentOptions, $ as UpdateBoilerplateContentPayload, a1 as UpdateBoilerplateContentResponse, aA as UpdateChannelConversationSettingsOptions, az as UpdateChannelConversationSettingsPayload, aB as UpdateChannelConversationSettingsResponse, au as UpdateChannelOptions, at as UpdateChannelPayload, av as UpdateChannelResponse, aO as UpdateCompositionSectionOptions, aN as UpdateCompositionSectionPayload, aP as UpdateCompositionSectionResponse, b5 as UpdateContactOptions, b4 as UpdateContactPayload, b6 as UpdateContactResponse, bv as UpdateConversationOptions, bu as UpdateConversationPayload, bw as UpdateConversationResponse, bP as UpdateLabelOptions, bO as UpdateLabelPayload, bQ as UpdateLabelResponse, cy as UpdateNoteOptions, cx as UpdateNotePayload, cz as UpdateNoteResponse, cG as Upload, cP as UploadID, cQ as User, cT as UserID, d1 as WebhookEventPayload, cW as WebhookEventType, d2 as WebhookResponse, d3 as WebhookSubscription, df as WebhookSubscriptionID, d0 as WebhookSubscriptionWebhookEventType, C as default, cV as eventWebhookSchema } from './Client-DZnura3y.cjs';
1
+ export { A as Account, j as AccountAccessToken, k as AccountAccessTokenID, c$ as AccountAccessTokenWebhookEventType, t as AccountConversationSettings, c as AccountID, c_ as AccountWebhookWebhookEventType, z as Action, B as ActionID, bc 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, bd as ConcludedConversationStatus, aS as Contact, aU as ContactCustomMetadata, aT as ContactID, d0 as ContactWebhookEventType, b9 as Conversation, bb as ConversationCustomMetadata, ba as ConversationID, bA as ConversationSettings, be as ConversationStatus, d1 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, aW as CreateContactOptions, aV as CreateContactPayload, aX as CreateContactResponse, bg as CreateConversationOptions, bf as CreateConversationPayload, bh as CreateConversationResponse, cf as CreateCorrectionModelOptions, ce as CreateCorrectionModelPayload, cg as CreateCorrectionResponse, aO as CreateEscalationOptions, aN as CreateEscalationPayload, aP as CreateEscalationResponse, bD as CreateLabelOptions, bC as CreateLabelPayload, bE as CreateLabelResponse, bW as CreateMessageOptions, bV as CreateMessagePayload, bX as CreateMessageResponse, cr as CreateNoteOptions, cq as CreateNotePayload, cs as CreateNoteResponse, ci as CreateResponseModelOptions, ch as CreateResponseModelPayload, cj as CreateResponseResponse, cK as CreateUploadOptions, cL as CreateUploadResponse, d8 as CreateWebhookSubscriptionOptions, d7 as CreateWebhookSubscriptionPayload, d9 as CreateWebhookSubscriptionResponse, b as CurrentAccountID, o as DeleteAccountAccessTokenOptions, D as DeleteAccountAccessTokenPayload, p as DeleteAccountAccessTokenResponse, aY as DeleteContactOptions, aZ as DeleteContactResponse, bi as DeleteConversationOptions, bj as DeleteConversationResponse, bF as DeleteLabelOptions, bG as DeleteLabelResponse, bY as DeleteMessageOptions, bZ as DeleteMessageResponse, cM as DeleteUploadOptions, cN as DeleteUploadResponse, da as DeleteWebhookSubscriptionOptions, db as DeleteWebhookSubscriptionResponse, aM as Escalation, cX as EventWebhookOptions, bs as FilterOptions, 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, a_ as GetContactIncludeOptions, a$ as GetContactOptions, b0 as GetContactResponse, b1 as GetContactVCFOptions, bk as GetConversationIncludeOptions, bl as GetConversationOptions, bm as GetConversationResponse, bH as GetLabelOptions, bI as GetLabelResponse, b_ as GetMessageOptions, b$ as GetMessageResponse, ck as GetModelOptions, cl as GetModelResponse, ct as GetNoteOptions, cu as GetNoteResponse, cE as GetSourceOptions, cF as GetSourceResponse, cO as GetUploadOptions, cP as GetUploadResponse, cU as GetUserOptions, cV as GetUserResponse, dc as GetWebhookSubscriptionOptions, dd as GetWebhookSubscriptionResponse, bB as Label, bJ 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, bn as ListChannelConversationsOptions, bo as ListChannelConversationsResponse, c0 as ListChannelMessagesIncludeOptions, c1 as ListChannelMessagesOptions, c2 as ListChannelMessagesResponse, ai as ListChannelsOptions, aj as ListChannelsResponse, aH as ListCompositionSectionsOptions, aI as ListCompositionSectionsResponse, bp as ListContactConversationsOptions, bq as ListContactConversationsResponse, bK as ListContactLabelsOptions, bL as ListContactLabelsResponse, cv as ListContactNotesOptions, cw as ListContactNotesResponse, b2 as ListContactsOptions, b3 as ListContactsResponse, bM as ListConversationLabelsOptions, bN as ListConversationLabelsResponse, c3 as ListConversationMessagesIncludeOptions, c4 as ListConversationMessagesOptions, c5 as ListConversationMessagesResponse, cx as ListConversationNotesOptions, cy as ListConversationNotesResponse, bt as ListConversationOptions, br as ListConversationsIncludeOptions, bu as ListConversationsResponse, aQ as ListEscalationsOptions, aR as ListEscalationsResponse, b4 as ListLabelContactsOptions, b5 as ListLabelContactsResponse, bv as ListLabelConversationsOptions, bw as ListLabelConversationsResponse, bO as ListLabelsIncludeOptions, bP as ListLabelsOptions, bQ as ListLabelsResponse, c6 as ListMessagesIncludeOptions, c7 as ListMessagesOptions, c8 as ListMessagesResponse, cm as ListModelsOptions, cn as ListModelsResponse, cG as ListSourcesOptions, cH as ListSourcesResponse, cQ as ListUploadsOptions, cR as ListUploadsResponse, de as ListWebhookSubscriptionsOptions, df as ListWebhookSubscriptionsResponse, bU as Message, cc as MessageEventType, c9 as MessageID, ca as MessageRole, cb as MessageStatus, d2 as MessageWebhookEventType, ak as MetaWhatsappChannelGetBusinessProfileOptions, al as MetaWhatsappChannelGetBusinessProfileResponse, cd as Model, co as ModelID, cp as Note, cz as NoteID, O as Options, R as RequestFilterable, S as SortOptions, cD as Source, cI as SourceID, dg as TestWebhookSubscriptionOptions, dh 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, b7 as UpdateContactOptions, b6 as UpdateContactPayload, b8 as UpdateContactResponse, by as UpdateConversationOptions, bx as UpdateConversationPayload, bz as UpdateConversationResponse, bS as UpdateLabelOptions, bR as UpdateLabelPayload, bT as UpdateLabelResponse, cB as UpdateNoteOptions, cA as UpdateNotePayload, cC as UpdateNoteResponse, cJ as Upload, cS as UploadID, cT as User, cW as UserID, d4 as WebhookEventPayload, cZ as WebhookEventType, d5 as WebhookResponse, d6 as WebhookSubscription, di as WebhookSubscriptionID, d3 as WebhookSubscriptionWebhookEventType, C as default, cY as eventWebhookSchema } from './Client-C5zIfdYu.cjs';
3
2
  import { KyResponse } from 'ky';
4
3
  import 'zod';
5
4
 
@@ -57,61 +56,4 @@ declare namespace index {
57
56
  export { type index_ErrorResponse as ErrorResponse, index_SupportError as SupportError };
58
57
  }
59
58
 
60
- /**
61
- * Great Detail Support System.
62
- *
63
- * @copyright 2025 Great Detail Ltd
64
- * @author Great Detail Ltd <info@greatdetail.com>
65
- * @author Dom Webber <dom.webber@greatdetail.com>
66
- * @see https://greatdetail.com
67
- */
68
-
69
- type EscalationID = `esc${string}` | (string & NonNullable<unknown>);
70
- type Escalation = {
71
- id: EscalationID;
72
- conversation: ConversationID;
73
- reason?: Nullable<string>;
74
- } & ResponseTimestamp;
75
-
76
- /**
77
- * Great Detail Support System.
78
- *
79
- * @copyright 2025 Great Detail Ltd
80
- * @author Great Detail Ltd <info@greatdetail.com>
81
- * @author Dom Webber <dom.webber@greatdetail.com>
82
- * @see https://greatdetail.com
83
- */
84
-
85
- type CreateEscalationPayload = {
86
- conversation: ConversationID;
87
- reason?: Nullable<string>;
88
- };
89
- interface CreateEscalationOptions {
90
- body: CreateEscalationPayload;
91
- request?: SendOptions;
92
- }
93
- type CreateEscalationResponse = {
94
- data: {
95
- escalation: Escalation;
96
- };
97
- };
98
-
99
- /**
100
- * Great Detail Support System.
101
- *
102
- * @copyright 2025 Great Detail Ltd
103
- * @author Great Detail Ltd <info@greatdetail.com>
104
- * @author Dom Webber <dom.webber@greatdetail.com>
105
- * @see https://greatdetail.com
106
- */
107
-
108
- interface ListEscalationsOptions {
109
- request?: SendOptions;
110
- }
111
- type ListEscalationsResponse = {
112
- data: {
113
- escalation: Escalation;
114
- }[];
115
- };
116
-
117
- export { ConversationID, type CreateEscalationOptions, type CreateEscalationPayload, type CreateEscalationResponse, DEFAULT_SUPPORT_BASE_URL, index as Error, type ErrorResponse, type Escalation, type ListEscalationsOptions, type ListEscalationsResponse, SupportError };
59
+ export { DEFAULT_SUPPORT_BASE_URL, index as Error, type ErrorResponse, SupportError };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { a as ConversationID, N as Nullable, R as ResponseTimestamp, S as SendOptions } from './Client-DZnura3y.js';
2
- export { A as Account, l as AccountAccessToken, m as AccountAccessTokenID, cY as AccountAccessTokenWebhookEventType, v as AccountConversationSettings, e as AccountID, cX as AccountWebhookWebhookEventType, E as Action, F as ActionID, b9 as ActiveConversationStatus, a2 as BoilerplateCategory, a3 as BoilerplateCategoryID, K as BoilerplateContent, M as BoilerplateContentID, af as Channel, aw as ChannelConversationSettings, ag as ChannelID, C as Client, aC as CompositionSection, aD as CompositionSectionID, ba as ConcludedConversationStatus, aQ as Contact, aS as ContactCustomMetadata, aR as ContactID, cZ as ContactWebhookEventType, b7 as Conversation, b8 as ConversationCustomMetadata, bx as ConversationSettings, bb as ConversationStatus, c_ as ConversationWebhookEventType, o as CreateAccountAccessTokenOptions, n as CreateAccountAccessTokenPayload, p as CreateAccountAccessTokenResponse, g as CreateAccountOptions, f as CreateAccountPayload, h as CreateAccountResponse, a5 as CreateBoilerplateCategoryOptions, a4 as CreateBoilerplateCategoryPayload, a6 as CreateBoilerplateCategoryResponse, Q as CreateBoilerplateContentOptions, P as CreateBoilerplateContentPayload, T as CreateBoilerplateContentResponse, ai as CreateChannelOptions, ah as CreateChannelPayload, aj as CreateChannelResponse, aF as CreateCompositionSectionOptions, aE as CreateCompositionSectionPayload, aG as CreateCompositionSectionResponse, aU as CreateContactOptions, aT as CreateContactPayload, aV as CreateContactResponse, bd as CreateConversationOptions, bc as CreateConversationPayload, be as CreateConversationResponse, cc as CreateCorrectionModelOptions, cb as CreateCorrectionModelPayload, cd as CreateCorrectionResponse, bA as CreateLabelOptions, bz as CreateLabelPayload, bB as CreateLabelResponse, bT as CreateMessageOptions, bS as CreateMessagePayload, bU as CreateMessageResponse, co as CreateNoteOptions, cn as CreateNotePayload, cp as CreateNoteResponse, cf as CreateResponseModelOptions, ce as CreateResponseModelPayload, cg as CreateResponseResponse, cH as CreateUploadOptions, cI as CreateUploadResponse, d5 as CreateWebhookSubscriptionOptions, d4 as CreateWebhookSubscriptionPayload, d6 as CreateWebhookSubscriptionResponse, d as CurrentAccountID, q as DeleteAccountAccessTokenOptions, D as DeleteAccountAccessTokenPayload, r as DeleteAccountAccessTokenResponse, aW as DeleteContactOptions, aX as DeleteContactResponse, bf as DeleteConversationOptions, bg as DeleteConversationResponse, bC as DeleteLabelOptions, bD as DeleteLabelResponse, bV as DeleteMessageOptions, bW as DeleteMessageResponse, cJ as DeleteUploadOptions, cK as DeleteUploadResponse, d7 as DeleteWebhookSubscriptionOptions, d8 as DeleteWebhookSubscriptionResponse, cU as EventWebhookOptions, bp as FilterOptions, s as GetAccountAccessTokenOptions, t as GetAccountAccessTokenResponse, w as GetAccountConversationSettingsOptions, x as GetAccountConversationSettingsResponse, G as GetAccountOptions, i as GetAccountResponse, a7 as GetBoilerplateCategoryOptions, a8 as GetBoilerplateCategoryResponse, V as GetBoilerplateContentOptions, W as GetBoilerplateContentResponse, ax as GetChannelConversationSettingsOptions, ay as GetChannelConversationSettingsResponse, ak as GetChannelOptions, al as GetChannelResponse, aH as GetCompositionSectionOptions, aI as GetCompositionSectionResponse, aY as GetContactIncludeOptions, aZ as GetContactOptions, a_ as GetContactResponse, a$ as GetContactVCFOptions, bh as GetConversationIncludeOptions, bi as GetConversationOptions, bj as GetConversationResponse, bE as GetLabelOptions, bF as GetLabelResponse, bX as GetMessageOptions, bY as GetMessageResponse, ch as GetModelOptions, ci as GetModelResponse, cq as GetNoteOptions, cr as GetNoteResponse, cB as GetSourceOptions, cC as GetSourceResponse, cL as GetUploadOptions, cM as GetUploadResponse, cR as GetUserOptions, cS as GetUserResponse, d9 as GetWebhookSubscriptionOptions, da as GetWebhookSubscriptionResponse, by as Label, bG as LabelID, L as ListAccountAccessTokensOptions, u as ListAccountAccessTokensResponse, I as ListActionsOptions, J as ListActionsResponse, a9 as ListBoilerplateCategoriesIncludeOptions, aa as ListBoilerplateCategoriesOptions, ab as ListBoilerplateCategoriesResponse, X as ListBoilerplateCategoryBoilerplateContentsOptions, Y as ListBoilerplateCategoryBoilerplateContentsResponse, Z as ListBoilerplateContentsOptions, _ as ListBoilerplateContentsResponse, aJ as ListChannelCompositionSectionsOptions, aK as ListChannelCompositionSectionsResponse, bk as ListChannelConversationsOptions, bl as ListChannelConversationsResponse, bZ as ListChannelMessagesIncludeOptions, b_ as ListChannelMessagesOptions, b$ as ListChannelMessagesResponse, am as ListChannelsOptions, an as ListChannelsResponse, aL as ListCompositionSectionsOptions, aM as ListCompositionSectionsResponse, bm as ListContactConversationsOptions, bn as ListContactConversationsResponse, bH as ListContactLabelsOptions, bI as ListContactLabelsResponse, cs as ListContactNotesOptions, ct as ListContactNotesResponse, b0 as ListContactsOptions, b1 as ListContactsResponse, bJ as ListConversationLabelsOptions, bK as ListConversationLabelsResponse, c0 as ListConversationMessagesIncludeOptions, c1 as ListConversationMessagesOptions, c2 as ListConversationMessagesResponse, cu as ListConversationNotesOptions, cv as ListConversationNotesResponse, bq as ListConversationOptions, bo as ListConversationsIncludeOptions, br as ListConversationsResponse, b2 as ListLabelContactsOptions, b3 as ListLabelContactsResponse, bs as ListLabelConversationsOptions, bt as ListLabelConversationsResponse, bL as ListLabelsIncludeOptions, bM as ListLabelsOptions, bN as ListLabelsResponse, c3 as ListMessagesIncludeOptions, c4 as ListMessagesOptions, c5 as ListMessagesResponse, cj as ListModelsOptions, ck as ListModelsResponse, cD as ListSourcesOptions, cE as ListSourcesResponse, cN as ListUploadsOptions, cO as ListUploadsResponse, db as ListWebhookSubscriptionsOptions, dc as ListWebhookSubscriptionsResponse, bR as Message, c9 as MessageEventType, c6 as MessageID, c7 as MessageRole, c8 as MessageStatus, c$ as MessageWebhookEventType, ao as MetaWhatsappChannelGetBusinessProfileOptions, ap as MetaWhatsappChannelGetBusinessProfileResponse, ca as Model, cl as ModelID, cm as Note, cw as NoteID, O as Options, b as RequestFilterable, H as SortOptions, cA as Source, cF as SourceID, dd as TestWebhookSubscriptionOptions, de as TestWebhookSubscriptionResponse, c as TransportOptions, aq as TwilioSendChannelSyncPayload, ar as TwilioSendgridChannelSyncOptions, as as TwilioSendgridChannelSyncResponse, z as UpdateAccountConversationSettingsOptions, y as UpdateAccountConversationSettingsPayload, B as UpdateAccountConversationSettingsResponse, j as UpdateAccountOptions, U as UpdateAccountPayload, k as UpdateAccountResponse, ad as UpdateBoilerplateCategoryOptions, ac as UpdateBoilerplateCategoryPayload, ae as UpdateBoilerplateCategoryResponse, a0 as UpdateBoilerplateContentOptions, $ as UpdateBoilerplateContentPayload, a1 as UpdateBoilerplateContentResponse, aA as UpdateChannelConversationSettingsOptions, az as UpdateChannelConversationSettingsPayload, aB as UpdateChannelConversationSettingsResponse, au as UpdateChannelOptions, at as UpdateChannelPayload, av as UpdateChannelResponse, aO as UpdateCompositionSectionOptions, aN as UpdateCompositionSectionPayload, aP as UpdateCompositionSectionResponse, b5 as UpdateContactOptions, b4 as UpdateContactPayload, b6 as UpdateContactResponse, bv as UpdateConversationOptions, bu as UpdateConversationPayload, bw as UpdateConversationResponse, bP as UpdateLabelOptions, bO as UpdateLabelPayload, bQ as UpdateLabelResponse, cy as UpdateNoteOptions, cx as UpdateNotePayload, cz as UpdateNoteResponse, cG as Upload, cP as UploadID, cQ as User, cT as UserID, d1 as WebhookEventPayload, cW as WebhookEventType, d2 as WebhookResponse, d3 as WebhookSubscription, df as WebhookSubscriptionID, d0 as WebhookSubscriptionWebhookEventType, C as default, cV as eventWebhookSchema } from './Client-DZnura3y.js';
1
+ export { A as Account, j as AccountAccessToken, k as AccountAccessTokenID, c$ as AccountAccessTokenWebhookEventType, t as AccountConversationSettings, c as AccountID, c_ as AccountWebhookWebhookEventType, z as Action, B as ActionID, bc 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, bd as ConcludedConversationStatus, aS as Contact, aU as ContactCustomMetadata, aT as ContactID, d0 as ContactWebhookEventType, b9 as Conversation, bb as ConversationCustomMetadata, ba as ConversationID, bA as ConversationSettings, be as ConversationStatus, d1 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, aW as CreateContactOptions, aV as CreateContactPayload, aX as CreateContactResponse, bg as CreateConversationOptions, bf as CreateConversationPayload, bh as CreateConversationResponse, cf as CreateCorrectionModelOptions, ce as CreateCorrectionModelPayload, cg as CreateCorrectionResponse, aO as CreateEscalationOptions, aN as CreateEscalationPayload, aP as CreateEscalationResponse, bD as CreateLabelOptions, bC as CreateLabelPayload, bE as CreateLabelResponse, bW as CreateMessageOptions, bV as CreateMessagePayload, bX as CreateMessageResponse, cr as CreateNoteOptions, cq as CreateNotePayload, cs as CreateNoteResponse, ci as CreateResponseModelOptions, ch as CreateResponseModelPayload, cj as CreateResponseResponse, cK as CreateUploadOptions, cL as CreateUploadResponse, d8 as CreateWebhookSubscriptionOptions, d7 as CreateWebhookSubscriptionPayload, d9 as CreateWebhookSubscriptionResponse, b as CurrentAccountID, o as DeleteAccountAccessTokenOptions, D as DeleteAccountAccessTokenPayload, p as DeleteAccountAccessTokenResponse, aY as DeleteContactOptions, aZ as DeleteContactResponse, bi as DeleteConversationOptions, bj as DeleteConversationResponse, bF as DeleteLabelOptions, bG as DeleteLabelResponse, bY as DeleteMessageOptions, bZ as DeleteMessageResponse, cM as DeleteUploadOptions, cN as DeleteUploadResponse, da as DeleteWebhookSubscriptionOptions, db as DeleteWebhookSubscriptionResponse, aM as Escalation, cX as EventWebhookOptions, bs as FilterOptions, 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, a_ as GetContactIncludeOptions, a$ as GetContactOptions, b0 as GetContactResponse, b1 as GetContactVCFOptions, bk as GetConversationIncludeOptions, bl as GetConversationOptions, bm as GetConversationResponse, bH as GetLabelOptions, bI as GetLabelResponse, b_ as GetMessageOptions, b$ as GetMessageResponse, ck as GetModelOptions, cl as GetModelResponse, ct as GetNoteOptions, cu as GetNoteResponse, cE as GetSourceOptions, cF as GetSourceResponse, cO as GetUploadOptions, cP as GetUploadResponse, cU as GetUserOptions, cV as GetUserResponse, dc as GetWebhookSubscriptionOptions, dd as GetWebhookSubscriptionResponse, bB as Label, bJ 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, bn as ListChannelConversationsOptions, bo as ListChannelConversationsResponse, c0 as ListChannelMessagesIncludeOptions, c1 as ListChannelMessagesOptions, c2 as ListChannelMessagesResponse, ai as ListChannelsOptions, aj as ListChannelsResponse, aH as ListCompositionSectionsOptions, aI as ListCompositionSectionsResponse, bp as ListContactConversationsOptions, bq as ListContactConversationsResponse, bK as ListContactLabelsOptions, bL as ListContactLabelsResponse, cv as ListContactNotesOptions, cw as ListContactNotesResponse, b2 as ListContactsOptions, b3 as ListContactsResponse, bM as ListConversationLabelsOptions, bN as ListConversationLabelsResponse, c3 as ListConversationMessagesIncludeOptions, c4 as ListConversationMessagesOptions, c5 as ListConversationMessagesResponse, cx as ListConversationNotesOptions, cy as ListConversationNotesResponse, bt as ListConversationOptions, br as ListConversationsIncludeOptions, bu as ListConversationsResponse, aQ as ListEscalationsOptions, aR as ListEscalationsResponse, b4 as ListLabelContactsOptions, b5 as ListLabelContactsResponse, bv as ListLabelConversationsOptions, bw as ListLabelConversationsResponse, bO as ListLabelsIncludeOptions, bP as ListLabelsOptions, bQ as ListLabelsResponse, c6 as ListMessagesIncludeOptions, c7 as ListMessagesOptions, c8 as ListMessagesResponse, cm as ListModelsOptions, cn as ListModelsResponse, cG as ListSourcesOptions, cH as ListSourcesResponse, cQ as ListUploadsOptions, cR as ListUploadsResponse, de as ListWebhookSubscriptionsOptions, df as ListWebhookSubscriptionsResponse, bU as Message, cc as MessageEventType, c9 as MessageID, ca as MessageRole, cb as MessageStatus, d2 as MessageWebhookEventType, ak as MetaWhatsappChannelGetBusinessProfileOptions, al as MetaWhatsappChannelGetBusinessProfileResponse, cd as Model, co as ModelID, cp as Note, cz as NoteID, O as Options, R as RequestFilterable, S as SortOptions, cD as Source, cI as SourceID, dg as TestWebhookSubscriptionOptions, dh 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, b7 as UpdateContactOptions, b6 as UpdateContactPayload, b8 as UpdateContactResponse, by as UpdateConversationOptions, bx as UpdateConversationPayload, bz as UpdateConversationResponse, bS as UpdateLabelOptions, bR as UpdateLabelPayload, bT as UpdateLabelResponse, cB as UpdateNoteOptions, cA as UpdateNotePayload, cC as UpdateNoteResponse, cJ as Upload, cS as UploadID, cT as User, cW as UserID, d4 as WebhookEventPayload, cZ as WebhookEventType, d5 as WebhookResponse, d6 as WebhookSubscription, di as WebhookSubscriptionID, d3 as WebhookSubscriptionWebhookEventType, C as default, cY as eventWebhookSchema } from './Client-C5zIfdYu.js';
3
2
  import { KyResponse } from 'ky';
4
3
  import 'zod';
5
4
 
@@ -57,61 +56,4 @@ declare namespace index {
57
56
  export { type index_ErrorResponse as ErrorResponse, index_SupportError as SupportError };
58
57
  }
59
58
 
60
- /**
61
- * Great Detail Support System.
62
- *
63
- * @copyright 2025 Great Detail Ltd
64
- * @author Great Detail Ltd <info@greatdetail.com>
65
- * @author Dom Webber <dom.webber@greatdetail.com>
66
- * @see https://greatdetail.com
67
- */
68
-
69
- type EscalationID = `esc${string}` | (string & NonNullable<unknown>);
70
- type Escalation = {
71
- id: EscalationID;
72
- conversation: ConversationID;
73
- reason?: Nullable<string>;
74
- } & ResponseTimestamp;
75
-
76
- /**
77
- * Great Detail Support System.
78
- *
79
- * @copyright 2025 Great Detail Ltd
80
- * @author Great Detail Ltd <info@greatdetail.com>
81
- * @author Dom Webber <dom.webber@greatdetail.com>
82
- * @see https://greatdetail.com
83
- */
84
-
85
- type CreateEscalationPayload = {
86
- conversation: ConversationID;
87
- reason?: Nullable<string>;
88
- };
89
- interface CreateEscalationOptions {
90
- body: CreateEscalationPayload;
91
- request?: SendOptions;
92
- }
93
- type CreateEscalationResponse = {
94
- data: {
95
- escalation: Escalation;
96
- };
97
- };
98
-
99
- /**
100
- * Great Detail Support System.
101
- *
102
- * @copyright 2025 Great Detail Ltd
103
- * @author Great Detail Ltd <info@greatdetail.com>
104
- * @author Dom Webber <dom.webber@greatdetail.com>
105
- * @see https://greatdetail.com
106
- */
107
-
108
- interface ListEscalationsOptions {
109
- request?: SendOptions;
110
- }
111
- type ListEscalationsResponse = {
112
- data: {
113
- escalation: Escalation;
114
- }[];
115
- };
116
-
117
- export { ConversationID, type CreateEscalationOptions, type CreateEscalationPayload, type CreateEscalationResponse, DEFAULT_SUPPORT_BASE_URL, index as Error, type ErrorResponse, type Escalation, type ListEscalationsOptions, type ListEscalationsResponse, SupportError };
59
+ export { DEFAULT_SUPPORT_BASE_URL, index as Error, type ErrorResponse, SupportError };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{a as t,c as e,d as p,e as f,f as o}from"./chunk-WIUEWWCB.js";var r={};t(r,{SupportError:()=>p});export{o as Client,e as DEFAULT_SUPPORT_BASE_URL,r as Error,p as SupportError,o as default,f as eventWebhookSchema};
1
+ import{a as t,c as e,d as p,e as f,f as o}from"./chunk-MKJLSHH7.js";var r={};t(r,{SupportError:()=>p});export{o as Client,e 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.2",
3
+ "version": "0.18.3",
4
4
  "type": "module",
5
5
  "description": "JavaScript SDK for the Great Detail Support System",
6
6
  "author": "Great Detail Ltd <info@greatdetail.com>",
@@ -1 +0,0 @@
1
- var V=Object.defineProperty;var z=(n,t)=>{for(var e in t)V(n,e,{get:t[e],enumerable:!0})};var a=class{getHeaders(){return{}}};var M="SUPPORT_ACCESS_TOKEN",x="SUPPORT_KEY_NAME",F="SUPPORT_KEY_PASSWORD",B="SUPPORT_SIGNING_KEY",W="SUPPORT_BASE_URL";var c=class{name;#t;constructor({name:t=process.env[x],password:e=process.env[F]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var m=class{#t;constructor({token:t=process.env[M]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var N="https://api.support.greatdetail.com",Q={"X-Powered-By":"GDSupport/JavaScript"};var P=class extends Error{constructor(e,o){super("Support Error",{cause:o});this.response=e}};import{z as i}from"zod";var j=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 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 v=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,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var O=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}list({query:t,limit:e,filter:o,include:s,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.limitQuery(e),...o?[["filter",o]]:[],...this._transport.includeQuery(s??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var _=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/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,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}listByConversation(t,{limit:e,include:o,request:s={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:s={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o)]})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var I=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 L=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 A=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Q;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var y=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 U=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 q from"is-network-error";import K,{HTTPError as Y}from"ky";var S=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=K.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let s of this.options.requestFilterables){let r=s.getHeaders();for(let[p,H]of Object.entries(r))o.headers.has(p)||o.headers.set(p,H)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,s]of Object.entries(t))s!==void 0&&e.push(["sort",s+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let o=this.client(t,e).catch(async s=>{throw q(s)?new Error("A network error occurred",{cause:s}):s instanceof Y?new P(s.response,s):s});return{response:()=>o,json:async()=>(await o).json()}}};var D=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,request:e={}}){let o=new FormData;for(let s of t)o.append("file",s);return this._transport.send("v1/uploads",{...e,method:"POST",body:o})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var E=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 G=class{constructor(t){this._transport=t}async event({key:t=process.env[B],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."+B);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}=j.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 k=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 w=class n{static DEFAULT_BASE_URL=N;static PublicAuthentication=a;static BasicAuthentication=c;static BearerAuthentication=m;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;channelConversationSettings;compositionSection;contact;conversation;label;message;model;note;source;statistics;upload;user;webhook;webhookSubscription;constructor(t,{baseURL:e,...o}={}){this._transport=new S({requestFilterables:[new A,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 g(this._transport),this.contact=new v(this._transport),this.conversation=new O(this._transport),this.label=new _(this._transport),this.message=new T(this._transport),this.model=new I(this._transport),this.note=new L(this._transport),this.source=new y(this._transport),this.statistics=new U(this._transport),this.upload=new D(this._transport),this.user=new E(this._transport),this.webhook=new G(this._transport),this.webhookSubscription=new k(this._transport)}static getBaseURL(){return process.env[W]??this.DEFAULT_BASE_URL}};export{z as a,a as b,N as c,P as d,j as e,w as f};