@great-detail/support-sdk 0.17.12 → 0.17.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Client-B25ztwwf.d.cts → Client-DdUmsH92.d.cts} +23 -21
- package/dist/{Client-B25ztwwf.d.ts → Client-DdUmsH92.d.ts} +23 -21
- package/dist/{chunk-HHCC353M.js → chunk-JF2KQDYG.js} +1 -1
- package/dist/{chunk-XA7UMLAC.js → chunk-KCAE7SJB.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 +2 -2
|
@@ -482,6 +482,7 @@ type Conversation = {
|
|
|
482
482
|
type MessageID = `msg${string}` | (string & NonNullable<unknown>);
|
|
483
483
|
type MessageRole = "user" | "assistant";
|
|
484
484
|
type MessageStatus = "PotentialMessageStatus" | "SendingMessageStatus" | "SentMessageStatus" | "ReceivedMessageStatus" | "FailedMessageStatus";
|
|
485
|
+
type MessageEventType = "ReadMessageEventType" | "ReceivedMessageEventType" | "SentMessageEventType";
|
|
485
486
|
type Message = {
|
|
486
487
|
id: MessageID;
|
|
487
488
|
role: MessageRole;
|
|
@@ -492,7 +493,7 @@ type Message = {
|
|
|
492
493
|
contact: ContactID;
|
|
493
494
|
messageEvents: {
|
|
494
495
|
id: string;
|
|
495
|
-
type:
|
|
496
|
+
type: MessageEventType;
|
|
496
497
|
triggeredAt: string;
|
|
497
498
|
createdAt: string;
|
|
498
499
|
updatedAt?: string;
|
|
@@ -1651,6 +1652,7 @@ type UpdateConversationPayload = {
|
|
|
1651
1652
|
status?: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
|
|
1652
1653
|
autoResolveAt?: Nullable<string>;
|
|
1653
1654
|
autoRespondAt?: Nullable<string>;
|
|
1655
|
+
conversationEscalation?: Nullable<undefined>;
|
|
1654
1656
|
hasEnded?: boolean;
|
|
1655
1657
|
};
|
|
1656
1658
|
interface UpdateConversationOptions {
|
|
@@ -2722,42 +2724,42 @@ declare const eventWebhookSchema: z.ZodObject<{
|
|
|
2722
2724
|
};
|
|
2723
2725
|
};
|
|
2724
2726
|
}>;
|
|
2725
|
-
type WebhookEventType =
|
|
2726
|
-
type
|
|
2727
|
-
type
|
|
2728
|
-
type
|
|
2729
|
-
type
|
|
2730
|
-
type
|
|
2731
|
-
type
|
|
2727
|
+
type WebhookEventType = AccountWebhookWebhookEventType | AccountAccessTokenWebhookEventType | ContactWebhookEventType | ConversationWebhookEventType | MessageWebhookEventType | WebhookSubscriptionWebhookEventType;
|
|
2728
|
+
type AccountWebhookWebhookEventType = "account.created" | "account.updated";
|
|
2729
|
+
type AccountAccessTokenWebhookEventType = "accountAccessToken.created" | "accountAccessToken.deleted";
|
|
2730
|
+
type ContactWebhookEventType = "contact.created" | "contact.updated" | "contact.deleted";
|
|
2731
|
+
type ConversationWebhookEventType = "conversation.created" | "conversation.updated" | "conversation.closed" | "conversation.received" | "conversation.resolved" | "conversation.sent";
|
|
2732
|
+
type MessageWebhookEventType = "message.created" | "message.updated" | "message.delivered" | "message.failed" | "message.read" | "message.received" | "message.sent";
|
|
2733
|
+
type WebhookSubscriptionWebhookEventType = "webhook-subscription.created" | "webhook-subscription.updated" | "webhook-subscription.deleted" | "webhook-subscription.test";
|
|
2732
2734
|
type WebhookEventPayload = {
|
|
2733
2735
|
data: {
|
|
2734
2736
|
event: {
|
|
2735
2737
|
id: string;
|
|
2736
2738
|
createdAt: string;
|
|
2737
2739
|
} & ({
|
|
2738
|
-
type:
|
|
2740
|
+
type: AccountWebhookWebhookEventType;
|
|
2739
2741
|
payload: {
|
|
2740
2742
|
account: string;
|
|
2741
2743
|
};
|
|
2742
2744
|
} | {
|
|
2743
|
-
type:
|
|
2745
|
+
type: AccountAccessTokenWebhookEventType;
|
|
2744
2746
|
payload: {
|
|
2745
2747
|
accountAccessToken: string;
|
|
2746
2748
|
};
|
|
2747
2749
|
} | {
|
|
2748
|
-
type:
|
|
2750
|
+
type: ContactWebhookEventType;
|
|
2749
2751
|
payload: {
|
|
2750
2752
|
contact: string;
|
|
2751
2753
|
};
|
|
2752
2754
|
} | {
|
|
2753
|
-
type:
|
|
2755
|
+
type: ConversationWebhookEventType;
|
|
2754
2756
|
payload: {
|
|
2755
2757
|
conversation: string;
|
|
2756
2758
|
};
|
|
2757
2759
|
} | {
|
|
2758
|
-
type:
|
|
2760
|
+
type: MessageWebhookEventType;
|
|
2759
2761
|
} | {
|
|
2760
|
-
type:
|
|
2762
|
+
type: WebhookSubscriptionWebhookEventType;
|
|
2761
2763
|
});
|
|
2762
2764
|
};
|
|
2763
2765
|
};
|
|
@@ -2853,29 +2855,29 @@ declare class WebhookAPI {
|
|
|
2853
2855
|
id: string;
|
|
2854
2856
|
createdAt: string;
|
|
2855
2857
|
} & ({
|
|
2856
|
-
type:
|
|
2858
|
+
type: AccountWebhookWebhookEventType;
|
|
2857
2859
|
payload: {
|
|
2858
2860
|
account: string;
|
|
2859
2861
|
};
|
|
2860
2862
|
} | {
|
|
2861
|
-
type:
|
|
2863
|
+
type: AccountAccessTokenWebhookEventType;
|
|
2862
2864
|
payload: {
|
|
2863
2865
|
accountAccessToken: string;
|
|
2864
2866
|
};
|
|
2865
2867
|
} | {
|
|
2866
|
-
type:
|
|
2868
|
+
type: ContactWebhookEventType;
|
|
2867
2869
|
payload: {
|
|
2868
2870
|
contact: string;
|
|
2869
2871
|
};
|
|
2870
2872
|
} | {
|
|
2871
|
-
type:
|
|
2873
|
+
type: ConversationWebhookEventType;
|
|
2872
2874
|
payload: {
|
|
2873
2875
|
conversation: string;
|
|
2874
2876
|
};
|
|
2875
2877
|
} | {
|
|
2876
|
-
type:
|
|
2878
|
+
type: MessageWebhookEventType;
|
|
2877
2879
|
} | {
|
|
2878
|
-
type:
|
|
2880
|
+
type: WebhookSubscriptionWebhookEventType;
|
|
2879
2881
|
});
|
|
2880
2882
|
}>;
|
|
2881
2883
|
protected _verifySignature(key: string, body: object, signatures: string[]): Promise<boolean>;
|
|
@@ -3080,4 +3082,4 @@ declare class Client {
|
|
|
3080
3082
|
static getBaseURL(): string;
|
|
3081
3083
|
}
|
|
3082
3084
|
|
|
3083
|
-
export { type BoilerplateCategoryID as $, type Account as A, type ActionID as B, Client as C, type DeleteAccountAccessTokenPayload as D, type ListActionsOptions as E, type ListActionsResponse as F, type GetAccountOptions as G, type BoilerplateContent as H, type BoilerplateContentID as I, type CreateBoilerplateContentPayload as J, type CreateBoilerplateContentOptions as K, type ListAccountAccessTokensOptions as L, type CreateBoilerplateContentResponse as M, type GetBoilerplateContentOptions as N, type Options as O, type GetBoilerplateContentResponse as P, type ListBoilerplateCategoryBoilerplateContentsOptions as Q, type RequestFilterable as R, type SortOptions as S, type ListBoilerplateCategoryBoilerplateContentsResponse as T, type UpdateAccountPayload as U, type ListBoilerplateContentsOptions as V, type ListBoilerplateContentsResponse as W, type UpdateBoilerplateContentPayload as X, type UpdateBoilerplateContentOptions as Y, type UpdateBoilerplateContentResponse as Z, type BoilerplateCategory as _, type Options$4 as a, type ActiveConversationStatus as a$, type CreateBoilerplateCategoryPayload as a0, type CreateBoilerplateCategoryOptions as a1, type CreateBoilerplateCategoryResponse as a2, type GetBoilerplateCategoryOptions as a3, type GetBoilerplateCategoryResponse as a4, type ListBoilerplateCategoriesIncludeOptions as a5, type ListBoilerplateCategoriesOptions as a6, type ListBoilerplateCategoriesResponse as a7, type UpdateBoilerplateCategoryPayload as a8, type UpdateBoilerplateCategoryOptions as a9, type ListChannelCompositionSectionsResponse as aA, type ListCompositionSectionsOptions as aB, type ListCompositionSectionsResponse as aC, type UpdateCompositionSectionPayload as aD, type UpdateCompositionSectionOptions as aE, type UpdateCompositionSectionResponse as aF, type Contact as aG, type ContactID as aH, type CustomMetadata as aI, type CreateContactPayload as aJ, type CreateContactOptions as aK, type CreateContactResponse as aL, type DeleteContactOptions as aM, type DeleteContactResponse as aN, type GetContactIncludeOptions as aO, type GetContactOptions as aP, type GetContactResponse as aQ, type GetContactVCFOptions as aR, type ListContactsOptions as aS, type ListContactsResponse as aT, type ListLabelContactsOptions as aU, type ListLabelContactsResponse as aV, type UpdateContactPayload as aW, type UpdateContactOptions as aX, type UpdateContactResponse as aY, type Conversation as aZ, type ConversationID as a_, type UpdateBoilerplateCategoryResponse as aa, type Channel as ab, type ChannelID as ac, type CreateChannelPayload as ad, type CreateChannelOptions as ae, type CreateChannelResponse as af, type GetChannelOptions as ag, type GetChannelResponse as ah, type ListChannelsOptions as ai, type ListChannelsResponse as aj, type MetaWhatsappChannelGetBusinessProfileOptions as ak, type MetaWhatsappChannelGetBusinessProfileResponse as al, type TwilioSendChannelSyncPayload as am, type TwilioSendgridChannelSyncOptions as an, type TwilioSendgridChannelSyncResponse as ao, type UpdateChannelPayload as ap, type UpdateChannelOptions as aq, type UpdateChannelResponse as ar, type CompositionSection as as, type CompositionSectionID as at, type CreateCompositionSectionPayload as au, type CreateCompositionSectionOptions as av, type CreateCompositionSectionResponse as aw, type GetCompositionSectionOptions as ax, type GetCompositionSectionResponse as ay, type ListChannelCompositionSectionsOptions as az, type CurrentAccountID as b, type
|
|
3085
|
+
export { type BoilerplateCategoryID as $, type Account as A, type ActionID as B, Client as C, type DeleteAccountAccessTokenPayload as D, type ListActionsOptions as E, type ListActionsResponse as F, type GetAccountOptions as G, type BoilerplateContent as H, type BoilerplateContentID as I, type CreateBoilerplateContentPayload as J, type CreateBoilerplateContentOptions as K, type ListAccountAccessTokensOptions as L, type CreateBoilerplateContentResponse as M, type GetBoilerplateContentOptions as N, type Options as O, type GetBoilerplateContentResponse as P, type ListBoilerplateCategoryBoilerplateContentsOptions as Q, type RequestFilterable as R, type SortOptions as S, type ListBoilerplateCategoryBoilerplateContentsResponse as T, type UpdateAccountPayload as U, type ListBoilerplateContentsOptions as V, type ListBoilerplateContentsResponse as W, type UpdateBoilerplateContentPayload as X, type UpdateBoilerplateContentOptions as Y, type UpdateBoilerplateContentResponse as Z, type BoilerplateCategory as _, type Options$4 as a, type ActiveConversationStatus as a$, type CreateBoilerplateCategoryPayload as a0, type CreateBoilerplateCategoryOptions as a1, type CreateBoilerplateCategoryResponse as a2, type GetBoilerplateCategoryOptions as a3, type GetBoilerplateCategoryResponse as a4, type ListBoilerplateCategoriesIncludeOptions as a5, type ListBoilerplateCategoriesOptions as a6, type ListBoilerplateCategoriesResponse as a7, type UpdateBoilerplateCategoryPayload as a8, type UpdateBoilerplateCategoryOptions as a9, type ListChannelCompositionSectionsResponse as aA, type ListCompositionSectionsOptions as aB, type ListCompositionSectionsResponse as aC, type UpdateCompositionSectionPayload as aD, type UpdateCompositionSectionOptions as aE, type UpdateCompositionSectionResponse as aF, type Contact as aG, type ContactID as aH, type CustomMetadata as aI, type CreateContactPayload as aJ, type CreateContactOptions as aK, type CreateContactResponse as aL, type DeleteContactOptions as aM, type DeleteContactResponse as aN, type GetContactIncludeOptions as aO, type GetContactOptions as aP, type GetContactResponse as aQ, type GetContactVCFOptions as aR, type ListContactsOptions as aS, type ListContactsResponse as aT, type ListLabelContactsOptions as aU, type ListLabelContactsResponse as aV, type UpdateContactPayload as aW, type UpdateContactOptions as aX, type UpdateContactResponse as aY, type Conversation as aZ, type ConversationID as a_, type UpdateBoilerplateCategoryResponse as aa, type Channel as ab, type ChannelID as ac, type CreateChannelPayload as ad, type CreateChannelOptions as ae, type CreateChannelResponse as af, type GetChannelOptions as ag, type GetChannelResponse as ah, type ListChannelsOptions as ai, type ListChannelsResponse as aj, type MetaWhatsappChannelGetBusinessProfileOptions as ak, type MetaWhatsappChannelGetBusinessProfileResponse as al, type TwilioSendChannelSyncPayload as am, type TwilioSendgridChannelSyncOptions as an, type TwilioSendgridChannelSyncResponse as ao, type UpdateChannelPayload as ap, type UpdateChannelOptions as aq, type UpdateChannelResponse as ar, type CompositionSection as as, type CompositionSectionID as at, type CreateCompositionSectionPayload as au, type CreateCompositionSectionOptions as av, type CreateCompositionSectionResponse as aw, type GetCompositionSectionOptions as ax, type GetCompositionSectionResponse as ay, type ListChannelCompositionSectionsOptions as az, type CurrentAccountID as b, type CreateCorrectionModelOptions as b$, type ConcludedConversationStatus as b0, type ConversationStatus as b1, type CreateConversationPayload as b2, type CreateConversationOptions as b3, type CreateConversationResponse as b4, type DeleteConversationOptions as b5, type DeleteConversationResponse as b6, type GetConversationIncludeOptions as b7, type GetConversationOptions as b8, type GetConversationResponse as b9, type ListLabelsIncludeOptions as bA, type ListLabelsOptions as bB, type ListLabelsResponse as bC, type UpdateLabelPayload as bD, type UpdateLabelOptions as bE, type UpdateLabelResponse as bF, type Message as bG, type CreateMessagePayload as bH, type CreateMessageOptions as bI, type CreateMessageResponse as bJ, type DeleteMessageOptions as bK, type DeleteMessageResponse as bL, type ListChannelMessagesIncludeOptions as bM, type ListChannelMessagesOptions as bN, type ListChannelMessagesResponse as bO, type ListConversationMessagesIncludeOptions as bP, type ListConversationMessagesOptions as bQ, type ListConversationMessagesResponse as bR, type ListMessagesIncludeOptions as bS, type ListMessagesOptions as bT, type ListMessagesResponse as bU, type MessageID as bV, type MessageRole as bW, type MessageStatus as bX, type MessageEventType as bY, type Model as bZ, type CreateCorrectionModelPayload as b_, type ListChannelConversationsOptions as ba, type ListChannelConversationsResponse as bb, type ListContactConversationsOptions as bc, type ListContactConversationsResponse as bd, type ListConversationsIncludeOptions as be, type FilterOptions as bf, type ListConversationOptions as bg, type ListConversationsResponse as bh, type ListLabelConversationsOptions as bi, type ListLabelConversationsResponse as bj, type UpdateConversationPayload as bk, type UpdateConversationOptions as bl, type UpdateConversationResponse as bm, type Label as bn, type CreateLabelPayload as bo, type CreateLabelOptions as bp, type CreateLabelResponse as bq, type DeleteLabelOptions as br, type DeleteLabelResponse as bs, type GetLabelOptions as bt, type GetLabelResponse as bu, type LabelID as bv, type ListContactLabelsOptions as bw, type ListContactLabelsResponse as bx, type ListConversationLabelsOptions as by, type ListConversationLabelsResponse as bz, type AccountID as c, type DeleteWebhookSubscriptionResponse 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 ListUploadsOptions as cI, type ListUploadsResponse as cJ, type UploadID as cK, type EventWebhookOptions as cL, eventWebhookSchema as cM, type WebhookEventType as cN, type AccountWebhookWebhookEventType as cO, type AccountAccessTokenWebhookEventType as cP, type ContactWebhookEventType as cQ, type ConversationWebhookEventType as cR, type MessageWebhookEventType as cS, type WebhookSubscriptionWebhookEventType as cT, type WebhookEventPayload as cU, type WebhookResponse as cV, type WebhookSubscription as cW, type CreateWebhookSubscriptionPayload as cX, type CreateWebhookSubscriptionOptions as cY, type CreateWebhookSubscriptionResponse as cZ, type DeleteWebhookSubscriptionOptions 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 CreateAccountPayload as d, type GetWebhookSubscriptionOptions as d0, type GetWebhookSubscriptionResponse as d1, type ListWebhookSubscriptionsOptions as d2, type ListWebhookSubscriptionsResponse as d3, type TestWebhookSubscriptionOptions as d4, type TestWebhookSubscriptionResponse as d5, type WebhookSubscriptionID as d6, type GetNotificationWellKnownResponse as d7, type CreateAccountOptions as e, type CreateAccountResponse as f, type GetAccountResponse as g, type UpdateAccountOptions as h, type UpdateAccountResponse as i, type AccountAccessToken as j, type AccountAccessTokenID as k, type CreateAccountAccessTokenPayload as l, type CreateAccountAccessTokenOptions as m, type CreateAccountAccessTokenResponse as n, type DeleteAccountAccessTokenOptions as o, type DeleteAccountAccessTokenResponse as p, type GetAccountAccessTokenOptions as q, type GetAccountAccessTokenResponse as r, type ListAccountAccessTokensResponse as s, type AccountConversationSettings as t, type GetAccountConversationSettingsOptions as u, type GetAccountConversationSettingsResponse as v, type UpdateAccountConversationSettingsPayload as w, type UpdateAccountConversationSettingsOptions as x, type UpdateAccountConversationSettingsResponse as y, type Action as z };
|
|
@@ -482,6 +482,7 @@ type Conversation = {
|
|
|
482
482
|
type MessageID = `msg${string}` | (string & NonNullable<unknown>);
|
|
483
483
|
type MessageRole = "user" | "assistant";
|
|
484
484
|
type MessageStatus = "PotentialMessageStatus" | "SendingMessageStatus" | "SentMessageStatus" | "ReceivedMessageStatus" | "FailedMessageStatus";
|
|
485
|
+
type MessageEventType = "ReadMessageEventType" | "ReceivedMessageEventType" | "SentMessageEventType";
|
|
485
486
|
type Message = {
|
|
486
487
|
id: MessageID;
|
|
487
488
|
role: MessageRole;
|
|
@@ -492,7 +493,7 @@ type Message = {
|
|
|
492
493
|
contact: ContactID;
|
|
493
494
|
messageEvents: {
|
|
494
495
|
id: string;
|
|
495
|
-
type:
|
|
496
|
+
type: MessageEventType;
|
|
496
497
|
triggeredAt: string;
|
|
497
498
|
createdAt: string;
|
|
498
499
|
updatedAt?: string;
|
|
@@ -1651,6 +1652,7 @@ type UpdateConversationPayload = {
|
|
|
1651
1652
|
status?: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
|
|
1652
1653
|
autoResolveAt?: Nullable<string>;
|
|
1653
1654
|
autoRespondAt?: Nullable<string>;
|
|
1655
|
+
conversationEscalation?: Nullable<undefined>;
|
|
1654
1656
|
hasEnded?: boolean;
|
|
1655
1657
|
};
|
|
1656
1658
|
interface UpdateConversationOptions {
|
|
@@ -2722,42 +2724,42 @@ declare const eventWebhookSchema: z.ZodObject<{
|
|
|
2722
2724
|
};
|
|
2723
2725
|
};
|
|
2724
2726
|
}>;
|
|
2725
|
-
type WebhookEventType =
|
|
2726
|
-
type
|
|
2727
|
-
type
|
|
2728
|
-
type
|
|
2729
|
-
type
|
|
2730
|
-
type
|
|
2731
|
-
type
|
|
2727
|
+
type WebhookEventType = AccountWebhookWebhookEventType | AccountAccessTokenWebhookEventType | ContactWebhookEventType | ConversationWebhookEventType | MessageWebhookEventType | WebhookSubscriptionWebhookEventType;
|
|
2728
|
+
type AccountWebhookWebhookEventType = "account.created" | "account.updated";
|
|
2729
|
+
type AccountAccessTokenWebhookEventType = "accountAccessToken.created" | "accountAccessToken.deleted";
|
|
2730
|
+
type ContactWebhookEventType = "contact.created" | "contact.updated" | "contact.deleted";
|
|
2731
|
+
type ConversationWebhookEventType = "conversation.created" | "conversation.updated" | "conversation.closed" | "conversation.received" | "conversation.resolved" | "conversation.sent";
|
|
2732
|
+
type MessageWebhookEventType = "message.created" | "message.updated" | "message.delivered" | "message.failed" | "message.read" | "message.received" | "message.sent";
|
|
2733
|
+
type WebhookSubscriptionWebhookEventType = "webhook-subscription.created" | "webhook-subscription.updated" | "webhook-subscription.deleted" | "webhook-subscription.test";
|
|
2732
2734
|
type WebhookEventPayload = {
|
|
2733
2735
|
data: {
|
|
2734
2736
|
event: {
|
|
2735
2737
|
id: string;
|
|
2736
2738
|
createdAt: string;
|
|
2737
2739
|
} & ({
|
|
2738
|
-
type:
|
|
2740
|
+
type: AccountWebhookWebhookEventType;
|
|
2739
2741
|
payload: {
|
|
2740
2742
|
account: string;
|
|
2741
2743
|
};
|
|
2742
2744
|
} | {
|
|
2743
|
-
type:
|
|
2745
|
+
type: AccountAccessTokenWebhookEventType;
|
|
2744
2746
|
payload: {
|
|
2745
2747
|
accountAccessToken: string;
|
|
2746
2748
|
};
|
|
2747
2749
|
} | {
|
|
2748
|
-
type:
|
|
2750
|
+
type: ContactWebhookEventType;
|
|
2749
2751
|
payload: {
|
|
2750
2752
|
contact: string;
|
|
2751
2753
|
};
|
|
2752
2754
|
} | {
|
|
2753
|
-
type:
|
|
2755
|
+
type: ConversationWebhookEventType;
|
|
2754
2756
|
payload: {
|
|
2755
2757
|
conversation: string;
|
|
2756
2758
|
};
|
|
2757
2759
|
} | {
|
|
2758
|
-
type:
|
|
2760
|
+
type: MessageWebhookEventType;
|
|
2759
2761
|
} | {
|
|
2760
|
-
type:
|
|
2762
|
+
type: WebhookSubscriptionWebhookEventType;
|
|
2761
2763
|
});
|
|
2762
2764
|
};
|
|
2763
2765
|
};
|
|
@@ -2853,29 +2855,29 @@ declare class WebhookAPI {
|
|
|
2853
2855
|
id: string;
|
|
2854
2856
|
createdAt: string;
|
|
2855
2857
|
} & ({
|
|
2856
|
-
type:
|
|
2858
|
+
type: AccountWebhookWebhookEventType;
|
|
2857
2859
|
payload: {
|
|
2858
2860
|
account: string;
|
|
2859
2861
|
};
|
|
2860
2862
|
} | {
|
|
2861
|
-
type:
|
|
2863
|
+
type: AccountAccessTokenWebhookEventType;
|
|
2862
2864
|
payload: {
|
|
2863
2865
|
accountAccessToken: string;
|
|
2864
2866
|
};
|
|
2865
2867
|
} | {
|
|
2866
|
-
type:
|
|
2868
|
+
type: ContactWebhookEventType;
|
|
2867
2869
|
payload: {
|
|
2868
2870
|
contact: string;
|
|
2869
2871
|
};
|
|
2870
2872
|
} | {
|
|
2871
|
-
type:
|
|
2873
|
+
type: ConversationWebhookEventType;
|
|
2872
2874
|
payload: {
|
|
2873
2875
|
conversation: string;
|
|
2874
2876
|
};
|
|
2875
2877
|
} | {
|
|
2876
|
-
type:
|
|
2878
|
+
type: MessageWebhookEventType;
|
|
2877
2879
|
} | {
|
|
2878
|
-
type:
|
|
2880
|
+
type: WebhookSubscriptionWebhookEventType;
|
|
2879
2881
|
});
|
|
2880
2882
|
}>;
|
|
2881
2883
|
protected _verifySignature(key: string, body: object, signatures: string[]): Promise<boolean>;
|
|
@@ -3080,4 +3082,4 @@ declare class Client {
|
|
|
3080
3082
|
static getBaseURL(): string;
|
|
3081
3083
|
}
|
|
3082
3084
|
|
|
3083
|
-
export { type BoilerplateCategoryID as $, type Account as A, type ActionID as B, Client as C, type DeleteAccountAccessTokenPayload as D, type ListActionsOptions as E, type ListActionsResponse as F, type GetAccountOptions as G, type BoilerplateContent as H, type BoilerplateContentID as I, type CreateBoilerplateContentPayload as J, type CreateBoilerplateContentOptions as K, type ListAccountAccessTokensOptions as L, type CreateBoilerplateContentResponse as M, type GetBoilerplateContentOptions as N, type Options as O, type GetBoilerplateContentResponse as P, type ListBoilerplateCategoryBoilerplateContentsOptions as Q, type RequestFilterable as R, type SortOptions as S, type ListBoilerplateCategoryBoilerplateContentsResponse as T, type UpdateAccountPayload as U, type ListBoilerplateContentsOptions as V, type ListBoilerplateContentsResponse as W, type UpdateBoilerplateContentPayload as X, type UpdateBoilerplateContentOptions as Y, type UpdateBoilerplateContentResponse as Z, type BoilerplateCategory as _, type Options$4 as a, type ActiveConversationStatus as a$, type CreateBoilerplateCategoryPayload as a0, type CreateBoilerplateCategoryOptions as a1, type CreateBoilerplateCategoryResponse as a2, type GetBoilerplateCategoryOptions as a3, type GetBoilerplateCategoryResponse as a4, type ListBoilerplateCategoriesIncludeOptions as a5, type ListBoilerplateCategoriesOptions as a6, type ListBoilerplateCategoriesResponse as a7, type UpdateBoilerplateCategoryPayload as a8, type UpdateBoilerplateCategoryOptions as a9, type ListChannelCompositionSectionsResponse as aA, type ListCompositionSectionsOptions as aB, type ListCompositionSectionsResponse as aC, type UpdateCompositionSectionPayload as aD, type UpdateCompositionSectionOptions as aE, type UpdateCompositionSectionResponse as aF, type Contact as aG, type ContactID as aH, type CustomMetadata as aI, type CreateContactPayload as aJ, type CreateContactOptions as aK, type CreateContactResponse as aL, type DeleteContactOptions as aM, type DeleteContactResponse as aN, type GetContactIncludeOptions as aO, type GetContactOptions as aP, type GetContactResponse as aQ, type GetContactVCFOptions as aR, type ListContactsOptions as aS, type ListContactsResponse as aT, type ListLabelContactsOptions as aU, type ListLabelContactsResponse as aV, type UpdateContactPayload as aW, type UpdateContactOptions as aX, type UpdateContactResponse as aY, type Conversation as aZ, type ConversationID as a_, type UpdateBoilerplateCategoryResponse as aa, type Channel as ab, type ChannelID as ac, type CreateChannelPayload as ad, type CreateChannelOptions as ae, type CreateChannelResponse as af, type GetChannelOptions as ag, type GetChannelResponse as ah, type ListChannelsOptions as ai, type ListChannelsResponse as aj, type MetaWhatsappChannelGetBusinessProfileOptions as ak, type MetaWhatsappChannelGetBusinessProfileResponse as al, type TwilioSendChannelSyncPayload as am, type TwilioSendgridChannelSyncOptions as an, type TwilioSendgridChannelSyncResponse as ao, type UpdateChannelPayload as ap, type UpdateChannelOptions as aq, type UpdateChannelResponse as ar, type CompositionSection as as, type CompositionSectionID as at, type CreateCompositionSectionPayload as au, type CreateCompositionSectionOptions as av, type CreateCompositionSectionResponse as aw, type GetCompositionSectionOptions as ax, type GetCompositionSectionResponse as ay, type ListChannelCompositionSectionsOptions as az, type CurrentAccountID as b, type
|
|
3085
|
+
export { type BoilerplateCategoryID as $, type Account as A, type ActionID as B, Client as C, type DeleteAccountAccessTokenPayload as D, type ListActionsOptions as E, type ListActionsResponse as F, type GetAccountOptions as G, type BoilerplateContent as H, type BoilerplateContentID as I, type CreateBoilerplateContentPayload as J, type CreateBoilerplateContentOptions as K, type ListAccountAccessTokensOptions as L, type CreateBoilerplateContentResponse as M, type GetBoilerplateContentOptions as N, type Options as O, type GetBoilerplateContentResponse as P, type ListBoilerplateCategoryBoilerplateContentsOptions as Q, type RequestFilterable as R, type SortOptions as S, type ListBoilerplateCategoryBoilerplateContentsResponse as T, type UpdateAccountPayload as U, type ListBoilerplateContentsOptions as V, type ListBoilerplateContentsResponse as W, type UpdateBoilerplateContentPayload as X, type UpdateBoilerplateContentOptions as Y, type UpdateBoilerplateContentResponse as Z, type BoilerplateCategory as _, type Options$4 as a, type ActiveConversationStatus as a$, type CreateBoilerplateCategoryPayload as a0, type CreateBoilerplateCategoryOptions as a1, type CreateBoilerplateCategoryResponse as a2, type GetBoilerplateCategoryOptions as a3, type GetBoilerplateCategoryResponse as a4, type ListBoilerplateCategoriesIncludeOptions as a5, type ListBoilerplateCategoriesOptions as a6, type ListBoilerplateCategoriesResponse as a7, type UpdateBoilerplateCategoryPayload as a8, type UpdateBoilerplateCategoryOptions as a9, type ListChannelCompositionSectionsResponse as aA, type ListCompositionSectionsOptions as aB, type ListCompositionSectionsResponse as aC, type UpdateCompositionSectionPayload as aD, type UpdateCompositionSectionOptions as aE, type UpdateCompositionSectionResponse as aF, type Contact as aG, type ContactID as aH, type CustomMetadata as aI, type CreateContactPayload as aJ, type CreateContactOptions as aK, type CreateContactResponse as aL, type DeleteContactOptions as aM, type DeleteContactResponse as aN, type GetContactIncludeOptions as aO, type GetContactOptions as aP, type GetContactResponse as aQ, type GetContactVCFOptions as aR, type ListContactsOptions as aS, type ListContactsResponse as aT, type ListLabelContactsOptions as aU, type ListLabelContactsResponse as aV, type UpdateContactPayload as aW, type UpdateContactOptions as aX, type UpdateContactResponse as aY, type Conversation as aZ, type ConversationID as a_, type UpdateBoilerplateCategoryResponse as aa, type Channel as ab, type ChannelID as ac, type CreateChannelPayload as ad, type CreateChannelOptions as ae, type CreateChannelResponse as af, type GetChannelOptions as ag, type GetChannelResponse as ah, type ListChannelsOptions as ai, type ListChannelsResponse as aj, type MetaWhatsappChannelGetBusinessProfileOptions as ak, type MetaWhatsappChannelGetBusinessProfileResponse as al, type TwilioSendChannelSyncPayload as am, type TwilioSendgridChannelSyncOptions as an, type TwilioSendgridChannelSyncResponse as ao, type UpdateChannelPayload as ap, type UpdateChannelOptions as aq, type UpdateChannelResponse as ar, type CompositionSection as as, type CompositionSectionID as at, type CreateCompositionSectionPayload as au, type CreateCompositionSectionOptions as av, type CreateCompositionSectionResponse as aw, type GetCompositionSectionOptions as ax, type GetCompositionSectionResponse as ay, type ListChannelCompositionSectionsOptions as az, type CurrentAccountID as b, type CreateCorrectionModelOptions as b$, type ConcludedConversationStatus as b0, type ConversationStatus as b1, type CreateConversationPayload as b2, type CreateConversationOptions as b3, type CreateConversationResponse as b4, type DeleteConversationOptions as b5, type DeleteConversationResponse as b6, type GetConversationIncludeOptions as b7, type GetConversationOptions as b8, type GetConversationResponse as b9, type ListLabelsIncludeOptions as bA, type ListLabelsOptions as bB, type ListLabelsResponse as bC, type UpdateLabelPayload as bD, type UpdateLabelOptions as bE, type UpdateLabelResponse as bF, type Message as bG, type CreateMessagePayload as bH, type CreateMessageOptions as bI, type CreateMessageResponse as bJ, type DeleteMessageOptions as bK, type DeleteMessageResponse as bL, type ListChannelMessagesIncludeOptions as bM, type ListChannelMessagesOptions as bN, type ListChannelMessagesResponse as bO, type ListConversationMessagesIncludeOptions as bP, type ListConversationMessagesOptions as bQ, type ListConversationMessagesResponse as bR, type ListMessagesIncludeOptions as bS, type ListMessagesOptions as bT, type ListMessagesResponse as bU, type MessageID as bV, type MessageRole as bW, type MessageStatus as bX, type MessageEventType as bY, type Model as bZ, type CreateCorrectionModelPayload as b_, type ListChannelConversationsOptions as ba, type ListChannelConversationsResponse as bb, type ListContactConversationsOptions as bc, type ListContactConversationsResponse as bd, type ListConversationsIncludeOptions as be, type FilterOptions as bf, type ListConversationOptions as bg, type ListConversationsResponse as bh, type ListLabelConversationsOptions as bi, type ListLabelConversationsResponse as bj, type UpdateConversationPayload as bk, type UpdateConversationOptions as bl, type UpdateConversationResponse as bm, type Label as bn, type CreateLabelPayload as bo, type CreateLabelOptions as bp, type CreateLabelResponse as bq, type DeleteLabelOptions as br, type DeleteLabelResponse as bs, type GetLabelOptions as bt, type GetLabelResponse as bu, type LabelID as bv, type ListContactLabelsOptions as bw, type ListContactLabelsResponse as bx, type ListConversationLabelsOptions as by, type ListConversationLabelsResponse as bz, type AccountID as c, type DeleteWebhookSubscriptionResponse 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 ListUploadsOptions as cI, type ListUploadsResponse as cJ, type UploadID as cK, type EventWebhookOptions as cL, eventWebhookSchema as cM, type WebhookEventType as cN, type AccountWebhookWebhookEventType as cO, type AccountAccessTokenWebhookEventType as cP, type ContactWebhookEventType as cQ, type ConversationWebhookEventType as cR, type MessageWebhookEventType as cS, type WebhookSubscriptionWebhookEventType as cT, type WebhookEventPayload as cU, type WebhookResponse as cV, type WebhookSubscription as cW, type CreateWebhookSubscriptionPayload as cX, type CreateWebhookSubscriptionOptions as cY, type CreateWebhookSubscriptionResponse as cZ, type DeleteWebhookSubscriptionOptions 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 CreateAccountPayload as d, type GetWebhookSubscriptionOptions as d0, type GetWebhookSubscriptionResponse as d1, type ListWebhookSubscriptionsOptions as d2, type ListWebhookSubscriptionsResponse as d3, type TestWebhookSubscriptionOptions as d4, type TestWebhookSubscriptionResponse as d5, type WebhookSubscriptionID as d6, type GetNotificationWellKnownResponse as d7, type CreateAccountOptions as e, type CreateAccountResponse as f, type GetAccountResponse as g, type UpdateAccountOptions as h, type UpdateAccountResponse as i, type AccountAccessToken as j, type AccountAccessTokenID as k, type CreateAccountAccessTokenPayload as l, type CreateAccountAccessTokenOptions as m, type CreateAccountAccessTokenResponse as n, type DeleteAccountAccessTokenOptions as o, type DeleteAccountAccessTokenResponse as p, type GetAccountAccessTokenOptions as q, type GetAccountAccessTokenResponse as r, type ListAccountAccessTokensResponse as s, type AccountConversationSettings as t, type GetAccountConversationSettingsOptions as u, type GetAccountConversationSettingsResponse as v, type UpdateAccountConversationSettingsPayload as w, type UpdateAccountConversationSettingsOptions as x, type UpdateAccountConversationSettingsResponse as y, type Action as z };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var V=Object.defineProperty;var z=(n,t)=>{for(var e in t)V(n,e,{get:t[e],enumerable:!0})};var a=class{getHeaders(){return{}}};var F="SUPPORT_ACCESS_TOKEN",M="SUPPORT_KEY_NAME",x="SUPPORT_KEY_PASSWORD",w="SUPPORT_SIGNING_KEY",N="SUPPORT_BASE_URL";var c=class{name;#t;constructor({name:t=process.env[M],password:e=process.env[x]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var m=class{#t;constructor({token:t=process.env[F]}={}){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 W="https://api.support.greatdetail.com",Q={"X-Powered-By":"GDSupport/JavaScript"};import{z as i}from"zod";var j=i.object({data:i.object({event:i.object({id:i.string(),type:i.string(),payload:i.record(i.string()),createdAt:i.string().datetime()})})});var l=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/accounts",{...e,method:"POST",json:t})}};var d=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}delete(t,e,{body:o,request:s={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...s,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var u=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var h=class{constructor(t){this._transport=t}list({limit:t,sort:e,request:o={}}={}){return this._transport.send("v1/actions",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var C=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var f=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByCategory=this.listByBoilerplateCategory;listByBoilerplateCategory(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t)+"/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var R=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/channels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}metaWhatsappGetBusinessProfile(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/meta-whatsapp/business-profile",{...e,method:"GET"})}twilioSendgridChannelSync(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/twilio-sendgrid/sync",{...o,method:"POST",json:e})}};var b=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var v=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}getRelativeVCFURL(t,{vcf:e={}}={}){let o=e.variant??"vcard",s=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(s)}getVCFURL(t,e={}){return this._transport.getURL(this.getRelativeVCFURL(t,e))}getVCF(t,e={}){return this._transport.send(this.getVCFURL(t,e),{method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var O=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}list({query:t,limit:e,filter:o,include:s,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.limitQuery(e),...o?[["filter",o]]:[],...this._transport.includeQuery(s??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var g=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 _=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 T=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}createResponse(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,json:e})}createCorrection(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",json:e})}};var I=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 L=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 A=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Q;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var y=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}list({featured:t,category:e,request:o={}}={}){let s=[];if(e){let r=Array.isArray(e)?e:[e];for(let p of r)s.push(["category",p])}return t!==void 0&&s.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:s})}};var S=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};import q from"is-network-error";import K,{HTTPError as Y}from"ky";var P=class extends Error{constructor(e,o){super("Support Error",{cause:o});this.response=e}};var U=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=K.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let s of this.options.requestFilterables){let r=s.getHeaders();for(let[p,H]of Object.entries(r))o.headers.has(p)||o.headers.set(p,H)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,s]of Object.entries(t))s!==void 0&&e.push(["sort",s+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let o=this.client(t,e).catch(async s=>{throw q(s)?new Error("A network error occurred",{cause:s}):s instanceof Y?new P(s.response,s):s});return{response:()=>o,json:async()=>(await o).json()}}};var D=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,request:e={}}){let o=new FormData;for(let s of t)o.append("file",s);return this._transport.send("v1/uploads",{...e,method:"POST",body:o})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var E=class{constructor(t){this._transport=t}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}=j.parse(o.body);return{event:r.event}}async _verifySignature(t,e,o){let s=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let r of o)if(await crypto.subtle.verify("HMAC",s,new TextEncoder().encode(atob(r)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var G=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 k=class{constructor(t){this._transport=t}getNotifications({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var B=class n{static DEFAULT_BASE_URL=W;static PublicAuthentication=a;static BasicAuthentication=c;static BearerAuthentication=m;_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 U({requestFilterables:[new A,t],...o,baseURL:e?.toString()??n.getBaseURL()}),this.account=new l(this._transport),this.accountAccessToken=new d(this._transport),this.accountConversationSettings=new u(this._transport),this.action=new h(this._transport),this.boilerplateCategory=new C(this._transport),this.boilerplateContent=new f(this._transport),this.channel=new R(this._transport),this.compositionSection=new b(this._transport),this.contact=new v(this._transport),this.conversation=new O(this._transport),this.label=new g(this._transport),this.message=new _(this._transport),this.model=new T(this._transport),this.note=new I(this._transport),this.notificationSubscription=new L(this._transport),this.source=new y(this._transport),this.statistics=new S(this._transport),this.upload=new D(this._transport),this.webhook=new E(this._transport),this.webhookSubscription=new G(this._transport),this.wellKnown=new k(this._transport)}static getBaseURL(){return process.env[N]??this.DEFAULT_BASE_URL}};export{z as a,a as b,W as c,P as d,j as e,B as f};
|
|
1
|
+
var V=Object.defineProperty;var z=(n,t)=>{for(var e in t)V(n,e,{get:t[e],enumerable:!0})};var a=class{getHeaders(){return{}}};var F="SUPPORT_ACCESS_TOKEN",M="SUPPORT_KEY_NAME",x="SUPPORT_KEY_PASSWORD",w="SUPPORT_SIGNING_KEY",W="SUPPORT_BASE_URL";var c=class{name;#t;constructor({name:t=process.env[M],password:e=process.env[x]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var m=class{#t;constructor({token:t=process.env[F]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var N="https://api.support.greatdetail.com",Q={"X-Powered-By":"GDSupport/JavaScript"};import{z as i}from"zod";var j=i.object({data:i.object({event:i.object({id:i.string(),type:i.string(),payload:i.record(i.string()),createdAt:i.string().datetime()})})});var l=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/accounts",{...e,method:"POST",json:t})}};var d=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}delete(t,e,{body:o,request:s={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...s,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var u=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var h=class{constructor(t){this._transport=t}list({limit:t,sort:e,request:o={}}={}){return this._transport.send("v1/actions",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var C=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var f=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByCategory=this.listByBoilerplateCategory;listByBoilerplateCategory(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t)+"/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var R=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/channels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}metaWhatsappGetBusinessProfile(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/meta-whatsapp/business-profile",{...e,method:"GET"})}twilioSendgridChannelSync(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/twilio-sendgrid/sync",{...o,method:"POST",json:e})}};var b=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var v=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}getRelativeVCFURL(t,{vcf:e={}}={}){let o=e.variant??"vcard",s=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(s)}getVCFURL(t,e={}){return this._transport.getURL(this.getRelativeVCFURL(t,e))}getVCF(t,e={}){return this._transport.send(this.getVCFURL(t,e),{method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var O=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}list({query:t,limit:e,filter:o,include:s,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.limitQuery(e),...o?[["filter",o]]:[],...this._transport.includeQuery(s??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var g=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 _=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 T=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}createResponse(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,json:e})}createCorrection(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",json:e})}};var I=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 L=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 A=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Q;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var y=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}list({featured:t,category:e,request:o={}}={}){let s=[];if(e){let r=Array.isArray(e)?e:[e];for(let p of r)s.push(["category",p])}return t!==void 0&&s.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:s})}};var S=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};import q from"is-network-error";import K,{HTTPError as Y}from"ky";var P=class extends Error{constructor(e,o){super("Support Error",{cause:o});this.response=e}};var U=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=K.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let s of this.options.requestFilterables){let r=s.getHeaders();for(let[p,H]of Object.entries(r))o.headers.has(p)||o.headers.set(p,H)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,s]of Object.entries(t))s!==void 0&&e.push(["sort",s+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let o=this.client(t,e).catch(async s=>{throw q(s)?new Error("A network error occurred",{cause:s}):s instanceof Y?new P(s.response,s):s});return{response:()=>o,json:async()=>(await o).json()}}};var D=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,request:e={}}){let o=new FormData;for(let s of t)o.append("file",s);return this._transport.send("v1/uploads",{...e,method:"POST",body:o})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var E=class{constructor(t){this._transport=t}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}=j.parse(o.body);return{event:r.event}}async _verifySignature(t,e,o){let s=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let r of o)if(await crypto.subtle.verify("HMAC",s,new TextEncoder().encode(atob(r)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var G=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 k=class{constructor(t){this._transport=t}getNotifications({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var B=class n{static DEFAULT_BASE_URL=N;static PublicAuthentication=a;static BasicAuthentication=c;static BearerAuthentication=m;_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 U({requestFilterables:[new A,t],...o,baseURL:e?.toString()??n.getBaseURL()}),this.account=new l(this._transport),this.accountAccessToken=new d(this._transport),this.accountConversationSettings=new u(this._transport),this.action=new h(this._transport),this.boilerplateCategory=new C(this._transport),this.boilerplateContent=new f(this._transport),this.channel=new R(this._transport),this.compositionSection=new b(this._transport),this.contact=new v(this._transport),this.conversation=new O(this._transport),this.label=new g(this._transport),this.message=new _(this._transport),this.model=new T(this._transport),this.note=new I(this._transport),this.notificationSubscription=new L(this._transport),this.source=new y(this._transport),this.statistics=new S(this._transport),this.upload=new D(this._transport),this.webhook=new E(this._transport),this.webhookSubscription=new G(this._transport),this.wellKnown=new k(this._transport)}static getBaseURL(){return process.env[W]??this.DEFAULT_BASE_URL}};export{z as a,a as b,N as c,P as d,j as e,B as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as v,f as b}from"./chunk-
|
|
1
|
+
import{b as v,f as b}from"./chunk-JF2KQDYG.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 At=Object.create;var B=Object.defineProperty;var St=Object.getOwnPropertyDescriptor;var Dt=Object.getOwnPropertyNames;var Ut=Object.getPrototypeOf,Et=Object.prototype.hasOwnProperty;var wt=(n,t)=>{for(var e in t)B(n,e,{get:t[e],enumerable:!0})},mt=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Dt(t))!Et.call(n,s)&&s!==e&&B(n,s,{get:()=>t[s],enumerable:!(o=St(t,s))||o.enumerable});return n};var lt=(n,t,e)=>(e=n!=null?At(Ut(n)):{},mt(t||!n||!n.__esModule?B(e,"default",{value:n,enumerable:!0}):e,n)),Gt=n=>mt(B({},"__esModule",{value:!0}),n);var kt={};wt(kt,{default:()=>Pt});module.exports=Gt(kt);var Tt=require("commander");var p=class{getHeaders(){return{}}};var m=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/accounts",{...e,method:"POST",json:t})}};var l=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}delete(t,e,{body:o,request:s={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...s,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var d=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var u=class{constructor(t){this._transport=t}list({limit:t,sort:e,request:o={}}={}){return this._transport.send("v1/actions",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var dt="SUPPORT_ACCESS_TOKEN",ut="SUPPORT_KEY_NAME",Ct="SUPPORT_KEY_PASSWORD",H="SUPPORT_SIGNING_KEY",ht="SUPPORT_BASE_URL";var C=class{name;#t;constructor({name:t=process.env[ut],password:e=process.env[Ct]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var h=class{#t;constructor({token:t=process.env[dt]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var f=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var 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,query:e,request:o={}}={}){return this._transport.send("v1/channels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}metaWhatsappGetBusinessProfile(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/meta-whatsapp/business-profile",{...e,method:"GET"})}twilioSendgridChannelSync(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/twilio-sendgrid/sync",{...o,method:"POST",json:e})}};var R=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var ft="https://api.support.greatdetail.com",Ot={"X-Powered-By":"GDSupport/JavaScript"};var b=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 v=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}list({query:t,limit:e,filter:o,include:s,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.limitQuery(e),...o?[["filter",o]]:[],...this._transport.includeQuery(s??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var y=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,include:o,request:s={}}={}){return this._transport.send("v1/labels",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByConversation(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var I=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 _=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 T=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 L=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 A=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Ot;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var S=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}list({featured:t,category:e,request:o={}}={}){let s=[];if(e){let r=Array.isArray(e)?e:[e];for(let c of r)s.push(["category",c])}return t!==void 0&&s.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:s})}};var D=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};var gt=lt(require("is-network-error"),1),N=lt(require("ky"),1);var M=class extends Error{constructor(e,o){super("Support Error",{cause:o});this.response=e}};var U=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=N.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let s of this.options.requestFilterables){let r=s.getHeaders();for(let[c,Lt]of Object.entries(r))o.headers.has(c)||o.headers.set(c,Lt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,s]of Object.entries(t))s!==void 0&&e.push(["sort",s+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let o=this.client(t,e).catch(async s=>{throw(0,gt.default)(s)?new Error("A network error occurred",{cause:s}):s instanceof N.HTTPError?new M(s.response,s):s});return{response:()=>o,json:async()=>(await o).json()}}};var E=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,request:e={}}){let o=new FormData;for(let s of t)o.append("file",s);return this._transport.send("v1/uploads",{...e,method:"POST",body:o})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var i=require("zod"),Rt=i.z.object({data:i.z.object({event:i.z.object({id:i.z.string(),type:i.z.string(),payload:i.z.record(i.z.string()),createdAt:i.z.string().datetime()})})});var w=class{constructor(t){this._transport=t}async event({key:t=process.env[H],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."+H);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}=Rt.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 G=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/webhooks/subscriptions",{...t,method:"GET"})}test(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t)+"/test",{...e,method:"POST"})}create({body:t,request:e={}}){return this._transport.send("v1/webhooks/subscriptions",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var x=class{constructor(t){this._transport=t}getNotifications({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var P=class n{static DEFAULT_BASE_URL=ft;static PublicAuthentication=p;static BasicAuthentication=C;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 U({requestFilterables:[new A,t],...o,baseURL:e?.toString()??n.getBaseURL()}),this.account=new m(this._transport),this.accountAccessToken=new l(this._transport),this.accountConversationSettings=new d(this._transport),this.action=new u(this._transport),this.boilerplateCategory=new f(this._transport),this.boilerplateContent=new O(this._transport),this.channel=new g(this._transport),this.compositionSection=new R(this._transport),this.contact=new b(this._transport),this.conversation=new v(this._transport),this.label=new y(this._transport),this.message=new I(this._transport),this.model=new _(this._transport),this.note=new T(this._transport),this.notificationSubscription=new L(this._transport),this.source=new S(this._transport),this.statistics=new D(this._transport),this.upload=new E(this._transport),this.webhook=new w(this._transport),this.webhookSubscription=new G(this._transport),this.wellKnown=new x(this._transport)}static getBaseURL(){return process.env[ht]??this.DEFAULT_BASE_URL}};var q=require("commander"),bt=require("ora");function Y({client:n,ora:t}){let e=new q.Command("actions").description("Actions");return e.addCommand(new q.Command("list").description("List actions").action(async()=>{let o=await(0,bt.oraPromise)(()=>n.action.list().json(),{...t,text:"Finding actions"});console.log(o)})),e}var z=require("commander"),vt=require("ora");function J({client:n,ora:t}){let e=new z.Command("channels").description("Channels");return e.addCommand(new z.Command("list").description("List channels").action(async()=>{let o=await(0,vt.oraPromise)(()=>n.channel.list().json(),{...t,text:"Finding channels"});console.log(o)})),e}var k=require("commander"),j=require("ora");function $({client:n,ora:t}){let e=new k.Command("contacts").description("Contacts");return e.addCommand(new k.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async o=>{let s=await(0,j.oraPromise)(()=>n.contact.get(o).json(),{...t,text:"Finding contact"});console.log(s)})),e.addCommand(new k.Command("list").description("List contacts").action(async()=>{let o=await(0,j.oraPromise)(()=>n.contact.list().json(),{...t,text:"Finding contacts"});console.log(o)})),e.addCommand(new k.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async o=>{let s=await(0,j.oraPromise)(()=>n.contact.getVCF(o).response(),{...t,text:"Exporting contact"});console.log(s)})),e}var W=require("commander"),X=require("ora");function Z({client:n,ora:t}){let e=new W.Command("conversations").description("Conversations");return e.addCommand(new W.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async o=>{let s=await(0,X.oraPromise)(()=>n.conversation.get(o).json(),{...t,text:"Finding conversation"});console.log(s)})),e.addCommand(new W.Command("list").description("List conversations").action(async()=>{let o=await(0,X.oraPromise)(()=>n.conversation.list().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var F=require("commander"),Q=require("ora");function tt({client:n,ora:t}){let e=new F.Command("labels").description("Labels");return e.addCommand(new F.Command("get").description("Find label").argument("<label>","Label ID").action(async o=>{let s=await(0,Q.oraPromise)(()=>n.label.get(o).json(),{...t,text:"Finding label"});console.log(s)})),e.addCommand(new F.Command("list").description("List labels").action(async()=>{let o=await(0,Q.oraPromise)(()=>n.label.list().json(),{...t,text:"Finding labels"});console.log(o)})),e.addCommand(new F.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async o=>{let s=await(0,Q.oraPromise)(()=>n.conversation.listByLabel(o).json(),{...t,text:"Finding conversations"});console.log(s)})),e}var et=require("commander"),yt=require("ora");function ot({client:n,ora:t}){let e=new et.Command("messages").description("Messages");return e.addCommand(new et.Command("list").description("List messages").action(async()=>{let o=await(0,yt.oraPromise)(()=>n.message.list().json(),{...t,text:"Finding messages"});console.log(o)})),e}var K=require("commander"),nt=require("ora");function st({client:n,ora:t}){let e=new K.Command("models").description("Models");return e.addCommand(new K.Command("get").description("Find model").argument("<model>","Model ID").action(async o=>{let s=await(0,nt.oraPromise)(()=>n.model.get(o).json(),{...t,text:"Finding model"});console.log(s)})),e.addCommand(new K.Command("list").description("List models").action(async()=>{let o=await(0,nt.oraPromise)(()=>n.model.list().json(),{...t,text:"Finding models"});console.log(o)})),e}var V=require("commander"),rt=require("ora");function it({client:n,ora:t}){let e=new V.Command("sources").description("Sources");return e.addCommand(new V.Command("get").description("Find source").argument("<source>","Source ID").action(async o=>{let s=await(0,rt.oraPromise)(()=>n.source.get(o).json(),{...t,text:"Finding source"});console.log(s)})),e.addCommand(new V.Command("list").description("List sources").action(async()=>{let o=await(0,rt.oraPromise)(()=>n.source.list().json(),{...t,text:"Finding sources"});console.log(o)})),e}var _t=require("commander");var at=require("commander"),It=require("ora");function pt({client:n,ora:t}){let e=new at.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new at.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let o=await(0,It.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 _t.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(pt({client:n,ora:t})),e}var a={ora:{spinner:"simpleDotsScrolling"},client:new P(new p)},xt=new Tt.Command("gds").description("Great Detail Support System").addCommand(Y(a)).addCommand(J(a)).addCommand($(a)).addCommand(Z(a)).addCommand(tt(a)).addCommand(ot(a)).addCommand(st(a)).addCommand(it(a)).addCommand(ct(a)),Pt=xt;
|
|
1
|
+
"use strict";var At=Object.create;var B=Object.defineProperty;var St=Object.getOwnPropertyDescriptor;var Dt=Object.getOwnPropertyNames;var Ut=Object.getPrototypeOf,Et=Object.prototype.hasOwnProperty;var wt=(n,t)=>{for(var e in t)B(n,e,{get:t[e],enumerable:!0})},mt=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Dt(t))!Et.call(n,s)&&s!==e&&B(n,s,{get:()=>t[s],enumerable:!(o=St(t,s))||o.enumerable});return n};var lt=(n,t,e)=>(e=n!=null?At(Ut(n)):{},mt(t||!n||!n.__esModule?B(e,"default",{value:n,enumerable:!0}):e,n)),Gt=n=>mt(B({},"__esModule",{value:!0}),n);var Pt={};wt(Pt,{default:()=>kt});module.exports=Gt(Pt);var Tt=require("commander");var p=class{getHeaders(){return{}}};var m=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/accounts",{...e,method:"POST",json:t})}};var l=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}delete(t,e,{body:o,request:s={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...s,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var d=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var u=class{constructor(t){this._transport=t}list({limit:t,sort:e,request:o={}}={}){return this._transport.send("v1/actions",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var dt="SUPPORT_ACCESS_TOKEN",ut="SUPPORT_KEY_NAME",Ct="SUPPORT_KEY_PASSWORD",H="SUPPORT_SIGNING_KEY",ht="SUPPORT_BASE_URL";var C=class{name;#t;constructor({name:t=process.env[ut],password:e=process.env[Ct]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var h=class{#t;constructor({token:t=process.env[dt]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var f=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var 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,query:e,request:o={}}={}){return this._transport.send("v1/channels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}metaWhatsappGetBusinessProfile(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/meta-whatsapp/business-profile",{...e,method:"GET"})}twilioSendgridChannelSync(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/twilio-sendgrid/sync",{...o,method:"POST",json:e})}};var b=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/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 ft="https://api.support.greatdetail.com",Ot={"X-Powered-By":"GDSupport/JavaScript"};var R=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 v=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}list({query:t,limit:e,filter:o,include:s,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.limitQuery(e),...o?[["filter",o]]:[],...this._transport.includeQuery(s??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var y=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,include:o,request:s={}}={}){return this._transport.send("v1/labels",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByConversation(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var I=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 _=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 T=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 L=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 A=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Ot;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var S=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}list({featured:t,category:e,request:o={}}={}){let s=[];if(e){let r=Array.isArray(e)?e:[e];for(let c of r)s.push(["category",c])}return t!==void 0&&s.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:s})}};var D=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};var gt=lt(require("is-network-error"),1),W=lt(require("ky"),1);var M=class extends Error{constructor(e,o){super("Support Error",{cause:o});this.response=e}};var U=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=W.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let s of this.options.requestFilterables){let r=s.getHeaders();for(let[c,Lt]of Object.entries(r))o.headers.has(c)||o.headers.set(c,Lt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,s]of Object.entries(t))s!==void 0&&e.push(["sort",s+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let o=this.client(t,e).catch(async s=>{throw(0,gt.default)(s)?new Error("A network error occurred",{cause:s}):s instanceof W.HTTPError?new M(s.response,s):s});return{response:()=>o,json:async()=>(await o).json()}}};var E=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,request:e={}}){let o=new FormData;for(let s of t)o.append("file",s);return this._transport.send("v1/uploads",{...e,method:"POST",body:o})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var i=require("zod"),bt=i.z.object({data:i.z.object({event:i.z.object({id:i.z.string(),type:i.z.string(),payload:i.z.record(i.z.string()),createdAt:i.z.string().datetime()})})});var w=class{constructor(t){this._transport=t}async event({key:t=process.env[H],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."+H);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}=bt.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 G=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/webhooks/subscriptions",{...t,method:"GET"})}test(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t)+"/test",{...e,method:"POST"})}create({body:t,request:e={}}){return this._transport.send("v1/webhooks/subscriptions",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var x=class{constructor(t){this._transport=t}getNotifications({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var k=class n{static DEFAULT_BASE_URL=ft;static PublicAuthentication=p;static BasicAuthentication=C;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 U({requestFilterables:[new A,t],...o,baseURL:e?.toString()??n.getBaseURL()}),this.account=new m(this._transport),this.accountAccessToken=new l(this._transport),this.accountConversationSettings=new d(this._transport),this.action=new u(this._transport),this.boilerplateCategory=new f(this._transport),this.boilerplateContent=new O(this._transport),this.channel=new g(this._transport),this.compositionSection=new b(this._transport),this.contact=new R(this._transport),this.conversation=new v(this._transport),this.label=new y(this._transport),this.message=new I(this._transport),this.model=new _(this._transport),this.note=new T(this._transport),this.notificationSubscription=new L(this._transport),this.source=new S(this._transport),this.statistics=new D(this._transport),this.upload=new E(this._transport),this.webhook=new w(this._transport),this.webhookSubscription=new G(this._transport),this.wellKnown=new x(this._transport)}static getBaseURL(){return process.env[ht]??this.DEFAULT_BASE_URL}};var q=require("commander"),Rt=require("ora");function Y({client:n,ora:t}){let e=new q.Command("actions").description("Actions");return e.addCommand(new q.Command("list").description("List actions").action(async()=>{let o=await(0,Rt.oraPromise)(()=>n.action.list().json(),{...t,text:"Finding actions"});console.log(o)})),e}var z=require("commander"),vt=require("ora");function J({client:n,ora:t}){let e=new z.Command("channels").description("Channels");return e.addCommand(new z.Command("list").description("List channels").action(async()=>{let o=await(0,vt.oraPromise)(()=>n.channel.list().json(),{...t,text:"Finding channels"});console.log(o)})),e}var P=require("commander"),N=require("ora");function $({client:n,ora:t}){let e=new P.Command("contacts").description("Contacts");return e.addCommand(new P.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async o=>{let s=await(0,N.oraPromise)(()=>n.contact.get(o).json(),{...t,text:"Finding contact"});console.log(s)})),e.addCommand(new P.Command("list").description("List contacts").action(async()=>{let o=await(0,N.oraPromise)(()=>n.contact.list().json(),{...t,text:"Finding contacts"});console.log(o)})),e.addCommand(new P.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async o=>{let s=await(0,N.oraPromise)(()=>n.contact.getVCF(o).response(),{...t,text:"Exporting contact"});console.log(s)})),e}var j=require("commander"),X=require("ora");function Z({client:n,ora:t}){let e=new j.Command("conversations").description("Conversations");return e.addCommand(new j.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async o=>{let s=await(0,X.oraPromise)(()=>n.conversation.get(o).json(),{...t,text:"Finding conversation"});console.log(s)})),e.addCommand(new j.Command("list").description("List conversations").action(async()=>{let o=await(0,X.oraPromise)(()=>n.conversation.list().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var F=require("commander"),Q=require("ora");function tt({client:n,ora:t}){let e=new F.Command("labels").description("Labels");return e.addCommand(new F.Command("get").description("Find label").argument("<label>","Label ID").action(async o=>{let s=await(0,Q.oraPromise)(()=>n.label.get(o).json(),{...t,text:"Finding label"});console.log(s)})),e.addCommand(new F.Command("list").description("List labels").action(async()=>{let o=await(0,Q.oraPromise)(()=>n.label.list().json(),{...t,text:"Finding labels"});console.log(o)})),e.addCommand(new F.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async o=>{let s=await(0,Q.oraPromise)(()=>n.conversation.listByLabel(o).json(),{...t,text:"Finding conversations"});console.log(s)})),e}var et=require("commander"),yt=require("ora");function ot({client:n,ora:t}){let e=new et.Command("messages").description("Messages");return e.addCommand(new et.Command("list").description("List messages").action(async()=>{let o=await(0,yt.oraPromise)(()=>n.message.list().json(),{...t,text:"Finding messages"});console.log(o)})),e}var K=require("commander"),nt=require("ora");function st({client:n,ora:t}){let e=new K.Command("models").description("Models");return e.addCommand(new K.Command("get").description("Find model").argument("<model>","Model ID").action(async o=>{let s=await(0,nt.oraPromise)(()=>n.model.get(o).json(),{...t,text:"Finding model"});console.log(s)})),e.addCommand(new K.Command("list").description("List models").action(async()=>{let o=await(0,nt.oraPromise)(()=>n.model.list().json(),{...t,text:"Finding models"});console.log(o)})),e}var V=require("commander"),rt=require("ora");function it({client:n,ora:t}){let e=new V.Command("sources").description("Sources");return e.addCommand(new V.Command("get").description("Find source").argument("<source>","Source ID").action(async o=>{let s=await(0,rt.oraPromise)(()=>n.source.get(o).json(),{...t,text:"Finding source"});console.log(s)})),e.addCommand(new V.Command("list").description("List sources").action(async()=>{let o=await(0,rt.oraPromise)(()=>n.source.list().json(),{...t,text:"Finding sources"});console.log(o)})),e}var _t=require("commander");var at=require("commander"),It=require("ora");function pt({client:n,ora:t}){let e=new at.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new at.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let o=await(0,It.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 _t.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(pt({client:n,ora:t})),e}var a={ora:{spinner:"simpleDotsScrolling"},client:new k(new p)},xt=new Tt.Command("gds").description("Great Detail Support System").addCommand(Y(a)).addCommand(J(a)).addCommand($(a)).addCommand(Z(a)).addCommand(tt(a)).addCommand(ot(a)).addCommand(st(a)).addCommand(it(a)).addCommand(ct(a)),kt=xt;
|
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-KCAE7SJB.js";import"../chunk-JF2KQDYG.js";export{a as default};
|
package/dist/cli.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var At=Object.create;var ct=Object.defineProperty;var St=Object.getOwnPropertyDescriptor;var Dt=Object.getOwnPropertyNames;var Ut=Object.getPrototypeOf,Et=Object.prototype.hasOwnProperty;var wt=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Dt(t))!Et.call(n,s)&&s!==e&&ct(n,s,{get:()=>t[s],enumerable:!(o=St(t,s))||o.enumerable});return n};var mt=(n,t,e)=>(e=n!=null?At(Ut(n)):{},wt(t||!n||!n.__esModule?ct(e,"default",{value:n,enumerable:!0}):e,n));var _t=require("commander");var p=class{getHeaders(){return{}}};var m=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/accounts",{...e,method:"POST",json:t})}};var l=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}delete(t,e,{body:o,request:s={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...s,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var d=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var u=class{constructor(t){this._transport=t}list({limit:t,sort:e,request:o={}}={}){return this._transport.send("v1/actions",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var lt="SUPPORT_ACCESS_TOKEN",dt="SUPPORT_KEY_NAME",ut="SUPPORT_KEY_PASSWORD",V="SUPPORT_SIGNING_KEY",Ct="SUPPORT_BASE_URL";var C=class{name;#t;constructor({name:t=process.env[dt],password:e=process.env[ut]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var h=class{#t;constructor({token:t=process.env[lt]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var f=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var 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,query:e,request:o={}}={}){return this._transport.send("v1/channels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}metaWhatsappGetBusinessProfile(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/meta-whatsapp/business-profile",{...e,method:"GET"})}twilioSendgridChannelSync(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/twilio-sendgrid/sync",{...o,method:"POST",json:e})}};var R=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var ht="https://api.support.greatdetail.com",ft={"X-Powered-By":"GDSupport/JavaScript"};var b=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 v=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}list({query:t,limit:e,filter:o,include:s,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.limitQuery(e),...o?[["filter",o]]:[],...this._transport.includeQuery(s??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var y=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,include:o,request:s={}}={}){return this._transport.send("v1/labels",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByConversation(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var I=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 _=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 T=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 L=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 A=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=ft;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var S=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}list({featured:t,category:e,request:o={}}={}){let s=[];if(e){let r=Array.isArray(e)?e:[e];for(let c of r)s.push(["category",c])}return t!==void 0&&s.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:s})}};var D=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};var Ot=mt(require("is-network-error"),1),M=mt(require("ky"),1);var B=class extends Error{constructor(e,o){super("Support Error",{cause:o});this.response=e}};var U=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=M.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let s of this.options.requestFilterables){let r=s.getHeaders();for(let[c,Lt]of Object.entries(r))o.headers.has(c)||o.headers.set(c,Lt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,s]of Object.entries(t))s!==void 0&&e.push(["sort",s+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let o=this.client(t,e).catch(async s=>{throw(0,Ot.default)(s)?new Error("A network error occurred",{cause:s}):s instanceof M.HTTPError?new B(s.response,s):s});return{response:()=>o,json:async()=>(await o).json()}}};var E=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,request:e={}}){let o=new FormData;for(let s of t)o.append("file",s);return this._transport.send("v1/uploads",{...e,method:"POST",body:o})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var i=require("zod"),gt=i.z.object({data:i.z.object({event:i.z.object({id:i.z.string(),type:i.z.string(),payload:i.z.record(i.z.string()),createdAt:i.z.string().datetime()})})});var w=class{constructor(t){this._transport=t}async event({key:t=process.env[V],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."+V);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}=gt.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 G=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/webhooks/subscriptions",{...t,method:"GET"})}test(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t)+"/test",{...e,method:"POST"})}create({body:t,request:e={}}){return this._transport.send("v1/webhooks/subscriptions",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var x=class{constructor(t){this._transport=t}getNotifications({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var P=class n{static DEFAULT_BASE_URL=ht;static PublicAuthentication=p;static BasicAuthentication=C;static BearerAuthentication=h;_transport;account;accountAccessToken;accountConversationSettings;action;boilerplateCategory;boilerplateContent;channel;compositionSection;contact;conversation;label;message;model;note;notificationSubscription;source;statistics;upload;webhook;webhookSubscription;wellKnown;constructor(t,{baseURL:e,...o}={}){this._transport=new U({requestFilterables:[new A,t],...o,baseURL:e?.toString()??n.getBaseURL()}),this.account=new m(this._transport),this.accountAccessToken=new l(this._transport),this.accountConversationSettings=new d(this._transport),this.action=new u(this._transport),this.boilerplateCategory=new f(this._transport),this.boilerplateContent=new O(this._transport),this.channel=new g(this._transport),this.compositionSection=new R(this._transport),this.contact=new b(this._transport),this.conversation=new v(this._transport),this.label=new y(this._transport),this.message=new I(this._transport),this.model=new _(this._transport),this.note=new T(this._transport),this.notificationSubscription=new L(this._transport),this.source=new S(this._transport),this.statistics=new D(this._transport),this.upload=new E(this._transport),this.webhook=new w(this._transport),this.webhookSubscription=new G(this._transport),this.wellKnown=new x(this._transport)}static getBaseURL(){return process.env[Ct]??this.DEFAULT_BASE_URL}};var H=require("commander"),Rt=require("ora");function q({client:n,ora:t}){let e=new H.Command("actions").description("Actions");return e.addCommand(new H.Command("list").description("List actions").action(async()=>{let o=await(0,Rt.oraPromise)(()=>n.action.list().json(),{...t,text:"Finding actions"});console.log(o)})),e}var Y=require("commander"),bt=require("ora");function z({client:n,ora:t}){let e=new Y.Command("channels").description("Channels");return e.addCommand(new Y.Command("list").description("List channels").action(async()=>{let o=await(0,bt.oraPromise)(()=>n.channel.list().json(),{...t,text:"Finding channels"});console.log(o)})),e}var k=require("commander"),N=require("ora");function J({client:n,ora:t}){let e=new k.Command("contacts").description("Contacts");return e.addCommand(new k.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async o=>{let s=await(0,N.oraPromise)(()=>n.contact.get(o).json(),{...t,text:"Finding contact"});console.log(s)})),e.addCommand(new k.Command("list").description("List contacts").action(async()=>{let o=await(0,N.oraPromise)(()=>n.contact.list().json(),{...t,text:"Finding contacts"});console.log(o)})),e.addCommand(new k.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async o=>{let s=await(0,N.oraPromise)(()=>n.contact.getVCF(o).response(),{...t,text:"Exporting contact"});console.log(s)})),e}var j=require("commander"),$=require("ora");function X({client:n,ora:t}){let e=new j.Command("conversations").description("Conversations");return e.addCommand(new j.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async o=>{let s=await(0,$.oraPromise)(()=>n.conversation.get(o).json(),{...t,text:"Finding conversation"});console.log(s)})),e.addCommand(new j.Command("list").description("List conversations").action(async()=>{let o=await(0,$.oraPromise)(()=>n.conversation.list().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var F=require("commander"),W=require("ora");function Z({client:n,ora:t}){let e=new F.Command("labels").description("Labels");return e.addCommand(new F.Command("get").description("Find label").argument("<label>","Label ID").action(async o=>{let s=await(0,W.oraPromise)(()=>n.label.get(o).json(),{...t,text:"Finding label"});console.log(s)})),e.addCommand(new F.Command("list").description("List labels").action(async()=>{let o=await(0,W.oraPromise)(()=>n.label.list().json(),{...t,text:"Finding labels"});console.log(o)})),e.addCommand(new F.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async o=>{let s=await(0,W.oraPromise)(()=>n.conversation.listByLabel(o).json(),{...t,text:"Finding conversations"});console.log(s)})),e}var tt=require("commander"),vt=require("ora");function et({client:n,ora:t}){let e=new tt.Command("messages").description("Messages");return e.addCommand(new tt.Command("list").description("List messages").action(async()=>{let o=await(0,vt.oraPromise)(()=>n.message.list().json(),{...t,text:"Finding messages"});console.log(o)})),e}var Q=require("commander"),ot=require("ora");function nt({client:n,ora:t}){let e=new Q.Command("models").description("Models");return e.addCommand(new Q.Command("get").description("Find model").argument("<model>","Model ID").action(async o=>{let s=await(0,ot.oraPromise)(()=>n.model.get(o).json(),{...t,text:"Finding model"});console.log(s)})),e.addCommand(new Q.Command("list").description("List models").action(async()=>{let o=await(0,ot.oraPromise)(()=>n.model.list().json(),{...t,text:"Finding models"});console.log(o)})),e}var K=require("commander"),st=require("ora");function rt({client:n,ora:t}){let e=new K.Command("sources").description("Sources");return e.addCommand(new K.Command("get").description("Find source").argument("<source>","Source ID").action(async o=>{let s=await(0,st.oraPromise)(()=>n.source.get(o).json(),{...t,text:"Finding source"});console.log(s)})),e.addCommand(new K.Command("list").description("List sources").action(async()=>{let o=await(0,st.oraPromise)(()=>n.source.list().json(),{...t,text:"Finding sources"});console.log(o)})),e}var It=require("commander");var it=require("commander"),yt=require("ora");function at({client:n,ora:t}){let e=new it.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new it.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let o=await(0,yt.oraPromise)(()=>n.wellKnown.getNotifications().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(o)})),e}function pt({client:n,ora:t}){let e=new It.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(at({client:n,ora:t})),e}var a={ora:{spinner:"simpleDotsScrolling"},client:new P(new p)},Gt=new _t.Command("gds").description("Great Detail Support System").addCommand(q(a)).addCommand(z(a)).addCommand(J(a)).addCommand(X(a)).addCommand(Z(a)).addCommand(et(a)).addCommand(nt(a)).addCommand(rt(a)).addCommand(pt(a)),Tt=Gt;Tt.parseAsync(process.argv);
|
|
2
|
+
"use strict";var At=Object.create;var ct=Object.defineProperty;var St=Object.getOwnPropertyDescriptor;var Dt=Object.getOwnPropertyNames;var Ut=Object.getPrototypeOf,Et=Object.prototype.hasOwnProperty;var wt=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Dt(t))!Et.call(n,s)&&s!==e&&ct(n,s,{get:()=>t[s],enumerable:!(o=St(t,s))||o.enumerable});return n};var mt=(n,t,e)=>(e=n!=null?At(Ut(n)):{},wt(t||!n||!n.__esModule?ct(e,"default",{value:n,enumerable:!0}):e,n));var _t=require("commander");var p=class{getHeaders(){return{}}};var m=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/accounts",{...e,method:"POST",json:t})}};var l=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}delete(t,e,{body:o,request:s={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...s,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var d=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var u=class{constructor(t){this._transport=t}list({limit:t,sort:e,request:o={}}={}){return this._transport.send("v1/actions",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var lt="SUPPORT_ACCESS_TOKEN",dt="SUPPORT_KEY_NAME",ut="SUPPORT_KEY_PASSWORD",V="SUPPORT_SIGNING_KEY",Ct="SUPPORT_BASE_URL";var C=class{name;#t;constructor({name:t=process.env[dt],password:e=process.env[ut]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var h=class{#t;constructor({token:t=process.env[lt]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var f=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var 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,query:e,request:o={}}={}){return this._transport.send("v1/channels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}metaWhatsappGetBusinessProfile(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/meta-whatsapp/business-profile",{...e,method:"GET"})}twilioSendgridChannelSync(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/twilio-sendgrid/sync",{...o,method:"POST",json:e})}};var b=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var ht="https://api.support.greatdetail.com",ft={"X-Powered-By":"GDSupport/JavaScript"};var R=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 v=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}list({query:t,limit:e,filter:o,include:s,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.limitQuery(e),...o?[["filter",o]]:[],...this._transport.includeQuery(s??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var y=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,include:o,request:s={}}={}){return this._transport.send("v1/labels",{...s,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByConversation(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var I=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 _=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 T=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 L=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 A=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=ft;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var S=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}list({featured:t,category:e,request:o={}}={}){let s=[];if(e){let r=Array.isArray(e)?e:[e];for(let c of r)s.push(["category",c])}return t!==void 0&&s.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:s})}};var D=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};var Ot=mt(require("is-network-error"),1),M=mt(require("ky"),1);var B=class extends Error{constructor(e,o){super("Support Error",{cause:o});this.response=e}};var U=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=M.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let s of this.options.requestFilterables){let r=s.getHeaders();for(let[c,Lt]of Object.entries(r))o.headers.has(c)||o.headers.set(c,Lt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,s]of Object.entries(t))s!==void 0&&e.push(["sort",s+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let o=this.client(t,e).catch(async s=>{throw(0,Ot.default)(s)?new Error("A network error occurred",{cause:s}):s instanceof M.HTTPError?new B(s.response,s):s});return{response:()=>o,json:async()=>(await o).json()}}};var E=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,request:e={}}){let o=new FormData;for(let s of t)o.append("file",s);return this._transport.send("v1/uploads",{...e,method:"POST",body:o})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var i=require("zod"),gt=i.z.object({data:i.z.object({event:i.z.object({id:i.z.string(),type:i.z.string(),payload:i.z.record(i.z.string()),createdAt:i.z.string().datetime()})})});var w=class{constructor(t){this._transport=t}async event({key:t=process.env[V],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."+V);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}=gt.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 G=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/webhooks/subscriptions",{...t,method:"GET"})}test(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t)+"/test",{...e,method:"POST"})}create({body:t,request:e={}}){return this._transport.send("v1/webhooks/subscriptions",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var x=class{constructor(t){this._transport=t}getNotifications({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var k=class n{static DEFAULT_BASE_URL=ht;static PublicAuthentication=p;static BasicAuthentication=C;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 U({requestFilterables:[new A,t],...o,baseURL:e?.toString()??n.getBaseURL()}),this.account=new m(this._transport),this.accountAccessToken=new l(this._transport),this.accountConversationSettings=new d(this._transport),this.action=new u(this._transport),this.boilerplateCategory=new f(this._transport),this.boilerplateContent=new O(this._transport),this.channel=new g(this._transport),this.compositionSection=new b(this._transport),this.contact=new R(this._transport),this.conversation=new v(this._transport),this.label=new y(this._transport),this.message=new I(this._transport),this.model=new _(this._transport),this.note=new T(this._transport),this.notificationSubscription=new L(this._transport),this.source=new S(this._transport),this.statistics=new D(this._transport),this.upload=new E(this._transport),this.webhook=new w(this._transport),this.webhookSubscription=new G(this._transport),this.wellKnown=new x(this._transport)}static getBaseURL(){return process.env[Ct]??this.DEFAULT_BASE_URL}};var H=require("commander"),bt=require("ora");function q({client:n,ora:t}){let e=new H.Command("actions").description("Actions");return e.addCommand(new H.Command("list").description("List actions").action(async()=>{let o=await(0,bt.oraPromise)(()=>n.action.list().json(),{...t,text:"Finding actions"});console.log(o)})),e}var Y=require("commander"),Rt=require("ora");function z({client:n,ora:t}){let e=new Y.Command("channels").description("Channels");return e.addCommand(new Y.Command("list").description("List channels").action(async()=>{let o=await(0,Rt.oraPromise)(()=>n.channel.list().json(),{...t,text:"Finding channels"});console.log(o)})),e}var P=require("commander"),W=require("ora");function J({client:n,ora:t}){let e=new P.Command("contacts").description("Contacts");return e.addCommand(new P.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async o=>{let s=await(0,W.oraPromise)(()=>n.contact.get(o).json(),{...t,text:"Finding contact"});console.log(s)})),e.addCommand(new P.Command("list").description("List contacts").action(async()=>{let o=await(0,W.oraPromise)(()=>n.contact.list().json(),{...t,text:"Finding contacts"});console.log(o)})),e.addCommand(new P.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async o=>{let s=await(0,W.oraPromise)(()=>n.contact.getVCF(o).response(),{...t,text:"Exporting contact"});console.log(s)})),e}var N=require("commander"),$=require("ora");function X({client:n,ora:t}){let e=new N.Command("conversations").description("Conversations");return e.addCommand(new N.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async o=>{let s=await(0,$.oraPromise)(()=>n.conversation.get(o).json(),{...t,text:"Finding conversation"});console.log(s)})),e.addCommand(new N.Command("list").description("List conversations").action(async()=>{let o=await(0,$.oraPromise)(()=>n.conversation.list().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var F=require("commander"),j=require("ora");function Z({client:n,ora:t}){let e=new F.Command("labels").description("Labels");return e.addCommand(new F.Command("get").description("Find label").argument("<label>","Label ID").action(async o=>{let s=await(0,j.oraPromise)(()=>n.label.get(o).json(),{...t,text:"Finding label"});console.log(s)})),e.addCommand(new F.Command("list").description("List labels").action(async()=>{let o=await(0,j.oraPromise)(()=>n.label.list().json(),{...t,text:"Finding labels"});console.log(o)})),e.addCommand(new F.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async o=>{let s=await(0,j.oraPromise)(()=>n.conversation.listByLabel(o).json(),{...t,text:"Finding conversations"});console.log(s)})),e}var tt=require("commander"),vt=require("ora");function et({client:n,ora:t}){let e=new tt.Command("messages").description("Messages");return e.addCommand(new tt.Command("list").description("List messages").action(async()=>{let o=await(0,vt.oraPromise)(()=>n.message.list().json(),{...t,text:"Finding messages"});console.log(o)})),e}var Q=require("commander"),ot=require("ora");function nt({client:n,ora:t}){let e=new Q.Command("models").description("Models");return e.addCommand(new Q.Command("get").description("Find model").argument("<model>","Model ID").action(async o=>{let s=await(0,ot.oraPromise)(()=>n.model.get(o).json(),{...t,text:"Finding model"});console.log(s)})),e.addCommand(new Q.Command("list").description("List models").action(async()=>{let o=await(0,ot.oraPromise)(()=>n.model.list().json(),{...t,text:"Finding models"});console.log(o)})),e}var K=require("commander"),st=require("ora");function rt({client:n,ora:t}){let e=new K.Command("sources").description("Sources");return e.addCommand(new K.Command("get").description("Find source").argument("<source>","Source ID").action(async o=>{let s=await(0,st.oraPromise)(()=>n.source.get(o).json(),{...t,text:"Finding source"});console.log(s)})),e.addCommand(new K.Command("list").description("List sources").action(async()=>{let o=await(0,st.oraPromise)(()=>n.source.list().json(),{...t,text:"Finding sources"});console.log(o)})),e}var It=require("commander");var it=require("commander"),yt=require("ora");function at({client:n,ora:t}){let e=new it.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new it.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let o=await(0,yt.oraPromise)(()=>n.wellKnown.getNotifications().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(o)})),e}function pt({client:n,ora:t}){let e=new It.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(at({client:n,ora:t})),e}var a={ora:{spinner:"simpleDotsScrolling"},client:new k(new p)},Gt=new _t.Command("gds").description("Great Detail Support System").addCommand(q(a)).addCommand(z(a)).addCommand(J(a)).addCommand(X(a)).addCommand(Z(a)).addCommand(et(a)).addCommand(nt(a)).addCommand(rt(a)).addCommand(pt(a)),Tt=Gt;Tt.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-KCAE7SJB.js";import"./chunk-JF2KQDYG.js";r.parseAsync(process.argv);
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var X=Object.create;var w=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var tt=Object.getOwnPropertyNames;var et=Object.getPrototypeOf,ot=Object.prototype.hasOwnProperty;var Q=(s,t)=>{for(var e in t)w(s,e,{get:t[e],enumerable:!0})},j=(s,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of tt(t))!ot.call(s,n)&&n!==e&&w(s,n,{get:()=>t[n],enumerable:!(o=Z(t,n))||o.enumerable});return s};var H=(s,t,e)=>(e=s!=null?X(et(s)):{},j(t||!s||!s.__esModule?w(e,"default",{value:s,enumerable:!0}):e,s)),st=s=>j(w({},"__esModule",{value:!0}),s);var nt={};Q(nt,{Client:()=>a,DEFAULT_SUPPORT_BASE_URL:()=>B,Error:()=>W,default:()=>a,eventWebhookSchema:()=>N});module.exports=st(nt);var B="https://api.support.greatdetail.com",V={"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"})}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 m=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}delete(t,e,{body:o,request:n={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...n,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var l=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var u=class{constructor(t){this._transport=t}list({limit:t,sort:e,request:o={}}={}){return this._transport.send("v1/actions",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var q="SUPPORT_ACCESS_TOKEN",K="SUPPORT_KEY_NAME",Y="SUPPORT_KEY_PASSWORD",M="SUPPORT_SIGNING_KEY",z="SUPPORT_BASE_URL";var d=class{name;#t;constructor({name:t=process.env[K],password:e=process.env[Y]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var h=class{#t;constructor({token:t=process.env[q]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var C=class{getHeaders(){return{}}};var f=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var R=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByCategory=this.listByBoilerplateCategory;listByBoilerplateCategory(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t)+"/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var b=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/channels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}metaWhatsappGetBusinessProfile(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/meta-whatsapp/business-profile",{...e,method:"GET"})}twilioSendgridChannelSync(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/twilio-sendgrid/sync",{...o,method:"POST",json:e})}};var v=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var O=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}getRelativeVCFURL(t,{vcf:e={}}={}){let o=e.variant??"vcard",n=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(n)}getVCFURL(t,e={}){return this._transport.getURL(this.getRelativeVCFURL(t,e))}getVCF(t,e={}){return this._transport.send(this.getVCFURL(t,e),{method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var g=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}list({query:t,limit:e,filter:o,include:n,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.limitQuery(e),...o?[["filter",o]]:[],...this._transport.includeQuery(n??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var x=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,include:o,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByConversation(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var T=class{constructor(t){this._transport=t}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}listByConversation(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o)]})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var _=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 I=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 A=class s{constructor(t=s.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=V;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var L=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}list({featured:t,category:e,request:o={}}={}){let n=[];if(e){let r=Array.isArray(e)?e:[e];for(let p of r)n.push(["category",p])}return t!==void 0&&n.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:n})}};var S=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};var J=H(require("is-network-error"),1),F=H(require("ky"),1);var U=class extends Error{constructor(e,o){super("Support Error",{cause:o});this.response=e}};var D=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=F.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let n of this.options.requestFilterables){let r=n.getHeaders();for(let[p,$]of Object.entries(r))o.headers.has(p)||o.headers.set(p,$)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,n]of Object.entries(t))n!==void 0&&e.push(["sort",n+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let o=this.client(t,e).catch(async n=>{throw(0,J.default)(n)?new Error("A network error occurred",{cause:n}):n instanceof F.HTTPError?new U(n.response,n):n});return{response:()=>o,json:async()=>(await o).json()}}};var E=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,request:e={}}){let o=new FormData;for(let n of t)o.append("file",n);return this._transport.send("v1/uploads",{...e,method:"POST",body:o})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var i=require("zod"),N=i.z.object({data:i.z.object({event:i.z.object({id:i.z.string(),type:i.z.string(),payload:i.z.record(i.z.string()),createdAt:i.z.string().datetime()})})});var G=class{constructor(t){this._transport=t}async event({key:t=process.env[M],maxSignatures:e=3,request:o}){let n=o.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+M);if(!n)throw new Error("Missing signature header");if(!this._verifySignature(t,o.body,Array.isArray(n)?n.slice(0,e):[n]))throw new Error("Untrusted signature")}let{data:r}=N.parse(o.body);return{event:r.event}}async _verifySignature(t,e,o){let n=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let r of o)if(await crypto.subtle.verify("HMAC",n,new TextEncoder().encode(atob(r)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var k=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/webhooks/subscriptions",{...t,method:"GET"})}test(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t)+"/test",{...e,method:"POST"})}create({body:t,request:e={}}){return this._transport.send("v1/webhooks/subscriptions",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var P=class{constructor(t){this._transport=t}getNotifications({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var a=class s{static DEFAULT_BASE_URL=B;static PublicAuthentication=C;static BasicAuthentication=d;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 D({requestFilterables:[new A,t],...o,baseURL:e?.toString()??s.getBaseURL()}),this.account=new c(this._transport),this.accountAccessToken=new m(this._transport),this.accountConversationSettings=new l(this._transport),this.action=new u(this._transport),this.boilerplateCategory=new f(this._transport),this.boilerplateContent=new R(this._transport),this.channel=new b(this._transport),this.compositionSection=new v(this._transport),this.contact=new O(this._transport),this.conversation=new g(this._transport),this.label=new x(this._transport),this.message=new T(this._transport),this.model=new _(this._transport),this.note=new y(this._transport),this.notificationSubscription=new I(this._transport),this.source=new L(this._transport),this.statistics=new S(this._transport),this.upload=new E(this._transport),this.webhook=new G(this._transport),this.webhookSubscription=new k(this._transport),this.wellKnown=new P(this._transport)}static getBaseURL(){return process.env[z]??this.DEFAULT_BASE_URL}};var W={};Q(W,{SupportError:()=>U});0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,Error,eventWebhookSchema});
|
|
1
|
+
"use strict";var X=Object.create;var w=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var tt=Object.getOwnPropertyNames;var et=Object.getPrototypeOf,ot=Object.prototype.hasOwnProperty;var Q=(s,t)=>{for(var e in t)w(s,e,{get:t[e],enumerable:!0})},j=(s,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of tt(t))!ot.call(s,n)&&n!==e&&w(s,n,{get:()=>t[n],enumerable:!(o=Z(t,n))||o.enumerable});return s};var H=(s,t,e)=>(e=s!=null?X(et(s)):{},j(t||!s||!s.__esModule?w(e,"default",{value:s,enumerable:!0}):e,s)),st=s=>j(w({},"__esModule",{value:!0}),s);var nt={};Q(nt,{Client:()=>a,DEFAULT_SUPPORT_BASE_URL:()=>B,Error:()=>N,default:()=>a,eventWebhookSchema:()=>W});module.exports=st(nt);var B="https://api.support.greatdetail.com",V={"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"})}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 m=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...e,method:"GET"})}delete(t,e,{body:o,request:n={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...n,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var l=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var u=class{constructor(t){this._transport=t}list({limit:t,sort:e,request:o={}}={}){return this._transport.send("v1/actions",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.sortQuery(e)]})}};var q="SUPPORT_ACCESS_TOKEN",K="SUPPORT_KEY_NAME",Y="SUPPORT_KEY_PASSWORD",M="SUPPORT_SIGNING_KEY",z="SUPPORT_BASE_URL";var d=class{name;#t;constructor({name:t=process.env[K],password:e=process.env[Y]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var h=class{#t;constructor({token:t=process.env[q]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var C=class{getHeaders(){return{}}};var f=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var R=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByCategory=this.listByBoilerplateCategory;listByBoilerplateCategory(t,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t)+"/contents",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var b=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/channels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}metaWhatsappGetBusinessProfile(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/meta-whatsapp/business-profile",{...e,method:"GET"})}twilioSendgridChannelSync(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/twilio-sendgrid/sync",{...o,method:"POST",json:e})}};var v=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var O=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}getRelativeVCFURL(t,{vcf:e={}}={}){let o=e.variant??"vcard",n=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(n)}getVCFURL(t,e={}){return this._transport.getURL(this.getRelativeVCFURL(t,e))}getVCF(t,e={}){return this._transport.send(this.getVCFURL(t,e),{method:"GET"})}list({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var g=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}list({query:t,limit:e,filter:o,include:n,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.limitQuery(e),...o?[["filter",o]]:[],...this._transport.includeQuery(n??{})]})}listByLabel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByChannel(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var x=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}list({limit:t,query:e,include:o,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}listByContact(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}listByConversation(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}create({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var T=class{constructor(t){this._transport=t}list({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}listByConversation(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}listByChannel(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o)]})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/messages/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var _=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 I=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 A=class s{constructor(t=s.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=V;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var L=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}list({featured:t,category:e,request:o={}}={}){let n=[];if(e){let r=Array.isArray(e)?e:[e];for(let p of r)n.push(["category",p])}return t!==void 0&&n.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:n})}};var S=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};var J=H(require("is-network-error"),1),F=H(require("ky"),1);var U=class extends Error{constructor(e,o){super("Support Error",{cause:o});this.response=e}};var D=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=F.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let n of this.options.requestFilterables){let r=n.getHeaders();for(let[p,$]of Object.entries(r))o.headers.has(p)||o.headers.set(p,$)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}sortQuery(t){let e=[];if(t===void 0)return e;for(let[o,n]of Object.entries(t))n!==void 0&&e.push(["sort",n+o]);return e}limitQuery(t){let e=[];return t===void 0||e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t===void 0||e.push(["query",t]),e}send(t,e={}){let o=this.client(t,e).catch(async n=>{throw(0,J.default)(n)?new Error("A network error occurred",{cause:n}):n instanceof F.HTTPError?new U(n.response,n):n});return{response:()=>o,json:async()=>(await o).json()}}};var E=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/uploads",{...t,method:"GET"})}create({files:t,request:e={}}){let o=new FormData;for(let n of t)o.append("file",n);return this._transport.send("v1/uploads",{...e,method:"POST",body:o})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var i=require("zod"),W=i.z.object({data:i.z.object({event:i.z.object({id:i.z.string(),type:i.z.string(),payload:i.z.record(i.z.string()),createdAt:i.z.string().datetime()})})});var G=class{constructor(t){this._transport=t}async event({key:t=process.env[M],maxSignatures:e=3,request:o}){let n=o.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+M);if(!n)throw new Error("Missing signature header");if(!this._verifySignature(t,o.body,Array.isArray(n)?n.slice(0,e):[n]))throw new Error("Untrusted signature")}let{data:r}=W.parse(o.body);return{event:r.event}}async _verifySignature(t,e,o){let n=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let r of o)if(await crypto.subtle.verify("HMAC",n,new TextEncoder().encode(atob(r)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var k=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/webhooks/subscriptions",{...t,method:"GET"})}test(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t)+"/test",{...e,method:"POST"})}create({body:t,request:e={}}){return this._transport.send("v1/webhooks/subscriptions",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var P=class{constructor(t){this._transport=t}getNotifications({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var a=class s{static DEFAULT_BASE_URL=B;static PublicAuthentication=C;static BasicAuthentication=d;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 D({requestFilterables:[new A,t],...o,baseURL:e?.toString()??s.getBaseURL()}),this.account=new c(this._transport),this.accountAccessToken=new m(this._transport),this.accountConversationSettings=new l(this._transport),this.action=new u(this._transport),this.boilerplateCategory=new f(this._transport),this.boilerplateContent=new R(this._transport),this.channel=new b(this._transport),this.compositionSection=new v(this._transport),this.contact=new O(this._transport),this.conversation=new g(this._transport),this.label=new x(this._transport),this.message=new T(this._transport),this.model=new _(this._transport),this.note=new y(this._transport),this.notificationSubscription=new I(this._transport),this.source=new L(this._transport),this.statistics=new S(this._transport),this.upload=new E(this._transport),this.webhook=new G(this._transport),this.webhookSubscription=new k(this._transport),this.wellKnown=new P(this._transport)}static getBaseURL(){return process.env[z]??this.DEFAULT_BASE_URL}};var N={};Q(N,{SupportError:()=>U});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, j as AccountAccessToken,
|
|
1
|
+
export { A as Account, j as AccountAccessToken, k as AccountAccessTokenID, cP as AccountAccessTokenWebhookEventType, t as AccountConversationSettings, c as AccountID, cO as AccountWebhookWebhookEventType, z as Action, B as ActionID, a$ as ActiveConversationStatus, _ as BoilerplateCategory, $ as BoilerplateCategoryID, H as BoilerplateContent, I as BoilerplateContentID, ab as Channel, ac as ChannelID, C as Client, as as CompositionSection, at as CompositionSectionID, b0 as ConcludedConversationStatus, aG as Contact, aH as ContactID, cQ as ContactWebhookEventType, aZ as Conversation, a_ as ConversationID, b1 as ConversationStatus, cR as ConversationWebhookEventType, m as CreateAccountAccessTokenOptions, l as CreateAccountAccessTokenPayload, n as CreateAccountAccessTokenResponse, e as CreateAccountOptions, d as CreateAccountPayload, f as CreateAccountResponse, a1 as CreateBoilerplateCategoryOptions, a0 as CreateBoilerplateCategoryPayload, a2 as CreateBoilerplateCategoryResponse, K as CreateBoilerplateContentOptions, J as CreateBoilerplateContentPayload, M as CreateBoilerplateContentResponse, ae as CreateChannelOptions, ad as CreateChannelPayload, af as CreateChannelResponse, av as CreateCompositionSectionOptions, au as CreateCompositionSectionPayload, aw as CreateCompositionSectionResponse, cb as CreateContactNoteOptions, ca as CreateContactNotePayload, cc as CreateContactNoteResponse, cy as CreateContactNotificationSubscriptionOptions, cx as CreateContactNotificationSubscriptionPayload, cz as CreateContactNotificationSubscriptionResponse, aK as CreateContactOptions, aJ as CreateContactPayload, aL as CreateContactResponse, ce as CreateConversationNoteOptions, cd as CreateConversationNotePayload, cf as CreateConversationNoteResponse, b3 as CreateConversationOptions, b2 as CreateConversationPayload, b4 as CreateConversationResponse, b$ as CreateCorrectionModelOptions, b_ as CreateCorrectionModelPayload, c0 as CreateCorrectionResponse, bp as CreateLabelOptions, bo as CreateLabelPayload, bq as CreateLabelResponse, bI as CreateMessageOptions, bH as CreateMessagePayload, bJ as CreateMessageResponse, c2 as CreateResponseModelOptions, c1 as CreateResponseModelPayload, c3 as CreateResponseResponse, cC as CreateUploadOptions, cD as CreateUploadResponse, cY as CreateWebhookSubscriptionOptions, cX as CreateWebhookSubscriptionPayload, cZ as CreateWebhookSubscriptionResponse, b as CurrentAccountID, aI as CustomMetadata, o as DeleteAccountAccessTokenOptions, D as DeleteAccountAccessTokenPayload, p as DeleteAccountAccessTokenResponse, aM as DeleteContactOptions, aN as DeleteContactResponse, b5 as DeleteConversationOptions, b6 as DeleteConversationResponse, br as DeleteLabelOptions, bs as DeleteLabelResponse, bK as DeleteMessageOptions, bL as DeleteMessageResponse, cE as DeleteUploadOptions, cF as DeleteUploadResponse, c_ as DeleteWebhookSubscriptionOptions, c$ as DeleteWebhookSubscriptionResponse, cL as EventWebhookOptions, bf as FilterOptions, q as GetAccountAccessTokenOptions, r as GetAccountAccessTokenResponse, u as GetAccountConversationSettingsOptions, v as GetAccountConversationSettingsResponse, G as GetAccountOptions, g as GetAccountResponse, a3 as GetBoilerplateCategoryOptions, a4 as GetBoilerplateCategoryResponse, N as GetBoilerplateContentOptions, P as GetBoilerplateContentResponse, ag as GetChannelOptions, ah as GetChannelResponse, ax as GetCompositionSectionOptions, ay as GetCompositionSectionResponse, aO as GetContactIncludeOptions, aP as GetContactOptions, aQ as GetContactResponse, aR as GetContactVCFOptions, b7 as GetConversationIncludeOptions, b8 as GetConversationOptions, b9 as GetConversationResponse, bt as GetLabelOptions, bu as GetLabelResponse, c4 as GetModelOptions, c5 as GetModelResponse, cg as GetNoteOptions, ch as GetNoteResponse, d7 as GetNotificationWellKnownResponse, cr as GetSourceOptions, cs as GetSourceResponse, cG as GetUploadOptions, cH as GetUploadResponse, d0 as GetWebhookSubscriptionOptions, d1 as GetWebhookSubscriptionResponse, bn as Label, bv as LabelID, L as ListAccountAccessTokensOptions, s as ListAccountAccessTokensResponse, E as ListActionsOptions, F as ListActionsResponse, a5 as ListBoilerplateCategoriesIncludeOptions, a6 as ListBoilerplateCategoriesOptions, a7 as ListBoilerplateCategoriesResponse, Q as ListBoilerplateCategoryBoilerplateContentsOptions, T as ListBoilerplateCategoryBoilerplateContentsResponse, V as ListBoilerplateContentsOptions, W as ListBoilerplateContentsResponse, az as ListChannelCompositionSectionsOptions, aA as ListChannelCompositionSectionsResponse, ba as ListChannelConversationsOptions, bb as ListChannelConversationsResponse, bM as ListChannelMessagesIncludeOptions, bN as ListChannelMessagesOptions, bO as ListChannelMessagesResponse, ai as ListChannelsOptions, aj as ListChannelsResponse, aB as ListCompositionSectionsOptions, aC as ListCompositionSectionsResponse, bc as ListContactConversationsOptions, bd as ListContactConversationsResponse, bw as ListContactLabelsOptions, bx as ListContactLabelsResponse, ci as ListContactNotesOptions, cj as ListContactNotesResponse, aS as ListContactsOptions, aT as ListContactsResponse, by as ListConversationLabelsOptions, bz as ListConversationLabelsResponse, bP as ListConversationMessagesIncludeOptions, bQ as ListConversationMessagesOptions, bR as ListConversationMessagesResponse, ck as ListConversationNotesOptions, cl as ListConversationNotesResponse, bg as ListConversationOptions, be as ListConversationsIncludeOptions, bh as ListConversationsResponse, aU as ListLabelContactsOptions, aV as ListLabelContactsResponse, bi as ListLabelConversationsOptions, bj as ListLabelConversationsResponse, bA as ListLabelsIncludeOptions, bB as ListLabelsOptions, bC as ListLabelsResponse, bS as ListMessagesIncludeOptions, bT as ListMessagesOptions, bU as ListMessagesResponse, c6 as ListModelsOptions, c7 as ListModelsResponse, ct as ListSourcesOptions, cu as ListSourcesResponse, cI as ListUploadsOptions, cJ as ListUploadsResponse, d2 as ListWebhookSubscriptionsOptions, d3 as ListWebhookSubscriptionsResponse, bG as Message, bY as MessageEventType, bV as MessageID, bW as MessageRole, bX as MessageStatus, cS as MessageWebhookEventType, ak as MetaWhatsappChannelGetBusinessProfileOptions, al 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, d4 as TestWebhookSubscriptionOptions, d5 as TestWebhookSubscriptionResponse, a as TransportOptions, am as TwilioSendChannelSyncPayload, an as TwilioSendgridChannelSyncOptions, ao as TwilioSendgridChannelSyncResponse, x as UpdateAccountConversationSettingsOptions, w as UpdateAccountConversationSettingsPayload, y as UpdateAccountConversationSettingsResponse, h as UpdateAccountOptions, U as UpdateAccountPayload, i as UpdateAccountResponse, a9 as UpdateBoilerplateCategoryOptions, a8 as UpdateBoilerplateCategoryPayload, aa as UpdateBoilerplateCategoryResponse, Y as UpdateBoilerplateContentOptions, X as UpdateBoilerplateContentPayload, Z as UpdateBoilerplateContentResponse, aq as UpdateChannelOptions, ap as UpdateChannelPayload, ar as UpdateChannelResponse, aE as UpdateCompositionSectionOptions, aD as UpdateCompositionSectionPayload, aF as UpdateCompositionSectionResponse, aX as UpdateContactOptions, aW as UpdateContactPayload, aY as UpdateContactResponse, bl as UpdateConversationOptions, bk as UpdateConversationPayload, bm as UpdateConversationResponse, bE as UpdateLabelOptions, bD as UpdateLabelPayload, bF as UpdateLabelResponse, co as UpdateNoteOptions, cn as UpdateNotePayload, cp as UpdateNoteResponse, cB as Upload, cK as UploadID, cU as WebhookEventPayload, cN as WebhookEventType, cV as WebhookResponse, cW as WebhookSubscription, d6 as WebhookSubscriptionID, cT as WebhookSubscriptionWebhookEventType, C as default, cM as eventWebhookSchema } from './Client-DdUmsH92.cjs';
|
|
2
2
|
import { KyResponse } from 'ky';
|
|
3
3
|
import 'zod';
|
|
4
4
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Account, j as AccountAccessToken,
|
|
1
|
+
export { A as Account, j as AccountAccessToken, k as AccountAccessTokenID, cP as AccountAccessTokenWebhookEventType, t as AccountConversationSettings, c as AccountID, cO as AccountWebhookWebhookEventType, z as Action, B as ActionID, a$ as ActiveConversationStatus, _ as BoilerplateCategory, $ as BoilerplateCategoryID, H as BoilerplateContent, I as BoilerplateContentID, ab as Channel, ac as ChannelID, C as Client, as as CompositionSection, at as CompositionSectionID, b0 as ConcludedConversationStatus, aG as Contact, aH as ContactID, cQ as ContactWebhookEventType, aZ as Conversation, a_ as ConversationID, b1 as ConversationStatus, cR as ConversationWebhookEventType, m as CreateAccountAccessTokenOptions, l as CreateAccountAccessTokenPayload, n as CreateAccountAccessTokenResponse, e as CreateAccountOptions, d as CreateAccountPayload, f as CreateAccountResponse, a1 as CreateBoilerplateCategoryOptions, a0 as CreateBoilerplateCategoryPayload, a2 as CreateBoilerplateCategoryResponse, K as CreateBoilerplateContentOptions, J as CreateBoilerplateContentPayload, M as CreateBoilerplateContentResponse, ae as CreateChannelOptions, ad as CreateChannelPayload, af as CreateChannelResponse, av as CreateCompositionSectionOptions, au as CreateCompositionSectionPayload, aw as CreateCompositionSectionResponse, cb as CreateContactNoteOptions, ca as CreateContactNotePayload, cc as CreateContactNoteResponse, cy as CreateContactNotificationSubscriptionOptions, cx as CreateContactNotificationSubscriptionPayload, cz as CreateContactNotificationSubscriptionResponse, aK as CreateContactOptions, aJ as CreateContactPayload, aL as CreateContactResponse, ce as CreateConversationNoteOptions, cd as CreateConversationNotePayload, cf as CreateConversationNoteResponse, b3 as CreateConversationOptions, b2 as CreateConversationPayload, b4 as CreateConversationResponse, b$ as CreateCorrectionModelOptions, b_ as CreateCorrectionModelPayload, c0 as CreateCorrectionResponse, bp as CreateLabelOptions, bo as CreateLabelPayload, bq as CreateLabelResponse, bI as CreateMessageOptions, bH as CreateMessagePayload, bJ as CreateMessageResponse, c2 as CreateResponseModelOptions, c1 as CreateResponseModelPayload, c3 as CreateResponseResponse, cC as CreateUploadOptions, cD as CreateUploadResponse, cY as CreateWebhookSubscriptionOptions, cX as CreateWebhookSubscriptionPayload, cZ as CreateWebhookSubscriptionResponse, b as CurrentAccountID, aI as CustomMetadata, o as DeleteAccountAccessTokenOptions, D as DeleteAccountAccessTokenPayload, p as DeleteAccountAccessTokenResponse, aM as DeleteContactOptions, aN as DeleteContactResponse, b5 as DeleteConversationOptions, b6 as DeleteConversationResponse, br as DeleteLabelOptions, bs as DeleteLabelResponse, bK as DeleteMessageOptions, bL as DeleteMessageResponse, cE as DeleteUploadOptions, cF as DeleteUploadResponse, c_ as DeleteWebhookSubscriptionOptions, c$ as DeleteWebhookSubscriptionResponse, cL as EventWebhookOptions, bf as FilterOptions, q as GetAccountAccessTokenOptions, r as GetAccountAccessTokenResponse, u as GetAccountConversationSettingsOptions, v as GetAccountConversationSettingsResponse, G as GetAccountOptions, g as GetAccountResponse, a3 as GetBoilerplateCategoryOptions, a4 as GetBoilerplateCategoryResponse, N as GetBoilerplateContentOptions, P as GetBoilerplateContentResponse, ag as GetChannelOptions, ah as GetChannelResponse, ax as GetCompositionSectionOptions, ay as GetCompositionSectionResponse, aO as GetContactIncludeOptions, aP as GetContactOptions, aQ as GetContactResponse, aR as GetContactVCFOptions, b7 as GetConversationIncludeOptions, b8 as GetConversationOptions, b9 as GetConversationResponse, bt as GetLabelOptions, bu as GetLabelResponse, c4 as GetModelOptions, c5 as GetModelResponse, cg as GetNoteOptions, ch as GetNoteResponse, d7 as GetNotificationWellKnownResponse, cr as GetSourceOptions, cs as GetSourceResponse, cG as GetUploadOptions, cH as GetUploadResponse, d0 as GetWebhookSubscriptionOptions, d1 as GetWebhookSubscriptionResponse, bn as Label, bv as LabelID, L as ListAccountAccessTokensOptions, s as ListAccountAccessTokensResponse, E as ListActionsOptions, F as ListActionsResponse, a5 as ListBoilerplateCategoriesIncludeOptions, a6 as ListBoilerplateCategoriesOptions, a7 as ListBoilerplateCategoriesResponse, Q as ListBoilerplateCategoryBoilerplateContentsOptions, T as ListBoilerplateCategoryBoilerplateContentsResponse, V as ListBoilerplateContentsOptions, W as ListBoilerplateContentsResponse, az as ListChannelCompositionSectionsOptions, aA as ListChannelCompositionSectionsResponse, ba as ListChannelConversationsOptions, bb as ListChannelConversationsResponse, bM as ListChannelMessagesIncludeOptions, bN as ListChannelMessagesOptions, bO as ListChannelMessagesResponse, ai as ListChannelsOptions, aj as ListChannelsResponse, aB as ListCompositionSectionsOptions, aC as ListCompositionSectionsResponse, bc as ListContactConversationsOptions, bd as ListContactConversationsResponse, bw as ListContactLabelsOptions, bx as ListContactLabelsResponse, ci as ListContactNotesOptions, cj as ListContactNotesResponse, aS as ListContactsOptions, aT as ListContactsResponse, by as ListConversationLabelsOptions, bz as ListConversationLabelsResponse, bP as ListConversationMessagesIncludeOptions, bQ as ListConversationMessagesOptions, bR as ListConversationMessagesResponse, ck as ListConversationNotesOptions, cl as ListConversationNotesResponse, bg as ListConversationOptions, be as ListConversationsIncludeOptions, bh as ListConversationsResponse, aU as ListLabelContactsOptions, aV as ListLabelContactsResponse, bi as ListLabelConversationsOptions, bj as ListLabelConversationsResponse, bA as ListLabelsIncludeOptions, bB as ListLabelsOptions, bC as ListLabelsResponse, bS as ListMessagesIncludeOptions, bT as ListMessagesOptions, bU as ListMessagesResponse, c6 as ListModelsOptions, c7 as ListModelsResponse, ct as ListSourcesOptions, cu as ListSourcesResponse, cI as ListUploadsOptions, cJ as ListUploadsResponse, d2 as ListWebhookSubscriptionsOptions, d3 as ListWebhookSubscriptionsResponse, bG as Message, bY as MessageEventType, bV as MessageID, bW as MessageRole, bX as MessageStatus, cS as MessageWebhookEventType, ak as MetaWhatsappChannelGetBusinessProfileOptions, al 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, d4 as TestWebhookSubscriptionOptions, d5 as TestWebhookSubscriptionResponse, a as TransportOptions, am as TwilioSendChannelSyncPayload, an as TwilioSendgridChannelSyncOptions, ao as TwilioSendgridChannelSyncResponse, x as UpdateAccountConversationSettingsOptions, w as UpdateAccountConversationSettingsPayload, y as UpdateAccountConversationSettingsResponse, h as UpdateAccountOptions, U as UpdateAccountPayload, i as UpdateAccountResponse, a9 as UpdateBoilerplateCategoryOptions, a8 as UpdateBoilerplateCategoryPayload, aa as UpdateBoilerplateCategoryResponse, Y as UpdateBoilerplateContentOptions, X as UpdateBoilerplateContentPayload, Z as UpdateBoilerplateContentResponse, aq as UpdateChannelOptions, ap as UpdateChannelPayload, ar as UpdateChannelResponse, aE as UpdateCompositionSectionOptions, aD as UpdateCompositionSectionPayload, aF as UpdateCompositionSectionResponse, aX as UpdateContactOptions, aW as UpdateContactPayload, aY as UpdateContactResponse, bl as UpdateConversationOptions, bk as UpdateConversationPayload, bm as UpdateConversationResponse, bE as UpdateLabelOptions, bD as UpdateLabelPayload, bF as UpdateLabelResponse, co as UpdateNoteOptions, cn as UpdateNotePayload, cp as UpdateNoteResponse, cB as Upload, cK as UploadID, cU as WebhookEventPayload, cN as WebhookEventType, cV as WebhookResponse, cW as WebhookSubscription, d6 as WebhookSubscriptionID, cT as WebhookSubscriptionWebhookEventType, C as default, cM as eventWebhookSchema } from './Client-DdUmsH92.js';
|
|
2
2
|
import { KyResponse } from 'ky';
|
|
3
3
|
import 'zod';
|
|
4
4
|
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as t,c as e,d as p,e as f,f as o}from"./chunk-
|
|
1
|
+
import{a as t,c as e,d as p,e as f,f as o}from"./chunk-JF2KQDYG.js";var r={};t(r,{SupportError:()=>p});export{o as Client,e as DEFAULT_SUPPORT_BASE_URL,r as Error,o as default,f as eventWebhookSchema};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@great-detail/support-sdk",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "JavaScript SDK for the Great Detail Support System",
|
|
6
6
|
"author": "Great Detail Ltd <info@greatdetail.com>",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"npm-run-all2": "^7.0.1",
|
|
76
76
|
"openapi-typescript": "^7.4.3",
|
|
77
77
|
"prettier": "^3.3.3",
|
|
78
|
-
"publint": "^0.
|
|
78
|
+
"publint": "^0.3.0",
|
|
79
79
|
"tsup": "^8.3.5",
|
|
80
80
|
"tsx": "^4.19.2",
|
|
81
81
|
"typescript": "^5.6.3"
|