@great-detail/support-sdk 0.17.1 → 0.17.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.
- package/dist/{Client-BobTSG8s.d.cts → Client-DLfBry8K.d.cts} +25 -27
- package/dist/{Client-BobTSG8s.d.ts → Client-DLfBry8K.d.ts} +25 -27
- package/dist/{chunk-O4VU5LNU.js → chunk-GDE2LAN3.js} +1 -1
- package/dist/{chunk-BMWOMVWD.js → chunk-IO4M5UU5.js} +1 -1
- package/dist/cli/index.cjs +1 -1
- package/dist/cli/index.d.cts +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -1265,6 +1265,7 @@ type CreateContactPayload = {
|
|
|
1265
1265
|
account: string;
|
|
1266
1266
|
emailAddress?: Nullable<string>;
|
|
1267
1267
|
telephoneNumber?: Nullable<string>;
|
|
1268
|
+
customMetadata?: Nullable<CustomMetadata>;
|
|
1268
1269
|
};
|
|
1269
1270
|
interface CreateContactOptions {
|
|
1270
1271
|
body: CreateContactPayload;
|
|
@@ -1447,7 +1448,7 @@ declare class ContactAPI {
|
|
|
1447
1448
|
*/
|
|
1448
1449
|
|
|
1449
1450
|
type ConversationID = `cnv${string}` | (string & NonNullable<unknown>);
|
|
1450
|
-
type ActiveConversationStatus = "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus";
|
|
1451
|
+
type ActiveConversationStatus = "OpenConversationStatus" | "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus";
|
|
1451
1452
|
type ConcludedConversationStatus = "ResolvedConversationStatus" | "ClosedConversationStatus";
|
|
1452
1453
|
type ConversationStatus = ActiveConversationStatus | ConcludedConversationStatus;
|
|
1453
1454
|
type Conversation = {
|
|
@@ -1472,6 +1473,8 @@ type Conversation = {
|
|
|
1472
1473
|
|
|
1473
1474
|
type CreateConversationPayload = {
|
|
1474
1475
|
name?: Nullable<string>;
|
|
1476
|
+
channel: ChannelID;
|
|
1477
|
+
contacts: ContactID[];
|
|
1475
1478
|
autoResolveAt?: Nullable<string>;
|
|
1476
1479
|
};
|
|
1477
1480
|
interface CreateConversationOptions {
|
|
@@ -1698,9 +1701,6 @@ declare class ConversationAPI {
|
|
|
1698
1701
|
response: () => Promise<ky.KyResponse<ListChannelConversationsResponse>>;
|
|
1699
1702
|
json: () => Promise<ListChannelConversationsResponse>;
|
|
1700
1703
|
};
|
|
1701
|
-
/**
|
|
1702
|
-
* @deprecated Not Yet Implemented
|
|
1703
|
-
*/
|
|
1704
1704
|
create({ body, request }: CreateConversationOptions): {
|
|
1705
1705
|
response: () => Promise<ky.KyResponse<CreateConversationResponse>>;
|
|
1706
1706
|
json: () => Promise<CreateConversationResponse>;
|
|
@@ -2714,48 +2714,46 @@ declare const eventWebhookSchema: z.ZodObject<{
|
|
|
2714
2714
|
};
|
|
2715
2715
|
};
|
|
2716
2716
|
}>;
|
|
2717
|
+
type WebhookEventType = AccountWebhookEventType | AccountAccessTokenEventType | ContactEventType | ConversationEventType | MessageEventType | WebhookSubscriptionEventType;
|
|
2718
|
+
type AccountWebhookEventType = "account.created" | "account.updated";
|
|
2719
|
+
type AccountAccessTokenEventType = "accountAccessToken.created" | "accountAccessToken.deleted";
|
|
2720
|
+
type ContactEventType = "contact.created" | "contact.updated" | "contact.deleted";
|
|
2721
|
+
type ConversationEventType = "conversation.created" | "conversation.updated" | "conversation.closed" | "conversation.received" | "conversation.resolved" | "conversation.sent";
|
|
2722
|
+
type MessageEventType = "message.created" | "message.updated" | "message.delivered" | "message.failed" | "message.read" | "message.received" | "message.sent";
|
|
2723
|
+
type WebhookSubscriptionEventType = "webhook-subscription.created" | "webhook-subscription.updated" | "webhook-subscription.deleted" | "webhook-subscription.test";
|
|
2717
2724
|
type WebhookEventPayload = {
|
|
2718
2725
|
data: {
|
|
2719
2726
|
event: {
|
|
2720
2727
|
id: string;
|
|
2721
2728
|
createdAt: string;
|
|
2722
2729
|
} & ({
|
|
2723
|
-
type:
|
|
2730
|
+
type: AccountWebhookEventType;
|
|
2724
2731
|
payload: {
|
|
2725
2732
|
account: string;
|
|
2726
2733
|
};
|
|
2727
2734
|
} | {
|
|
2728
|
-
type:
|
|
2735
|
+
type: AccountAccessTokenEventType;
|
|
2729
2736
|
payload: {
|
|
2730
2737
|
accountAccessToken: string;
|
|
2731
2738
|
};
|
|
2732
2739
|
} | {
|
|
2733
|
-
type:
|
|
2740
|
+
type: ContactEventType;
|
|
2734
2741
|
payload: {
|
|
2735
2742
|
contact: string;
|
|
2736
2743
|
};
|
|
2737
2744
|
} | {
|
|
2738
|
-
type:
|
|
2745
|
+
type: ConversationEventType;
|
|
2739
2746
|
payload: {
|
|
2740
2747
|
conversation: string;
|
|
2741
2748
|
};
|
|
2742
2749
|
} | {
|
|
2743
|
-
type:
|
|
2750
|
+
type: MessageEventType;
|
|
2744
2751
|
} | {
|
|
2745
|
-
type:
|
|
2752
|
+
type: WebhookSubscriptionEventType;
|
|
2746
2753
|
});
|
|
2747
2754
|
};
|
|
2748
2755
|
};
|
|
2749
2756
|
|
|
2750
|
-
/**
|
|
2751
|
-
* Great Detail Support System.
|
|
2752
|
-
*
|
|
2753
|
-
* @copyright 2024 Great Detail Ltd
|
|
2754
|
-
* @author Great Detail Ltd <info@greatdetail.com>
|
|
2755
|
-
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
2756
|
-
* @see https://greatdetail.com
|
|
2757
|
-
*/
|
|
2758
|
-
|
|
2759
2757
|
type WebhookResponse = z.infer<typeof eventWebhookSchema>;
|
|
2760
2758
|
declare class WebhookAPI {
|
|
2761
2759
|
protected _transport: FetchTransport;
|
|
@@ -2847,29 +2845,29 @@ declare class WebhookAPI {
|
|
|
2847
2845
|
id: string;
|
|
2848
2846
|
createdAt: string;
|
|
2849
2847
|
} & ({
|
|
2850
|
-
type:
|
|
2848
|
+
type: AccountWebhookEventType;
|
|
2851
2849
|
payload: {
|
|
2852
2850
|
account: string;
|
|
2853
2851
|
};
|
|
2854
2852
|
} | {
|
|
2855
|
-
type:
|
|
2853
|
+
type: AccountAccessTokenEventType;
|
|
2856
2854
|
payload: {
|
|
2857
2855
|
accountAccessToken: string;
|
|
2858
2856
|
};
|
|
2859
2857
|
} | {
|
|
2860
|
-
type:
|
|
2858
|
+
type: ContactEventType;
|
|
2861
2859
|
payload: {
|
|
2862
2860
|
contact: string;
|
|
2863
2861
|
};
|
|
2864
2862
|
} | {
|
|
2865
|
-
type:
|
|
2863
|
+
type: ConversationEventType;
|
|
2866
2864
|
payload: {
|
|
2867
2865
|
conversation: string;
|
|
2868
2866
|
};
|
|
2869
2867
|
} | {
|
|
2870
|
-
type:
|
|
2868
|
+
type: MessageEventType;
|
|
2871
2869
|
} | {
|
|
2872
|
-
type:
|
|
2870
|
+
type: WebhookSubscriptionEventType;
|
|
2873
2871
|
});
|
|
2874
2872
|
}>;
|
|
2875
2873
|
protected _verifySignature(key: string, body: object, signatures: string[]): Promise<boolean>;
|
|
@@ -2988,7 +2986,7 @@ declare class WebhookSubscriptionAPI {
|
|
|
2988
2986
|
response: () => Promise<ky.KyResponse<ListWebhookSubscriptionsResponse>>;
|
|
2989
2987
|
json: () => Promise<ListWebhookSubscriptionsResponse>;
|
|
2990
2988
|
};
|
|
2991
|
-
test(id: WebhookSubscriptionID, { request }
|
|
2989
|
+
test(id: WebhookSubscriptionID, { request }?: TestWebhookSubscriptionOptions): {
|
|
2992
2990
|
response: () => Promise<ky.KyResponse<TestWebhookSubscriptionResponse>>;
|
|
2993
2991
|
json: () => Promise<TestWebhookSubscriptionResponse>;
|
|
2994
2992
|
};
|
|
@@ -3074,4 +3072,4 @@ declare class Client {
|
|
|
3074
3072
|
static getBaseURL(): string;
|
|
3075
3073
|
}
|
|
3076
3074
|
|
|
3077
|
-
export { type BoilerplateCategory as $, type Account as A, type Action as B, Client as C, type DeleteAccountAccessTokenPayload as D, type ActionID as E, type ListActionsOptions as F, type GetAccountOptions as G, type ListActionsResponse as H, type BoilerplateContent as I, type BoilerplateContentID as J, type CreateBoilerplateContentPayload as K, type ListAccountAccessTokensOptions as L, type CreateBoilerplateContentOptions as M, type CreateBoilerplateContentResponse as N, type Options as O, type GetBoilerplateContentOptions as P, type GetBoilerplateContentResponse as Q, type RequestFilterable as R, type SortOptions as S, type ListBoilerplateCategoryBoilerplateContentsOptions as T, type UpdateAccountPayload as U, type ListBoilerplateCategoryBoilerplateContentsResponse as V, type ListBoilerplateContentsOptions as W, type ListBoilerplateContentsResponse as X, type UpdateBoilerplateContentPayload as Y, type UpdateBoilerplateContentOptions as Z, type UpdateBoilerplateContentResponse as _, type Options$4 as a, type ConversationID as a$, type BoilerplateCategoryID as a0, type CreateBoilerplateCategoryPayload as a1, type CreateBoilerplateCategoryOptions as a2, type CreateBoilerplateCategoryResponse as a3, type GetBoilerplateCategoryOptions as a4, type GetBoilerplateCategoryResponse as a5, type ListBoilerplateCategoriesIncludeOptions as a6, type ListBoilerplateCategoriesOptions as a7, type ListBoilerplateCategoriesResponse as a8, type UpdateBoilerplateCategoryPayload as a9, type ListChannelCompositionSectionsOptions as aA, type ListChannelCompositionSectionsResponse as aB, type ListCompositionSectionsOptions as aC, type ListCompositionSectionsResponse as aD, type UpdateCompositionSectionPayload as aE, type UpdateCompositionSectionOptions as aF, type UpdateCompositionSectionResponse as aG, type Contact as aH, type ContactID as aI, type CustomMetadata as aJ, type CreateContactPayload as aK, type CreateContactOptions as aL, type CreateContactResponse as aM, type DeleteContactOptions as aN, type DeleteContactResponse as aO, type GetContactIncludeOptions as aP, type GetContactOptions as aQ, type GetContactResponse as aR, type GetContactVCFOptions as aS, type ListContactsOptions as aT, type ListContactsResponse as aU, type ListLabelContactsOptions as aV, type ListLabelContactsResponse as aW, type UpdateContactPayload as aX, type UpdateContactOptions as aY, type UpdateContactResponse as aZ, type Conversation as a_, type UpdateBoilerplateCategoryOptions as aa, type UpdateBoilerplateCategoryResponse as ab, type Channel as ac, type ChannelID as ad, type CreateChannelPayload as ae, type CreateChannelOptions as af, type CreateChannelResponse as ag, type GetChannelOptions as ah, type GetChannelResponse as ai, type ListChannelsOptions as aj, type ListChannelsResponse as ak, type MetaWhatsappChannelGetBusinessProfileOptions as al, type MetaWhatsappChannelGetBusinessProfileResponse as am, type TwilioSendChannelSyncPayload as an, type TwilioSendgridChannelSyncOptions as ao, type TwilioSendgridChannelSyncResponse as ap, type UpdateChannelPayload as aq, type UpdateChannelOptions as ar, type UpdateChannelResponse as as, type CompositionSection as at, type CompositionSectionID as au, type CreateCompositionSectionPayload as av, type CreateCompositionSectionOptions as aw, type CreateCompositionSectionResponse as ax, type GetCompositionSectionOptions as ay, type GetCompositionSectionResponse as az, type AccountID as b, type CreateCorrectionModelOptions as b$, type ActiveConversationStatus as b0, type ConcludedConversationStatus as b1, type ConversationStatus as b2, type CreateConversationPayload as b3, type CreateConversationOptions as b4, type CreateConversationResponse as b5, type DeleteConversationOptions as b6, type DeleteConversationResponse as b7, type GetConversationIncludeOptions as b8, type GetConversationOptions as b9, type ListConversationLabelsResponse as bA, type ListLabelsIncludeOptions as bB, type ListLabelsOptions as bC, type ListLabelsResponse as bD, type UpdateLabelPayload as bE, type UpdateLabelOptions as bF, type UpdateLabelResponse as bG, type Message as bH, type CreateMessagePayload as bI, type CreateMessageOptions as bJ, type CreateMessageResponse as bK, type DeleteMessageOptions as bL, type DeleteMessageResponse as bM, type ListChannelMessagesIncludeOptions as bN, type ListChannelMessagesOptions as bO, type ListChannelMessagesResponse as bP, type ListConversationMessagesIncludeOptions as bQ, type ListConversationMessagesOptions as bR, type ListConversationMessagesResponse as bS, type ListMessagesIncludeOptions as bT, type ListMessagesOptions as bU, type ListMessagesResponse as bV, type MessageID as bW, type MessageRole as bX, type MessageStatus as bY, type Model as bZ, type CreateCorrectionModelPayload as b_, type GetConversationResponse as ba, type ListChannelConversationsOptions as bb, type ListChannelConversationsResponse as bc, type ListContactConversationsOptions as bd, type ListContactConversationsResponse as be, type ListConversationsIncludeOptions as bf, type FilterOptions as bg, type ListConversationOptions as bh, type ListConversationsResponse as bi, type ListLabelConversationsOptions as bj, type ListLabelConversationsResponse as bk, type UpdateConversationPayload as bl, type UpdateConversationOptions as bm, type UpdateConversationResponse as bn, type Label as bo, type CreateLabelPayload as bp, type CreateLabelOptions as bq, type CreateLabelResponse as br, type DeleteLabelOptions as bs, type DeleteLabelResponse as bt, type GetLabelOptions as bu, type GetLabelResponse as bv, type LabelID as bw, type ListContactLabelsOptions as bx, type ListContactLabelsResponse as by, type ListConversationLabelsOptions as bz, type CreateAccountPayload as c, type CreateCorrectionResponse as c0, type CreateResponseModelPayload as c1, type CreateResponseModelOptions as c2, type CreateResponseResponse as c3, type GetModelOptions as c4, type GetModelResponse as c5, type ListModelsOptions as c6, type ListModelsResponse as c7, type ModelID as c8, type Note as c9, type NotificationSubscriptionID as cA, type Upload as cB, type CreateUploadOptions as cC, type CreateUploadResponse as cD, type DeleteUploadOptions as cE, type DeleteUploadResponse as cF, type GetUploadOptions as cG, type GetUploadResponse as cH, type UploadID as cI, type EventWebhookOptions as cJ, eventWebhookSchema as cK, type
|
|
3075
|
+
export { type BoilerplateCategory as $, type Account as A, type Action as B, Client as C, type DeleteAccountAccessTokenPayload as D, type ActionID as E, type ListActionsOptions as F, type GetAccountOptions as G, type ListActionsResponse as H, type BoilerplateContent as I, type BoilerplateContentID as J, type CreateBoilerplateContentPayload as K, type ListAccountAccessTokensOptions as L, type CreateBoilerplateContentOptions as M, type CreateBoilerplateContentResponse as N, type Options as O, type GetBoilerplateContentOptions as P, type GetBoilerplateContentResponse as Q, type RequestFilterable as R, type SortOptions as S, type ListBoilerplateCategoryBoilerplateContentsOptions as T, type UpdateAccountPayload as U, type ListBoilerplateCategoryBoilerplateContentsResponse as V, type ListBoilerplateContentsOptions as W, type ListBoilerplateContentsResponse as X, type UpdateBoilerplateContentPayload as Y, type UpdateBoilerplateContentOptions as Z, type UpdateBoilerplateContentResponse as _, type Options$4 as a, type ConversationID as a$, type BoilerplateCategoryID as a0, type CreateBoilerplateCategoryPayload as a1, type CreateBoilerplateCategoryOptions as a2, type CreateBoilerplateCategoryResponse as a3, type GetBoilerplateCategoryOptions as a4, type GetBoilerplateCategoryResponse as a5, type ListBoilerplateCategoriesIncludeOptions as a6, type ListBoilerplateCategoriesOptions as a7, type ListBoilerplateCategoriesResponse as a8, type UpdateBoilerplateCategoryPayload as a9, type ListChannelCompositionSectionsOptions as aA, type ListChannelCompositionSectionsResponse as aB, type ListCompositionSectionsOptions as aC, type ListCompositionSectionsResponse as aD, type UpdateCompositionSectionPayload as aE, type UpdateCompositionSectionOptions as aF, type UpdateCompositionSectionResponse as aG, type Contact as aH, type ContactID as aI, type CustomMetadata as aJ, type CreateContactPayload as aK, type CreateContactOptions as aL, type CreateContactResponse as aM, type DeleteContactOptions as aN, type DeleteContactResponse as aO, type GetContactIncludeOptions as aP, type GetContactOptions as aQ, type GetContactResponse as aR, type GetContactVCFOptions as aS, type ListContactsOptions as aT, type ListContactsResponse as aU, type ListLabelContactsOptions as aV, type ListLabelContactsResponse as aW, type UpdateContactPayload as aX, type UpdateContactOptions as aY, type UpdateContactResponse as aZ, type Conversation as a_, type UpdateBoilerplateCategoryOptions as aa, type UpdateBoilerplateCategoryResponse as ab, type Channel as ac, type ChannelID as ad, type CreateChannelPayload as ae, type CreateChannelOptions as af, type CreateChannelResponse as ag, type GetChannelOptions as ah, type GetChannelResponse as ai, type ListChannelsOptions as aj, type ListChannelsResponse as ak, type MetaWhatsappChannelGetBusinessProfileOptions as al, type MetaWhatsappChannelGetBusinessProfileResponse as am, type TwilioSendChannelSyncPayload as an, type TwilioSendgridChannelSyncOptions as ao, type TwilioSendgridChannelSyncResponse as ap, type UpdateChannelPayload as aq, type UpdateChannelOptions as ar, type UpdateChannelResponse as as, type CompositionSection as at, type CompositionSectionID as au, type CreateCompositionSectionPayload as av, type CreateCompositionSectionOptions as aw, type CreateCompositionSectionResponse as ax, type GetCompositionSectionOptions as ay, type GetCompositionSectionResponse as az, type AccountID as b, type CreateCorrectionModelOptions as b$, type ActiveConversationStatus as b0, type ConcludedConversationStatus as b1, type ConversationStatus as b2, type CreateConversationPayload as b3, type CreateConversationOptions as b4, type CreateConversationResponse as b5, type DeleteConversationOptions as b6, type DeleteConversationResponse as b7, type GetConversationIncludeOptions as b8, type GetConversationOptions as b9, type ListConversationLabelsResponse as bA, type ListLabelsIncludeOptions as bB, type ListLabelsOptions as bC, type ListLabelsResponse as bD, type UpdateLabelPayload as bE, type UpdateLabelOptions as bF, type UpdateLabelResponse as bG, type Message as bH, type CreateMessagePayload as bI, type CreateMessageOptions as bJ, type CreateMessageResponse as bK, type DeleteMessageOptions as bL, type DeleteMessageResponse as bM, type ListChannelMessagesIncludeOptions as bN, type ListChannelMessagesOptions as bO, type ListChannelMessagesResponse as bP, type ListConversationMessagesIncludeOptions as bQ, type ListConversationMessagesOptions as bR, type ListConversationMessagesResponse as bS, type ListMessagesIncludeOptions as bT, type ListMessagesOptions as bU, type ListMessagesResponse as bV, type MessageID as bW, type MessageRole as bX, type MessageStatus as bY, type Model as bZ, type CreateCorrectionModelPayload as b_, type GetConversationResponse as ba, type ListChannelConversationsOptions as bb, type ListChannelConversationsResponse as bc, type ListContactConversationsOptions as bd, type ListContactConversationsResponse as be, type ListConversationsIncludeOptions as bf, type FilterOptions as bg, type ListConversationOptions as bh, type ListConversationsResponse as bi, type ListLabelConversationsOptions as bj, type ListLabelConversationsResponse as bk, type UpdateConversationPayload as bl, type UpdateConversationOptions as bm, type UpdateConversationResponse as bn, type Label as bo, type CreateLabelPayload as bp, type CreateLabelOptions as bq, type CreateLabelResponse as br, type DeleteLabelOptions as bs, type DeleteLabelResponse as bt, type GetLabelOptions as bu, type GetLabelResponse as bv, type LabelID as bw, type ListContactLabelsOptions as bx, type ListContactLabelsResponse as by, type ListConversationLabelsOptions as bz, type CreateAccountPayload as c, type GetWebhookSubscriptionResponse as c$, type CreateCorrectionResponse as c0, type CreateResponseModelPayload as c1, type CreateResponseModelOptions as c2, type CreateResponseResponse as c3, type GetModelOptions as c4, type GetModelResponse as c5, type ListModelsOptions as c6, type ListModelsResponse as c7, type ModelID as c8, type Note as c9, type NotificationSubscriptionID as cA, type Upload as cB, type CreateUploadOptions as cC, type CreateUploadResponse as cD, type DeleteUploadOptions as cE, type DeleteUploadResponse as cF, type GetUploadOptions as cG, type GetUploadResponse as cH, type UploadID as cI, type EventWebhookOptions as cJ, eventWebhookSchema as cK, type WebhookEventType as cL, type AccountWebhookEventType as cM, type AccountAccessTokenEventType as cN, type ContactEventType as cO, type ConversationEventType as cP, type MessageEventType as cQ, type WebhookSubscriptionEventType as cR, type WebhookEventPayload as cS, type WebhookResponse as cT, type WebhookSubscription as cU, type CreateWebhookSubscriptionPayload as cV, type CreateWebhookSubscriptionOptions as cW, type CreateWebhookSubscriptionResponse as cX, type DeleteWebhookSubscriptionOptions as cY, type DeleteWebhookSubscriptionResponse as cZ, type GetWebhookSubscriptionOptions as c_, type CreateContactNotePayload as ca, type CreateContactNoteOptions as cb, type CreateContactNoteResponse as cc, type CreateConversationNotePayload as cd, type CreateConversationNoteOptions as ce, type CreateConversationNoteResponse as cf, type GetNoteOptions as cg, type GetNoteResponse as ch, type ListContactNotesOptions as ci, type ListContactNotesResponse as cj, type ListConversationNotesOptions as ck, type ListConversationNotesResponse as cl, type NoteID as cm, type UpdateNotePayload as cn, type UpdateNoteOptions as co, type UpdateNoteResponse as cp, type Source as cq, type GetSourceOptions as cr, type GetSourceResponse as cs, type ListSourcesOptions as ct, type ListSourcesResponse as cu, type SourceID as cv, type NotificationSubscription as cw, type CreateContactNotificationSubscriptionPayload as cx, type CreateContactNotificationSubscriptionOptions as cy, type CreateContactNotificationSubscriptionResponse as cz, type CreateAccountOptions as d, type ListWebhookSubscriptionsOptions as d0, type ListWebhookSubscriptionsResponse as d1, type TestWebhookSubscriptionOptions as d2, type TestWebhookSubscriptionResponse as d3, type WebhookSubscriptionID as d4, type GetNotificationWellKnownResponse as d5, type CreateAccountResponse as e, type GetAccountResponse as f, type GetCurrentAccountOptions as g, type GetCurrentAccountResponse as h, type UpdateAccountOptions as i, type UpdateAccountResponse as j, type AccountAccessToken as k, type AccountAccessTokenID as l, type CreateAccountAccessTokenPayload as m, type CreateAccountAccessTokenOptions as n, type CreateAccountAccessTokenResponse as o, type DeleteAccountAccessTokenOptions as p, type DeleteAccountAccessTokenResponse as q, type GetAccountAccessTokenOptions as r, type GetAccountAccessTokenResponse as s, type ListAccountAccessTokensResponse as t, type AccountConversationSettings as u, type GetAccountConversationSettingsOptions as v, type GetAccountConversationSettingsResponse as w, type UpdateAccountConversationSettingsPayload as x, type UpdateAccountConversationSettingsOptions as y, type UpdateAccountConversationSettingsResponse as z };
|
|
@@ -1265,6 +1265,7 @@ type CreateContactPayload = {
|
|
|
1265
1265
|
account: string;
|
|
1266
1266
|
emailAddress?: Nullable<string>;
|
|
1267
1267
|
telephoneNumber?: Nullable<string>;
|
|
1268
|
+
customMetadata?: Nullable<CustomMetadata>;
|
|
1268
1269
|
};
|
|
1269
1270
|
interface CreateContactOptions {
|
|
1270
1271
|
body: CreateContactPayload;
|
|
@@ -1447,7 +1448,7 @@ declare class ContactAPI {
|
|
|
1447
1448
|
*/
|
|
1448
1449
|
|
|
1449
1450
|
type ConversationID = `cnv${string}` | (string & NonNullable<unknown>);
|
|
1450
|
-
type ActiveConversationStatus = "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus";
|
|
1451
|
+
type ActiveConversationStatus = "OpenConversationStatus" | "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus";
|
|
1451
1452
|
type ConcludedConversationStatus = "ResolvedConversationStatus" | "ClosedConversationStatus";
|
|
1452
1453
|
type ConversationStatus = ActiveConversationStatus | ConcludedConversationStatus;
|
|
1453
1454
|
type Conversation = {
|
|
@@ -1472,6 +1473,8 @@ type Conversation = {
|
|
|
1472
1473
|
|
|
1473
1474
|
type CreateConversationPayload = {
|
|
1474
1475
|
name?: Nullable<string>;
|
|
1476
|
+
channel: ChannelID;
|
|
1477
|
+
contacts: ContactID[];
|
|
1475
1478
|
autoResolveAt?: Nullable<string>;
|
|
1476
1479
|
};
|
|
1477
1480
|
interface CreateConversationOptions {
|
|
@@ -1698,9 +1701,6 @@ declare class ConversationAPI {
|
|
|
1698
1701
|
response: () => Promise<ky.KyResponse<ListChannelConversationsResponse>>;
|
|
1699
1702
|
json: () => Promise<ListChannelConversationsResponse>;
|
|
1700
1703
|
};
|
|
1701
|
-
/**
|
|
1702
|
-
* @deprecated Not Yet Implemented
|
|
1703
|
-
*/
|
|
1704
1704
|
create({ body, request }: CreateConversationOptions): {
|
|
1705
1705
|
response: () => Promise<ky.KyResponse<CreateConversationResponse>>;
|
|
1706
1706
|
json: () => Promise<CreateConversationResponse>;
|
|
@@ -2714,48 +2714,46 @@ declare const eventWebhookSchema: z.ZodObject<{
|
|
|
2714
2714
|
};
|
|
2715
2715
|
};
|
|
2716
2716
|
}>;
|
|
2717
|
+
type WebhookEventType = AccountWebhookEventType | AccountAccessTokenEventType | ContactEventType | ConversationEventType | MessageEventType | WebhookSubscriptionEventType;
|
|
2718
|
+
type AccountWebhookEventType = "account.created" | "account.updated";
|
|
2719
|
+
type AccountAccessTokenEventType = "accountAccessToken.created" | "accountAccessToken.deleted";
|
|
2720
|
+
type ContactEventType = "contact.created" | "contact.updated" | "contact.deleted";
|
|
2721
|
+
type ConversationEventType = "conversation.created" | "conversation.updated" | "conversation.closed" | "conversation.received" | "conversation.resolved" | "conversation.sent";
|
|
2722
|
+
type MessageEventType = "message.created" | "message.updated" | "message.delivered" | "message.failed" | "message.read" | "message.received" | "message.sent";
|
|
2723
|
+
type WebhookSubscriptionEventType = "webhook-subscription.created" | "webhook-subscription.updated" | "webhook-subscription.deleted" | "webhook-subscription.test";
|
|
2717
2724
|
type WebhookEventPayload = {
|
|
2718
2725
|
data: {
|
|
2719
2726
|
event: {
|
|
2720
2727
|
id: string;
|
|
2721
2728
|
createdAt: string;
|
|
2722
2729
|
} & ({
|
|
2723
|
-
type:
|
|
2730
|
+
type: AccountWebhookEventType;
|
|
2724
2731
|
payload: {
|
|
2725
2732
|
account: string;
|
|
2726
2733
|
};
|
|
2727
2734
|
} | {
|
|
2728
|
-
type:
|
|
2735
|
+
type: AccountAccessTokenEventType;
|
|
2729
2736
|
payload: {
|
|
2730
2737
|
accountAccessToken: string;
|
|
2731
2738
|
};
|
|
2732
2739
|
} | {
|
|
2733
|
-
type:
|
|
2740
|
+
type: ContactEventType;
|
|
2734
2741
|
payload: {
|
|
2735
2742
|
contact: string;
|
|
2736
2743
|
};
|
|
2737
2744
|
} | {
|
|
2738
|
-
type:
|
|
2745
|
+
type: ConversationEventType;
|
|
2739
2746
|
payload: {
|
|
2740
2747
|
conversation: string;
|
|
2741
2748
|
};
|
|
2742
2749
|
} | {
|
|
2743
|
-
type:
|
|
2750
|
+
type: MessageEventType;
|
|
2744
2751
|
} | {
|
|
2745
|
-
type:
|
|
2752
|
+
type: WebhookSubscriptionEventType;
|
|
2746
2753
|
});
|
|
2747
2754
|
};
|
|
2748
2755
|
};
|
|
2749
2756
|
|
|
2750
|
-
/**
|
|
2751
|
-
* Great Detail Support System.
|
|
2752
|
-
*
|
|
2753
|
-
* @copyright 2024 Great Detail Ltd
|
|
2754
|
-
* @author Great Detail Ltd <info@greatdetail.com>
|
|
2755
|
-
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
2756
|
-
* @see https://greatdetail.com
|
|
2757
|
-
*/
|
|
2758
|
-
|
|
2759
2757
|
type WebhookResponse = z.infer<typeof eventWebhookSchema>;
|
|
2760
2758
|
declare class WebhookAPI {
|
|
2761
2759
|
protected _transport: FetchTransport;
|
|
@@ -2847,29 +2845,29 @@ declare class WebhookAPI {
|
|
|
2847
2845
|
id: string;
|
|
2848
2846
|
createdAt: string;
|
|
2849
2847
|
} & ({
|
|
2850
|
-
type:
|
|
2848
|
+
type: AccountWebhookEventType;
|
|
2851
2849
|
payload: {
|
|
2852
2850
|
account: string;
|
|
2853
2851
|
};
|
|
2854
2852
|
} | {
|
|
2855
|
-
type:
|
|
2853
|
+
type: AccountAccessTokenEventType;
|
|
2856
2854
|
payload: {
|
|
2857
2855
|
accountAccessToken: string;
|
|
2858
2856
|
};
|
|
2859
2857
|
} | {
|
|
2860
|
-
type:
|
|
2858
|
+
type: ContactEventType;
|
|
2861
2859
|
payload: {
|
|
2862
2860
|
contact: string;
|
|
2863
2861
|
};
|
|
2864
2862
|
} | {
|
|
2865
|
-
type:
|
|
2863
|
+
type: ConversationEventType;
|
|
2866
2864
|
payload: {
|
|
2867
2865
|
conversation: string;
|
|
2868
2866
|
};
|
|
2869
2867
|
} | {
|
|
2870
|
-
type:
|
|
2868
|
+
type: MessageEventType;
|
|
2871
2869
|
} | {
|
|
2872
|
-
type:
|
|
2870
|
+
type: WebhookSubscriptionEventType;
|
|
2873
2871
|
});
|
|
2874
2872
|
}>;
|
|
2875
2873
|
protected _verifySignature(key: string, body: object, signatures: string[]): Promise<boolean>;
|
|
@@ -2988,7 +2986,7 @@ declare class WebhookSubscriptionAPI {
|
|
|
2988
2986
|
response: () => Promise<ky.KyResponse<ListWebhookSubscriptionsResponse>>;
|
|
2989
2987
|
json: () => Promise<ListWebhookSubscriptionsResponse>;
|
|
2990
2988
|
};
|
|
2991
|
-
test(id: WebhookSubscriptionID, { request }
|
|
2989
|
+
test(id: WebhookSubscriptionID, { request }?: TestWebhookSubscriptionOptions): {
|
|
2992
2990
|
response: () => Promise<ky.KyResponse<TestWebhookSubscriptionResponse>>;
|
|
2993
2991
|
json: () => Promise<TestWebhookSubscriptionResponse>;
|
|
2994
2992
|
};
|
|
@@ -3074,4 +3072,4 @@ declare class Client {
|
|
|
3074
3072
|
static getBaseURL(): string;
|
|
3075
3073
|
}
|
|
3076
3074
|
|
|
3077
|
-
export { type BoilerplateCategory as $, type Account as A, type Action as B, Client as C, type DeleteAccountAccessTokenPayload as D, type ActionID as E, type ListActionsOptions as F, type GetAccountOptions as G, type ListActionsResponse as H, type BoilerplateContent as I, type BoilerplateContentID as J, type CreateBoilerplateContentPayload as K, type ListAccountAccessTokensOptions as L, type CreateBoilerplateContentOptions as M, type CreateBoilerplateContentResponse as N, type Options as O, type GetBoilerplateContentOptions as P, type GetBoilerplateContentResponse as Q, type RequestFilterable as R, type SortOptions as S, type ListBoilerplateCategoryBoilerplateContentsOptions as T, type UpdateAccountPayload as U, type ListBoilerplateCategoryBoilerplateContentsResponse as V, type ListBoilerplateContentsOptions as W, type ListBoilerplateContentsResponse as X, type UpdateBoilerplateContentPayload as Y, type UpdateBoilerplateContentOptions as Z, type UpdateBoilerplateContentResponse as _, type Options$4 as a, type ConversationID as a$, type BoilerplateCategoryID as a0, type CreateBoilerplateCategoryPayload as a1, type CreateBoilerplateCategoryOptions as a2, type CreateBoilerplateCategoryResponse as a3, type GetBoilerplateCategoryOptions as a4, type GetBoilerplateCategoryResponse as a5, type ListBoilerplateCategoriesIncludeOptions as a6, type ListBoilerplateCategoriesOptions as a7, type ListBoilerplateCategoriesResponse as a8, type UpdateBoilerplateCategoryPayload as a9, type ListChannelCompositionSectionsOptions as aA, type ListChannelCompositionSectionsResponse as aB, type ListCompositionSectionsOptions as aC, type ListCompositionSectionsResponse as aD, type UpdateCompositionSectionPayload as aE, type UpdateCompositionSectionOptions as aF, type UpdateCompositionSectionResponse as aG, type Contact as aH, type ContactID as aI, type CustomMetadata as aJ, type CreateContactPayload as aK, type CreateContactOptions as aL, type CreateContactResponse as aM, type DeleteContactOptions as aN, type DeleteContactResponse as aO, type GetContactIncludeOptions as aP, type GetContactOptions as aQ, type GetContactResponse as aR, type GetContactVCFOptions as aS, type ListContactsOptions as aT, type ListContactsResponse as aU, type ListLabelContactsOptions as aV, type ListLabelContactsResponse as aW, type UpdateContactPayload as aX, type UpdateContactOptions as aY, type UpdateContactResponse as aZ, type Conversation as a_, type UpdateBoilerplateCategoryOptions as aa, type UpdateBoilerplateCategoryResponse as ab, type Channel as ac, type ChannelID as ad, type CreateChannelPayload as ae, type CreateChannelOptions as af, type CreateChannelResponse as ag, type GetChannelOptions as ah, type GetChannelResponse as ai, type ListChannelsOptions as aj, type ListChannelsResponse as ak, type MetaWhatsappChannelGetBusinessProfileOptions as al, type MetaWhatsappChannelGetBusinessProfileResponse as am, type TwilioSendChannelSyncPayload as an, type TwilioSendgridChannelSyncOptions as ao, type TwilioSendgridChannelSyncResponse as ap, type UpdateChannelPayload as aq, type UpdateChannelOptions as ar, type UpdateChannelResponse as as, type CompositionSection as at, type CompositionSectionID as au, type CreateCompositionSectionPayload as av, type CreateCompositionSectionOptions as aw, type CreateCompositionSectionResponse as ax, type GetCompositionSectionOptions as ay, type GetCompositionSectionResponse as az, type AccountID as b, type CreateCorrectionModelOptions as b$, type ActiveConversationStatus as b0, type ConcludedConversationStatus as b1, type ConversationStatus as b2, type CreateConversationPayload as b3, type CreateConversationOptions as b4, type CreateConversationResponse as b5, type DeleteConversationOptions as b6, type DeleteConversationResponse as b7, type GetConversationIncludeOptions as b8, type GetConversationOptions as b9, type ListConversationLabelsResponse as bA, type ListLabelsIncludeOptions as bB, type ListLabelsOptions as bC, type ListLabelsResponse as bD, type UpdateLabelPayload as bE, type UpdateLabelOptions as bF, type UpdateLabelResponse as bG, type Message as bH, type CreateMessagePayload as bI, type CreateMessageOptions as bJ, type CreateMessageResponse as bK, type DeleteMessageOptions as bL, type DeleteMessageResponse as bM, type ListChannelMessagesIncludeOptions as bN, type ListChannelMessagesOptions as bO, type ListChannelMessagesResponse as bP, type ListConversationMessagesIncludeOptions as bQ, type ListConversationMessagesOptions as bR, type ListConversationMessagesResponse as bS, type ListMessagesIncludeOptions as bT, type ListMessagesOptions as bU, type ListMessagesResponse as bV, type MessageID as bW, type MessageRole as bX, type MessageStatus as bY, type Model as bZ, type CreateCorrectionModelPayload as b_, type GetConversationResponse as ba, type ListChannelConversationsOptions as bb, type ListChannelConversationsResponse as bc, type ListContactConversationsOptions as bd, type ListContactConversationsResponse as be, type ListConversationsIncludeOptions as bf, type FilterOptions as bg, type ListConversationOptions as bh, type ListConversationsResponse as bi, type ListLabelConversationsOptions as bj, type ListLabelConversationsResponse as bk, type UpdateConversationPayload as bl, type UpdateConversationOptions as bm, type UpdateConversationResponse as bn, type Label as bo, type CreateLabelPayload as bp, type CreateLabelOptions as bq, type CreateLabelResponse as br, type DeleteLabelOptions as bs, type DeleteLabelResponse as bt, type GetLabelOptions as bu, type GetLabelResponse as bv, type LabelID as bw, type ListContactLabelsOptions as bx, type ListContactLabelsResponse as by, type ListConversationLabelsOptions as bz, type CreateAccountPayload as c, type CreateCorrectionResponse as c0, type CreateResponseModelPayload as c1, type CreateResponseModelOptions as c2, type CreateResponseResponse as c3, type GetModelOptions as c4, type GetModelResponse as c5, type ListModelsOptions as c6, type ListModelsResponse as c7, type ModelID as c8, type Note as c9, type NotificationSubscriptionID as cA, type Upload as cB, type CreateUploadOptions as cC, type CreateUploadResponse as cD, type DeleteUploadOptions as cE, type DeleteUploadResponse as cF, type GetUploadOptions as cG, type GetUploadResponse as cH, type UploadID as cI, type EventWebhookOptions as cJ, eventWebhookSchema as cK, type
|
|
3075
|
+
export { type BoilerplateCategory as $, type Account as A, type Action as B, Client as C, type DeleteAccountAccessTokenPayload as D, type ActionID as E, type ListActionsOptions as F, type GetAccountOptions as G, type ListActionsResponse as H, type BoilerplateContent as I, type BoilerplateContentID as J, type CreateBoilerplateContentPayload as K, type ListAccountAccessTokensOptions as L, type CreateBoilerplateContentOptions as M, type CreateBoilerplateContentResponse as N, type Options as O, type GetBoilerplateContentOptions as P, type GetBoilerplateContentResponse as Q, type RequestFilterable as R, type SortOptions as S, type ListBoilerplateCategoryBoilerplateContentsOptions as T, type UpdateAccountPayload as U, type ListBoilerplateCategoryBoilerplateContentsResponse as V, type ListBoilerplateContentsOptions as W, type ListBoilerplateContentsResponse as X, type UpdateBoilerplateContentPayload as Y, type UpdateBoilerplateContentOptions as Z, type UpdateBoilerplateContentResponse as _, type Options$4 as a, type ConversationID as a$, type BoilerplateCategoryID as a0, type CreateBoilerplateCategoryPayload as a1, type CreateBoilerplateCategoryOptions as a2, type CreateBoilerplateCategoryResponse as a3, type GetBoilerplateCategoryOptions as a4, type GetBoilerplateCategoryResponse as a5, type ListBoilerplateCategoriesIncludeOptions as a6, type ListBoilerplateCategoriesOptions as a7, type ListBoilerplateCategoriesResponse as a8, type UpdateBoilerplateCategoryPayload as a9, type ListChannelCompositionSectionsOptions as aA, type ListChannelCompositionSectionsResponse as aB, type ListCompositionSectionsOptions as aC, type ListCompositionSectionsResponse as aD, type UpdateCompositionSectionPayload as aE, type UpdateCompositionSectionOptions as aF, type UpdateCompositionSectionResponse as aG, type Contact as aH, type ContactID as aI, type CustomMetadata as aJ, type CreateContactPayload as aK, type CreateContactOptions as aL, type CreateContactResponse as aM, type DeleteContactOptions as aN, type DeleteContactResponse as aO, type GetContactIncludeOptions as aP, type GetContactOptions as aQ, type GetContactResponse as aR, type GetContactVCFOptions as aS, type ListContactsOptions as aT, type ListContactsResponse as aU, type ListLabelContactsOptions as aV, type ListLabelContactsResponse as aW, type UpdateContactPayload as aX, type UpdateContactOptions as aY, type UpdateContactResponse as aZ, type Conversation as a_, type UpdateBoilerplateCategoryOptions as aa, type UpdateBoilerplateCategoryResponse as ab, type Channel as ac, type ChannelID as ad, type CreateChannelPayload as ae, type CreateChannelOptions as af, type CreateChannelResponse as ag, type GetChannelOptions as ah, type GetChannelResponse as ai, type ListChannelsOptions as aj, type ListChannelsResponse as ak, type MetaWhatsappChannelGetBusinessProfileOptions as al, type MetaWhatsappChannelGetBusinessProfileResponse as am, type TwilioSendChannelSyncPayload as an, type TwilioSendgridChannelSyncOptions as ao, type TwilioSendgridChannelSyncResponse as ap, type UpdateChannelPayload as aq, type UpdateChannelOptions as ar, type UpdateChannelResponse as as, type CompositionSection as at, type CompositionSectionID as au, type CreateCompositionSectionPayload as av, type CreateCompositionSectionOptions as aw, type CreateCompositionSectionResponse as ax, type GetCompositionSectionOptions as ay, type GetCompositionSectionResponse as az, type AccountID as b, type CreateCorrectionModelOptions as b$, type ActiveConversationStatus as b0, type ConcludedConversationStatus as b1, type ConversationStatus as b2, type CreateConversationPayload as b3, type CreateConversationOptions as b4, type CreateConversationResponse as b5, type DeleteConversationOptions as b6, type DeleteConversationResponse as b7, type GetConversationIncludeOptions as b8, type GetConversationOptions as b9, type ListConversationLabelsResponse as bA, type ListLabelsIncludeOptions as bB, type ListLabelsOptions as bC, type ListLabelsResponse as bD, type UpdateLabelPayload as bE, type UpdateLabelOptions as bF, type UpdateLabelResponse as bG, type Message as bH, type CreateMessagePayload as bI, type CreateMessageOptions as bJ, type CreateMessageResponse as bK, type DeleteMessageOptions as bL, type DeleteMessageResponse as bM, type ListChannelMessagesIncludeOptions as bN, type ListChannelMessagesOptions as bO, type ListChannelMessagesResponse as bP, type ListConversationMessagesIncludeOptions as bQ, type ListConversationMessagesOptions as bR, type ListConversationMessagesResponse as bS, type ListMessagesIncludeOptions as bT, type ListMessagesOptions as bU, type ListMessagesResponse as bV, type MessageID as bW, type MessageRole as bX, type MessageStatus as bY, type Model as bZ, type CreateCorrectionModelPayload as b_, type GetConversationResponse as ba, type ListChannelConversationsOptions as bb, type ListChannelConversationsResponse as bc, type ListContactConversationsOptions as bd, type ListContactConversationsResponse as be, type ListConversationsIncludeOptions as bf, type FilterOptions as bg, type ListConversationOptions as bh, type ListConversationsResponse as bi, type ListLabelConversationsOptions as bj, type ListLabelConversationsResponse as bk, type UpdateConversationPayload as bl, type UpdateConversationOptions as bm, type UpdateConversationResponse as bn, type Label as bo, type CreateLabelPayload as bp, type CreateLabelOptions as bq, type CreateLabelResponse as br, type DeleteLabelOptions as bs, type DeleteLabelResponse as bt, type GetLabelOptions as bu, type GetLabelResponse as bv, type LabelID as bw, type ListContactLabelsOptions as bx, type ListContactLabelsResponse as by, type ListConversationLabelsOptions as bz, type CreateAccountPayload as c, type GetWebhookSubscriptionResponse as c$, type CreateCorrectionResponse as c0, type CreateResponseModelPayload as c1, type CreateResponseModelOptions as c2, type CreateResponseResponse as c3, type GetModelOptions as c4, type GetModelResponse as c5, type ListModelsOptions as c6, type ListModelsResponse as c7, type ModelID as c8, type Note as c9, type NotificationSubscriptionID as cA, type Upload as cB, type CreateUploadOptions as cC, type CreateUploadResponse as cD, type DeleteUploadOptions as cE, type DeleteUploadResponse as cF, type GetUploadOptions as cG, type GetUploadResponse as cH, type UploadID as cI, type EventWebhookOptions as cJ, eventWebhookSchema as cK, type WebhookEventType as cL, type AccountWebhookEventType as cM, type AccountAccessTokenEventType as cN, type ContactEventType as cO, type ConversationEventType as cP, type MessageEventType as cQ, type WebhookSubscriptionEventType as cR, type WebhookEventPayload as cS, type WebhookResponse as cT, type WebhookSubscription as cU, type CreateWebhookSubscriptionPayload as cV, type CreateWebhookSubscriptionOptions as cW, type CreateWebhookSubscriptionResponse as cX, type DeleteWebhookSubscriptionOptions as cY, type DeleteWebhookSubscriptionResponse as cZ, type GetWebhookSubscriptionOptions as c_, type CreateContactNotePayload as ca, type CreateContactNoteOptions as cb, type CreateContactNoteResponse as cc, type CreateConversationNotePayload as cd, type CreateConversationNoteOptions as ce, type CreateConversationNoteResponse as cf, type GetNoteOptions as cg, type GetNoteResponse as ch, type ListContactNotesOptions as ci, type ListContactNotesResponse as cj, type ListConversationNotesOptions as ck, type ListConversationNotesResponse as cl, type NoteID as cm, type UpdateNotePayload as cn, type UpdateNoteOptions as co, type UpdateNoteResponse as cp, type Source as cq, type GetSourceOptions as cr, type GetSourceResponse as cs, type ListSourcesOptions as ct, type ListSourcesResponse as cu, type SourceID as cv, type NotificationSubscription as cw, type CreateContactNotificationSubscriptionPayload as cx, type CreateContactNotificationSubscriptionOptions as cy, type CreateContactNotificationSubscriptionResponse as cz, type CreateAccountOptions as d, type ListWebhookSubscriptionsOptions as d0, type ListWebhookSubscriptionsResponse as d1, type TestWebhookSubscriptionOptions as d2, type TestWebhookSubscriptionResponse as d3, type WebhookSubscriptionID as d4, type GetNotificationWellKnownResponse as d5, type CreateAccountResponse as e, type GetAccountResponse as f, type GetCurrentAccountOptions as g, type GetCurrentAccountResponse as h, type UpdateAccountOptions as i, type UpdateAccountResponse as j, type AccountAccessToken as k, type AccountAccessTokenID as l, type CreateAccountAccessTokenPayload as m, type CreateAccountAccessTokenOptions as n, type CreateAccountAccessTokenResponse as o, type DeleteAccountAccessTokenOptions as p, type DeleteAccountAccessTokenResponse as q, type GetAccountAccessTokenOptions as r, type GetAccountAccessTokenResponse as s, type ListAccountAccessTokensResponse as t, type AccountConversationSettings as u, type GetAccountConversationSettingsOptions as v, type GetAccountConversationSettingsResponse as w, type UpdateAccountConversationSettingsPayload as x, type UpdateAccountConversationSettingsOptions as y, type UpdateAccountConversationSettingsResponse as z };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var J=Object.defineProperty;var et=(n,t)=>{for(var e in t)J(n,e,{get:t[e],enumerable:!0})};var d=class{getHeaders(){return{}}};var j="SUPPORT_ACCESS_TOKEN",q="SUPPORT_KEY_NAME",H="SUPPORT_KEY_PASSWORD",W="SUPPORT_SIGNING_KEY",V="SUPPORT_BASE_URL";var u=class{name;#t;constructor({name:t=process.env[q],password:e=process.env[H]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var h=class{#t;constructor({token:t=process.env[j]}={}){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 K="https://api.support.greatdetail.com",Y={"X-Powered-By":"GDSupport/JavaScript"};import{z as a}from"zod";var z=a.object({data:a.object({event:a.object({id:a.string(),type:a.string(),payload:a.record(a.string()),createdAt:a.string().datetime()})})});var C=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}getCurrent({request:t={}}){return this._transport.send("v1/accounts/current",{...t,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 f=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 R=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 b=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 O=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 v=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}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 _=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 L=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 I=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}list({limit:t,filter:e,include:o,request:s={}}={}){return this._transport.send("v1/conversations",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var T=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/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 S=class{constructor(t){this._transport=t}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}listByConversation(t,{limit:e,include:o,request:s={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:s={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o)]})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var A=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}createResponse(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,json:e})}createCorrection(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",json:e})}};var y=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}listByContact(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}createForConversation(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var U=class{constructor(t){this._transport=t}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",json:e})}};var G=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Y;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var D=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 m of r)s.push(["category",m])}return t!==void 0&&s.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:s})}};var E=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};import X from"is-network-error";import Z,{HTTPError as tt}from"ky";var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends i{};var w=class extends c{static unauthenticated(){return new this("An unauthenticated request occurred")}};var P=class extends c{static forbidden(){return new this("A forbidden request occurred")}};var p=class extends i{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var k=class extends i{};var l=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var B=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Z.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let s of this.options.requestFilterables){let r=s.getHeaders();for(let[m,$]of Object.entries(r))o.headers.has(m)||o.headers.set(m,$)}}]}})}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(s=>{if(X(s))throw new k("A network error occurred",{cause:s});if(s instanceof tt){let r=s.response.status;switch(console.error(JSON.stringify(s.response)),r){case 400:throw l.badRequest();case 401:throw w.unauthenticated();case 403:throw P.forbidden();case 404:throw p.notFound(t);case 405:throw p.forbiddenMethod(t,e.method??"GET");case 415:throw l.unsupportedMediaType();case 418:throw p.teapot();case 429:throw p.rateLimited()}if(r>=500&&r<600)throw i.serverError(r)}throw s});return{response:()=>o,json:async()=>(await o).json()}}};var F=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}create({account:t,files:e,request:o={}}){let s=new FormData;for(let r of e)s.append("file",r);return this._transport.send("v1/uploads",{...o,method:"POST",body:s,searchParams:{account:t}})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var x=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}=z.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 M=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 N=class{constructor(t){this._transport=t}getNotifications({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var Q=class n{static DEFAULT_BASE_URL=K;static PublicAuthentication=d;static BasicAuthentication=u;static BearerAuthentication=h;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;compositionSection;contact;conversation;label;message;model;note;notificationSubscription;source;statistics;upload;webhook;webhookSubscription;wellKnown;constructor(t,{baseURL:e,...o}={}){this._transport=new B({requestFilterables:[new G,t],...o,baseURL:e?.toString()??n.getBaseURL()}),this.account=new C(this._transport),this.accountAccessToken=new f(this._transport),this.accountConversationSettings=new R(this._transport),this.action=new b(this._transport),this.boilerplateCategory=new O(this._transport),this.boilerplateContent=new g(this._transport),this.channel=new v(this._transport),this.compositionSection=new _(this._transport),this.contact=new L(this._transport),this.conversation=new I(this._transport),this.label=new T(this._transport),this.message=new S(this._transport),this.model=new A(this._transport),this.note=new y(this._transport),this.notificationSubscription=new U(this._transport),this.source=new D(this._transport),this.statistics=new E(this._transport),this.upload=new F(this._transport),this.webhook=new x(this._transport),this.webhookSubscription=new M(this._transport),this.wellKnown=new N(this._transport)}static getBaseURL(){return process.env[V]??this.DEFAULT_BASE_URL}};export{et as a,d as b,K as c,i as d,c as e,w as f,P as g,p as h,k as i,l as j,z as k,Q as l};
|
|
1
|
+
var J=Object.defineProperty;var et=(n,t)=>{for(var e in t)J(n,e,{get:t[e],enumerable:!0})};var d=class{getHeaders(){return{}}};var j="SUPPORT_ACCESS_TOKEN",q="SUPPORT_KEY_NAME",H="SUPPORT_KEY_PASSWORD",W="SUPPORT_SIGNING_KEY",V="SUPPORT_BASE_URL";var u=class{name;#t;constructor({name:t=process.env[q],password:e=process.env[H]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var h=class{#t;constructor({token:t=process.env[j]}={}){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 K="https://api.support.greatdetail.com",Y={"X-Powered-By":"GDSupport/JavaScript"};import{z as p}from"zod";var z=p.object({data:p.object({event:p.object({id:p.string(),type:p.string(),payload:p.record(p.string()),createdAt:p.string().datetime()})})});var C=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}getCurrent({request:t={}}){return this._transport.send("v1/accounts/current",{...t,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 f=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 R=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 b=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 v=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 O=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,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}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 T=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 _=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 L=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({limit:t,filter:e,include:o,request:s={}}={}){return this._transport.send("v1/conversations",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}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:s={}}={}){return this._transport.send("v1/labels",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByConversation(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var y=class{constructor(t){this._transport=t}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}listByConversation(t,{limit:e,include:o,request:s={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:s={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o)]})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var A=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}createResponse(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,json:e})}createCorrection(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",json:e})}};var S=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}listByContact(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}listByConversation(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}createForConversation(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var U=class{constructor(t){this._transport=t}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",json:e})}};var E=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Y;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var G=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 m of r)s.push(["category",m])}return t!==void 0&&s.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:s})}};var D=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};import X from"is-network-error";import Z,{HTTPError as tt}from"ky";var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends i{};var w=class extends c{static unauthenticated(){return new this("An unauthenticated request occurred")}};var k=class extends c{static forbidden(){return new this("A forbidden request occurred")}};var a=class extends i{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var P=class extends i{};var l=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var B=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Z.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let s of this.options.requestFilterables){let r=s.getHeaders();for(let[m,$]of Object.entries(r))o.headers.has(m)||o.headers.set(m,$)}}]}})}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(s=>{if(X(s))throw new P("A network error occurred",{cause:s});if(s instanceof tt){let r=s.response.status;switch(console.error(JSON.stringify(s.response)),r){case 400:throw l.badRequest();case 401:throw w.unauthenticated();case 403:throw k.forbidden();case 404:throw a.notFound(t);case 405:throw a.forbiddenMethod(t,e.method??"GET");case 415:throw l.unsupportedMediaType();case 418:throw a.teapot();case 429:throw a.rateLimited()}if(r>=500&&r<600)throw i.serverError(r)}throw s});return{response:()=>o,json:async()=>(await o).json()}}};var x=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}create({account:t,files:e,request:o={}}){let s=new FormData;for(let r of e)s.append("file",r);return this._transport.send("v1/uploads",{...o,method:"POST",body:s,searchParams:{account:t}})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var M=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}=z.parse(o.body);return{event:r.event}}async _verifySignature(t,e,o){let s=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let r of o)if(await crypto.subtle.verify("HMAC",s,new TextEncoder().encode(atob(r)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var F=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/webhooks/subscriptions",{...t,method:"GET"})}test(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t)+"/test",{...e,method:"POST"})}create({body:t,request:e={}}){return this._transport.send("v1/webhooks/subscriptions",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var N=class{constructor(t){this._transport=t}getNotifications({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var Q=class n{static DEFAULT_BASE_URL=K;static PublicAuthentication=d;static BasicAuthentication=u;static BearerAuthentication=h;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;compositionSection;contact;conversation;label;message;model;note;notificationSubscription;source;statistics;upload;webhook;webhookSubscription;wellKnown;constructor(t,{baseURL:e,...o}={}){this._transport=new B({requestFilterables:[new E,t],...o,baseURL:e?.toString()??n.getBaseURL()}),this.account=new C(this._transport),this.accountAccessToken=new f(this._transport),this.accountConversationSettings=new R(this._transport),this.action=new b(this._transport),this.boilerplateCategory=new v(this._transport),this.boilerplateContent=new O(this._transport),this.channel=new g(this._transport),this.compositionSection=new T(this._transport),this.contact=new _(this._transport),this.conversation=new L(this._transport),this.label=new I(this._transport),this.message=new y(this._transport),this.model=new A(this._transport),this.note=new S(this._transport),this.notificationSubscription=new U(this._transport),this.source=new G(this._transport),this.statistics=new D(this._transport),this.upload=new x(this._transport),this.webhook=new M(this._transport),this.webhookSubscription=new F(this._transport),this.wellKnown=new N(this._transport)}static getBaseURL(){return process.env[V]??this.DEFAULT_BASE_URL}};export{et as a,d as b,K as c,i as d,c as e,w as f,k as g,a as h,P as i,l as j,z as k,Q as l};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as v,l as b}from"./chunk-
|
|
1
|
+
import{b as v,l as b}from"./chunk-GDE2LAN3.js";import{Command as G}from"commander";import{Command as L}from"commander";import{oraPromise as S}from"ora";function r({client:t,ora:s}){let o=new L("actions").description("Actions");return o.addCommand(new L("list").description("List actions").action(async()=>{let n=await S(()=>t.action.list().json(),{...s,text:"Finding actions"});console.log(n)})),o}import{Command as D}from"commander";import{oraPromise as M}from"ora";function d({client:t,ora:s}){let o=new D("channels").description("Channels");return o.addCommand(new D("list").description("List channels").action(async()=>{let n=await M(()=>t.channel.list().json(),{...s,text:"Finding channels"});console.log(n)})),o}import{Command as a}from"commander";import{oraPromise as c}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 c(()=>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 c(()=>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 c(()=>t.contact.getVCF(n).response(),{...s,text:"Exporting contact"});console.log(i)})),o}import{Command as l}from"commander";import{oraPromise as I}from"ora";function f({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 I(()=>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 I(()=>t.conversation.list().json(),{...s,text:"Finding conversations"});console.log(n)})),o}import{Command as m}from"commander";import{oraPromise as u}from"ora";function C({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 u(()=>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 u(()=>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 u(()=>t.conversation.listByLabel(n).json(),{...s,text:"Finding conversations"});console.log(i)})),o}import{Command as P}from"commander";import{oraPromise as W}from"ora";function g({client:t,ora:s}){let o=new P("messages").description("Messages");return o.addCommand(new P("list").description("List messages").action(async()=>{let n=await W(()=>t.message.list().json(),{...s,text:"Finding messages"});console.log(n)})),o}import{Command as w}from"commander";import{oraPromise as K}from"ora";function O({client:t,ora:s}){let o=new w("models").description("Models");return o.addCommand(new w("get").description("Find model").argument("<model>","Model ID").action(async n=>{let i=await K(()=>t.model.get(n).json(),{...s,text:"Finding model"});console.log(i)})),o.addCommand(new w("list").description("List models").action(async()=>{let n=await K(()=>t.model.list().json(),{...s,text:"Finding models"});console.log(n)})),o}import{Command as x}from"commander";import{oraPromise as h}from"ora";function y({client:t,ora:s}){let o=new x("sources").description("Sources");return o.addCommand(new x("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 x("list").description("List sources").action(async()=>{let n=await h(()=>t.source.list().json(),{...s,text:"Finding sources"});console.log(n)})),o}import{Command as E}from"commander";import{Command as N}from"commander";import{oraPromise as A}from"ora";function j({client:t,ora:s}){let o=new N("notifications").description("Well-Known Notifications Details");return o.addCommand(new N("get").description("Get Notifications Server Well-Known Info").action(async()=>{let n=await A(()=>t.wellKnown.getNotifications().json(),{...s,text:"Finding Notifications Well-Known Info"});console.log(n)})),o}function F({client:t,ora:s}){let o=new E("well-known").description("Well-Known Metadata & Info");return o.addCommand(j({client:t,ora:s})),o}var e={ora:{spinner:"simpleDotsScrolling"},client:new b(new v)},V=new G("gds").description("Great Detail Support System").addCommand(r(e)).addCommand(d(e)).addCommand(p(e)).addCommand(f(e)).addCommand(C(e)).addCommand(g(e)).addCommand(O(e)).addCommand(y(e)).addCommand(F(e)),Po=V;export{Po as a};
|
package/dist/cli/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Et=Object.create;var K=Object.defineProperty;var xt=Object.getOwnPropertyDescriptor;var Pt=Object.getOwnPropertyNames;var Ft=Object.getPrototypeOf,kt=Object.prototype.hasOwnProperty;var Bt=(n,t)=>{for(var e in t)K(n,e,{get:t[e],enumerable:!0})},ft=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Pt(t))!kt.call(n,s)&&s!==e&&K(n,s,{get:()=>t[s],enumerable:!(o=xt(t,s))||o.enumerable});return n};var Ot=(n,t,e)=>(e=n!=null?Et(Ft(n)):{},ft(t||!n||!n.__esModule?K(e,"default",{value:n,enumerable:!0}):e,n)),Mt=n=>ft(K({},"__esModule",{value:!0}),n);var Wt={};Bt(Wt,{default:()=>jt});module.exports=Mt(Wt);var Dt=require("commander");var m=class{getHeaders(){return{}}};var C=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}getCurrent({request:t={}}){return this._transport.send("v1/accounts/current",{...t,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 h=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 f=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 O=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 gt="SUPPORT_ACCESS_TOKEN",Rt="SUPPORT_KEY_NAME",bt="SUPPORT_KEY_PASSWORD",X="SUPPORT_SIGNING_KEY",vt="SUPPORT_BASE_URL";var g=class{name;#t;constructor({name:t=process.env[Rt],password:e=process.env[bt]}={}){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 R=class{#t;constructor({token:t=process.env[gt]}={}){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 b=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var v=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByCategory=this.listByBoilerplateCategory;listByBoilerplateCategory(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t)+"/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var _=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}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 L=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 _t="https://api.support.greatdetail.com",Lt={"X-Powered-By":"GDSupport/JavaScript"};var I=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 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({limit:t,filter:e,include:o,request:s={}}={}){return this._transport.send("v1/conversations",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var T=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/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 S=class{constructor(t){this._transport=t}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}listByConversation(t,{limit:e,include:o,request:s={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:s={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o)]})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var A=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}createResponse(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,json:e})}createCorrection(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",json:e})}};var w=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"})}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}createForConversation(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var U=class{constructor(t){this._transport=t}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",json:e})}};var D=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Lt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var G=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 l of r)s.push(["category",l])}return t!==void 0&&s.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:s})}};var E=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};var It=Ot(require("is-network-error"),1),V=Ot(require("ky"),1);var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var d=class extends i{};var x=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var P=class extends d{static forbidden(){return new this("A forbidden request occurred")}};var c=class extends i{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var F=class extends i{};var u=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var k=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=V.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let s of this.options.requestFilterables){let r=s.getHeaders();for(let[l,Gt]of Object.entries(r))o.headers.has(l)||o.headers.set(l,Gt)}}]}})}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(s=>{if((0,It.default)(s))throw new F("A network error occurred",{cause:s});if(s instanceof V.HTTPError){let r=s.response.status;switch(console.error(JSON.stringify(s.response)),r){case 400:throw u.badRequest();case 401:throw x.unauthenticated();case 403:throw P.forbidden();case 404:throw c.notFound(t);case 405:throw c.forbiddenMethod(t,e.method??"GET");case 415:throw u.unsupportedMediaType();case 418:throw c.teapot();case 429:throw c.rateLimited()}if(r>=500&&r<600)throw i.serverError(r)}throw s});return{response:()=>o,json:async()=>(await o).json()}}};var B=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}create({account:t,files:e,request:o={}}){let s=new FormData;for(let r of e)s.append("file",r);return this._transport.send("v1/uploads",{...o,method:"POST",body:s,searchParams:{account:t}})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var a=require("zod"),yt=a.z.object({data:a.z.object({event:a.z.object({id:a.z.string(),type:a.z.string(),payload:a.z.record(a.z.string()),createdAt:a.z.string().datetime()})})});var M=class{constructor(t){this._transport=t}async event({key:t=process.env[X],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."+X);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}=yt.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 N=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 j=class{constructor(t){this._transport=t}getNotifications({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var W=class n{static DEFAULT_BASE_URL=_t;static PublicAuthentication=m;static BasicAuthentication=g;static BearerAuthentication=R;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;compositionSection;contact;conversation;label;message;model;note;notificationSubscription;source;statistics;upload;webhook;webhookSubscription;wellKnown;constructor(t,{baseURL:e,...o}={}){this._transport=new k({requestFilterables:[new D,t],...o,baseURL:e?.toString()??n.getBaseURL()}),this.account=new C(this._transport),this.accountAccessToken=new h(this._transport),this.accountConversationSettings=new f(this._transport),this.action=new O(this._transport),this.boilerplateCategory=new b(this._transport),this.boilerplateContent=new v(this._transport),this.channel=new _(this._transport),this.compositionSection=new L(this._transport),this.contact=new I(this._transport),this.conversation=new y(this._transport),this.label=new T(this._transport),this.message=new S(this._transport),this.model=new A(this._transport),this.note=new w(this._transport),this.notificationSubscription=new U(this._transport),this.source=new G(this._transport),this.statistics=new E(this._transport),this.upload=new B(this._transport),this.webhook=new M(this._transport),this.webhookSubscription=new N(this._transport),this.wellKnown=new j(this._transport)}static getBaseURL(){return process.env[vt]??this.DEFAULT_BASE_URL}};var Z=require("commander"),Tt=require("ora");function tt({client:n,ora:t}){let e=new Z.Command("actions").description("Actions");return e.addCommand(new Z.Command("list").description("List actions").action(async()=>{let o=await(0,Tt.oraPromise)(()=>n.action.list().json(),{...t,text:"Finding actions"});console.log(o)})),e}var et=require("commander"),St=require("ora");function ot({client:n,ora:t}){let e=new et.Command("channels").description("Channels");return e.addCommand(new et.Command("list").description("List channels").action(async()=>{let o=await(0,St.oraPromise)(()=>n.channel.list().json(),{...t,text:"Finding channels"});console.log(o)})),e}var Q=require("commander"),H=require("ora");function nt({client:n,ora:t}){let e=new Q.Command("contacts").description("Contacts");return e.addCommand(new Q.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async o=>{let s=await(0,H.oraPromise)(()=>n.contact.get(o).json(),{...t,text:"Finding contact"});console.log(s)})),e.addCommand(new Q.Command("list").description("List contacts").action(async()=>{let o=await(0,H.oraPromise)(()=>n.contact.list().json(),{...t,text:"Finding contacts"});console.log(o)})),e.addCommand(new Q.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async o=>{let s=await(0,H.oraPromise)(()=>n.contact.getVCF(o).response(),{...t,text:"Exporting contact"});console.log(s)})),e}var Y=require("commander"),st=require("ora");function rt({client:n,ora:t}){let e=new Y.Command("conversations").description("Conversations");return e.addCommand(new Y.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async o=>{let s=await(0,st.oraPromise)(()=>n.conversation.get(o).json(),{...t,text:"Finding conversation"});console.log(s)})),e.addCommand(new Y.Command("list").description("List conversations").action(async()=>{let o=await(0,st.oraPromise)(()=>n.conversation.list().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var q=require("commander"),z=require("ora");function it({client:n,ora:t}){let e=new q.Command("labels").description("Labels");return e.addCommand(new q.Command("get").description("Find label").argument("<label>","Label ID").action(async o=>{let s=await(0,z.oraPromise)(()=>n.label.get(o).json(),{...t,text:"Finding label"});console.log(s)})),e.addCommand(new q.Command("list").description("List labels").action(async()=>{let o=await(0,z.oraPromise)(()=>n.label.list().json(),{...t,text:"Finding labels"});console.log(o)})),e.addCommand(new q.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async o=>{let s=await(0,z.oraPromise)(()=>n.conversation.listByLabel(o).json(),{...t,text:"Finding conversations"});console.log(s)})),e}var at=require("commander"),At=require("ora");function pt({client:n,ora:t}){let e=new at.Command("messages").description("Messages");return e.addCommand(new at.Command("list").description("List messages").action(async()=>{let o=await(0,At.oraPromise)(()=>n.message.list().json(),{...t,text:"Finding messages"});console.log(o)})),e}var $=require("commander"),ct=require("ora");function mt({client:n,ora:t}){let e=new $.Command("models").description("Models");return e.addCommand(new $.Command("get").description("Find model").argument("<model>","Model ID").action(async o=>{let s=await(0,ct.oraPromise)(()=>n.model.get(o).json(),{...t,text:"Finding model"});console.log(s)})),e.addCommand(new $.Command("list").description("List models").action(async()=>{let o=await(0,ct.oraPromise)(()=>n.model.list().json(),{...t,text:"Finding models"});console.log(o)})),e}var J=require("commander"),dt=require("ora");function lt({client:n,ora:t}){let e=new J.Command("sources").description("Sources");return e.addCommand(new J.Command("get").description("Find source").argument("<source>","Source ID").action(async o=>{let s=await(0,dt.oraPromise)(()=>n.source.get(o).json(),{...t,text:"Finding source"});console.log(s)})),e.addCommand(new J.Command("list").description("List sources").action(async()=>{let o=await(0,dt.oraPromise)(()=>n.source.list().json(),{...t,text:"Finding sources"});console.log(o)})),e}var Ut=require("commander");var ut=require("commander"),wt=require("ora");function Ct({client:n,ora:t}){let e=new ut.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new ut.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let o=await(0,wt.oraPromise)(()=>n.wellKnown.getNotifications().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(o)})),e}function ht({client:n,ora:t}){let e=new Ut.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(Ct({client:n,ora:t})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new W(new m)},Nt=new Dt.Command("gds").description("Great Detail Support System").addCommand(tt(p)).addCommand(ot(p)).addCommand(nt(p)).addCommand(rt(p)).addCommand(it(p)).addCommand(pt(p)).addCommand(mt(p)).addCommand(lt(p)).addCommand(ht(p)),jt=Nt;
|
|
1
|
+
"use strict";var Gt=Object.create;var K=Object.defineProperty;var xt=Object.getOwnPropertyDescriptor;var Pt=Object.getOwnPropertyNames;var kt=Object.getPrototypeOf,Ft=Object.prototype.hasOwnProperty;var Bt=(n,t)=>{for(var e in t)K(n,e,{get:t[e],enumerable:!0})},ft=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Pt(t))!Ft.call(n,s)&&s!==e&&K(n,s,{get:()=>t[s],enumerable:!(o=xt(t,s))||o.enumerable});return n};var Ot=(n,t,e)=>(e=n!=null?Gt(kt(n)):{},ft(t||!n||!n.__esModule?K(e,"default",{value:n,enumerable:!0}):e,n)),Mt=n=>ft(K({},"__esModule",{value:!0}),n);var Wt={};Bt(Wt,{default:()=>jt});module.exports=Mt(Wt);var Et=require("commander");var m=class{getHeaders(){return{}}};var C=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}getCurrent({request:t={}}){return this._transport.send("v1/accounts/current",{...t,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 h=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 f=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 O=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 gt="SUPPORT_ACCESS_TOKEN",bt="SUPPORT_KEY_NAME",Rt="SUPPORT_KEY_PASSWORD",X="SUPPORT_SIGNING_KEY",vt="SUPPORT_BASE_URL";var g=class{name;#t;constructor({name:t=process.env[bt],password:e=process.env[Rt]}={}){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 b=class{#t;constructor({token:t=process.env[gt]}={}){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 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 v=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByCategory=this.listByBoilerplateCategory;listByBoilerplateCategory(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t)+"/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var y=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}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 T=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 yt="https://api.support.greatdetail.com",Tt={"X-Powered-By":"GDSupport/JavaScript"};var _=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 L=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({limit:t,filter:e,include:o,request:s={}}={}){return this._transport.send("v1/conversations",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}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: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 A=class{constructor(t){this._transport=t}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 S=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 w=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"})}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}createForConversation(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var U=class{constructor(t){this._transport=t}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",json:e})}};var E=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Tt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var D=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 l of r)s.push(["category",l])}return t!==void 0&&s.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:s})}};var G=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 _t=Ot(require("is-network-error"),1),V=Ot(require("ky"),1);var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var d=class extends i{};var x=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var P=class extends d{static forbidden(){return new this("A forbidden request occurred")}};var c=class extends i{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var k=class extends i{};var u=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var F=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=V.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let s of this.options.requestFilterables){let r=s.getHeaders();for(let[l,Dt]of Object.entries(r))o.headers.has(l)||o.headers.set(l,Dt)}}]}})}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(s=>{if((0,_t.default)(s))throw new k("A network error occurred",{cause:s});if(s instanceof V.HTTPError){let r=s.response.status;switch(console.error(JSON.stringify(s.response)),r){case 400:throw u.badRequest();case 401:throw x.unauthenticated();case 403:throw P.forbidden();case 404:throw c.notFound(t);case 405:throw c.forbiddenMethod(t,e.method??"GET");case 415:throw u.unsupportedMediaType();case 418:throw c.teapot();case 429:throw c.rateLimited()}if(r>=500&&r<600)throw i.serverError(r)}throw s});return{response:()=>o,json:async()=>(await o).json()}}};var B=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}create({account:t,files:e,request:o={}}){let s=new FormData;for(let r of e)s.append("file",r);return this._transport.send("v1/uploads",{...o,method:"POST",body:s,searchParams:{account:t}})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var a=require("zod"),Lt=a.z.object({data:a.z.object({event:a.z.object({id:a.z.string(),type:a.z.string(),payload:a.z.record(a.z.string()),createdAt:a.z.string().datetime()})})});var M=class{constructor(t){this._transport=t}async event({key:t=process.env[X],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."+X);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}=Lt.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 N=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 j=class{constructor(t){this._transport=t}getNotifications({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var W=class n{static DEFAULT_BASE_URL=yt;static PublicAuthentication=m;static BasicAuthentication=g;static BearerAuthentication=b;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;compositionSection;contact;conversation;label;message;model;note;notificationSubscription;source;statistics;upload;webhook;webhookSubscription;wellKnown;constructor(t,{baseURL:e,...o}={}){this._transport=new F({requestFilterables:[new E,t],...o,baseURL:e?.toString()??n.getBaseURL()}),this.account=new C(this._transport),this.accountAccessToken=new h(this._transport),this.accountConversationSettings=new f(this._transport),this.action=new O(this._transport),this.boilerplateCategory=new R(this._transport),this.boilerplateContent=new v(this._transport),this.channel=new y(this._transport),this.compositionSection=new T(this._transport),this.contact=new _(this._transport),this.conversation=new L(this._transport),this.label=new I(this._transport),this.message=new A(this._transport),this.model=new S(this._transport),this.note=new w(this._transport),this.notificationSubscription=new U(this._transport),this.source=new D(this._transport),this.statistics=new G(this._transport),this.upload=new B(this._transport),this.webhook=new M(this._transport),this.webhookSubscription=new N(this._transport),this.wellKnown=new j(this._transport)}static getBaseURL(){return process.env[vt]??this.DEFAULT_BASE_URL}};var Z=require("commander"),It=require("ora");function tt({client:n,ora:t}){let e=new Z.Command("actions").description("Actions");return e.addCommand(new Z.Command("list").description("List actions").action(async()=>{let o=await(0,It.oraPromise)(()=>n.action.list().json(),{...t,text:"Finding actions"});console.log(o)})),e}var et=require("commander"),At=require("ora");function ot({client:n,ora:t}){let e=new et.Command("channels").description("Channels");return e.addCommand(new et.Command("list").description("List channels").action(async()=>{let o=await(0,At.oraPromise)(()=>n.channel.list().json(),{...t,text:"Finding channels"});console.log(o)})),e}var Q=require("commander"),H=require("ora");function nt({client:n,ora:t}){let e=new Q.Command("contacts").description("Contacts");return e.addCommand(new Q.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async o=>{let s=await(0,H.oraPromise)(()=>n.contact.get(o).json(),{...t,text:"Finding contact"});console.log(s)})),e.addCommand(new Q.Command("list").description("List contacts").action(async()=>{let o=await(0,H.oraPromise)(()=>n.contact.list().json(),{...t,text:"Finding contacts"});console.log(o)})),e.addCommand(new Q.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async o=>{let s=await(0,H.oraPromise)(()=>n.contact.getVCF(o).response(),{...t,text:"Exporting contact"});console.log(s)})),e}var Y=require("commander"),st=require("ora");function rt({client:n,ora:t}){let e=new Y.Command("conversations").description("Conversations");return e.addCommand(new Y.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async o=>{let s=await(0,st.oraPromise)(()=>n.conversation.get(o).json(),{...t,text:"Finding conversation"});console.log(s)})),e.addCommand(new Y.Command("list").description("List conversations").action(async()=>{let o=await(0,st.oraPromise)(()=>n.conversation.list().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var q=require("commander"),z=require("ora");function it({client:n,ora:t}){let e=new q.Command("labels").description("Labels");return e.addCommand(new q.Command("get").description("Find label").argument("<label>","Label ID").action(async o=>{let s=await(0,z.oraPromise)(()=>n.label.get(o).json(),{...t,text:"Finding label"});console.log(s)})),e.addCommand(new q.Command("list").description("List labels").action(async()=>{let o=await(0,z.oraPromise)(()=>n.label.list().json(),{...t,text:"Finding labels"});console.log(o)})),e.addCommand(new q.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async o=>{let s=await(0,z.oraPromise)(()=>n.conversation.listByLabel(o).json(),{...t,text:"Finding conversations"});console.log(s)})),e}var at=require("commander"),St=require("ora");function pt({client:n,ora:t}){let e=new at.Command("messages").description("Messages");return e.addCommand(new at.Command("list").description("List messages").action(async()=>{let o=await(0,St.oraPromise)(()=>n.message.list().json(),{...t,text:"Finding messages"});console.log(o)})),e}var $=require("commander"),ct=require("ora");function mt({client:n,ora:t}){let e=new $.Command("models").description("Models");return e.addCommand(new $.Command("get").description("Find model").argument("<model>","Model ID").action(async o=>{let s=await(0,ct.oraPromise)(()=>n.model.get(o).json(),{...t,text:"Finding model"});console.log(s)})),e.addCommand(new $.Command("list").description("List models").action(async()=>{let o=await(0,ct.oraPromise)(()=>n.model.list().json(),{...t,text:"Finding models"});console.log(o)})),e}var J=require("commander"),dt=require("ora");function lt({client:n,ora:t}){let e=new J.Command("sources").description("Sources");return e.addCommand(new J.Command("get").description("Find source").argument("<source>","Source ID").action(async o=>{let s=await(0,dt.oraPromise)(()=>n.source.get(o).json(),{...t,text:"Finding source"});console.log(s)})),e.addCommand(new J.Command("list").description("List sources").action(async()=>{let o=await(0,dt.oraPromise)(()=>n.source.list().json(),{...t,text:"Finding sources"});console.log(o)})),e}var Ut=require("commander");var ut=require("commander"),wt=require("ora");function Ct({client:n,ora:t}){let e=new ut.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new ut.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let o=await(0,wt.oraPromise)(()=>n.wellKnown.getNotifications().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(o)})),e}function ht({client:n,ora:t}){let e=new Ut.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(Ct({client:n,ora:t})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new W(new m)},Nt=new Et.Command("gds").description("Great Detail Support System").addCommand(tt(p)).addCommand(ot(p)).addCommand(nt(p)).addCommand(rt(p)).addCommand(it(p)).addCommand(pt(p)).addCommand(mt(p)).addCommand(lt(p)).addCommand(ht(p)),jt=Nt;
|
package/dist/cli/index.d.cts
CHANGED
package/dist/cli/index.d.ts
CHANGED
package/dist/cli/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-IO4M5UU5.js";import"../chunk-GDE2LAN3.js";export{a as default};
|
package/dist/cli.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var Et=Object.create;var ht=Object.defineProperty;var xt=Object.getOwnPropertyDescriptor;var Pt=Object.getOwnPropertyNames;var Ft=Object.getPrototypeOf,kt=Object.prototype.hasOwnProperty;var Bt=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Pt(t))!kt.call(n,s)&&s!==e&&ht(n,s,{get:()=>t[s],enumerable:!(o=xt(t,s))||o.enumerable});return n};var ft=(n,t,e)=>(e=n!=null?Et(Ft(n)):{},Bt(t||!n||!n.__esModule?ht(e,"default",{value:n,enumerable:!0}):e,n));var Ut=require("commander");var m=class{getHeaders(){return{}}};var C=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}getCurrent({request:t={}}){return this._transport.send("v1/accounts/current",{...t,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 h=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 f=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 O=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 Ot="SUPPORT_ACCESS_TOKEN",gt="SUPPORT_KEY_NAME",Rt="SUPPORT_KEY_PASSWORD",J="SUPPORT_SIGNING_KEY",bt="SUPPORT_BASE_URL";var g=class{name;#t;constructor({name:t=process.env[gt],password:e=process.env[Rt]}={}){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 R=class{#t;constructor({token:t=process.env[Ot]}={}){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 b=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var v=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByCategory=this.listByBoilerplateCategory;listByBoilerplateCategory(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t)+"/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var _=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}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 L=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 vt="https://api.support.greatdetail.com",_t={"X-Powered-By":"GDSupport/JavaScript"};var I=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 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({limit:t,filter:e,include:o,request:s={}}={}){return this._transport.send("v1/conversations",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var T=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/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 S=class{constructor(t){this._transport=t}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}listByConversation(t,{limit:e,include:o,request:s={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:s={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...s,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o)]})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var A=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}createResponse(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,json:e})}createCorrection(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",json:e})}};var w=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"})}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}createForConversation(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var U=class{constructor(t){this._transport=t}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",json:e})}};var D=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=_t;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var G=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 l of r)s.push(["category",l])}return t!==void 0&&s.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:s})}};var E=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};var Lt=ft(require("is-network-error"),1),K=ft(require("ky"),1);var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var d=class extends i{};var x=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var P=class extends d{static forbidden(){return new this("A forbidden request occurred")}};var c=class extends i{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var F=class extends i{};var u=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var k=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=K.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let s of this.options.requestFilterables){let r=s.getHeaders();for(let[l,Gt]of Object.entries(r))o.headers.has(l)||o.headers.set(l,Gt)}}]}})}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(s=>{if((0,Lt.default)(s))throw new F("A network error occurred",{cause:s});if(s instanceof K.HTTPError){let r=s.response.status;switch(console.error(JSON.stringify(s.response)),r){case 400:throw u.badRequest();case 401:throw x.unauthenticated();case 403:throw P.forbidden();case 404:throw c.notFound(t);case 405:throw c.forbiddenMethod(t,e.method??"GET");case 415:throw u.unsupportedMediaType();case 418:throw c.teapot();case 429:throw c.rateLimited()}if(r>=500&&r<600)throw i.serverError(r)}throw s});return{response:()=>o,json:async()=>(await o).json()}}};var B=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}create({account:t,files:e,request:o={}}){let s=new FormData;for(let r of e)s.append("file",r);return this._transport.send("v1/uploads",{...o,method:"POST",body:s,searchParams:{account:t}})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var a=require("zod"),It=a.z.object({data:a.z.object({event:a.z.object({id:a.z.string(),type:a.z.string(),payload:a.z.record(a.z.string()),createdAt:a.z.string().datetime()})})});var M=class{constructor(t){this._transport=t}async event({key:t=process.env[J],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."+J);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}=It.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 N=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 j=class{constructor(t){this._transport=t}getNotifications({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var W=class n{static DEFAULT_BASE_URL=vt;static PublicAuthentication=m;static BasicAuthentication=g;static BearerAuthentication=R;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;compositionSection;contact;conversation;label;message;model;note;notificationSubscription;source;statistics;upload;webhook;webhookSubscription;wellKnown;constructor(t,{baseURL:e,...o}={}){this._transport=new k({requestFilterables:[new D,t],...o,baseURL:e?.toString()??n.getBaseURL()}),this.account=new C(this._transport),this.accountAccessToken=new h(this._transport),this.accountConversationSettings=new f(this._transport),this.action=new O(this._transport),this.boilerplateCategory=new b(this._transport),this.boilerplateContent=new v(this._transport),this.channel=new _(this._transport),this.compositionSection=new L(this._transport),this.contact=new I(this._transport),this.conversation=new y(this._transport),this.label=new T(this._transport),this.message=new S(this._transport),this.model=new A(this._transport),this.note=new w(this._transport),this.notificationSubscription=new U(this._transport),this.source=new G(this._transport),this.statistics=new E(this._transport),this.upload=new B(this._transport),this.webhook=new M(this._transport),this.webhookSubscription=new N(this._transport),this.wellKnown=new j(this._transport)}static getBaseURL(){return process.env[bt]??this.DEFAULT_BASE_URL}};var X=require("commander"),yt=require("ora");function Z({client:n,ora:t}){let e=new X.Command("actions").description("Actions");return e.addCommand(new X.Command("list").description("List actions").action(async()=>{let o=await(0,yt.oraPromise)(()=>n.action.list().json(),{...t,text:"Finding actions"});console.log(o)})),e}var tt=require("commander"),Tt=require("ora");function et({client:n,ora:t}){let e=new tt.Command("channels").description("Channels");return e.addCommand(new tt.Command("list").description("List channels").action(async()=>{let o=await(0,Tt.oraPromise)(()=>n.channel.list().json(),{...t,text:"Finding channels"});console.log(o)})),e}var Q=require("commander"),V=require("ora");function ot({client:n,ora:t}){let e=new Q.Command("contacts").description("Contacts");return e.addCommand(new Q.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async o=>{let s=await(0,V.oraPromise)(()=>n.contact.get(o).json(),{...t,text:"Finding contact"});console.log(s)})),e.addCommand(new Q.Command("list").description("List contacts").action(async()=>{let o=await(0,V.oraPromise)(()=>n.contact.list().json(),{...t,text:"Finding contacts"});console.log(o)})),e.addCommand(new Q.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async o=>{let s=await(0,V.oraPromise)(()=>n.contact.getVCF(o).response(),{...t,text:"Exporting contact"});console.log(s)})),e}var H=require("commander"),nt=require("ora");function st({client:n,ora:t}){let e=new H.Command("conversations").description("Conversations");return e.addCommand(new H.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async o=>{let s=await(0,nt.oraPromise)(()=>n.conversation.get(o).json(),{...t,text:"Finding conversation"});console.log(s)})),e.addCommand(new H.Command("list").description("List conversations").action(async()=>{let o=await(0,nt.oraPromise)(()=>n.conversation.list().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var q=require("commander"),Y=require("ora");function rt({client:n,ora:t}){let e=new q.Command("labels").description("Labels");return e.addCommand(new q.Command("get").description("Find label").argument("<label>","Label ID").action(async o=>{let s=await(0,Y.oraPromise)(()=>n.label.get(o).json(),{...t,text:"Finding label"});console.log(s)})),e.addCommand(new q.Command("list").description("List labels").action(async()=>{let o=await(0,Y.oraPromise)(()=>n.label.list().json(),{...t,text:"Finding labels"});console.log(o)})),e.addCommand(new q.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async o=>{let s=await(0,Y.oraPromise)(()=>n.conversation.listByLabel(o).json(),{...t,text:"Finding conversations"});console.log(s)})),e}var it=require("commander"),St=require("ora");function at({client:n,ora:t}){let e=new it.Command("messages").description("Messages");return e.addCommand(new it.Command("list").description("List messages").action(async()=>{let o=await(0,St.oraPromise)(()=>n.message.list().json(),{...t,text:"Finding messages"});console.log(o)})),e}var z=require("commander"),pt=require("ora");function ct({client:n,ora:t}){let e=new z.Command("models").description("Models");return e.addCommand(new z.Command("get").description("Find model").argument("<model>","Model ID").action(async o=>{let s=await(0,pt.oraPromise)(()=>n.model.get(o).json(),{...t,text:"Finding model"});console.log(s)})),e.addCommand(new z.Command("list").description("List models").action(async()=>{let o=await(0,pt.oraPromise)(()=>n.model.list().json(),{...t,text:"Finding models"});console.log(o)})),e}var $=require("commander"),mt=require("ora");function dt({client:n,ora:t}){let e=new $.Command("sources").description("Sources");return e.addCommand(new $.Command("get").description("Find source").argument("<source>","Source ID").action(async o=>{let s=await(0,mt.oraPromise)(()=>n.source.get(o).json(),{...t,text:"Finding source"});console.log(s)})),e.addCommand(new $.Command("list").description("List sources").action(async()=>{let o=await(0,mt.oraPromise)(()=>n.source.list().json(),{...t,text:"Finding sources"});console.log(o)})),e}var wt=require("commander");var lt=require("commander"),At=require("ora");function ut({client:n,ora:t}){let e=new lt.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new lt.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let o=await(0,At.oraPromise)(()=>n.wellKnown.getNotifications().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(o)})),e}function Ct({client:n,ora:t}){let e=new wt.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(ut({client:n,ora:t})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new W(new m)},Mt=new Ut.Command("gds").description("Great Detail Support System").addCommand(Z(p)).addCommand(et(p)).addCommand(ot(p)).addCommand(st(p)).addCommand(rt(p)).addCommand(at(p)).addCommand(ct(p)).addCommand(dt(p)).addCommand(Ct(p)),Dt=Mt;Dt.parseAsync(process.argv);
|
|
2
|
+
"use strict";var Gt=Object.create;var ht=Object.defineProperty;var xt=Object.getOwnPropertyDescriptor;var Pt=Object.getOwnPropertyNames;var kt=Object.getPrototypeOf,Ft=Object.prototype.hasOwnProperty;var Bt=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Pt(t))!Ft.call(n,s)&&s!==e&&ht(n,s,{get:()=>t[s],enumerable:!(o=xt(t,s))||o.enumerable});return n};var ft=(n,t,e)=>(e=n!=null?Gt(kt(n)):{},Bt(t||!n||!n.__esModule?ht(e,"default",{value:n,enumerable:!0}):e,n));var Ut=require("commander");var m=class{getHeaders(){return{}}};var C=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}getCurrent({request:t={}}){return this._transport.send("v1/accounts/current",{...t,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 h=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 f=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 O=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 Ot="SUPPORT_ACCESS_TOKEN",gt="SUPPORT_KEY_NAME",bt="SUPPORT_KEY_PASSWORD",J="SUPPORT_SIGNING_KEY",Rt="SUPPORT_BASE_URL";var g=class{name;#t;constructor({name:t=process.env[gt],password:e=process.env[bt]}={}){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 b=class{#t;constructor({token:t=process.env[Ot]}={}){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 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 v=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByCategory=this.listByBoilerplateCategory;listByBoilerplateCategory(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t)+"/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var y=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}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 T=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 vt="https://api.support.greatdetail.com",yt={"X-Powered-By":"GDSupport/JavaScript"};var _=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 L=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({limit:t,filter:e,include:o,request:s={}}={}){return this._transport.send("v1/conversations",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}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: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 A=class{constructor(t){this._transport=t}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 S=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 w=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"})}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}createForConversation(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var U=class{constructor(t){this._transport=t}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",json:e})}};var E=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=yt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var D=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 l of r)s.push(["category",l])}return t!==void 0&&s.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:s})}};var G=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 Tt=ft(require("is-network-error"),1),K=ft(require("ky"),1);var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var d=class extends i{};var x=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var P=class extends d{static forbidden(){return new this("A forbidden request occurred")}};var c=class extends i{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var k=class extends i{};var u=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var F=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=K.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let s of this.options.requestFilterables){let r=s.getHeaders();for(let[l,Dt]of Object.entries(r))o.headers.has(l)||o.headers.set(l,Dt)}}]}})}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(s=>{if((0,Tt.default)(s))throw new k("A network error occurred",{cause:s});if(s instanceof K.HTTPError){let r=s.response.status;switch(console.error(JSON.stringify(s.response)),r){case 400:throw u.badRequest();case 401:throw x.unauthenticated();case 403:throw P.forbidden();case 404:throw c.notFound(t);case 405:throw c.forbiddenMethod(t,e.method??"GET");case 415:throw u.unsupportedMediaType();case 418:throw c.teapot();case 429:throw c.rateLimited()}if(r>=500&&r<600)throw i.serverError(r)}throw s});return{response:()=>o,json:async()=>(await o).json()}}};var B=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}create({account:t,files:e,request:o={}}){let s=new FormData;for(let r of e)s.append("file",r);return this._transport.send("v1/uploads",{...o,method:"POST",body:s,searchParams:{account:t}})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var a=require("zod"),_t=a.z.object({data:a.z.object({event:a.z.object({id:a.z.string(),type:a.z.string(),payload:a.z.record(a.z.string()),createdAt:a.z.string().datetime()})})});var M=class{constructor(t){this._transport=t}async event({key:t=process.env[J],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."+J);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}=_t.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 N=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 j=class{constructor(t){this._transport=t}getNotifications({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var W=class n{static DEFAULT_BASE_URL=vt;static PublicAuthentication=m;static BasicAuthentication=g;static BearerAuthentication=b;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;compositionSection;contact;conversation;label;message;model;note;notificationSubscription;source;statistics;upload;webhook;webhookSubscription;wellKnown;constructor(t,{baseURL:e,...o}={}){this._transport=new F({requestFilterables:[new E,t],...o,baseURL:e?.toString()??n.getBaseURL()}),this.account=new C(this._transport),this.accountAccessToken=new h(this._transport),this.accountConversationSettings=new f(this._transport),this.action=new O(this._transport),this.boilerplateCategory=new R(this._transport),this.boilerplateContent=new v(this._transport),this.channel=new y(this._transport),this.compositionSection=new T(this._transport),this.contact=new _(this._transport),this.conversation=new L(this._transport),this.label=new I(this._transport),this.message=new A(this._transport),this.model=new S(this._transport),this.note=new w(this._transport),this.notificationSubscription=new U(this._transport),this.source=new D(this._transport),this.statistics=new G(this._transport),this.upload=new B(this._transport),this.webhook=new M(this._transport),this.webhookSubscription=new N(this._transport),this.wellKnown=new j(this._transport)}static getBaseURL(){return process.env[Rt]??this.DEFAULT_BASE_URL}};var X=require("commander"),Lt=require("ora");function Z({client:n,ora:t}){let e=new X.Command("actions").description("Actions");return e.addCommand(new X.Command("list").description("List actions").action(async()=>{let o=await(0,Lt.oraPromise)(()=>n.action.list().json(),{...t,text:"Finding actions"});console.log(o)})),e}var tt=require("commander"),It=require("ora");function et({client:n,ora:t}){let e=new tt.Command("channels").description("Channels");return e.addCommand(new tt.Command("list").description("List channels").action(async()=>{let o=await(0,It.oraPromise)(()=>n.channel.list().json(),{...t,text:"Finding channels"});console.log(o)})),e}var Q=require("commander"),V=require("ora");function ot({client:n,ora:t}){let e=new Q.Command("contacts").description("Contacts");return e.addCommand(new Q.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async o=>{let s=await(0,V.oraPromise)(()=>n.contact.get(o).json(),{...t,text:"Finding contact"});console.log(s)})),e.addCommand(new Q.Command("list").description("List contacts").action(async()=>{let o=await(0,V.oraPromise)(()=>n.contact.list().json(),{...t,text:"Finding contacts"});console.log(o)})),e.addCommand(new Q.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async o=>{let s=await(0,V.oraPromise)(()=>n.contact.getVCF(o).response(),{...t,text:"Exporting contact"});console.log(s)})),e}var H=require("commander"),nt=require("ora");function st({client:n,ora:t}){let e=new H.Command("conversations").description("Conversations");return e.addCommand(new H.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async o=>{let s=await(0,nt.oraPromise)(()=>n.conversation.get(o).json(),{...t,text:"Finding conversation"});console.log(s)})),e.addCommand(new H.Command("list").description("List conversations").action(async()=>{let o=await(0,nt.oraPromise)(()=>n.conversation.list().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var q=require("commander"),Y=require("ora");function rt({client:n,ora:t}){let e=new q.Command("labels").description("Labels");return e.addCommand(new q.Command("get").description("Find label").argument("<label>","Label ID").action(async o=>{let s=await(0,Y.oraPromise)(()=>n.label.get(o).json(),{...t,text:"Finding label"});console.log(s)})),e.addCommand(new q.Command("list").description("List labels").action(async()=>{let o=await(0,Y.oraPromise)(()=>n.label.list().json(),{...t,text:"Finding labels"});console.log(o)})),e.addCommand(new q.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async o=>{let s=await(0,Y.oraPromise)(()=>n.conversation.listByLabel(o).json(),{...t,text:"Finding conversations"});console.log(s)})),e}var it=require("commander"),At=require("ora");function at({client:n,ora:t}){let e=new it.Command("messages").description("Messages");return e.addCommand(new it.Command("list").description("List messages").action(async()=>{let o=await(0,At.oraPromise)(()=>n.message.list().json(),{...t,text:"Finding messages"});console.log(o)})),e}var z=require("commander"),pt=require("ora");function ct({client:n,ora:t}){let e=new z.Command("models").description("Models");return e.addCommand(new z.Command("get").description("Find model").argument("<model>","Model ID").action(async o=>{let s=await(0,pt.oraPromise)(()=>n.model.get(o).json(),{...t,text:"Finding model"});console.log(s)})),e.addCommand(new z.Command("list").description("List models").action(async()=>{let o=await(0,pt.oraPromise)(()=>n.model.list().json(),{...t,text:"Finding models"});console.log(o)})),e}var $=require("commander"),mt=require("ora");function dt({client:n,ora:t}){let e=new $.Command("sources").description("Sources");return e.addCommand(new $.Command("get").description("Find source").argument("<source>","Source ID").action(async o=>{let s=await(0,mt.oraPromise)(()=>n.source.get(o).json(),{...t,text:"Finding source"});console.log(s)})),e.addCommand(new $.Command("list").description("List sources").action(async()=>{let o=await(0,mt.oraPromise)(()=>n.source.list().json(),{...t,text:"Finding sources"});console.log(o)})),e}var wt=require("commander");var lt=require("commander"),St=require("ora");function ut({client:n,ora:t}){let e=new lt.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new lt.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let o=await(0,St.oraPromise)(()=>n.wellKnown.getNotifications().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(o)})),e}function Ct({client:n,ora:t}){let e=new wt.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(ut({client:n,ora:t})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new W(new m)},Mt=new Ut.Command("gds").description("Great Detail Support System").addCommand(Z(p)).addCommand(et(p)).addCommand(ot(p)).addCommand(st(p)).addCommand(rt(p)).addCommand(at(p)).addCommand(ct(p)).addCommand(dt(p)).addCommand(Ct(p)),Et=Mt;Et.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-
|
|
2
|
+
import{a as r}from"./chunk-IO4M5UU5.js";import"./chunk-GDE2LAN3.js";r.parseAsync(process.argv);
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var rt=Object.create;var Q=Object.defineProperty;var nt=Object.getOwnPropertyDescriptor;var it=Object.getOwnPropertyNames;var pt=Object.getPrototypeOf,at=Object.prototype.hasOwnProperty;var Y=(s,t)=>{for(var e in t)Q(s,e,{get:t[e],enumerable:!0})},z=(s,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of it(t))!at.call(s,r)&&r!==e&&Q(s,r,{get:()=>t[r],enumerable:!(o=nt(t,r))||o.enumerable});return s};var $=(s,t,e)=>(e=s!=null?rt(pt(s)):{},z(t||!s||!s.__esModule?Q(e,"default",{value:s,enumerable:!0}):e,s)),ct=s=>z(Q({},"__esModule",{value:!0}),s);var mt={};Y(mt,{Client:()=>h,DEFAULT_SUPPORT_BASE_URL:()=>j,Error:()=>K,default:()=>h,eventWebhookSchema:()=>H});module.exports=ct(mt);var j="https://api.support.greatdetail.com",J={"X-Powered-By":"GDSupport/JavaScript"};var C=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}getCurrent({request:t={}}){return this._transport.send("v1/accounts/current",{...t,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 R=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:r={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...r,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 b=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 O=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 X="SUPPORT_ACCESS_TOKEN",Z="SUPPORT_KEY_NAME",tt="SUPPORT_KEY_PASSWORD",V="SUPPORT_SIGNING_KEY",et="SUPPORT_BASE_URL";var x=class{name;#t;constructor({name:t=process.env[Z],password:e=process.env[tt]}={}){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 g=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 v=class{getHeaders(){return{}}};var _=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 L=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 T=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}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 I=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 A=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",r=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(r)}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 S=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({limit:t,filter:e,include:o,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var y=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,include:o,request:r={}}={}){return this._transport.send("v1/labels",{...r,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 U=class{constructor(t){this._transport=t}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:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...r,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 E=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 G=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"})}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}createForConversation(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var D=class{constructor(t){this._transport=t}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",json:e})}};var w=class s{constructor(t=s.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=J;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var P=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 r=[];if(e){let i=Array.isArray(e)?e:[e];for(let f of i)r.push(["category",f])}return t!==void 0&&r.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:r})}};var k=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 ot=$(require("is-network-error"),1),q=$(require("ky"),1);var n=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var a=class extends n{};var l=class extends a{static unauthenticated(){return new this("An unauthenticated request occurred")}};var d=class extends a{static forbidden(){return new this("A forbidden request occurred")}};var p=class extends n{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var u=class extends n{};var m=class extends n{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var B=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=q.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let r of this.options.requestFilterables){let i=r.getHeaders();for(let[f,st]of Object.entries(i))o.headers.has(f)||o.headers.set(f,st)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,r]of Object.entries(t))r!==void 0&&e.push(["sort",r+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(r=>{if((0,ot.default)(r))throw new u("A network error occurred",{cause:r});if(r instanceof q.HTTPError){let i=r.response.status;switch(console.error(JSON.stringify(r.response)),i){case 400:throw m.badRequest();case 401:throw l.unauthenticated();case 403:throw d.forbidden();case 404:throw p.notFound(t);case 405:throw p.forbiddenMethod(t,e.method??"GET");case 415:throw m.unsupportedMediaType();case 418:throw p.teapot();case 429:throw p.rateLimited()}if(i>=500&&i<600)throw n.serverError(i)}throw r});return{response:()=>o,json:async()=>(await o).json()}}};var F=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}create({account:t,files:e,request:o={}}){let r=new FormData;for(let i of e)r.append("file",i);return this._transport.send("v1/uploads",{...o,method:"POST",body:r,searchParams:{account:t}})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var c=require("zod"),H=c.z.object({data:c.z.object({event:c.z.object({id:c.z.string(),type:c.z.string(),payload:c.z.record(c.z.string()),createdAt:c.z.string().datetime()})})});var M=class{constructor(t){this._transport=t}async event({key:t=process.env[V],maxSignatures:e=3,request:o}){let r=o.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+V);if(!r)throw new Error("Missing signature header");if(!this._verifySignature(t,o.body,Array.isArray(r)?r.slice(0,e):[r]))throw new Error("Untrusted signature")}let{data:i}=H.parse(o.body);return{event:i.event}}async _verifySignature(t,e,o){let r=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let i of o)if(await crypto.subtle.verify("HMAC",r,new TextEncoder().encode(atob(i)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var N=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{constructor(t){this._transport=t}getNotifications({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var h=class s{static DEFAULT_BASE_URL=j;static PublicAuthentication=v;static BasicAuthentication=x;static BearerAuthentication=g;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;compositionSection;contact;conversation;label;message;model;note;notificationSubscription;source;statistics;upload;webhook;webhookSubscription;wellKnown;constructor(t,{baseURL:e,...o}={}){this._transport=new B({requestFilterables:[new w,t],...o,baseURL:e?.toString()??s.getBaseURL()}),this.account=new C(this._transport),this.accountAccessToken=new R(this._transport),this.accountConversationSettings=new b(this._transport),this.action=new O(this._transport),this.boilerplateCategory=new _(this._transport),this.boilerplateContent=new L(this._transport),this.channel=new T(this._transport),this.compositionSection=new I(this._transport),this.contact=new A(this._transport),this.conversation=new S(this._transport),this.label=new y(this._transport),this.message=new U(this._transport),this.model=new E(this._transport),this.note=new G(this._transport),this.notificationSubscription=new D(this._transport),this.source=new P(this._transport),this.statistics=new k(this._transport),this.upload=new F(this._transport),this.webhook=new M(this._transport),this.webhookSubscription=new N(this._transport),this.wellKnown=new W(this._transport)}static getBaseURL(){return process.env[et]??this.DEFAULT_BASE_URL}};var K={};Y(K,{AuthError:()=>a,AuthenticationError:()=>l,AuthorizationError:()=>d,LogicError:()=>p,NetworkError:()=>u,SupportError:()=>n,ValidationError:()=>m});0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,Error,eventWebhookSchema});
|
|
1
|
+
"use strict";var rt=Object.create;var Q=Object.defineProperty;var nt=Object.getOwnPropertyDescriptor;var it=Object.getOwnPropertyNames;var pt=Object.getPrototypeOf,at=Object.prototype.hasOwnProperty;var Y=(s,t)=>{for(var e in t)Q(s,e,{get:t[e],enumerable:!0})},z=(s,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of it(t))!at.call(s,r)&&r!==e&&Q(s,r,{get:()=>t[r],enumerable:!(o=nt(t,r))||o.enumerable});return s};var $=(s,t,e)=>(e=s!=null?rt(pt(s)):{},z(t||!s||!s.__esModule?Q(e,"default",{value:s,enumerable:!0}):e,s)),ct=s=>z(Q({},"__esModule",{value:!0}),s);var mt={};Y(mt,{Client:()=>f,DEFAULT_SUPPORT_BASE_URL:()=>j,Error:()=>K,default:()=>f,eventWebhookSchema:()=>H});module.exports=ct(mt);var j="https://api.support.greatdetail.com",J={"X-Powered-By":"GDSupport/JavaScript"};var C=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}getCurrent({request:t={}}){return this._transport.send("v1/accounts/current",{...t,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 R=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:r={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...r,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 b=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 v=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 X="SUPPORT_ACCESS_TOKEN",Z="SUPPORT_KEY_NAME",tt="SUPPORT_KEY_PASSWORD",V="SUPPORT_SIGNING_KEY",et="SUPPORT_BASE_URL";var x=class{name;#t;constructor({name:t=process.env[Z],password:e=process.env[tt]}={}){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 O=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 g=class{getHeaders(){return{}}};var T=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 _=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 y=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}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 L=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 A=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",r=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(r)}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 I=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}list({limit:t,filter:e,include:o,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}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 S=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:r={}}={}){return this._transport.send("v1/labels",{...r,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 E=class{constructor(t){this._transport=t}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:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:r={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...r,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 U=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 G=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"})}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}createForConversation(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",json:e})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var D=class{constructor(t){this._transport=t}createForContact(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",json:e})}};var w=class s{constructor(t=s.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=J;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var k=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 r=[];if(e){let i=Array.isArray(e)?e:[e];for(let h of i)r.push(["category",h])}return t!==void 0&&r.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:r})}};var P=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 ot=$(require("is-network-error"),1),q=$(require("ky"),1);var n=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var a=class extends n{};var l=class extends a{static unauthenticated(){return new this("An unauthenticated request occurred")}};var d=class extends a{static forbidden(){return new this("A forbidden request occurred")}};var p=class extends n{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var u=class extends n{};var m=class extends n{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var B=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=q.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let r of this.options.requestFilterables){let i=r.getHeaders();for(let[h,st]of Object.entries(i))o.headers.has(h)||o.headers.set(h,st)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,r]of Object.entries(t))r!==void 0&&e.push(["sort",r+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(r=>{if((0,ot.default)(r))throw new u("A network error occurred",{cause:r});if(r instanceof q.HTTPError){let i=r.response.status;switch(console.error(JSON.stringify(r.response)),i){case 400:throw m.badRequest();case 401:throw l.unauthenticated();case 403:throw d.forbidden();case 404:throw p.notFound(t);case 405:throw p.forbiddenMethod(t,e.method??"GET");case 415:throw m.unsupportedMediaType();case 418:throw p.teapot();case 429:throw p.rateLimited()}if(i>=500&&i<600)throw n.serverError(i)}throw r});return{response:()=>o,json:async()=>(await o).json()}}};var M=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}create({account:t,files:e,request:o={}}){let r=new FormData;for(let i of e)r.append("file",i);return this._transport.send("v1/uploads",{...o,method:"POST",body:r,searchParams:{account:t}})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var c=require("zod"),H=c.z.object({data:c.z.object({event:c.z.object({id:c.z.string(),type:c.z.string(),payload:c.z.record(c.z.string()),createdAt:c.z.string().datetime()})})});var F=class{constructor(t){this._transport=t}async event({key:t=process.env[V],maxSignatures:e=3,request:o}){let r=o.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+V);if(!r)throw new Error("Missing signature header");if(!this._verifySignature(t,o.body,Array.isArray(r)?r.slice(0,e):[r]))throw new Error("Untrusted signature")}let{data:i}=H.parse(o.body);return{event:i.event}}async _verifySignature(t,e,o){let r=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let i of o)if(await crypto.subtle.verify("HMAC",r,new TextEncoder().encode(atob(i)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var N=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{constructor(t){this._transport=t}getNotifications({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var f=class s{static DEFAULT_BASE_URL=j;static PublicAuthentication=g;static BasicAuthentication=x;static BearerAuthentication=O;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;compositionSection;contact;conversation;label;message;model;note;notificationSubscription;source;statistics;upload;webhook;webhookSubscription;wellKnown;constructor(t,{baseURL:e,...o}={}){this._transport=new B({requestFilterables:[new w,t],...o,baseURL:e?.toString()??s.getBaseURL()}),this.account=new C(this._transport),this.accountAccessToken=new R(this._transport),this.accountConversationSettings=new b(this._transport),this.action=new v(this._transport),this.boilerplateCategory=new T(this._transport),this.boilerplateContent=new _(this._transport),this.channel=new y(this._transport),this.compositionSection=new L(this._transport),this.contact=new A(this._transport),this.conversation=new I(this._transport),this.label=new S(this._transport),this.message=new E(this._transport),this.model=new U(this._transport),this.note=new G(this._transport),this.notificationSubscription=new D(this._transport),this.source=new k(this._transport),this.statistics=new P(this._transport),this.upload=new M(this._transport),this.webhook=new F(this._transport),this.webhookSubscription=new N(this._transport),this.wellKnown=new W(this._transport)}static getBaseURL(){return process.env[et]??this.DEFAULT_BASE_URL}};var K={};Y(K,{AuthError:()=>a,AuthenticationError:()=>l,AuthorizationError:()=>d,LogicError:()=>p,NetworkError:()=>u,SupportError:()=>n,ValidationError:()=>m});0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,Error,eventWebhookSchema});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Account, k as AccountAccessToken, l as AccountAccessTokenID, u as AccountConversationSettings, b as AccountID, B as Action, E as ActionID, b0 as ActiveConversationStatus, $ as BoilerplateCategory, a0 as BoilerplateCategoryID, I as BoilerplateContent, J as BoilerplateContentID, ac as Channel, ad as ChannelID, C as Client, at as CompositionSection, au as CompositionSectionID, b1 as ConcludedConversationStatus, aH as Contact, aI as ContactID, a_ as Conversation, a$ as ConversationID, b2 as ConversationStatus, n as CreateAccountAccessTokenOptions, m as CreateAccountAccessTokenPayload, o as CreateAccountAccessTokenResponse, d as CreateAccountOptions, c as CreateAccountPayload, e as CreateAccountResponse, a2 as CreateBoilerplateCategoryOptions, a1 as CreateBoilerplateCategoryPayload, a3 as CreateBoilerplateCategoryResponse, M as CreateBoilerplateContentOptions, K as CreateBoilerplateContentPayload, N as CreateBoilerplateContentResponse, af as CreateChannelOptions, ae as CreateChannelPayload, ag as CreateChannelResponse, aw as CreateCompositionSectionOptions, av as CreateCompositionSectionPayload, ax as CreateCompositionSectionResponse, cb as CreateContactNoteOptions, ca as CreateContactNotePayload, cc as CreateContactNoteResponse, cy as CreateContactNotificationSubscriptionOptions, cx as CreateContactNotificationSubscriptionPayload, cz as CreateContactNotificationSubscriptionResponse, aL as CreateContactOptions, aK as CreateContactPayload, aM as CreateContactResponse, ce as CreateConversationNoteOptions, cd as CreateConversationNotePayload, cf as CreateConversationNoteResponse, b4 as CreateConversationOptions, b3 as CreateConversationPayload, b5 as CreateConversationResponse, b$ as CreateCorrectionModelOptions, b_ as CreateCorrectionModelPayload, c0 as CreateCorrectionResponse, bq as CreateLabelOptions, bp as CreateLabelPayload, br as CreateLabelResponse, bJ as CreateMessageOptions, bI as CreateMessagePayload, bK as CreateMessageResponse, c2 as CreateResponseModelOptions, c1 as CreateResponseModelPayload, c3 as CreateResponseResponse, cC as CreateUploadOptions, cD as CreateUploadResponse,
|
|
1
|
+
export { A as Account, k as AccountAccessToken, cN as AccountAccessTokenEventType, l as AccountAccessTokenID, u as AccountConversationSettings, b as AccountID, cM as AccountWebhookEventType, B as Action, E as ActionID, b0 as ActiveConversationStatus, $ as BoilerplateCategory, a0 as BoilerplateCategoryID, I as BoilerplateContent, J as BoilerplateContentID, ac as Channel, ad as ChannelID, C as Client, at as CompositionSection, au as CompositionSectionID, b1 as ConcludedConversationStatus, aH as Contact, cO as ContactEventType, aI as ContactID, a_ as Conversation, cP as ConversationEventType, a$ as ConversationID, b2 as ConversationStatus, n as CreateAccountAccessTokenOptions, m as CreateAccountAccessTokenPayload, o as CreateAccountAccessTokenResponse, d as CreateAccountOptions, c as CreateAccountPayload, e as CreateAccountResponse, a2 as CreateBoilerplateCategoryOptions, a1 as CreateBoilerplateCategoryPayload, a3 as CreateBoilerplateCategoryResponse, M as CreateBoilerplateContentOptions, K as CreateBoilerplateContentPayload, N as CreateBoilerplateContentResponse, af as CreateChannelOptions, ae as CreateChannelPayload, ag as CreateChannelResponse, aw as CreateCompositionSectionOptions, av as CreateCompositionSectionPayload, ax as CreateCompositionSectionResponse, cb as CreateContactNoteOptions, ca as CreateContactNotePayload, cc as CreateContactNoteResponse, cy as CreateContactNotificationSubscriptionOptions, cx as CreateContactNotificationSubscriptionPayload, cz as CreateContactNotificationSubscriptionResponse, aL as CreateContactOptions, aK as CreateContactPayload, aM as CreateContactResponse, ce as CreateConversationNoteOptions, cd as CreateConversationNotePayload, cf as CreateConversationNoteResponse, b4 as CreateConversationOptions, b3 as CreateConversationPayload, b5 as CreateConversationResponse, b$ as CreateCorrectionModelOptions, b_ as CreateCorrectionModelPayload, c0 as CreateCorrectionResponse, bq as CreateLabelOptions, bp as CreateLabelPayload, br as CreateLabelResponse, bJ as CreateMessageOptions, bI as CreateMessagePayload, bK as CreateMessageResponse, c2 as CreateResponseModelOptions, c1 as CreateResponseModelPayload, c3 as CreateResponseResponse, cC as CreateUploadOptions, cD as CreateUploadResponse, cW as CreateWebhookSubscriptionOptions, cV as CreateWebhookSubscriptionPayload, cX as CreateWebhookSubscriptionResponse, aJ as CustomMetadata, p as DeleteAccountAccessTokenOptions, D as DeleteAccountAccessTokenPayload, q as DeleteAccountAccessTokenResponse, aN as DeleteContactOptions, aO as DeleteContactResponse, b6 as DeleteConversationOptions, b7 as DeleteConversationResponse, bs as DeleteLabelOptions, bt as DeleteLabelResponse, bL as DeleteMessageOptions, bM as DeleteMessageResponse, cE as DeleteUploadOptions, cF as DeleteUploadResponse, cY as DeleteWebhookSubscriptionOptions, cZ as DeleteWebhookSubscriptionResponse, cJ as EventWebhookOptions, bg as FilterOptions, r as GetAccountAccessTokenOptions, s as GetAccountAccessTokenResponse, v as GetAccountConversationSettingsOptions, w as GetAccountConversationSettingsResponse, G as GetAccountOptions, f as GetAccountResponse, a4 as GetBoilerplateCategoryOptions, a5 as GetBoilerplateCategoryResponse, P as GetBoilerplateContentOptions, Q as GetBoilerplateContentResponse, ah as GetChannelOptions, ai as GetChannelResponse, ay as GetCompositionSectionOptions, az as GetCompositionSectionResponse, aP as GetContactIncludeOptions, aQ as GetContactOptions, aR as GetContactResponse, aS as GetContactVCFOptions, b8 as GetConversationIncludeOptions, b9 as GetConversationOptions, ba as GetConversationResponse, g as GetCurrentAccountOptions, h as GetCurrentAccountResponse, bu as GetLabelOptions, bv as GetLabelResponse, c4 as GetModelOptions, c5 as GetModelResponse, cg as GetNoteOptions, ch as GetNoteResponse, d5 as GetNotificationWellKnownResponse, cr as GetSourceOptions, cs as GetSourceResponse, cG as GetUploadOptions, cH as GetUploadResponse, c_ as GetWebhookSubscriptionOptions, c$ as GetWebhookSubscriptionResponse, bo as Label, bw as LabelID, L as ListAccountAccessTokensOptions, t as ListAccountAccessTokensResponse, F as ListActionsOptions, H as ListActionsResponse, a6 as ListBoilerplateCategoriesIncludeOptions, a7 as ListBoilerplateCategoriesOptions, a8 as ListBoilerplateCategoriesResponse, T as ListBoilerplateCategoryBoilerplateContentsOptions, V as ListBoilerplateCategoryBoilerplateContentsResponse, W as ListBoilerplateContentsOptions, X as ListBoilerplateContentsResponse, aA as ListChannelCompositionSectionsOptions, aB as ListChannelCompositionSectionsResponse, bb as ListChannelConversationsOptions, bc as ListChannelConversationsResponse, bN as ListChannelMessagesIncludeOptions, bO as ListChannelMessagesOptions, bP as ListChannelMessagesResponse, aj as ListChannelsOptions, ak as ListChannelsResponse, aC as ListCompositionSectionsOptions, aD as ListCompositionSectionsResponse, bd as ListContactConversationsOptions, be as ListContactConversationsResponse, bx as ListContactLabelsOptions, by as ListContactLabelsResponse, ci as ListContactNotesOptions, cj as ListContactNotesResponse, aT as ListContactsOptions, aU as ListContactsResponse, bz as ListConversationLabelsOptions, bA as ListConversationLabelsResponse, bQ as ListConversationMessagesIncludeOptions, bR as ListConversationMessagesOptions, bS as ListConversationMessagesResponse, ck as ListConversationNotesOptions, cl as ListConversationNotesResponse, bh as ListConversationOptions, bf as ListConversationsIncludeOptions, bi as ListConversationsResponse, aV as ListLabelContactsOptions, aW as ListLabelContactsResponse, bj as ListLabelConversationsOptions, bk as ListLabelConversationsResponse, bB as ListLabelsIncludeOptions, bC as ListLabelsOptions, bD as ListLabelsResponse, bT as ListMessagesIncludeOptions, bU as ListMessagesOptions, bV as ListMessagesResponse, c6 as ListModelsOptions, c7 as ListModelsResponse, ct as ListSourcesOptions, cu as ListSourcesResponse, d0 as ListWebhookSubscriptionsOptions, d1 as ListWebhookSubscriptionsResponse, bH as Message, cQ as MessageEventType, bW as MessageID, bX as MessageRole, bY as MessageStatus, al as MetaWhatsappChannelGetBusinessProfileOptions, am as MetaWhatsappChannelGetBusinessProfileResponse, bZ as Model, c8 as ModelID, c9 as Note, cm as NoteID, cw as NotificationSubscription, cA as NotificationSubscriptionID, O as Options, R as RequestFilterable, S as SortOptions, cq as Source, cv as SourceID, d2 as TestWebhookSubscriptionOptions, d3 as TestWebhookSubscriptionResponse, a as TransportOptions, an as TwilioSendChannelSyncPayload, ao as TwilioSendgridChannelSyncOptions, ap as TwilioSendgridChannelSyncResponse, y as UpdateAccountConversationSettingsOptions, x as UpdateAccountConversationSettingsPayload, z as UpdateAccountConversationSettingsResponse, i as UpdateAccountOptions, U as UpdateAccountPayload, j as UpdateAccountResponse, aa as UpdateBoilerplateCategoryOptions, a9 as UpdateBoilerplateCategoryPayload, ab as UpdateBoilerplateCategoryResponse, Z as UpdateBoilerplateContentOptions, Y as UpdateBoilerplateContentPayload, _ as UpdateBoilerplateContentResponse, ar as UpdateChannelOptions, aq as UpdateChannelPayload, as as UpdateChannelResponse, aF as UpdateCompositionSectionOptions, aE as UpdateCompositionSectionPayload, aG as UpdateCompositionSectionResponse, aY as UpdateContactOptions, aX as UpdateContactPayload, aZ as UpdateContactResponse, bm as UpdateConversationOptions, bl as UpdateConversationPayload, bn as UpdateConversationResponse, bF as UpdateLabelOptions, bE as UpdateLabelPayload, bG as UpdateLabelResponse, co as UpdateNoteOptions, cn as UpdateNotePayload, cp as UpdateNoteResponse, cB as Upload, cI as UploadID, cS as WebhookEventPayload, cL as WebhookEventType, cT as WebhookResponse, cU as WebhookSubscription, cR as WebhookSubscriptionEventType, d4 as WebhookSubscriptionID, C as default, cK as eventWebhookSchema } from './Client-DLfBry8K.cjs';
|
|
2
2
|
import 'ky';
|
|
3
3
|
import 'zod';
|
|
4
4
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Account, k as AccountAccessToken, l as AccountAccessTokenID, u as AccountConversationSettings, b as AccountID, B as Action, E as ActionID, b0 as ActiveConversationStatus, $ as BoilerplateCategory, a0 as BoilerplateCategoryID, I as BoilerplateContent, J as BoilerplateContentID, ac as Channel, ad as ChannelID, C as Client, at as CompositionSection, au as CompositionSectionID, b1 as ConcludedConversationStatus, aH as Contact, aI as ContactID, a_ as Conversation, a$ as ConversationID, b2 as ConversationStatus, n as CreateAccountAccessTokenOptions, m as CreateAccountAccessTokenPayload, o as CreateAccountAccessTokenResponse, d as CreateAccountOptions, c as CreateAccountPayload, e as CreateAccountResponse, a2 as CreateBoilerplateCategoryOptions, a1 as CreateBoilerplateCategoryPayload, a3 as CreateBoilerplateCategoryResponse, M as CreateBoilerplateContentOptions, K as CreateBoilerplateContentPayload, N as CreateBoilerplateContentResponse, af as CreateChannelOptions, ae as CreateChannelPayload, ag as CreateChannelResponse, aw as CreateCompositionSectionOptions, av as CreateCompositionSectionPayload, ax as CreateCompositionSectionResponse, cb as CreateContactNoteOptions, ca as CreateContactNotePayload, cc as CreateContactNoteResponse, cy as CreateContactNotificationSubscriptionOptions, cx as CreateContactNotificationSubscriptionPayload, cz as CreateContactNotificationSubscriptionResponse, aL as CreateContactOptions, aK as CreateContactPayload, aM as CreateContactResponse, ce as CreateConversationNoteOptions, cd as CreateConversationNotePayload, cf as CreateConversationNoteResponse, b4 as CreateConversationOptions, b3 as CreateConversationPayload, b5 as CreateConversationResponse, b$ as CreateCorrectionModelOptions, b_ as CreateCorrectionModelPayload, c0 as CreateCorrectionResponse, bq as CreateLabelOptions, bp as CreateLabelPayload, br as CreateLabelResponse, bJ as CreateMessageOptions, bI as CreateMessagePayload, bK as CreateMessageResponse, c2 as CreateResponseModelOptions, c1 as CreateResponseModelPayload, c3 as CreateResponseResponse, cC as CreateUploadOptions, cD as CreateUploadResponse,
|
|
1
|
+
export { A as Account, k as AccountAccessToken, cN as AccountAccessTokenEventType, l as AccountAccessTokenID, u as AccountConversationSettings, b as AccountID, cM as AccountWebhookEventType, B as Action, E as ActionID, b0 as ActiveConversationStatus, $ as BoilerplateCategory, a0 as BoilerplateCategoryID, I as BoilerplateContent, J as BoilerplateContentID, ac as Channel, ad as ChannelID, C as Client, at as CompositionSection, au as CompositionSectionID, b1 as ConcludedConversationStatus, aH as Contact, cO as ContactEventType, aI as ContactID, a_ as Conversation, cP as ConversationEventType, a$ as ConversationID, b2 as ConversationStatus, n as CreateAccountAccessTokenOptions, m as CreateAccountAccessTokenPayload, o as CreateAccountAccessTokenResponse, d as CreateAccountOptions, c as CreateAccountPayload, e as CreateAccountResponse, a2 as CreateBoilerplateCategoryOptions, a1 as CreateBoilerplateCategoryPayload, a3 as CreateBoilerplateCategoryResponse, M as CreateBoilerplateContentOptions, K as CreateBoilerplateContentPayload, N as CreateBoilerplateContentResponse, af as CreateChannelOptions, ae as CreateChannelPayload, ag as CreateChannelResponse, aw as CreateCompositionSectionOptions, av as CreateCompositionSectionPayload, ax as CreateCompositionSectionResponse, cb as CreateContactNoteOptions, ca as CreateContactNotePayload, cc as CreateContactNoteResponse, cy as CreateContactNotificationSubscriptionOptions, cx as CreateContactNotificationSubscriptionPayload, cz as CreateContactNotificationSubscriptionResponse, aL as CreateContactOptions, aK as CreateContactPayload, aM as CreateContactResponse, ce as CreateConversationNoteOptions, cd as CreateConversationNotePayload, cf as CreateConversationNoteResponse, b4 as CreateConversationOptions, b3 as CreateConversationPayload, b5 as CreateConversationResponse, b$ as CreateCorrectionModelOptions, b_ as CreateCorrectionModelPayload, c0 as CreateCorrectionResponse, bq as CreateLabelOptions, bp as CreateLabelPayload, br as CreateLabelResponse, bJ as CreateMessageOptions, bI as CreateMessagePayload, bK as CreateMessageResponse, c2 as CreateResponseModelOptions, c1 as CreateResponseModelPayload, c3 as CreateResponseResponse, cC as CreateUploadOptions, cD as CreateUploadResponse, cW as CreateWebhookSubscriptionOptions, cV as CreateWebhookSubscriptionPayload, cX as CreateWebhookSubscriptionResponse, aJ as CustomMetadata, p as DeleteAccountAccessTokenOptions, D as DeleteAccountAccessTokenPayload, q as DeleteAccountAccessTokenResponse, aN as DeleteContactOptions, aO as DeleteContactResponse, b6 as DeleteConversationOptions, b7 as DeleteConversationResponse, bs as DeleteLabelOptions, bt as DeleteLabelResponse, bL as DeleteMessageOptions, bM as DeleteMessageResponse, cE as DeleteUploadOptions, cF as DeleteUploadResponse, cY as DeleteWebhookSubscriptionOptions, cZ as DeleteWebhookSubscriptionResponse, cJ as EventWebhookOptions, bg as FilterOptions, r as GetAccountAccessTokenOptions, s as GetAccountAccessTokenResponse, v as GetAccountConversationSettingsOptions, w as GetAccountConversationSettingsResponse, G as GetAccountOptions, f as GetAccountResponse, a4 as GetBoilerplateCategoryOptions, a5 as GetBoilerplateCategoryResponse, P as GetBoilerplateContentOptions, Q as GetBoilerplateContentResponse, ah as GetChannelOptions, ai as GetChannelResponse, ay as GetCompositionSectionOptions, az as GetCompositionSectionResponse, aP as GetContactIncludeOptions, aQ as GetContactOptions, aR as GetContactResponse, aS as GetContactVCFOptions, b8 as GetConversationIncludeOptions, b9 as GetConversationOptions, ba as GetConversationResponse, g as GetCurrentAccountOptions, h as GetCurrentAccountResponse, bu as GetLabelOptions, bv as GetLabelResponse, c4 as GetModelOptions, c5 as GetModelResponse, cg as GetNoteOptions, ch as GetNoteResponse, d5 as GetNotificationWellKnownResponse, cr as GetSourceOptions, cs as GetSourceResponse, cG as GetUploadOptions, cH as GetUploadResponse, c_ as GetWebhookSubscriptionOptions, c$ as GetWebhookSubscriptionResponse, bo as Label, bw as LabelID, L as ListAccountAccessTokensOptions, t as ListAccountAccessTokensResponse, F as ListActionsOptions, H as ListActionsResponse, a6 as ListBoilerplateCategoriesIncludeOptions, a7 as ListBoilerplateCategoriesOptions, a8 as ListBoilerplateCategoriesResponse, T as ListBoilerplateCategoryBoilerplateContentsOptions, V as ListBoilerplateCategoryBoilerplateContentsResponse, W as ListBoilerplateContentsOptions, X as ListBoilerplateContentsResponse, aA as ListChannelCompositionSectionsOptions, aB as ListChannelCompositionSectionsResponse, bb as ListChannelConversationsOptions, bc as ListChannelConversationsResponse, bN as ListChannelMessagesIncludeOptions, bO as ListChannelMessagesOptions, bP as ListChannelMessagesResponse, aj as ListChannelsOptions, ak as ListChannelsResponse, aC as ListCompositionSectionsOptions, aD as ListCompositionSectionsResponse, bd as ListContactConversationsOptions, be as ListContactConversationsResponse, bx as ListContactLabelsOptions, by as ListContactLabelsResponse, ci as ListContactNotesOptions, cj as ListContactNotesResponse, aT as ListContactsOptions, aU as ListContactsResponse, bz as ListConversationLabelsOptions, bA as ListConversationLabelsResponse, bQ as ListConversationMessagesIncludeOptions, bR as ListConversationMessagesOptions, bS as ListConversationMessagesResponse, ck as ListConversationNotesOptions, cl as ListConversationNotesResponse, bh as ListConversationOptions, bf as ListConversationsIncludeOptions, bi as ListConversationsResponse, aV as ListLabelContactsOptions, aW as ListLabelContactsResponse, bj as ListLabelConversationsOptions, bk as ListLabelConversationsResponse, bB as ListLabelsIncludeOptions, bC as ListLabelsOptions, bD as ListLabelsResponse, bT as ListMessagesIncludeOptions, bU as ListMessagesOptions, bV as ListMessagesResponse, c6 as ListModelsOptions, c7 as ListModelsResponse, ct as ListSourcesOptions, cu as ListSourcesResponse, d0 as ListWebhookSubscriptionsOptions, d1 as ListWebhookSubscriptionsResponse, bH as Message, cQ as MessageEventType, bW as MessageID, bX as MessageRole, bY as MessageStatus, al as MetaWhatsappChannelGetBusinessProfileOptions, am as MetaWhatsappChannelGetBusinessProfileResponse, bZ as Model, c8 as ModelID, c9 as Note, cm as NoteID, cw as NotificationSubscription, cA as NotificationSubscriptionID, O as Options, R as RequestFilterable, S as SortOptions, cq as Source, cv as SourceID, d2 as TestWebhookSubscriptionOptions, d3 as TestWebhookSubscriptionResponse, a as TransportOptions, an as TwilioSendChannelSyncPayload, ao as TwilioSendgridChannelSyncOptions, ap as TwilioSendgridChannelSyncResponse, y as UpdateAccountConversationSettingsOptions, x as UpdateAccountConversationSettingsPayload, z as UpdateAccountConversationSettingsResponse, i as UpdateAccountOptions, U as UpdateAccountPayload, j as UpdateAccountResponse, aa as UpdateBoilerplateCategoryOptions, a9 as UpdateBoilerplateCategoryPayload, ab as UpdateBoilerplateCategoryResponse, Z as UpdateBoilerplateContentOptions, Y as UpdateBoilerplateContentPayload, _ as UpdateBoilerplateContentResponse, ar as UpdateChannelOptions, aq as UpdateChannelPayload, as as UpdateChannelResponse, aF as UpdateCompositionSectionOptions, aE as UpdateCompositionSectionPayload, aG as UpdateCompositionSectionResponse, aY as UpdateContactOptions, aX as UpdateContactPayload, aZ as UpdateContactResponse, bm as UpdateConversationOptions, bl as UpdateConversationPayload, bn as UpdateConversationResponse, bF as UpdateLabelOptions, bE as UpdateLabelPayload, bG as UpdateLabelResponse, co as UpdateNoteOptions, cn as UpdateNotePayload, cp as UpdateNoteResponse, cB as Upload, cI as UploadID, cS as WebhookEventPayload, cL as WebhookEventType, cT as WebhookResponse, cU as WebhookSubscription, cR as WebhookSubscriptionEventType, d4 as WebhookSubscriptionID, C as default, cK as eventWebhookSchema } from './Client-DLfBry8K.js';
|
|
2
2
|
import 'ky';
|
|
3
3
|
import 'zod';
|
|
4
4
|
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s,c as l,d as o,e as r,f as t,g as e,h as p,i as f,j as m,k as u,l as x}from"./chunk-
|
|
1
|
+
import{a as s,c as l,d as o,e as r,f as t,g as e,h as p,i as f,j as m,k as u,l as x}from"./chunk-GDE2LAN3.js";var a={};s(a,{AuthError:()=>r,AuthenticationError:()=>t,AuthorizationError:()=>e,LogicError:()=>p,NetworkError:()=>f,SupportError:()=>o,ValidationError:()=>m});export{x as Client,l as DEFAULT_SUPPORT_BASE_URL,a as Error,x as default,u as eventWebhookSchema};
|