mailchannels-sdk 0.7.5 → 0.7.7
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/README.md +111 -88
- package/dist/mailchannels.d.mts +169 -119
- package/dist/mailchannels.mjs +255 -765
- package/package.json +13 -11
package/dist/mailchannels.d.mts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { FetchOptions } from "ofetch";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
interface MailChannelsClientOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Override the MailChannels API base URL.
|
|
5
|
+
* Useful for local testing against a simulator.
|
|
6
|
+
* @default "https://api.mailchannels.net"
|
|
7
|
+
*/
|
|
8
|
+
baseUrl?: string;
|
|
9
|
+
}
|
|
4
10
|
declare class MailChannelsClient {
|
|
5
11
|
#private;
|
|
6
|
-
private static
|
|
7
|
-
constructor(key: string);
|
|
12
|
+
private static readonly DEFAULT_BASE_URL;
|
|
13
|
+
constructor(key: string, options?: MailChannelsClientOptions);
|
|
8
14
|
protected _fetch<T>(path: string, options?: FetchOptions<"json">): Promise<T>;
|
|
9
15
|
post<T>(path: string, options?: Omit<FetchOptions<"json">, "method">): Promise<T>;
|
|
10
16
|
get<T>(path: string, options?: Omit<FetchOptions<"json">, "method">): Promise<T>;
|
|
@@ -12,8 +18,6 @@ declare class MailChannelsClient {
|
|
|
12
18
|
put<T>(path: string, options?: Omit<FetchOptions<"json">, "method">): Promise<T>;
|
|
13
19
|
patch<T>(path: string, options?: Omit<FetchOptions<"json">, "method">): Promise<T>;
|
|
14
20
|
}
|
|
15
|
-
//#endregion
|
|
16
|
-
//#region src/types/responses.d.ts
|
|
17
21
|
interface ErrorResponse {
|
|
18
22
|
message: string;
|
|
19
23
|
statusCode: number | null;
|
|
@@ -47,8 +51,6 @@ type DataResponse<T> = {
|
|
|
47
51
|
*/
|
|
48
52
|
error: ErrorResponse;
|
|
49
53
|
};
|
|
50
|
-
//#endregion
|
|
51
|
-
//#region src/types/emails/send.d.ts
|
|
52
54
|
interface EmailsSendRecipient {
|
|
53
55
|
/**
|
|
54
56
|
* The email address of the recipient.
|
|
@@ -85,6 +87,63 @@ interface EmailsSendTracking {
|
|
|
85
87
|
*/
|
|
86
88
|
open?: boolean;
|
|
87
89
|
}
|
|
90
|
+
type EmailsSendRecipientInput = EmailsSendRecipient[] | EmailsSendRecipient | string[] | string;
|
|
91
|
+
interface EmailsSendDkim {
|
|
92
|
+
/**
|
|
93
|
+
* Domain used for DKIM signing.
|
|
94
|
+
*/
|
|
95
|
+
domain?: string;
|
|
96
|
+
/**
|
|
97
|
+
* DKIM private key encoded in Base64.
|
|
98
|
+
*/
|
|
99
|
+
privateKey?: string;
|
|
100
|
+
/**
|
|
101
|
+
* DKIM selector in the domain DNS records.
|
|
102
|
+
*/
|
|
103
|
+
selector?: string;
|
|
104
|
+
}
|
|
105
|
+
interface EmailsSendPersonalization {
|
|
106
|
+
/**
|
|
107
|
+
* The BCC recipients for this personalization.
|
|
108
|
+
*/
|
|
109
|
+
bcc?: EmailsSendRecipientInput;
|
|
110
|
+
/**
|
|
111
|
+
* The CC recipients for this personalization.
|
|
112
|
+
*/
|
|
113
|
+
cc?: EmailsSendRecipientInput;
|
|
114
|
+
/**
|
|
115
|
+
* DKIM settings for this personalization.
|
|
116
|
+
*/
|
|
117
|
+
dkim?: EmailsSendDkim;
|
|
118
|
+
/**
|
|
119
|
+
* Optional envelope sender for this personalization.
|
|
120
|
+
*/
|
|
121
|
+
envelopeFrom?: EmailsSendRecipient | string;
|
|
122
|
+
/**
|
|
123
|
+
* Optional sender override for this personalization.
|
|
124
|
+
*/
|
|
125
|
+
from?: EmailsSendRecipient | string;
|
|
126
|
+
/**
|
|
127
|
+
* Custom headers for this personalization.
|
|
128
|
+
*/
|
|
129
|
+
headers?: Record<string, string>;
|
|
130
|
+
/**
|
|
131
|
+
* Reply-to override for this personalization.
|
|
132
|
+
*/
|
|
133
|
+
replyTo?: EmailsSendRecipient | string;
|
|
134
|
+
/**
|
|
135
|
+
* Subject override for this personalization.
|
|
136
|
+
*/
|
|
137
|
+
subject?: string;
|
|
138
|
+
/**
|
|
139
|
+
* The recipients for this personalization.
|
|
140
|
+
*/
|
|
141
|
+
to: EmailsSendRecipientInput;
|
|
142
|
+
/**
|
|
143
|
+
* Template variables for this personalization.
|
|
144
|
+
*/
|
|
145
|
+
mustaches?: Record<string, unknown>;
|
|
146
|
+
}
|
|
88
147
|
interface EmailsSendOptionsBase {
|
|
89
148
|
/**
|
|
90
149
|
* An array of attachments to be sent with the email.
|
|
@@ -110,7 +169,7 @@ interface EmailsSendOptionsBase {
|
|
|
110
169
|
* @example
|
|
111
170
|
* 'Name <email@example.com>'
|
|
112
171
|
*/
|
|
113
|
-
bcc?:
|
|
172
|
+
bcc?: EmailsSendRecipientInput;
|
|
114
173
|
/**
|
|
115
174
|
* The CC recipients of the email. Can be an array of email addresses or an array of objects with email and name properties or a single email address string or an object with email and name properties.
|
|
116
175
|
* @example
|
|
@@ -127,24 +186,11 @@ interface EmailsSendOptionsBase {
|
|
|
127
186
|
* @example
|
|
128
187
|
* 'Name <email@example.com>'
|
|
129
188
|
*/
|
|
130
|
-
cc?:
|
|
189
|
+
cc?: EmailsSendRecipientInput;
|
|
131
190
|
/**
|
|
132
191
|
* The DKIM settings for the email.
|
|
133
192
|
*/
|
|
134
|
-
dkim?:
|
|
135
|
-
/**
|
|
136
|
-
* Domain used for DKIM signing.
|
|
137
|
-
*/
|
|
138
|
-
domain: string;
|
|
139
|
-
/**
|
|
140
|
-
* DKIM private key encoded in Base64.
|
|
141
|
-
*/
|
|
142
|
-
privateKey?: string;
|
|
143
|
-
/**
|
|
144
|
-
* DKIM selector in the domain DNS records.
|
|
145
|
-
*/
|
|
146
|
-
selector: string;
|
|
147
|
-
};
|
|
193
|
+
dkim?: EmailsSendDkim;
|
|
148
194
|
/**
|
|
149
195
|
* Optional envelope sender address. If not set, the envelope sender defaults to the `from.email` field. Can be overridden per-personalization. Only the email portion is used; the name field is ignored.
|
|
150
196
|
* @example
|
|
@@ -174,6 +220,10 @@ interface EmailsSendOptionsBase {
|
|
|
174
220
|
* - **Case sensitivity**: Headers are treated as case-insensitive. If multiple headers differ only by case, only one will be used, with no guarantee of which one.
|
|
175
221
|
*/
|
|
176
222
|
headers?: Record<string, string>;
|
|
223
|
+
/**
|
|
224
|
+
* Explicit personalization objects. Use this for advanced MailChannels payloads with multiple recipient groups or per-personalization overrides.
|
|
225
|
+
*/
|
|
226
|
+
personalizations?: EmailsSendPersonalization[];
|
|
177
227
|
/**
|
|
178
228
|
* The recipient of the email. Can be an array of email addresses or an array of objects with `email` and `name` properties or a single email address string or an object with `email` and `name` properties.
|
|
179
229
|
* @example
|
|
@@ -190,7 +240,7 @@ interface EmailsSendOptionsBase {
|
|
|
190
240
|
* @example
|
|
191
241
|
* 'Name <email@example.com>'
|
|
192
242
|
*/
|
|
193
|
-
to
|
|
243
|
+
to?: EmailsSendRecipientInput;
|
|
194
244
|
/**
|
|
195
245
|
* Adjust open and click tracking for the message. Please note that enabling tracking for your messages requires a subscription that supports open and click tracking.
|
|
196
246
|
*
|
|
@@ -233,7 +283,20 @@ interface EmailsSendOptionsBase {
|
|
|
233
283
|
*/
|
|
234
284
|
transactional?: boolean;
|
|
235
285
|
}
|
|
236
|
-
type
|
|
286
|
+
type EmailsSendTargetOptions = {
|
|
287
|
+
personalizations: EmailsSendPersonalization[];
|
|
288
|
+
to?: never;
|
|
289
|
+
cc?: never;
|
|
290
|
+
bcc?: never;
|
|
291
|
+
mustaches?: never;
|
|
292
|
+
} | {
|
|
293
|
+
personalizations?: never;
|
|
294
|
+
to: EmailsSendRecipientInput;
|
|
295
|
+
cc?: EmailsSendRecipientInput;
|
|
296
|
+
bcc?: EmailsSendRecipientInput;
|
|
297
|
+
mustaches?: Record<string, unknown>;
|
|
298
|
+
};
|
|
299
|
+
type EmailsSendOptions = EmailsSendOptionsBase & EmailsSendTargetOptions & ({
|
|
237
300
|
/**
|
|
238
301
|
* The HTML content of the email.
|
|
239
302
|
* @example
|
|
@@ -288,8 +351,6 @@ type EmailsSendResponse = SuccessResponse & DataResponse<{
|
|
|
288
351
|
status: "sent" | "failed";
|
|
289
352
|
}[];
|
|
290
353
|
}>;
|
|
291
|
-
//#endregion
|
|
292
|
-
//#region src/types/emails/send-async.d.ts
|
|
293
354
|
type EmailsSendAsyncResponse = DataResponse<{
|
|
294
355
|
/**
|
|
295
356
|
* ISO 8601 timestamp when the request was queued for processing.
|
|
@@ -300,8 +361,6 @@ type EmailsSendAsyncResponse = DataResponse<{
|
|
|
300
361
|
*/
|
|
301
362
|
requestId: string;
|
|
302
363
|
}>;
|
|
303
|
-
//#endregion
|
|
304
|
-
//#region src/types/emails/create-dkim-key.d.ts
|
|
305
364
|
interface EmailsCreateDkimKeyOptions {
|
|
306
365
|
/**
|
|
307
366
|
* Algorithm used for the new key pair Currently, only RSA is supported.
|
|
@@ -367,8 +426,6 @@ interface EmailsDkimKey {
|
|
|
367
426
|
statusModifiedAt?: string;
|
|
368
427
|
}
|
|
369
428
|
type EmailsCreateDkimKeyResponse = DataResponse<EmailsDkimKey>;
|
|
370
|
-
//#endregion
|
|
371
|
-
//#region src/types/emails/check-domain.d.ts
|
|
372
429
|
interface EmailsCheckDomainDkim {
|
|
373
430
|
/**
|
|
374
431
|
* Domain used for DKIM signing.
|
|
@@ -457,8 +514,6 @@ type EmailsCheckDomainResponse = DataResponse<{
|
|
|
457
514
|
};
|
|
458
515
|
references?: string[];
|
|
459
516
|
}>;
|
|
460
|
-
//#endregion
|
|
461
|
-
//#region src/types/emails/get-dkim-keys.d.ts
|
|
462
517
|
interface EmailsGetDkimKeysOptions {
|
|
463
518
|
/**
|
|
464
519
|
* Selector to filter keys by. Must be a maximum of 63 characters.
|
|
@@ -486,8 +541,6 @@ interface EmailsGetDkimKeysOptions {
|
|
|
486
541
|
}
|
|
487
542
|
type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
488
543
|
type EmailsGetDkimKeysResponse = DataResponse<Optional<EmailsDkimKey, "dnsRecords">[]>;
|
|
489
|
-
//#endregion
|
|
490
|
-
//#region src/types/emails/update-dkim-key.d.ts
|
|
491
544
|
interface EmailsUpdateDkimKeyOptions {
|
|
492
545
|
/**
|
|
493
546
|
* Selector of the DKIM key pair to update. Must be a maximum of 63 characters.
|
|
@@ -501,8 +554,6 @@ interface EmailsUpdateDkimKeyOptions {
|
|
|
501
554
|
*/
|
|
502
555
|
status: Exclude<EmailsDkimKey["status"], "active">;
|
|
503
556
|
}
|
|
504
|
-
//#endregion
|
|
505
|
-
//#region src/types/emails/rotate-dkim-key.d.ts
|
|
506
557
|
interface EmailsRotateDkimKeyOptions {
|
|
507
558
|
newKey: {
|
|
508
559
|
/**
|
|
@@ -515,8 +566,6 @@ type EmailsRotateDkimKeyResponse = DataResponse<{
|
|
|
515
566
|
new: EmailsDkimKey;
|
|
516
567
|
rotated: EmailsDkimKey;
|
|
517
568
|
}>;
|
|
518
|
-
//#endregion
|
|
519
|
-
//#region src/modules/emails.d.ts
|
|
520
569
|
declare class Emails {
|
|
521
570
|
protected mailchannels: MailChannelsClient;
|
|
522
571
|
constructor(mailchannels: MailChannelsClient);
|
|
@@ -631,11 +680,7 @@ declare class Emails {
|
|
|
631
680
|
*/
|
|
632
681
|
rotateDkimKey(domain: string, selector: string, options: EmailsRotateDkimKeyOptions): Promise<EmailsRotateDkimKeyResponse>;
|
|
633
682
|
}
|
|
634
|
-
//#endregion
|
|
635
|
-
//#region src/types/webhooks/list.d.ts
|
|
636
683
|
type WebhooksListResponse = DataResponse<string[]>;
|
|
637
|
-
//#endregion
|
|
638
|
-
//#region src/types/webhooks/signing-key.d.ts
|
|
639
684
|
type WebhooksSigningKeyResponse = DataResponse<{
|
|
640
685
|
/**
|
|
641
686
|
* The ID of the key.
|
|
@@ -646,8 +691,6 @@ type WebhooksSigningKeyResponse = DataResponse<{
|
|
|
646
691
|
*/
|
|
647
692
|
key: string;
|
|
648
693
|
}>;
|
|
649
|
-
//#endregion
|
|
650
|
-
//#region src/types/webhooks/validate.d.ts
|
|
651
694
|
type WebhooksValidateResponse = DataResponse<{
|
|
652
695
|
/**
|
|
653
696
|
* Indicates whether all webhook validations passed.
|
|
@@ -680,8 +723,6 @@ type WebhooksValidateResponse = DataResponse<{
|
|
|
680
723
|
} | null;
|
|
681
724
|
}[];
|
|
682
725
|
}>;
|
|
683
|
-
//#endregion
|
|
684
|
-
//#region src/types/webhooks/verify.d.ts
|
|
685
726
|
interface WebhooksVerifyOptions {
|
|
686
727
|
/**
|
|
687
728
|
* The raw body of the incoming webhook request as a string. This should be the exact payload received from the webhook, without any modifications or parsing, to ensure accurate signature verification.
|
|
@@ -700,8 +741,74 @@ interface WebhooksVerifyOptions {
|
|
|
700
741
|
*/
|
|
701
742
|
publicKey?: string;
|
|
702
743
|
}
|
|
703
|
-
|
|
704
|
-
|
|
744
|
+
type WebhooksBatchStatus = "1xx" | "2xx" | "3xx" | "4xx" | "5xx" | "no_response";
|
|
745
|
+
type WebhooksBatchResponseStatus = "1xx_response" | "2xx_response" | "3xx_response" | "4xx_response" | "5xx_response" | "no_response";
|
|
746
|
+
interface WebhooksBatchesOptions {
|
|
747
|
+
/**
|
|
748
|
+
* Inclusive lower bound (UTC) for filtering webhook batches by creation time. Formats: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ`.
|
|
749
|
+
*/
|
|
750
|
+
createdAfter?: string;
|
|
751
|
+
/**
|
|
752
|
+
* Exclusive upper bound (UTC) for filtering webhook batches by creation time. Formats: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ`.
|
|
753
|
+
*/
|
|
754
|
+
createdBefore?: string;
|
|
755
|
+
/**
|
|
756
|
+
* Filters webhook batches by webhook response status category. If not provided, batches with all categories are returned.
|
|
757
|
+
*/
|
|
758
|
+
statuses?: WebhooksBatchStatus[];
|
|
759
|
+
/**
|
|
760
|
+
* Filters webhook batches by the webhook endpoint to which events in the batch were posted.
|
|
761
|
+
*/
|
|
762
|
+
webhook?: string;
|
|
763
|
+
/**
|
|
764
|
+
* The maximum number of webhook batches to return. Must be between `1` and `500`.
|
|
765
|
+
* @default 500
|
|
766
|
+
*/
|
|
767
|
+
limit?: number;
|
|
768
|
+
/**
|
|
769
|
+
* The number of webhook batches to skip before starting to collect the result set.
|
|
770
|
+
* @default 0
|
|
771
|
+
*/
|
|
772
|
+
offset?: number;
|
|
773
|
+
}
|
|
774
|
+
interface WebhooksBatch {
|
|
775
|
+
/**
|
|
776
|
+
* Unique identifier for the webhook batch.
|
|
777
|
+
*/
|
|
778
|
+
batchId: number;
|
|
779
|
+
/**
|
|
780
|
+
* Timestamp of when the webhook batch was created.
|
|
781
|
+
*/
|
|
782
|
+
createdAt: string;
|
|
783
|
+
/**
|
|
784
|
+
* Customer handle associated with the webhook batch.
|
|
785
|
+
*/
|
|
786
|
+
customerHandle: string;
|
|
787
|
+
/**
|
|
788
|
+
* Duration of the webhook batch, measured from the time the request was sent to the webhook endpoint until the response was received.
|
|
789
|
+
*/
|
|
790
|
+
duration?: {
|
|
791
|
+
unit: "milliseconds";
|
|
792
|
+
value: number;
|
|
793
|
+
};
|
|
794
|
+
/**
|
|
795
|
+
* Number of events in the webhook batch.
|
|
796
|
+
*/
|
|
797
|
+
eventCount: number;
|
|
798
|
+
/**
|
|
799
|
+
* Status of the webhook batch.
|
|
800
|
+
*/
|
|
801
|
+
status: WebhooksBatchResponseStatus;
|
|
802
|
+
/**
|
|
803
|
+
* HTTP status code returned by the webhook endpoint.
|
|
804
|
+
*/
|
|
805
|
+
statusCode: number | null;
|
|
806
|
+
/**
|
|
807
|
+
* Webhook endpoint to which events in the batch were posted.
|
|
808
|
+
*/
|
|
809
|
+
webhook: string;
|
|
810
|
+
}
|
|
811
|
+
type WebhooksBatchesResponse = DataResponse<WebhooksBatch[]>;
|
|
705
812
|
declare class Webhooks {
|
|
706
813
|
protected mailchannels: MailChannelsClient;
|
|
707
814
|
constructor(mailchannels: MailChannelsClient);
|
|
@@ -772,9 +879,17 @@ declare class Webhooks {
|
|
|
772
879
|
* ```
|
|
773
880
|
*/
|
|
774
881
|
verify(options: WebhooksVerifyOptions): Promise<boolean>;
|
|
882
|
+
/**
|
|
883
|
+
* Retrieves paged webhook batches associated with the customer. The time range specified by `createdAfter` and `createdBefore` must not exceed 31 days. If neither is specified, the default time range is the last 3 days.
|
|
884
|
+
* @param options - The options for listing webhook batches.
|
|
885
|
+
* @example
|
|
886
|
+
* ```ts
|
|
887
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
888
|
+
* const { data, error } = await mailchannels.webhooks.batches()
|
|
889
|
+
* ```
|
|
890
|
+
*/
|
|
891
|
+
batches(options?: WebhooksBatchesOptions): Promise<WebhooksBatchesResponse>;
|
|
775
892
|
}
|
|
776
|
-
//#endregion
|
|
777
|
-
//#region src/types/sub-accounts/create.d.ts
|
|
778
893
|
interface SubAccountsAccount {
|
|
779
894
|
/**
|
|
780
895
|
* The name of the company associated with the sub-account.
|
|
@@ -790,8 +905,6 @@ interface SubAccountsAccount {
|
|
|
790
905
|
handle: string;
|
|
791
906
|
}
|
|
792
907
|
type SubAccountsCreateResponse = DataResponse<SubAccountsAccount>;
|
|
793
|
-
//#endregion
|
|
794
|
-
//#region src/types/sub-accounts/list.d.ts
|
|
795
908
|
interface SubAccountsListOptions {
|
|
796
909
|
/**
|
|
797
910
|
* Possible values are `1` to `1000`.
|
|
@@ -805,8 +918,6 @@ interface SubAccountsListOptions {
|
|
|
805
918
|
offset?: number;
|
|
806
919
|
}
|
|
807
920
|
type SubAccountsListResponse = DataResponse<SubAccountsAccount[]>;
|
|
808
|
-
//#endregion
|
|
809
|
-
//#region src/types/sub-accounts/api-key.d.ts
|
|
810
921
|
interface SubAccountsApiKey {
|
|
811
922
|
/**
|
|
812
923
|
* The API key ID for the sub-account.
|
|
@@ -831,8 +942,6 @@ interface SubAccountsListApiKeyOptions {
|
|
|
831
942
|
offset?: number;
|
|
832
943
|
}
|
|
833
944
|
type SubAccountsListApiKeyResponse = DataResponse<SubAccountsApiKey[]>;
|
|
834
|
-
//#endregion
|
|
835
|
-
//#region src/types/sub-accounts/smtp-password.d.ts
|
|
836
945
|
interface SubAccountsSmtpPassword {
|
|
837
946
|
/**
|
|
838
947
|
* Whether the SMTP password is enabled.
|
|
@@ -849,14 +958,10 @@ interface SubAccountsSmtpPassword {
|
|
|
849
958
|
}
|
|
850
959
|
type SubAccountsCreateSmtpPasswordResponse = DataResponse<SubAccountsSmtpPassword>;
|
|
851
960
|
type SubAccountsListSmtpPasswordResponse = DataResponse<SubAccountsSmtpPassword[]>;
|
|
852
|
-
//#endregion
|
|
853
|
-
//#region src/types/sub-accounts/limit.d.ts
|
|
854
961
|
interface SubAccountsLimit {
|
|
855
962
|
sends: number;
|
|
856
963
|
}
|
|
857
964
|
type SubAccountsLimitResponse = DataResponse<SubAccountsLimit>;
|
|
858
|
-
//#endregion
|
|
859
|
-
//#region src/types/sub-accounts/usage.d.ts
|
|
860
965
|
interface SubAccountsUsage {
|
|
861
966
|
/**
|
|
862
967
|
* The end date of the current billing period (ISO 8601 format).
|
|
@@ -874,8 +979,6 @@ interface SubAccountsUsage {
|
|
|
874
979
|
total: number;
|
|
875
980
|
}
|
|
876
981
|
type SubAccountsUsageResponse = DataResponse<SubAccountsUsage>;
|
|
877
|
-
//#endregion
|
|
878
|
-
//#region src/modules/sub-accounts.d.ts
|
|
879
982
|
declare class SubAccounts {
|
|
880
983
|
protected mailchannels: MailChannelsClient;
|
|
881
984
|
private static readonly COMPANY_PATTERN;
|
|
@@ -1037,8 +1140,6 @@ declare class SubAccounts {
|
|
|
1037
1140
|
*/
|
|
1038
1141
|
getUsage(handle: string): Promise<SubAccountsUsageResponse>;
|
|
1039
1142
|
}
|
|
1040
|
-
//#endregion
|
|
1041
|
-
//#region src/types/metrics/engagement.d.ts
|
|
1042
1143
|
interface MetricsEngagement {
|
|
1043
1144
|
/**
|
|
1044
1145
|
* A series of metrics aggregations bucketed by time interval (e.g. hour, day).
|
|
@@ -1057,8 +1158,6 @@ interface MetricsEngagement {
|
|
|
1057
1158
|
startTime: string;
|
|
1058
1159
|
}
|
|
1059
1160
|
type MetricsEngagementResponse = DataResponse<MetricsEngagement>;
|
|
1060
|
-
//#endregion
|
|
1061
|
-
//#region src/types/metrics/performance.d.ts
|
|
1062
1161
|
interface MetricsPerformance {
|
|
1063
1162
|
/**
|
|
1064
1163
|
* Count of messages bounced during the specified time range.
|
|
@@ -1090,8 +1189,6 @@ interface MetricsPerformance {
|
|
|
1090
1189
|
startTime: string;
|
|
1091
1190
|
}
|
|
1092
1191
|
type MetricsPerformanceResponse = DataResponse<MetricsPerformance>;
|
|
1093
|
-
//#endregion
|
|
1094
|
-
//#region src/types/metrics/recipient-behaviour.d.ts
|
|
1095
1192
|
interface MetricsRecipientBehaviour {
|
|
1096
1193
|
/**
|
|
1097
1194
|
* A series of metrics aggregations bucketed by time interval (e.g. hour, day).
|
|
@@ -1118,8 +1215,6 @@ interface MetricsRecipientBehaviour {
|
|
|
1118
1215
|
unsubscribed: number;
|
|
1119
1216
|
}
|
|
1120
1217
|
type MetricsRecipientBehaviourResponse = DataResponse<MetricsRecipientBehaviour>;
|
|
1121
|
-
//#endregion
|
|
1122
|
-
//#region src/types/metrics/volume.d.ts
|
|
1123
1218
|
interface MetricsVolume {
|
|
1124
1219
|
/**
|
|
1125
1220
|
* A series of metrics aggregations bucketed by time interval (e.g. hour, day).
|
|
@@ -1151,8 +1246,6 @@ interface MetricsVolume {
|
|
|
1151
1246
|
startTime: string;
|
|
1152
1247
|
}
|
|
1153
1248
|
type MetricsVolumeResponse = DataResponse<MetricsVolume>;
|
|
1154
|
-
//#endregion
|
|
1155
|
-
//#region src/types/metrics/usage.d.ts
|
|
1156
1249
|
type MetricsUsageResponse = DataResponse<{
|
|
1157
1250
|
/**
|
|
1158
1251
|
* The end date of the current billing period (ISO 8601 format).
|
|
@@ -1169,8 +1262,6 @@ type MetricsUsageResponse = DataResponse<{
|
|
|
1169
1262
|
*/
|
|
1170
1263
|
total: number;
|
|
1171
1264
|
}>;
|
|
1172
|
-
//#endregion
|
|
1173
|
-
//#region src/types/metrics/senders.d.ts
|
|
1174
1265
|
type MetricsSendersType = "sub-accounts" | "campaigns";
|
|
1175
1266
|
interface MetricsSendersOptions {
|
|
1176
1267
|
/**
|
|
@@ -1220,8 +1311,6 @@ interface MetricsSenders {
|
|
|
1220
1311
|
total: number;
|
|
1221
1312
|
}
|
|
1222
1313
|
type MetricsSendersResponse = DataResponse<MetricsSenders>;
|
|
1223
|
-
//#endregion
|
|
1224
|
-
//#region src/types/metrics/index.d.ts
|
|
1225
1314
|
interface MetricsBucket {
|
|
1226
1315
|
/**
|
|
1227
1316
|
* The number of events or occurrences aggregated within this time period.
|
|
@@ -1253,8 +1342,6 @@ interface MetricsOptions {
|
|
|
1253
1342
|
*/
|
|
1254
1343
|
interval?: "hour" | "day" | "week" | "month";
|
|
1255
1344
|
}
|
|
1256
|
-
//#endregion
|
|
1257
|
-
//#region src/modules/metrics.d.ts
|
|
1258
1345
|
declare class Metrics {
|
|
1259
1346
|
protected mailchannels: MailChannelsClient;
|
|
1260
1347
|
constructor(mailchannels: MailChannelsClient);
|
|
@@ -1319,8 +1406,6 @@ declare class Metrics {
|
|
|
1319
1406
|
*/
|
|
1320
1407
|
senders(type: MetricsSendersType, options?: MetricsSendersOptions): Promise<MetricsSendersResponse>;
|
|
1321
1408
|
}
|
|
1322
|
-
//#endregion
|
|
1323
|
-
//#region src/types/suppressions/create.d.ts
|
|
1324
1409
|
type SuppressionsTypes = "transactional" | "non-transactional";
|
|
1325
1410
|
interface SuppressionsCreateOptions {
|
|
1326
1411
|
/**
|
|
@@ -1347,8 +1432,6 @@ interface SuppressionsCreateOptions {
|
|
|
1347
1432
|
types?: SuppressionsTypes[];
|
|
1348
1433
|
}[];
|
|
1349
1434
|
}
|
|
1350
|
-
//#endregion
|
|
1351
|
-
//#region src/types/suppressions/list.d.ts
|
|
1352
1435
|
type SuppressionsSource = "api" | "unsubscribe_link" | "list_unsubscribe" | "hard_bounce" | "spam_complaint" | "all";
|
|
1353
1436
|
interface SuppressionsListOptions {
|
|
1354
1437
|
/**
|
|
@@ -1390,8 +1473,6 @@ interface SuppressionsListEntry {
|
|
|
1390
1473
|
types: SuppressionsTypes[];
|
|
1391
1474
|
}
|
|
1392
1475
|
type SuppressionsListResponse = DataResponse<SuppressionsListEntry[]>;
|
|
1393
|
-
//#endregion
|
|
1394
|
-
//#region src/modules/suppressions.d.ts
|
|
1395
1476
|
declare class Suppressions {
|
|
1396
1477
|
protected mailchannels: MailChannelsClient;
|
|
1397
1478
|
constructor(mailchannels: MailChannelsClient);
|
|
@@ -1428,8 +1509,6 @@ declare class Suppressions {
|
|
|
1428
1509
|
*/
|
|
1429
1510
|
list(options?: SuppressionsListOptions): Promise<SuppressionsListResponse>;
|
|
1430
1511
|
}
|
|
1431
|
-
//#endregion
|
|
1432
|
-
//#region src/types/lists/entry.d.ts
|
|
1433
1512
|
type ListNames = "blocklist" | "safelist" | "blacklist" | "whitelist";
|
|
1434
1513
|
interface ListEntryOptions {
|
|
1435
1514
|
/**
|
|
@@ -1448,8 +1527,6 @@ interface ListEntry {
|
|
|
1448
1527
|
}
|
|
1449
1528
|
type ListEntryResponse = DataResponse<ListEntry>;
|
|
1450
1529
|
type ListEntriesResponse = DataResponse<ListEntry[]>;
|
|
1451
|
-
//#endregion
|
|
1452
|
-
//#region src/types/domains/provision.d.ts
|
|
1453
1530
|
interface DomainsData {
|
|
1454
1531
|
/**
|
|
1455
1532
|
* The domain name.
|
|
@@ -1546,8 +1623,6 @@ type DomainsBulkProvisionResponse = DataResponse<{
|
|
|
1546
1623
|
comment?: string;
|
|
1547
1624
|
}[];
|
|
1548
1625
|
}>;
|
|
1549
|
-
//#endregion
|
|
1550
|
-
//#region src/types/domains/list.d.ts
|
|
1551
1626
|
interface DomainsListOptions {
|
|
1552
1627
|
/**
|
|
1553
1628
|
* A list of domains to fetch. If this parameter is present, only domains whose name matches an item in this list are returned.
|
|
@@ -1574,8 +1649,6 @@ type DomainsListResponse = DataResponse<{
|
|
|
1574
1649
|
*/
|
|
1575
1650
|
total: number;
|
|
1576
1651
|
}>;
|
|
1577
|
-
//#endregion
|
|
1578
|
-
//#region src/types/domains/create-login-link.d.ts
|
|
1579
1652
|
interface DomainsCreateLoginLink {
|
|
1580
1653
|
/**
|
|
1581
1654
|
* If a user browses to this URL, they will be automatically logged in as a domain admin.
|
|
@@ -1583,8 +1656,6 @@ interface DomainsCreateLoginLink {
|
|
|
1583
1656
|
link: string;
|
|
1584
1657
|
}
|
|
1585
1658
|
type DomainsCreateLoginLinkResponse = DataResponse<DomainsCreateLoginLink>;
|
|
1586
|
-
//#endregion
|
|
1587
|
-
//#region src/types/domains/downstream-addresses.d.ts
|
|
1588
1659
|
interface DomainsListDownstreamAddressesOptions {
|
|
1589
1660
|
/**
|
|
1590
1661
|
* The number of records to return.
|
|
@@ -1616,8 +1687,6 @@ interface DomainsDownstreamAddress {
|
|
|
1616
1687
|
weight: number;
|
|
1617
1688
|
}
|
|
1618
1689
|
type DomainsListDownstreamAddressesResponse = DataResponse<DomainsDownstreamAddress[]>;
|
|
1619
|
-
//#endregion
|
|
1620
|
-
//#region src/types/domains/bulk-create-login-links.d.ts
|
|
1621
1690
|
interface DomainsBulkCreateLoginLinkResult {
|
|
1622
1691
|
/**
|
|
1623
1692
|
* The domain the request was for.
|
|
@@ -1638,8 +1707,6 @@ interface DomainsBulkCreateLoginLinks {
|
|
|
1638
1707
|
errors: Omit<DomainsBulkCreateLoginLinkResult, "loginLink">[];
|
|
1639
1708
|
}
|
|
1640
1709
|
type DomainsBulkCreateLoginLinksResponse = DataResponse<DomainsBulkCreateLoginLinks>;
|
|
1641
|
-
//#endregion
|
|
1642
|
-
//#region src/modules/domains.d.ts
|
|
1643
1710
|
declare class Domains {
|
|
1644
1711
|
protected mailchannels: MailChannelsClient;
|
|
1645
1712
|
constructor(mailchannels: MailChannelsClient);
|
|
@@ -1797,8 +1864,6 @@ declare class Domains {
|
|
|
1797
1864
|
*/
|
|
1798
1865
|
bulkCreateLoginLinks(domains: string[]): Promise<DomainsBulkCreateLoginLinksResponse>;
|
|
1799
1866
|
}
|
|
1800
|
-
//#endregion
|
|
1801
|
-
//#region src/modules/lists.d.ts
|
|
1802
1867
|
declare class Lists {
|
|
1803
1868
|
protected mailchannels: MailChannelsClient;
|
|
1804
1869
|
constructor(mailchannels: MailChannelsClient);
|
|
@@ -1839,8 +1904,6 @@ declare class Lists {
|
|
|
1839
1904
|
*/
|
|
1840
1905
|
deleteListEntry(options: ListEntryOptions): Promise<SuccessResponse>;
|
|
1841
1906
|
}
|
|
1842
|
-
//#endregion
|
|
1843
|
-
//#region src/types/users/create.d.ts
|
|
1844
1907
|
interface UsersCreateOptions {
|
|
1845
1908
|
/**
|
|
1846
1909
|
* Flag to indicate if the user is a domain admin or a regular user.
|
|
@@ -1873,8 +1936,6 @@ type UsersCreateResponse = DataResponse<{
|
|
|
1873
1936
|
action: "safelist" | "blocklist";
|
|
1874
1937
|
}[];
|
|
1875
1938
|
}>;
|
|
1876
|
-
//#endregion
|
|
1877
|
-
//#region src/modules/users.d.ts
|
|
1878
1939
|
declare class Users {
|
|
1879
1940
|
protected mailchannels: MailChannelsClient;
|
|
1880
1941
|
constructor(mailchannels: MailChannelsClient);
|
|
@@ -1931,8 +1992,6 @@ declare class Users {
|
|
|
1931
1992
|
*/
|
|
1932
1993
|
deleteListEntry(email: string, options: ListEntryOptions): Promise<SuccessResponse>;
|
|
1933
1994
|
}
|
|
1934
|
-
//#endregion
|
|
1935
|
-
//#region src/types/service/subscriptions.d.ts
|
|
1936
1995
|
type ServiceSubscriptionsResponse = DataResponse<{
|
|
1937
1996
|
active: boolean;
|
|
1938
1997
|
activeAccountsCount: number;
|
|
@@ -1946,8 +2005,6 @@ type ServiceSubscriptionsResponse = DataResponse<{
|
|
|
1946
2005
|
name: string;
|
|
1947
2006
|
};
|
|
1948
2007
|
}[]>;
|
|
1949
|
-
//#endregion
|
|
1950
|
-
//#region src/types/service/report.d.ts
|
|
1951
2008
|
interface ServiceReportOptions {
|
|
1952
2009
|
/**
|
|
1953
2010
|
* The report type. It can be either `false_negative` or `false_positive`.
|
|
@@ -1972,8 +2029,6 @@ interface ServiceReportOptions {
|
|
|
1972
2029
|
name?: string;
|
|
1973
2030
|
};
|
|
1974
2031
|
}
|
|
1975
|
-
//#endregion
|
|
1976
|
-
//#region src/modules/service.d.ts
|
|
1977
2032
|
declare class Service {
|
|
1978
2033
|
protected mailchannels: MailChannelsClient;
|
|
1979
2034
|
constructor(mailchannels: MailChannelsClient);
|
|
@@ -2008,8 +2063,6 @@ declare class Service {
|
|
|
2008
2063
|
*/
|
|
2009
2064
|
report(options: ServiceReportOptions): Promise<SuccessResponse>;
|
|
2010
2065
|
}
|
|
2011
|
-
//#endregion
|
|
2012
|
-
//#region src/types/webhooks/events.d.ts
|
|
2013
2066
|
type WebhookEventType = "processed" | "delivered" | "open" | "click" | "hard-bounced" | "soft-bounced" | "dropped" | "complained" | "unsubscribed" | "test";
|
|
2014
2067
|
interface WebhookEventBase<T extends WebhookEventType> {
|
|
2015
2068
|
/**
|
|
@@ -2083,8 +2136,6 @@ interface WebhookEventUnsubscribed extends WebhookEventBase<"unsubscribed"> {}
|
|
|
2083
2136
|
interface WebhookEventTest extends Omit<WebhookEventBase<"test">, "recipients" | "campaign_id"> {}
|
|
2084
2137
|
type WebhookEvent = WebhookEventProcessed | WebhookEventDelivered | WebhookEventOpen | WebhookEventClick | WebhookEventHardBounced | WebhookEventSoftBounced | WebhookEventDropped | WebhookEventComplained | WebhookEventUnsubscribed | WebhookEventTest;
|
|
2085
2138
|
type WebhookEvents = WebhookEvent[];
|
|
2086
|
-
//#endregion
|
|
2087
|
-
//#region src/mailchannels.d.ts
|
|
2088
2139
|
declare class MailChannels extends MailChannelsClient {
|
|
2089
2140
|
readonly emails: Emails;
|
|
2090
2141
|
readonly webhooks: Webhooks;
|
|
@@ -2095,7 +2146,6 @@ declare class MailChannels extends MailChannelsClient {
|
|
|
2095
2146
|
readonly lists: Lists;
|
|
2096
2147
|
readonly users: Users;
|
|
2097
2148
|
readonly service: Service;
|
|
2098
|
-
constructor(key: string);
|
|
2149
|
+
constructor(key: string, options?: MailChannelsClientOptions);
|
|
2099
2150
|
}
|
|
2100
|
-
|
|
2101
|
-
export { DataResponse, Domains, DomainsBulkCreateLoginLinks, DomainsBulkCreateLoginLinksResponse, DomainsBulkProvisionOptions, DomainsBulkProvisionResponse, DomainsCreateLoginLink, DomainsCreateLoginLinkResponse, DomainsData, DomainsDownstreamAddress, DomainsListDownstreamAddressesOptions, DomainsListDownstreamAddressesResponse, DomainsListOptions, DomainsListResponse, DomainsProvisionOptions, DomainsProvisionResponse, Emails, EmailsCheckDomainOptions, EmailsCheckDomainResponse, EmailsCheckDomainVerdict, EmailsCreateDkimKeyOptions, EmailsCreateDkimKeyResponse, EmailsDkimKey, EmailsDkimKeyStatus, EmailsGetDkimKeysOptions, EmailsGetDkimKeysResponse, EmailsRotateDkimKeyOptions, EmailsRotateDkimKeyResponse, EmailsSendAsyncResponse, EmailsSendAttachment, EmailsSendOptions, EmailsSendRecipient, EmailsSendResponse, EmailsSendTracking, EmailsUpdateDkimKeyOptions, ErrorResponse, ListEntriesResponse, ListEntry, ListEntryOptions, ListEntryResponse, ListNames, Lists, MailChannels, MailChannelsClient, Metrics, MetricsBucket, MetricsEngagement, MetricsEngagementResponse, MetricsOptions, MetricsPerformance, MetricsPerformanceResponse, MetricsRecipientBehaviour, MetricsRecipientBehaviourResponse, MetricsSenders, MetricsSendersOptions, MetricsSendersResponse, MetricsSendersType, MetricsUsageResponse, MetricsVolume, MetricsVolumeResponse, Service, ServiceReportOptions, ServiceSubscriptionsResponse, SubAccounts, SubAccountsAccount, SubAccountsApiKey, SubAccountsCreateApiKeyResponse, SubAccountsCreateResponse, SubAccountsCreateSmtpPasswordResponse, SubAccountsLimit, SubAccountsLimitResponse, SubAccountsListApiKeyOptions, SubAccountsListApiKeyResponse, SubAccountsListOptions, SubAccountsListResponse, SubAccountsListSmtpPasswordResponse, SubAccountsSmtpPassword, SubAccountsUsage, SubAccountsUsageResponse, SuccessResponse, Suppressions, SuppressionsCreateOptions, SuppressionsListEntry, SuppressionsListOptions, SuppressionsListResponse, SuppressionsSource, SuppressionsTypes, Users, UsersCreateOptions, UsersCreateResponse, WebhookEvent, WebhookEventClick, WebhookEventComplained, WebhookEventDelivered, WebhookEventDropped, WebhookEventHardBounced, WebhookEventOpen, WebhookEventProcessed, WebhookEventSoftBounced, WebhookEventTest, WebhookEventType, WebhookEventUnsubscribed, WebhookEvents, Webhooks, WebhooksListResponse, WebhooksSigningKeyResponse, WebhooksValidateResponse, WebhooksVerifyOptions };
|
|
2151
|
+
export { DataResponse, Domains, DomainsBulkCreateLoginLinks, DomainsBulkCreateLoginLinksResponse, DomainsBulkProvisionOptions, DomainsBulkProvisionResponse, DomainsCreateLoginLink, DomainsCreateLoginLinkResponse, DomainsData, DomainsDownstreamAddress, DomainsListDownstreamAddressesOptions, DomainsListDownstreamAddressesResponse, DomainsListOptions, DomainsListResponse, DomainsProvisionOptions, DomainsProvisionResponse, Emails, EmailsCheckDomainOptions, EmailsCheckDomainResponse, EmailsCheckDomainVerdict, EmailsCreateDkimKeyOptions, EmailsCreateDkimKeyResponse, EmailsDkimKey, EmailsDkimKeyStatus, EmailsGetDkimKeysOptions, EmailsGetDkimKeysResponse, EmailsRotateDkimKeyOptions, EmailsRotateDkimKeyResponse, EmailsSendAsyncResponse, EmailsSendAttachment, EmailsSendDkim, EmailsSendOptions, EmailsSendPersonalization, EmailsSendRecipient, EmailsSendRecipientInput, EmailsSendResponse, EmailsSendTracking, EmailsUpdateDkimKeyOptions, ErrorResponse, ListEntriesResponse, ListEntry, ListEntryOptions, ListEntryResponse, ListNames, Lists, MailChannels, MailChannelsClient, type MailChannelsClientOptions, Metrics, MetricsBucket, MetricsEngagement, MetricsEngagementResponse, MetricsOptions, MetricsPerformance, MetricsPerformanceResponse, MetricsRecipientBehaviour, MetricsRecipientBehaviourResponse, MetricsSenders, MetricsSendersOptions, MetricsSendersResponse, MetricsSendersType, MetricsUsageResponse, MetricsVolume, MetricsVolumeResponse, Service, ServiceReportOptions, ServiceSubscriptionsResponse, SubAccounts, SubAccountsAccount, SubAccountsApiKey, SubAccountsCreateApiKeyResponse, SubAccountsCreateResponse, SubAccountsCreateSmtpPasswordResponse, SubAccountsLimit, SubAccountsLimitResponse, SubAccountsListApiKeyOptions, SubAccountsListApiKeyResponse, SubAccountsListOptions, SubAccountsListResponse, SubAccountsListSmtpPasswordResponse, SubAccountsSmtpPassword, SubAccountsUsage, SubAccountsUsageResponse, SuccessResponse, Suppressions, SuppressionsCreateOptions, SuppressionsListEntry, SuppressionsListOptions, SuppressionsListResponse, SuppressionsSource, SuppressionsTypes, Users, UsersCreateOptions, UsersCreateResponse, WebhookEvent, WebhookEventClick, WebhookEventComplained, WebhookEventDelivered, WebhookEventDropped, WebhookEventHardBounced, WebhookEventOpen, WebhookEventProcessed, WebhookEventSoftBounced, WebhookEventTest, WebhookEventType, WebhookEventUnsubscribed, WebhookEvents, Webhooks, WebhooksBatch, WebhooksBatchResponseStatus, WebhooksBatchStatus, WebhooksBatchesOptions, WebhooksBatchesResponse, WebhooksListResponse, WebhooksSigningKeyResponse, WebhooksValidateResponse, WebhooksVerifyOptions };
|