mailchannels-sdk 1.0.0 → 1.1.0
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/.agents/skills/mailchannels-js/SKILL.md +91 -0
- package/.agents/skills/mailchannels-js/resources/attachments.md +113 -0
- package/.agents/skills/mailchannels-js/resources/clients-and-transport.md +98 -0
- package/.agents/skills/mailchannels-js/resources/custom-headers.md +64 -0
- package/.agents/skills/mailchannels-js/resources/dkim.md +148 -0
- package/.agents/skills/mailchannels-js/resources/domain-checks.md +100 -0
- package/.agents/skills/mailchannels-js/resources/error-handling.md +142 -0
- package/.agents/skills/mailchannels-js/resources/metrics-and-usage.md +113 -0
- package/.agents/skills/mailchannels-js/resources/overview.md +91 -0
- package/.agents/skills/mailchannels-js/resources/sending.md +195 -0
- package/.agents/skills/mailchannels-js/resources/sub-accounts.md +129 -0
- package/.agents/skills/mailchannels-js/resources/suppressions.md +91 -0
- package/.agents/skills/mailchannels-js/resources/templates.md +97 -0
- package/.agents/skills/mailchannels-js/resources/testing.md +95 -0
- package/.agents/skills/mailchannels-js/resources/unsubscribe.md +73 -0
- package/.agents/skills/mailchannels-js/resources/webhooks.md +174 -0
- package/README.md +64 -0
- package/dist/_chunks/simulator.mjs +1 -1
- package/dist/mailchannels.d.mts +428 -379
- package/dist/mailchannels.mjs +401 -270
- package/package.json +7 -6
package/dist/mailchannels.d.mts
CHANGED
|
@@ -474,6 +474,7 @@ type EmailsQueueResponse = DataResponse<{
|
|
|
474
474
|
*/
|
|
475
475
|
requestId: string;
|
|
476
476
|
}>;
|
|
477
|
+
/** @deprecated Use `EmailsQueueResponse` instead. */
|
|
477
478
|
type EmailsSendAsyncResponse = EmailsQueueResponse;
|
|
478
479
|
declare class Emails {
|
|
479
480
|
protected mailchannels: MailChannelsClient;
|
|
@@ -584,6 +585,118 @@ interface DomainsDkimKey {
|
|
|
584
585
|
statusModifiedAt?: string;
|
|
585
586
|
}
|
|
586
587
|
type DomainsDkimCreateResponse = DataResponse<DomainsDkimKey>;
|
|
588
|
+
interface DomainsDkimListOptions {
|
|
589
|
+
/**
|
|
590
|
+
* Selector to filter keys by. Must be a maximum of 63 characters.
|
|
591
|
+
*/
|
|
592
|
+
selector?: string;
|
|
593
|
+
/**
|
|
594
|
+
* Status to filter keys by.
|
|
595
|
+
*/
|
|
596
|
+
status?: DomainsDkimKey["status"];
|
|
597
|
+
/**
|
|
598
|
+
* Number of keys to skip before returning results.
|
|
599
|
+
* @default 0
|
|
600
|
+
*/
|
|
601
|
+
offset?: number;
|
|
602
|
+
/**
|
|
603
|
+
* Maximum number of keys to return. Maximum is `100` and minimum is `1`.
|
|
604
|
+
* @default 10
|
|
605
|
+
*/
|
|
606
|
+
limit?: number;
|
|
607
|
+
/**
|
|
608
|
+
* If `true`, includes the suggested DKIM DNS record for each returned key.
|
|
609
|
+
* @default false
|
|
610
|
+
*/
|
|
611
|
+
includeDnsRecord?: boolean;
|
|
612
|
+
}
|
|
613
|
+
type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
614
|
+
type DomainsDkimListResponse = DataResponse<Optional<DomainsDkimKey, "dnsRecords">[]>;
|
|
615
|
+
interface DomainsDkimUpdateStatusOptions {
|
|
616
|
+
/**
|
|
617
|
+
* Selector of the DKIM key pair to update. Must be a maximum of 63 characters.
|
|
618
|
+
*/
|
|
619
|
+
selector: string;
|
|
620
|
+
/**
|
|
621
|
+
* New status of the DKIM key pair.
|
|
622
|
+
* - `revoked`: Indicates that the key is compromised and should not be used.
|
|
623
|
+
* - `retired`: Indicates that the key has been rotated and is no longer in use.
|
|
624
|
+
* - `rotated`: Indicates that the key is going through the rotation process. Only active key pairs can be updated to this status, and no new key pair is created. The rotated key can be used to sign emails for 3 days after the status update, and will automatically change to `retired` 2 weeks after update. For a smooth key transition, it is recommended to create and publish a new key pair before signing is disabled for the rotated key.
|
|
625
|
+
*/
|
|
626
|
+
status: Exclude<DomainsDkimKey["status"], "active">;
|
|
627
|
+
}
|
|
628
|
+
interface DomainsDkimRotateOptions {
|
|
629
|
+
newKey: {
|
|
630
|
+
/**
|
|
631
|
+
* Selector for the new key pair. Must be a maximum of 63 characters.
|
|
632
|
+
*/
|
|
633
|
+
selector: string;
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
type DomainsDkimRotateResponse = DataResponse<{
|
|
637
|
+
new: DomainsDkimKey;
|
|
638
|
+
rotated: DomainsDkimKey;
|
|
639
|
+
}>;
|
|
640
|
+
declare class DomainsDkim {
|
|
641
|
+
private mailchannels;
|
|
642
|
+
constructor(mailchannels: MailChannelsClient);
|
|
643
|
+
/**
|
|
644
|
+
* Create a DKIM key pair for a specified domain and selector using the specified algorithm and key length, for the current customer.
|
|
645
|
+
* @param domain - The domain to create the DKIM key for.
|
|
646
|
+
* @param options - DKIM key creation options.
|
|
647
|
+
* @example
|
|
648
|
+
* ```ts
|
|
649
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
650
|
+
* const { data, error } = await mailchannels.domains.dkim.create('example.com', {
|
|
651
|
+
* selector: 'mailchannels'
|
|
652
|
+
* })
|
|
653
|
+
* ```
|
|
654
|
+
*/
|
|
655
|
+
create(domain: string, options: DomainsDkimCreateOptions): Promise<DomainsDkimCreateResponse>;
|
|
656
|
+
/**
|
|
657
|
+
* Search for DKIM keys by domain, with optional filters. If selector is provided, at most one key will be returned.
|
|
658
|
+
* @param domain - The domain to search DKIM keys for.
|
|
659
|
+
* @param options - The options to filter DKIM keys by.
|
|
660
|
+
* @example
|
|
661
|
+
* ```ts
|
|
662
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
663
|
+
* const { data, error } = await mailchannels.domains.dkim.list('example.com', {
|
|
664
|
+
* includeDnsRecord: true
|
|
665
|
+
* })
|
|
666
|
+
* ```
|
|
667
|
+
*/
|
|
668
|
+
list(domain: string, options?: DomainsDkimListOptions): Promise<DomainsDkimListResponse>;
|
|
669
|
+
/**
|
|
670
|
+
* Update fields of an existing DKIM key pair for the specified domain and selector, for the current customer. Currently, only the `status` field can be updated.
|
|
671
|
+
* @param domain - The domain the DKIM key belongs to.
|
|
672
|
+
* @param options - The options to update the DKIM key.
|
|
673
|
+
* @example
|
|
674
|
+
* ```ts
|
|
675
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
676
|
+
* const { success, error } = await mailchannels.domains.dkim.updateStatus('example.com', {
|
|
677
|
+
* selector: 'mailchannels',
|
|
678
|
+
* status: 'retired'
|
|
679
|
+
* })
|
|
680
|
+
*/
|
|
681
|
+
updateStatus(domain: string, options: DomainsDkimUpdateStatusOptions): Promise<SuccessResponse>;
|
|
682
|
+
/**
|
|
683
|
+
* Rotate an active DKIM key pair. Mark the original key as `rotated`, and create a new key pair with the required new key selector, reusing the same algorithm and key length. The rotated key remains valid for signing for a 3-day grace period, and is automatically changed to `retired` 2 weeks after rotation. Publish the new key to its DNS TXT record before rotated key expires for signing as emails sent with an unpublished key will fail DKIM validation by receiving providers. After the grace period, only the new key is valid for signing if published.
|
|
684
|
+
* @param domain - The domain the DKIM key belongs to.
|
|
685
|
+
* @param selector - The selector of the DKIM key to rotate.
|
|
686
|
+
* @param options - The options to rotate the DKIM key.
|
|
687
|
+
* @param options.newKey.selector - The selector for the new key pair. Must be a maximum of 63 characters.
|
|
688
|
+
* @example
|
|
689
|
+
* ```ts
|
|
690
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
691
|
+
* const { data, error } = await mailchannels.domains.dkim.rotate('example.com', 'mailchannels', {
|
|
692
|
+
* newKey: {
|
|
693
|
+
* selector: 'new-selector'
|
|
694
|
+
* }
|
|
695
|
+
* })
|
|
696
|
+
* ```
|
|
697
|
+
*/
|
|
698
|
+
rotate(domain: string, selector: string, options: DomainsDkimRotateOptions): Promise<DomainsDkimRotateResponse>;
|
|
699
|
+
}
|
|
587
700
|
interface DomainsCheck {
|
|
588
701
|
/**
|
|
589
702
|
* Domain used for DKIM signing.
|
|
@@ -676,58 +789,6 @@ type DomainsCheckResponse = DataResponse<{
|
|
|
676
789
|
};
|
|
677
790
|
references?: string[];
|
|
678
791
|
}>;
|
|
679
|
-
interface DomainsDkimListOptions {
|
|
680
|
-
/**
|
|
681
|
-
* Selector to filter keys by. Must be a maximum of 63 characters.
|
|
682
|
-
*/
|
|
683
|
-
selector?: string;
|
|
684
|
-
/**
|
|
685
|
-
* Status to filter keys by.
|
|
686
|
-
*/
|
|
687
|
-
status?: DomainsDkimKey["status"];
|
|
688
|
-
/**
|
|
689
|
-
* Number of keys to skip before returning results.
|
|
690
|
-
* @default 0
|
|
691
|
-
*/
|
|
692
|
-
offset?: number;
|
|
693
|
-
/**
|
|
694
|
-
* Maximum number of keys to return. Maximum is `100` and minimum is `1`.
|
|
695
|
-
* @default 10
|
|
696
|
-
*/
|
|
697
|
-
limit?: number;
|
|
698
|
-
/**
|
|
699
|
-
* If `true`, includes the suggested DKIM DNS record for each returned key.
|
|
700
|
-
* @default false
|
|
701
|
-
*/
|
|
702
|
-
includeDnsRecord?: boolean;
|
|
703
|
-
}
|
|
704
|
-
type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
705
|
-
type DomainsDkimListResponse = DataResponse<Optional<DomainsDkimKey, "dnsRecords">[]>;
|
|
706
|
-
interface DomainsDkimUpdateStatusOptions {
|
|
707
|
-
/**
|
|
708
|
-
* Selector of the DKIM key pair to update. Must be a maximum of 63 characters.
|
|
709
|
-
*/
|
|
710
|
-
selector: string;
|
|
711
|
-
/**
|
|
712
|
-
* New status of the DKIM key pair.
|
|
713
|
-
* - `revoked`: Indicates that the key is compromised and should not be used.
|
|
714
|
-
* - `retired`: Indicates that the key has been rotated and is no longer in use.
|
|
715
|
-
* - `rotated`: Indicates that the key is going through the rotation process. Only active key pairs can be updated to this status, and no new key pair is created. The rotated key can be used to sign emails for 3 days after the status update, and will automatically change to `retired` 2 weeks after update. For a smooth key transition, it is recommended to create and publish a new key pair before signing is disabled for the rotated key.
|
|
716
|
-
*/
|
|
717
|
-
status: Exclude<DomainsDkimKey["status"], "active">;
|
|
718
|
-
}
|
|
719
|
-
interface DomainsDkimRotateOptions {
|
|
720
|
-
newKey: {
|
|
721
|
-
/**
|
|
722
|
-
* Selector for the new key pair. Must be a maximum of 63 characters.
|
|
723
|
-
*/
|
|
724
|
-
selector: string;
|
|
725
|
-
};
|
|
726
|
-
}
|
|
727
|
-
type DomainsDkimRotateResponse = DataResponse<{
|
|
728
|
-
new: DomainsDkimKey;
|
|
729
|
-
rotated: DomainsDkimKey;
|
|
730
|
-
}>;
|
|
731
792
|
declare class Domains {
|
|
732
793
|
protected mailchannels: MailChannelsClient;
|
|
733
794
|
readonly dkim: DomainsDkim;
|
|
@@ -751,66 +812,6 @@ declare class Domains {
|
|
|
751
812
|
*/
|
|
752
813
|
check(domain: string, options?: DomainsCheckOptions): Promise<DomainsCheckResponse>;
|
|
753
814
|
}
|
|
754
|
-
declare class DomainsDkim {
|
|
755
|
-
private mailchannels;
|
|
756
|
-
constructor(mailchannels: MailChannelsClient);
|
|
757
|
-
/**
|
|
758
|
-
* Create a DKIM key pair for a specified domain and selector using the specified algorithm and key length, for the current customer.
|
|
759
|
-
* @param domain - The domain to create the DKIM key for.
|
|
760
|
-
* @param options - DKIM key creation options.
|
|
761
|
-
* @example
|
|
762
|
-
* ```ts
|
|
763
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
764
|
-
* const { data, error } = await mailchannels.domains.dkim.create('example.com', {
|
|
765
|
-
* selector: 'mailchannels'
|
|
766
|
-
* })
|
|
767
|
-
* ```
|
|
768
|
-
*/
|
|
769
|
-
create(domain: string, options: DomainsDkimCreateOptions): Promise<DomainsDkimCreateResponse>;
|
|
770
|
-
/**
|
|
771
|
-
* Search for DKIM keys by domain, with optional filters. If selector is provided, at most one key will be returned.
|
|
772
|
-
* @param domain - The domain to search DKIM keys for.
|
|
773
|
-
* @param options - The options to filter DKIM keys by.
|
|
774
|
-
* @example
|
|
775
|
-
* ```ts
|
|
776
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
777
|
-
* const { data, error } = await mailchannels.domains.dkim.list('example.com', {
|
|
778
|
-
* includeDnsRecord: true
|
|
779
|
-
* })
|
|
780
|
-
* ```
|
|
781
|
-
*/
|
|
782
|
-
list(domain: string, options?: DomainsDkimListOptions): Promise<DomainsDkimListResponse>;
|
|
783
|
-
/**
|
|
784
|
-
* Update fields of an existing DKIM key pair for the specified domain and selector, for the current customer. Currently, only the `status` field can be updated.
|
|
785
|
-
* @param domain - The domain the DKIM key belongs to.
|
|
786
|
-
* @param options - The options to update the DKIM key.
|
|
787
|
-
* @example
|
|
788
|
-
* ```ts
|
|
789
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
790
|
-
* const { success, error } = await mailchannels.domains.dkim.updateStatus('example.com', {
|
|
791
|
-
* selector: 'mailchannels',
|
|
792
|
-
* status: 'retired'
|
|
793
|
-
* })
|
|
794
|
-
*/
|
|
795
|
-
updateStatus(domain: string, options: DomainsDkimUpdateStatusOptions): Promise<SuccessResponse>;
|
|
796
|
-
/**
|
|
797
|
-
* Rotate an active DKIM key pair. Mark the original key as `rotated`, and create a new key pair with the required new key selector, reusing the same algorithm and key length. The rotated key remains valid for signing for a 3-day grace period, and is automatically changed to `retired` 2 weeks after rotation. Publish the new key to its DNS TXT record before rotated key expires for signing as emails sent with an unpublished key will fail DKIM validation by receiving providers. After the grace period, only the new key is valid for signing if published.
|
|
798
|
-
* @param domain - The domain the DKIM key belongs to.
|
|
799
|
-
* @param selector - The selector of the DKIM key to rotate.
|
|
800
|
-
* @param options - The options to rotate the DKIM key.
|
|
801
|
-
* @param options.newKey.selector - The selector for the new key pair. Must be a maximum of 63 characters.
|
|
802
|
-
* @example
|
|
803
|
-
* ```ts
|
|
804
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
805
|
-
* const { data, error } = await mailchannels.domains.dkim.rotate('example.com', 'mailchannels', {
|
|
806
|
-
* newKey: {
|
|
807
|
-
* selector: 'new-selector'
|
|
808
|
-
* }
|
|
809
|
-
* })
|
|
810
|
-
* ```
|
|
811
|
-
*/
|
|
812
|
-
rotate(domain: string, selector: string, options: DomainsDkimRotateOptions): Promise<DomainsDkimRotateResponse>;
|
|
813
|
-
}
|
|
814
815
|
type WebhooksListResponse = DataResponse<{
|
|
815
816
|
/**
|
|
816
817
|
* A customer's webhook that events will be sent to
|
|
@@ -959,13 +960,13 @@ type WebhooksBatchStatus = "1xx" | "2xx" | "3xx" | "4xx" | "5xx" | "no_response"
|
|
|
959
960
|
type WebhooksBatchResponseStatus = "1xx_response" | "2xx_response" | "3xx_response" | "4xx_response" | "5xx_response" | "no_response";
|
|
960
961
|
interface WebhooksBatchesOptions {
|
|
961
962
|
/**
|
|
962
|
-
* Inclusive lower bound (UTC) for filtering webhook batches by creation time. Formats: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ
|
|
963
|
+
* Inclusive lower bound (UTC) for filtering webhook batches by creation time. Formats: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ` or a `Date` object.
|
|
963
964
|
*/
|
|
964
|
-
createdAfter?: string;
|
|
965
|
+
createdAfter?: string | Date;
|
|
965
966
|
/**
|
|
966
|
-
* Exclusive upper bound (UTC) for filtering webhook batches by creation time. Formats: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ
|
|
967
|
+
* Exclusive upper bound (UTC) for filtering webhook batches by creation time. Formats: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ` or a `Date` object.
|
|
967
968
|
*/
|
|
968
|
-
createdBefore?: string;
|
|
969
|
+
createdBefore?: string | Date;
|
|
969
970
|
/**
|
|
970
971
|
* Filters webhook batches by webhook response status category. If not provided, batches with all categories are returned.
|
|
971
972
|
*/
|
|
@@ -1145,7 +1146,7 @@ declare class Webhooks {
|
|
|
1145
1146
|
*/
|
|
1146
1147
|
resendBatch(batchId: number): Promise<WebhooksResendBatchResponse>;
|
|
1147
1148
|
}
|
|
1148
|
-
interface
|
|
1149
|
+
interface SubAccount {
|
|
1149
1150
|
/**
|
|
1150
1151
|
* The name of the company associated with the sub-account.
|
|
1151
1152
|
*/
|
|
@@ -1159,7 +1160,9 @@ interface SubAccountsAccount {
|
|
|
1159
1160
|
*/
|
|
1160
1161
|
handle: string;
|
|
1161
1162
|
}
|
|
1162
|
-
type SubAccountsCreateResponse = DataResponse<
|
|
1163
|
+
type SubAccountsCreateResponse = DataResponse<SubAccount>;
|
|
1164
|
+
/** @deprecated Use `SubAccount` instead. */
|
|
1165
|
+
type SubAccountsAccount = SubAccount;
|
|
1163
1166
|
interface SubAccountsListOptions {
|
|
1164
1167
|
/**
|
|
1165
1168
|
* Possible values are `1` to `1000`.
|
|
@@ -1172,7 +1175,7 @@ interface SubAccountsListOptions {
|
|
|
1172
1175
|
*/
|
|
1173
1176
|
offset?: number;
|
|
1174
1177
|
}
|
|
1175
|
-
type SubAccountsListResponse = DataResponse<
|
|
1178
|
+
type SubAccountsListResponse = DataResponse<SubAccount[]>;
|
|
1176
1179
|
interface SubAccountsApiKey {
|
|
1177
1180
|
/**
|
|
1178
1181
|
* The API key ID for the sub-account.
|
|
@@ -1183,8 +1186,8 @@ interface SubAccountsApiKey {
|
|
|
1183
1186
|
*/
|
|
1184
1187
|
key: string;
|
|
1185
1188
|
}
|
|
1186
|
-
type
|
|
1187
|
-
interface
|
|
1189
|
+
type SubAccountsApiKeysCreateResponse = DataResponse<SubAccountsApiKey>;
|
|
1190
|
+
interface SubAccountsApiKeysListOptions {
|
|
1188
1191
|
/**
|
|
1189
1192
|
* The maximum number of API keys included in the response. Possible values are `1` to `1000`.
|
|
1190
1193
|
* @default 100
|
|
@@ -1196,7 +1199,13 @@ interface SubAccountsListApiKeyOptions {
|
|
|
1196
1199
|
*/
|
|
1197
1200
|
offset?: number;
|
|
1198
1201
|
}
|
|
1199
|
-
type
|
|
1202
|
+
type SubAccountsApiKeysListResponse = DataResponse<SubAccountsApiKey[]>;
|
|
1203
|
+
/** @deprecated Use `SubAccountsApiKeysCreateResponse` instead. */
|
|
1204
|
+
type SubAccountsCreateApiKeyResponse = SubAccountsApiKeysCreateResponse;
|
|
1205
|
+
/** @deprecated Use `SubAccountsApiKeysListOptions` instead. */
|
|
1206
|
+
type SubAccountsListApiKeyOptions = SubAccountsApiKeysListOptions;
|
|
1207
|
+
/** @deprecated Use `SubAccountsApiKeysListResponse` instead. */
|
|
1208
|
+
type SubAccountsListApiKeyResponse = SubAccountsApiKeysListResponse;
|
|
1200
1209
|
interface SubAccountsSmtpPassword {
|
|
1201
1210
|
/**
|
|
1202
1211
|
* Whether the SMTP password is enabled.
|
|
@@ -1211,12 +1220,19 @@ interface SubAccountsSmtpPassword {
|
|
|
1211
1220
|
*/
|
|
1212
1221
|
smtpPassword: string;
|
|
1213
1222
|
}
|
|
1214
|
-
type
|
|
1215
|
-
type
|
|
1223
|
+
type SubAccountsSmtpPasswordsCreateResponse = DataResponse<SubAccountsSmtpPassword>;
|
|
1224
|
+
type SubAccountsSmtpPasswordsListResponse = DataResponse<SubAccountsSmtpPassword[]>;
|
|
1225
|
+
/** @deprecated Use `SubAccountsSmtpPasswordsCreateResponse` instead. */
|
|
1226
|
+
type SubAccountsCreateSmtpPasswordResponse = SubAccountsSmtpPasswordsCreateResponse;
|
|
1227
|
+
/** @deprecated Use `SubAccountsSmtpPasswordsListResponse` instead. */
|
|
1228
|
+
type SubAccountsListSmtpPasswordResponse = SubAccountsSmtpPasswordsListResponse;
|
|
1216
1229
|
interface SubAccountsLimit {
|
|
1217
1230
|
sends: number;
|
|
1218
1231
|
}
|
|
1219
|
-
|
|
1232
|
+
interface SubAccountsLimitsSetOptions extends SubAccountsLimit {}
|
|
1233
|
+
type SubAccountsLimitsGetResponse = DataResponse<SubAccountsLimit>;
|
|
1234
|
+
/** @deprecated Use `SubAccountsLimitsGetResponse` instead. */
|
|
1235
|
+
type SubAccountsLimitResponse = SubAccountsLimitsGetResponse;
|
|
1220
1236
|
interface SubAccountsUsage {
|
|
1221
1237
|
/**
|
|
1222
1238
|
* The end date of the current billing period (ISO 8601 format).
|
|
@@ -1234,186 +1250,25 @@ interface SubAccountsUsage {
|
|
|
1234
1250
|
total: number;
|
|
1235
1251
|
}
|
|
1236
1252
|
type SubAccountsUsageResponse = DataResponse<SubAccountsUsage>;
|
|
1237
|
-
|
|
1238
|
-
protected mailchannels: MailChannelsClient;
|
|
1239
|
-
private static readonly COMPANY_PATTERN;
|
|
1240
|
-
private static readonly HANDLE_PATTERN;
|
|
1241
|
-
constructor(mailchannels: MailChannelsClient);
|
|
1253
|
+
interface MetricsEngagement {
|
|
1242
1254
|
/**
|
|
1243
|
-
*
|
|
1244
|
-
* @param companyName - The name of the company associated with the sub-account. This name is used for display purposes only and does not affect the functionality of the sub-account. The length must be between 3 and 128 characters.
|
|
1245
|
-
* @param handle - A unique name for the sub-account to be created. The length must be between 3 and 128 characters, and it may contain only lowercase letters and numbers. If not provided, a random handle will be generated.
|
|
1246
|
-
* @example
|
|
1247
|
-
* ```ts
|
|
1248
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1249
|
-
* const { data, error } = await mailchannels.subAccounts.create('My Company', 'validhandle123')
|
|
1250
|
-
* ```
|
|
1255
|
+
* A series of metrics aggregations bucketed by time interval (e.g. hour, day).
|
|
1251
1256
|
*/
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
* ```ts
|
|
1268
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1269
|
-
* const { success, error } = await mailchannels.subAccounts.delete('validhandle123')
|
|
1270
|
-
* ```
|
|
1271
|
-
*/
|
|
1272
|
-
delete(handle: string): Promise<SuccessResponse>;
|
|
1273
|
-
/**
|
|
1274
|
-
* Suspends the sub-account identified by its handle. This action disables the account, preventing it from sending any emails until it is reactivated.
|
|
1275
|
-
* @param handle - Handle of sub-account to be suspended.
|
|
1276
|
-
* @example
|
|
1277
|
-
* ```ts
|
|
1278
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1279
|
-
* const { success, error } = await mailchannels.subAccounts.suspend('validhandle123')
|
|
1280
|
-
* ```
|
|
1281
|
-
*/
|
|
1282
|
-
suspend(handle: string): Promise<SuccessResponse>;
|
|
1283
|
-
/**
|
|
1284
|
-
* Activates a suspended sub-account identified by its handle, restoring its ability to send emails.
|
|
1285
|
-
* @param handle - Handle of sub-account to be activated.
|
|
1286
|
-
* @example
|
|
1287
|
-
* ```ts
|
|
1288
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1289
|
-
* const { success, error } = await mailchannels.subAccounts.activate('validhandle123')
|
|
1290
|
-
* ```
|
|
1291
|
-
*/
|
|
1292
|
-
activate(handle: string): Promise<SuccessResponse>;
|
|
1293
|
-
/**
|
|
1294
|
-
* Creates a new API key for the specified sub-account.
|
|
1295
|
-
* @param handle - Handle of the sub-account to create API key for.
|
|
1296
|
-
* @example
|
|
1297
|
-
* ```ts
|
|
1298
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1299
|
-
* const { data, error } = await mailchannels.subAccounts.createApiKey('validhandle123')
|
|
1300
|
-
* ```
|
|
1301
|
-
*/
|
|
1302
|
-
createApiKey(handle: string): Promise<SubAccountsCreateApiKeyResponse>;
|
|
1303
|
-
/**
|
|
1304
|
-
* Retrieves details of all API keys associated with the specified sub-account. For security reasons, the full API key is not returned; only the key ID and a partially redacted version are provided.
|
|
1305
|
-
* @param handle - Handle of the sub-account to retrieve the API key for.
|
|
1306
|
-
* @param options - The options to filter the list of API keys.
|
|
1307
|
-
* @example
|
|
1308
|
-
* ```ts
|
|
1309
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1310
|
-
* const { data, error } = await mailchannels.subAccounts.listApiKeys('validhandle123')
|
|
1311
|
-
* ```
|
|
1312
|
-
*/
|
|
1313
|
-
listApiKeys(handle: string, options?: SubAccountsListApiKeyOptions): Promise<SubAccountsListApiKeyResponse>;
|
|
1314
|
-
/**
|
|
1315
|
-
* Deletes the API key identified by its ID for the specified sub-account.
|
|
1316
|
-
* @param handle - Handle of the sub-account for which the API key should be deleted.
|
|
1317
|
-
* @param id - The ID of the API key to delete.
|
|
1318
|
-
* @example
|
|
1319
|
-
* ```ts
|
|
1320
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1321
|
-
* const { success, error } = await mailchannels.subAccounts.deleteApiKey('validhandle123', 1)
|
|
1322
|
-
* ```
|
|
1323
|
-
*/
|
|
1324
|
-
deleteApiKey(handle: string, id: number): Promise<SuccessResponse>;
|
|
1325
|
-
/**
|
|
1326
|
-
* Creates a new SMTP password for the specified sub-account.
|
|
1327
|
-
* @param handle - Handle of the sub-account to create SMTP password for.
|
|
1328
|
-
* @example
|
|
1329
|
-
* ```ts
|
|
1330
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1331
|
-
* const { data, error } = await mailchannels.subAccounts.createSmtpPassword('validhandle123')
|
|
1332
|
-
* ```
|
|
1333
|
-
*/
|
|
1334
|
-
createSmtpPassword(handle: string): Promise<SubAccountsCreateSmtpPasswordResponse>;
|
|
1335
|
-
/**
|
|
1336
|
-
* Retrieves details of all SMTP passwords associated with the specified sub-account. For security, the full SMTP password is not returned; only the password ID and a partially redacted version are provided.
|
|
1337
|
-
* @param handle - Handle of the sub-account to retrieve the SMTP password for.
|
|
1338
|
-
* @example
|
|
1339
|
-
* ```ts
|
|
1340
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1341
|
-
* const { data, error } = await mailchannels.subAccounts.listSmtpPasswords('validhandle123')
|
|
1342
|
-
* ```
|
|
1343
|
-
*/
|
|
1344
|
-
listSmtpPasswords(handle: string): Promise<SubAccountsListSmtpPasswordResponse>;
|
|
1345
|
-
/**
|
|
1346
|
-
* Deletes the SMTP password identified by its ID for the specified sub-account.
|
|
1347
|
-
* @param handle - Handle of the sub-account for which the SMTP password should be deleted.
|
|
1348
|
-
* @param id - The ID of the SMTP password to delete.
|
|
1349
|
-
* @example
|
|
1350
|
-
* ```ts
|
|
1351
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1352
|
-
* const { success, error } = await mailchannels.subAccounts.deleteSmtpPassword('validhandle123', 1)
|
|
1353
|
-
* ```
|
|
1354
|
-
*/
|
|
1355
|
-
deleteSmtpPassword(handle: string, id: number): Promise<SuccessResponse>;
|
|
1356
|
-
/**
|
|
1357
|
-
* Retrieves the limit of a specified sub-account. A value of `-1` indicates that the sub-account inherits the parent account's limit, allowing the sub-account to utilize any remaining capacity within the parent account's allocation.
|
|
1358
|
-
* @param handle - Handle of the sub-account to retrieve the limit for.
|
|
1359
|
-
* @example
|
|
1360
|
-
* ```ts
|
|
1361
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1362
|
-
* const { data, error } = await mailchannels.subAccounts.getLimit('validhandle123')
|
|
1363
|
-
* ```
|
|
1364
|
-
*/
|
|
1365
|
-
getLimit(handle: string): Promise<SubAccountsLimitResponse>;
|
|
1366
|
-
/**
|
|
1367
|
-
* Sets the limit for the specified sub-account.
|
|
1368
|
-
* @param handle - Handle of the sub-account to set limit for.
|
|
1369
|
-
* @param limit - The limits to set for the sub-account. The minimum allowed sends is `0`
|
|
1370
|
-
* @example
|
|
1371
|
-
* ```ts
|
|
1372
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1373
|
-
* const { success, error } = await mailchannels.subAccounts.setLimit('validhandle123', { sends: 1000 })
|
|
1374
|
-
* ```
|
|
1375
|
-
*/
|
|
1376
|
-
setLimit(handle: string, limit: SubAccountsLimit): Promise<SuccessResponse>;
|
|
1377
|
-
/**
|
|
1378
|
-
* Deletes the limit for the specified sub-account. After a successful deletion, the specified sub-account will be limited to the parent account's limit.
|
|
1379
|
-
* @param handle - Handle of the sub-account to delete limit for.
|
|
1380
|
-
* @example
|
|
1381
|
-
* ```ts
|
|
1382
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1383
|
-
* const { success, error } = await mailchannels.subAccounts.deleteLimit('validhandle123')
|
|
1384
|
-
* ```
|
|
1385
|
-
*/
|
|
1386
|
-
deleteLimit(handle: string): Promise<SuccessResponse>;
|
|
1387
|
-
/**
|
|
1388
|
-
* Retrieves usage statistics for the specified sub-account during the current billing period.
|
|
1389
|
-
* @param handle - Handle of the sub-account to query usage stats for.
|
|
1390
|
-
* @example
|
|
1391
|
-
* ```ts
|
|
1392
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1393
|
-
* const { data, error } = await mailchannels.subAccounts.getUsage('validhandle123')
|
|
1394
|
-
* ```
|
|
1395
|
-
*/
|
|
1396
|
-
getUsage(handle: string): Promise<SubAccountsUsageResponse>;
|
|
1397
|
-
}
|
|
1398
|
-
interface MetricsEngagement {
|
|
1399
|
-
/**
|
|
1400
|
-
* A series of metrics aggregations bucketed by time interval (e.g. hour, day).
|
|
1401
|
-
*/
|
|
1402
|
-
buckets: {
|
|
1403
|
-
click: MetricsBucket[];
|
|
1404
|
-
clickTrackingDelivered: MetricsBucket[];
|
|
1405
|
-
open: MetricsBucket[];
|
|
1406
|
-
openTrackingDelivered: MetricsBucket[];
|
|
1407
|
-
};
|
|
1408
|
-
click: number;
|
|
1409
|
-
clickTrackingDelivered: number;
|
|
1410
|
-
endTime: string;
|
|
1411
|
-
open: number;
|
|
1412
|
-
openTrackingDelivered: number;
|
|
1413
|
-
startTime: string;
|
|
1414
|
-
}
|
|
1415
|
-
type MetricsEngagementResponse = DataResponse<MetricsEngagement>;
|
|
1416
|
-
interface MetricsPerformance {
|
|
1257
|
+
buckets: {
|
|
1258
|
+
click: MetricsBucket[];
|
|
1259
|
+
clickTrackingDelivered: MetricsBucket[];
|
|
1260
|
+
open: MetricsBucket[];
|
|
1261
|
+
openTrackingDelivered: MetricsBucket[];
|
|
1262
|
+
};
|
|
1263
|
+
click: number;
|
|
1264
|
+
clickTrackingDelivered: number;
|
|
1265
|
+
endTime: string;
|
|
1266
|
+
open: number;
|
|
1267
|
+
openTrackingDelivered: number;
|
|
1268
|
+
startTime: string;
|
|
1269
|
+
}
|
|
1270
|
+
type MetricsEngagementResponse = DataResponse<MetricsEngagement>;
|
|
1271
|
+
interface MetricsPerformance {
|
|
1417
1272
|
/**
|
|
1418
1273
|
* Count of messages bounced during the specified time range.
|
|
1419
1274
|
*/
|
|
@@ -1520,15 +1375,15 @@ type MetricsUsageResponse = DataResponse<{
|
|
|
1520
1375
|
type MetricsSendersType = "sub-accounts" | "campaigns";
|
|
1521
1376
|
interface MetricsSendersOptions {
|
|
1522
1377
|
/**
|
|
1523
|
-
* The beginning of the time range for retrieving top senders metrics (inclusive). Formats: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ
|
|
1378
|
+
* The beginning of the time range for retrieving top senders metrics (inclusive). Formats: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ` or a `Date` object. Defaults to one month ago if not provided.
|
|
1524
1379
|
* @example "2025-11-02T03:13:35.761763554Z"
|
|
1525
1380
|
*/
|
|
1526
|
-
startTime?: string;
|
|
1381
|
+
startTime?: string | Date;
|
|
1527
1382
|
/**
|
|
1528
|
-
* The end of the time range for retrieving top senders metrics (exclusive). Formats: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ
|
|
1383
|
+
* The end of the time range for retrieving top senders metrics (exclusive). Formats: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ` or a `Date` object. Defaults to the current time if not provided.
|
|
1529
1384
|
* @example "2025-12-02T03:13:35.761763554Z"
|
|
1530
1385
|
*/
|
|
1531
|
-
endTime?: string;
|
|
1386
|
+
endTime?: string | Date;
|
|
1532
1387
|
/**
|
|
1533
1388
|
* The maximum number of senders to return. Possible values are 1 to 1000.
|
|
1534
1389
|
* @default 10
|
|
@@ -1578,15 +1433,15 @@ interface MetricsBucket {
|
|
|
1578
1433
|
}
|
|
1579
1434
|
interface MetricsOptions {
|
|
1580
1435
|
/**
|
|
1581
|
-
* The beginning of the time range for retrieving message metrics (inclusive). Formats: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ
|
|
1436
|
+
* The beginning of the time range for retrieving message metrics (inclusive). Formats: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ` or a `Date` object. Defaults to one month ago if not provided.
|
|
1582
1437
|
* @example "2025-05-26"
|
|
1583
1438
|
*/
|
|
1584
|
-
startTime?: string;
|
|
1439
|
+
startTime?: string | Date;
|
|
1585
1440
|
/**
|
|
1586
|
-
* The end of the time range for retrieving message metrics (exclusive). Formats: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ
|
|
1441
|
+
* The end of the time range for retrieving message metrics (exclusive). Formats: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ` or a `Date` object. Defaults to the current time if not provided.
|
|
1587
1442
|
* @example "2025-05-31T15:16:17Z"
|
|
1588
1443
|
*/
|
|
1589
|
-
endTime?: string;
|
|
1444
|
+
endTime?: string | Date;
|
|
1590
1445
|
/**
|
|
1591
1446
|
* The ID of the campaign to filter metrics by. If not provided, metrics for all campaigns will be returned.
|
|
1592
1447
|
*/
|
|
@@ -1597,6 +1452,267 @@ interface MetricsOptions {
|
|
|
1597
1452
|
*/
|
|
1598
1453
|
interval?: "hour" | "day" | "week" | "month";
|
|
1599
1454
|
}
|
|
1455
|
+
type SuppressionsTypes = "transactional" | "non-transactional";
|
|
1456
|
+
interface SuppressionsCreateOptions {
|
|
1457
|
+
/**
|
|
1458
|
+
* If true, the parent account creates suppression entries for all associated sub-accounts. This field is only applicable to parent accounts. Sub-accounts cannot create entries for other sub-accounts.
|
|
1459
|
+
* @default false
|
|
1460
|
+
*/
|
|
1461
|
+
addToSubAccounts?: boolean;
|
|
1462
|
+
/**
|
|
1463
|
+
* The total number of suppression entries to create, for the parent and/or its sub-accounts, must not exceed `1000`.
|
|
1464
|
+
*/
|
|
1465
|
+
entries: {
|
|
1466
|
+
/**
|
|
1467
|
+
* Must be less than `1024` characters.
|
|
1468
|
+
*/
|
|
1469
|
+
notes?: string;
|
|
1470
|
+
/**
|
|
1471
|
+
* The email address to suppress. Must be a valid email address format and less than `255` characters.
|
|
1472
|
+
*/
|
|
1473
|
+
recipient: string;
|
|
1474
|
+
/**
|
|
1475
|
+
* An array of types of suppression to apply to the recipient.
|
|
1476
|
+
* @default ["non-transactional"]
|
|
1477
|
+
*/
|
|
1478
|
+
types?: SuppressionsTypes[];
|
|
1479
|
+
}[];
|
|
1480
|
+
}
|
|
1481
|
+
type SuppressionsSource = "api" | "unsubscribe_link" | "list_unsubscribe" | "hard_bounce" | "spam_complaint" | "all";
|
|
1482
|
+
interface SuppressionsListOptions {
|
|
1483
|
+
/**
|
|
1484
|
+
* The email address of the suppression entry to search for. If provided, the search will return the suppression entry associated with this recipient. If not provided, the search will return all suppression entries for the account.
|
|
1485
|
+
*/
|
|
1486
|
+
recipient?: string;
|
|
1487
|
+
/**
|
|
1488
|
+
* The source of the suppression entries to filter by. If not provided, suppression entries from all sources will be returned.
|
|
1489
|
+
*/
|
|
1490
|
+
source?: Exclude<SuppressionsSource, "all">;
|
|
1491
|
+
/**
|
|
1492
|
+
* The date and/or time before which the suppression entries were created. Format: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ` or a `Date` object.
|
|
1493
|
+
*/
|
|
1494
|
+
createdBefore?: string | Date;
|
|
1495
|
+
/**
|
|
1496
|
+
* The date and/or time after which the suppression entries were created. Format: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ` or a `Date` object.
|
|
1497
|
+
*/
|
|
1498
|
+
createdAfter?: string | Date;
|
|
1499
|
+
/**
|
|
1500
|
+
* The maximum number of suppression entries to return. Must be between `1` and `1000`.
|
|
1501
|
+
* @default 1000
|
|
1502
|
+
*/
|
|
1503
|
+
limit?: number;
|
|
1504
|
+
/**
|
|
1505
|
+
* The number of suppression entries to skip before returning results.
|
|
1506
|
+
* @default 0
|
|
1507
|
+
*/
|
|
1508
|
+
offset?: number;
|
|
1509
|
+
}
|
|
1510
|
+
interface SuppressionsListEntry {
|
|
1511
|
+
createdAt: string;
|
|
1512
|
+
notes?: string;
|
|
1513
|
+
/**
|
|
1514
|
+
* The email address that is suppressed.
|
|
1515
|
+
*/
|
|
1516
|
+
recipient: string;
|
|
1517
|
+
sender?: string;
|
|
1518
|
+
source: SuppressionsSource;
|
|
1519
|
+
types: SuppressionsTypes[];
|
|
1520
|
+
}
|
|
1521
|
+
type SuppressionsListResponse = DataResponse<SuppressionsListEntry[]>;
|
|
1522
|
+
declare class SubAccountsApiKeys {
|
|
1523
|
+
private mailchannels;
|
|
1524
|
+
constructor(mailchannels: MailChannelsClient);
|
|
1525
|
+
/**
|
|
1526
|
+
* Creates a new API key for the specified sub-account.
|
|
1527
|
+
* @param handle - Handle of the sub-account to create API key for.
|
|
1528
|
+
* @example
|
|
1529
|
+
* ```ts
|
|
1530
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
1531
|
+
* const { data, error } = await mailchannels.subAccounts.apiKeys.create('validhandle123')
|
|
1532
|
+
* ```
|
|
1533
|
+
*/
|
|
1534
|
+
create(handle: string): Promise<SubAccountsApiKeysCreateResponse>;
|
|
1535
|
+
/**
|
|
1536
|
+
* Retrieves details of all API keys associated with the specified sub-account. For security reasons, the full API key is not returned; only the key ID and a partially redacted version are provided.
|
|
1537
|
+
* @param handle - Handle of the sub-account to retrieve the API key for.
|
|
1538
|
+
* @param options - The options to filter the list of API keys.
|
|
1539
|
+
* @example
|
|
1540
|
+
* ```ts
|
|
1541
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
1542
|
+
* const { data, error } = await mailchannels.subAccounts.apiKeys.list('validhandle123')
|
|
1543
|
+
* ```
|
|
1544
|
+
*/
|
|
1545
|
+
list(handle: string, options?: SubAccountsApiKeysListOptions): Promise<SubAccountsApiKeysListResponse>;
|
|
1546
|
+
/**
|
|
1547
|
+
* Deletes the API key identified by its ID for the specified sub-account.
|
|
1548
|
+
* @param handle - Handle of the sub-account for which the API key should be deleted.
|
|
1549
|
+
* @param id - The ID of the API key to delete.
|
|
1550
|
+
* @example
|
|
1551
|
+
* ```ts
|
|
1552
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
1553
|
+
* const { success, error } = await mailchannels.subAccounts.apiKeys.delete('validhandle123', 1)
|
|
1554
|
+
* ```
|
|
1555
|
+
*/
|
|
1556
|
+
delete(handle: string, id: number): Promise<SuccessResponse>;
|
|
1557
|
+
}
|
|
1558
|
+
declare class SubAccountsSmtpPasswords {
|
|
1559
|
+
private mailchannels;
|
|
1560
|
+
constructor(mailchannels: MailChannelsClient);
|
|
1561
|
+
/**
|
|
1562
|
+
* Creates a new SMTP password for the specified sub-account.
|
|
1563
|
+
* @param handle - Handle of the sub-account to create SMTP password for.
|
|
1564
|
+
* @example
|
|
1565
|
+
* ```ts
|
|
1566
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
1567
|
+
* const { data, error } = await mailchannels.subAccounts.smtpPasswords.create('validhandle123')
|
|
1568
|
+
* ```
|
|
1569
|
+
*/
|
|
1570
|
+
create(handle: string): Promise<SubAccountsSmtpPasswordsCreateResponse>;
|
|
1571
|
+
/**
|
|
1572
|
+
* Retrieves details of all SMTP passwords associated with the specified sub-account. For security, the full SMTP password is not returned; only the password ID and a partially redacted version are provided.
|
|
1573
|
+
* @param handle - Handle of the sub-account to retrieve the SMTP password for.
|
|
1574
|
+
* @example
|
|
1575
|
+
* ```ts
|
|
1576
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
1577
|
+
* const { data, error } = await mailchannels.subAccounts.smtpPasswords.list('validhandle123')
|
|
1578
|
+
* ```
|
|
1579
|
+
*/
|
|
1580
|
+
list(handle: string): Promise<SubAccountsSmtpPasswordsListResponse>;
|
|
1581
|
+
/**
|
|
1582
|
+
* Deletes the SMTP password identified by its ID for the specified sub-account.
|
|
1583
|
+
* @param handle - Handle of the sub-account for which the SMTP password should be deleted.
|
|
1584
|
+
* @param id - The ID of the SMTP password to delete.
|
|
1585
|
+
* @example
|
|
1586
|
+
* ```ts
|
|
1587
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
1588
|
+
* const { success, error } = await mailchannels.subAccounts.smtpPasswords.delete('validhandle123', 1)
|
|
1589
|
+
* ```
|
|
1590
|
+
*/
|
|
1591
|
+
delete(handle: string, id: number): Promise<SuccessResponse>;
|
|
1592
|
+
}
|
|
1593
|
+
declare class SubAccountsLimits {
|
|
1594
|
+
private mailchannels;
|
|
1595
|
+
constructor(mailchannels: MailChannelsClient);
|
|
1596
|
+
/**
|
|
1597
|
+
* Retrieves the limit of a specified sub-account. A value of `-1` indicates that the sub-account inherits the parent account's limit, allowing the sub-account to utilize any remaining capacity within the parent account's allocation.
|
|
1598
|
+
* @param handle - Handle of the sub-account to retrieve the limit for.
|
|
1599
|
+
* @example
|
|
1600
|
+
* ```ts
|
|
1601
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
1602
|
+
* const { data, error } = await mailchannels.subAccounts.limits.get('validhandle123')
|
|
1603
|
+
* ```
|
|
1604
|
+
*/
|
|
1605
|
+
get(handle: string): Promise<SubAccountsLimitsGetResponse>;
|
|
1606
|
+
/**
|
|
1607
|
+
* Sets the limit for the specified sub-account.
|
|
1608
|
+
* @param handle - Handle of the sub-account to set limit for.
|
|
1609
|
+
* @param options - The limits to set for the sub-account. The minimum allowed sends is `0`
|
|
1610
|
+
* @example
|
|
1611
|
+
* ```ts
|
|
1612
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
1613
|
+
* const { success, error } = await mailchannels.subAccounts.limits.set('validhandle123', { sends: 1000 })
|
|
1614
|
+
* ```
|
|
1615
|
+
*/
|
|
1616
|
+
set(handle: string, options: SubAccountsLimitsSetOptions): Promise<SuccessResponse>;
|
|
1617
|
+
/**
|
|
1618
|
+
* Deletes the limit for the specified sub-account. After a successful deletion, the specified sub-account will be limited to the parent account's limit.
|
|
1619
|
+
* @param handle - Handle of the sub-account to delete limit for.
|
|
1620
|
+
* @example
|
|
1621
|
+
* ```ts
|
|
1622
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
1623
|
+
* const { success, error } = await mailchannels.subAccounts.limits.delete('validhandle123')
|
|
1624
|
+
* ```
|
|
1625
|
+
*/
|
|
1626
|
+
delete(handle: string): Promise<SuccessResponse>;
|
|
1627
|
+
}
|
|
1628
|
+
declare class SubAccounts {
|
|
1629
|
+
protected mailchannels: MailChannelsClient;
|
|
1630
|
+
private static readonly COMPANY_PATTERN;
|
|
1631
|
+
private static readonly HANDLE_PATTERN;
|
|
1632
|
+
readonly apiKeys: SubAccountsApiKeys;
|
|
1633
|
+
readonly smtpPasswords: SubAccountsSmtpPasswords;
|
|
1634
|
+
readonly limits: SubAccountsLimits;
|
|
1635
|
+
constructor(mailchannels: MailChannelsClient);
|
|
1636
|
+
/**
|
|
1637
|
+
* Creates a new sub-account under the parent account. Each sub-account must have a unique handle composed solely of lowercase alphanumeric characters. If no handle is provided, a random handle will be generated. Note that Sub-accounts are only available to parent accounts on 100K and higher plans.
|
|
1638
|
+
* @param companyName - The name of the company associated with the sub-account. This name is used for display purposes only and does not affect the functionality of the sub-account. The length must be between 3 and 128 characters.
|
|
1639
|
+
* @param handle - A unique name for the sub-account to be created. The length must be between 3 and 128 characters, and it may contain only lowercase letters and numbers. If not provided, a random handle will be generated.
|
|
1640
|
+
* @example
|
|
1641
|
+
* ```ts
|
|
1642
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
1643
|
+
* const { data, error } = await mailchannels.subAccounts.create('My Company', 'validhandle123')
|
|
1644
|
+
* ```
|
|
1645
|
+
*/
|
|
1646
|
+
create(companyName: string, handle?: string): Promise<SubAccountsCreateResponse>;
|
|
1647
|
+
/**
|
|
1648
|
+
* Retrieves all sub-accounts associated with the parent account. The response is paginated with a default limit of 1000 sub-accounts per page and an offset of 0.
|
|
1649
|
+
* @param options - The options to filter the list of sub-accounts.
|
|
1650
|
+
* @example
|
|
1651
|
+
* ```ts
|
|
1652
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
1653
|
+
* const { data, error } = await mailchannels.subAccounts.list()
|
|
1654
|
+
* ```
|
|
1655
|
+
*/
|
|
1656
|
+
list(options?: SubAccountsListOptions): Promise<SubAccountsListResponse>;
|
|
1657
|
+
/**
|
|
1658
|
+
* Deletes the sub-account identified by its handle.
|
|
1659
|
+
* @param handle - Handle of sub-account to be deleted.
|
|
1660
|
+
* @example
|
|
1661
|
+
* ```ts
|
|
1662
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
1663
|
+
* const { success, error } = await mailchannels.subAccounts.delete('validhandle123')
|
|
1664
|
+
* ```
|
|
1665
|
+
*/
|
|
1666
|
+
delete(handle: string): Promise<SuccessResponse>;
|
|
1667
|
+
/**
|
|
1668
|
+
* Suspends the sub-account identified by its handle. This action disables the account, preventing it from sending any emails until it is reactivated.
|
|
1669
|
+
* @param handle - Handle of sub-account to be suspended.
|
|
1670
|
+
* @example
|
|
1671
|
+
* ```ts
|
|
1672
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
1673
|
+
* const { success, error } = await mailchannels.subAccounts.suspend('validhandle123')
|
|
1674
|
+
* ```
|
|
1675
|
+
*/
|
|
1676
|
+
suspend(handle: string): Promise<SuccessResponse>;
|
|
1677
|
+
/**
|
|
1678
|
+
* Activates a suspended sub-account identified by its handle, restoring its ability to send emails.
|
|
1679
|
+
* @param handle - Handle of sub-account to be activated.
|
|
1680
|
+
* @example
|
|
1681
|
+
* ```ts
|
|
1682
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
1683
|
+
* const { success, error } = await mailchannels.subAccounts.activate('validhandle123')
|
|
1684
|
+
* ```
|
|
1685
|
+
*/
|
|
1686
|
+
activate(handle: string): Promise<SuccessResponse>;
|
|
1687
|
+
/**
|
|
1688
|
+
* Retrieves usage statistics for the specified sub-account during the current billing period.
|
|
1689
|
+
* @param handle - Handle of the sub-account to query usage stats for.
|
|
1690
|
+
* @example
|
|
1691
|
+
* ```ts
|
|
1692
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
1693
|
+
* const { data, error } = await mailchannels.subAccounts.getUsage('validhandle123')
|
|
1694
|
+
* ```
|
|
1695
|
+
*/
|
|
1696
|
+
getUsage(handle: string): Promise<SubAccountsUsageResponse>;
|
|
1697
|
+
/** @deprecated Use `apiKeys.create` instead. */
|
|
1698
|
+
createApiKey(...args: Parameters<SubAccountsApiKeys["create"]>): Promise<SubAccountsApiKeysCreateResponse>;
|
|
1699
|
+
/** @deprecated Use `apiKeys.list` instead. */
|
|
1700
|
+
listApiKeys(...args: Parameters<SubAccountsApiKeys["list"]>): Promise<SubAccountsApiKeysListResponse>;
|
|
1701
|
+
/** @deprecated Use `apiKeys.delete` instead. */
|
|
1702
|
+
deleteApiKey(...args: Parameters<SubAccountsApiKeys["delete"]>): Promise<SuccessResponse>;
|
|
1703
|
+
/** @deprecated Use `smtpPasswords.create` instead. */
|
|
1704
|
+
createSmtpPassword(...args: Parameters<SubAccountsSmtpPasswords["create"]>): Promise<SubAccountsSmtpPasswordsCreateResponse>;
|
|
1705
|
+
/** @deprecated Use `smtpPasswords.list` instead. */
|
|
1706
|
+
listSmtpPasswords(...args: Parameters<SubAccountsSmtpPasswords["list"]>): Promise<SubAccountsSmtpPasswordsListResponse>;
|
|
1707
|
+
/** @deprecated Use `smtpPasswords.delete` instead. */
|
|
1708
|
+
deleteSmtpPassword(...args: Parameters<SubAccountsSmtpPasswords["delete"]>): Promise<SuccessResponse>;
|
|
1709
|
+
/** @deprecated Use `limits.set` instead. */
|
|
1710
|
+
setLimit(...args: Parameters<SubAccountsLimits["set"]>): Promise<SuccessResponse>;
|
|
1711
|
+
/** @deprecated Use `limits.get` instead. */
|
|
1712
|
+
getLimit(...args: Parameters<SubAccountsLimits["get"]>): Promise<SubAccountsLimitsGetResponse>;
|
|
1713
|
+
/** @deprecated Use `limits.delete` instead. */
|
|
1714
|
+
deleteLimit(...args: Parameters<SubAccountsLimits["delete"]>): Promise<SuccessResponse>;
|
|
1715
|
+
}
|
|
1600
1716
|
declare class Metrics {
|
|
1601
1717
|
protected mailchannels: MailChannelsClient;
|
|
1602
1718
|
constructor(mailchannels: MailChannelsClient);
|
|
@@ -1661,73 +1777,6 @@ declare class Metrics {
|
|
|
1661
1777
|
*/
|
|
1662
1778
|
senders(type: MetricsSendersType, options?: MetricsSendersOptions): Promise<MetricsSendersResponse>;
|
|
1663
1779
|
}
|
|
1664
|
-
type SuppressionsTypes = "transactional" | "non-transactional";
|
|
1665
|
-
interface SuppressionsCreateOptions {
|
|
1666
|
-
/**
|
|
1667
|
-
* If true, the parent account creates suppression entries for all associated sub-accounts. This field is only applicable to parent accounts. Sub-accounts cannot create entries for other sub-accounts.
|
|
1668
|
-
* @default false
|
|
1669
|
-
*/
|
|
1670
|
-
addToSubAccounts?: boolean;
|
|
1671
|
-
/**
|
|
1672
|
-
* The total number of suppression entries to create, for the parent and/or its sub-accounts, must not exceed `1000`.
|
|
1673
|
-
*/
|
|
1674
|
-
entries: {
|
|
1675
|
-
/**
|
|
1676
|
-
* Must be less than `1024` characters.
|
|
1677
|
-
*/
|
|
1678
|
-
notes?: string;
|
|
1679
|
-
/**
|
|
1680
|
-
* The email address to suppress. Must be a valid email address format and less than `255` characters.
|
|
1681
|
-
*/
|
|
1682
|
-
recipient: string;
|
|
1683
|
-
/**
|
|
1684
|
-
* An array of types of suppression to apply to the recipient.
|
|
1685
|
-
* @default ["non-transactional"]
|
|
1686
|
-
*/
|
|
1687
|
-
types?: SuppressionsTypes[];
|
|
1688
|
-
}[];
|
|
1689
|
-
}
|
|
1690
|
-
type SuppressionsSource = "api" | "unsubscribe_link" | "list_unsubscribe" | "hard_bounce" | "spam_complaint" | "all";
|
|
1691
|
-
interface SuppressionsListOptions {
|
|
1692
|
-
/**
|
|
1693
|
-
* The email address of the suppression entry to search for. If provided, the search will return the suppression entry associated with this recipient. If not provided, the search will return all suppression entries for the account.
|
|
1694
|
-
*/
|
|
1695
|
-
recipient?: string;
|
|
1696
|
-
/**
|
|
1697
|
-
* The source of the suppression entries to filter by. If not provided, suppression entries from all sources will be returned.
|
|
1698
|
-
*/
|
|
1699
|
-
source?: Exclude<SuppressionsSource, "all">;
|
|
1700
|
-
/**
|
|
1701
|
-
* The date and/or time before which the suppression entries were created. Format: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ`.
|
|
1702
|
-
*/
|
|
1703
|
-
createdBefore?: string;
|
|
1704
|
-
/**
|
|
1705
|
-
* The date and/or time after which the suppression entries were created. Format: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ`.
|
|
1706
|
-
*/
|
|
1707
|
-
createdAfter?: string;
|
|
1708
|
-
/**
|
|
1709
|
-
* The maximum number of suppression entries to return. Must be between `1` and `1000`.
|
|
1710
|
-
* @default 1000
|
|
1711
|
-
*/
|
|
1712
|
-
limit?: number;
|
|
1713
|
-
/**
|
|
1714
|
-
* The number of suppression entries to skip before returning results.
|
|
1715
|
-
* @default 0
|
|
1716
|
-
*/
|
|
1717
|
-
offset?: number;
|
|
1718
|
-
}
|
|
1719
|
-
interface SuppressionsListEntry {
|
|
1720
|
-
createdAt: string;
|
|
1721
|
-
notes?: string;
|
|
1722
|
-
/**
|
|
1723
|
-
* The email address that is suppressed.
|
|
1724
|
-
*/
|
|
1725
|
-
recipient: string;
|
|
1726
|
-
sender?: string;
|
|
1727
|
-
source: SuppressionsSource;
|
|
1728
|
-
types: SuppressionsTypes[];
|
|
1729
|
-
}
|
|
1730
|
-
type SuppressionsListResponse = DataResponse<SuppressionsListEntry[]>;
|
|
1731
1780
|
declare class Suppressions {
|
|
1732
1781
|
protected mailchannels: MailChannelsClient;
|
|
1733
1782
|
constructor(mailchannels: MailChannelsClient);
|
|
@@ -1778,4 +1827,4 @@ declare class MailChannels extends MailChannelsClient {
|
|
|
1778
1827
|
readonly suppressions: Suppressions;
|
|
1779
1828
|
constructor(key: string, options?: MailChannelsClientOptions);
|
|
1780
1829
|
}
|
|
1781
|
-
export { Attachment, type DataResponse, Domains, type DomainsCheckOptions, type DomainsCheckResponse, type DomainsCheckVerdict, type DomainsDkimCreateOptions, type DomainsDkimCreateResponse, type DomainsDkimKey, type DomainsDkimKeyStatus, type DomainsDkimListOptions, type DomainsDkimListResponse, type DomainsDkimRotateOptions, type DomainsDkimRotateResponse, type DomainsDkimUpdateStatusOptions, Emails, type EmailsQueueResponse, type EmailsSendAsyncResponse, type EmailsSendAttachment, type EmailsSendContent, type EmailsSendDkim, type EmailsSendOptions, type EmailsSendPersonalization, type EmailsSendRecipient, type EmailsSendRecipientInput, type EmailsSendResponse, type EmailsSendTemplate, type EmailsSendTemplateType, type EmailsSendTemplateValue, type EmailsSendTracking, type ErrorResponse, type ErrorType, MailChannels, MailChannelsClient, type MailChannelsClientOptions, Metrics, type MetricsBucket, type MetricsEngagement, type MetricsEngagementResponse, type MetricsOptions, type MetricsPerformance, type MetricsPerformanceResponse, type MetricsRecipientBehaviour, type MetricsRecipientBehaviourResponse, type MetricsSenders, type MetricsSendersOptions, type MetricsSendersResponse, type MetricsSendersType, type MetricsUsageResponse, type MetricsVolume, type MetricsVolumeResponse, SubAccounts, type SubAccountsAccount, type SubAccountsApiKey, type SubAccountsCreateApiKeyResponse, type SubAccountsCreateResponse, type SubAccountsCreateSmtpPasswordResponse, type SubAccountsLimit, type SubAccountsLimitResponse, type SubAccountsListApiKeyOptions, type SubAccountsListApiKeyResponse, type SubAccountsListOptions, type SubAccountsListResponse, type SubAccountsListSmtpPasswordResponse, type SubAccountsSmtpPassword, type SubAccountsUsage, type SubAccountsUsageResponse, type SuccessResponse, Suppressions, type SuppressionsCreateOptions, type SuppressionsListEntry, type SuppressionsListOptions, type SuppressionsListResponse, type SuppressionsSource, type SuppressionsTypes, type WebhookEvent, type WebhookEventClick, type WebhookEventComplained, type WebhookEventDelivered, type WebhookEventDropped, type WebhookEventHardBounced, type WebhookEventOpen, type WebhookEventProcessed, type WebhookEventSoftBounced, type WebhookEventTest, type WebhookEventType, type WebhookEventUnsubscribed, Webhooks, type WebhooksBatch, type WebhooksBatchResponseStatus, type WebhooksBatchStatus, type WebhooksBatchesOptions, type WebhooksBatchesResponse, type WebhooksListResponse, type WebhooksResendBatch, type WebhooksResendBatchResponse, type WebhooksSigningKeyResponse, type WebhooksValidateResponse, type WebhooksVerifyOptions, type WebhooksVerifyResponse };
|
|
1830
|
+
export { Attachment, type DataResponse, Domains, type DomainsCheckOptions, type DomainsCheckResponse, type DomainsCheckVerdict, type DomainsDkimCreateOptions, type DomainsDkimCreateResponse, type DomainsDkimKey, type DomainsDkimKeyStatus, type DomainsDkimListOptions, type DomainsDkimListResponse, type DomainsDkimRotateOptions, type DomainsDkimRotateResponse, type DomainsDkimUpdateStatusOptions, Emails, type EmailsQueueResponse, type EmailsSendAsyncResponse, type EmailsSendAttachment, type EmailsSendContent, type EmailsSendDkim, type EmailsSendOptions, type EmailsSendPersonalization, type EmailsSendRecipient, type EmailsSendRecipientInput, type EmailsSendResponse, type EmailsSendTemplate, type EmailsSendTemplateType, type EmailsSendTemplateValue, type EmailsSendTracking, type ErrorResponse, type ErrorType, MailChannels, MailChannelsClient, type MailChannelsClientOptions, Metrics, type MetricsBucket, type MetricsEngagement, type MetricsEngagementResponse, type MetricsOptions, type MetricsPerformance, type MetricsPerformanceResponse, type MetricsRecipientBehaviour, type MetricsRecipientBehaviourResponse, type MetricsSenders, type MetricsSendersOptions, type MetricsSendersResponse, type MetricsSendersType, type MetricsUsageResponse, type MetricsVolume, type MetricsVolumeResponse, type SubAccount, SubAccounts, type SubAccountsAccount, type SubAccountsApiKey, type SubAccountsApiKeysCreateResponse, type SubAccountsApiKeysListOptions, type SubAccountsApiKeysListResponse, type SubAccountsCreateApiKeyResponse, type SubAccountsCreateResponse, type SubAccountsCreateSmtpPasswordResponse, type SubAccountsLimit, type SubAccountsLimitResponse, type SubAccountsLimitsGetResponse, type SubAccountsLimitsSetOptions, type SubAccountsListApiKeyOptions, type SubAccountsListApiKeyResponse, type SubAccountsListOptions, type SubAccountsListResponse, type SubAccountsListSmtpPasswordResponse, type SubAccountsSmtpPassword, type SubAccountsSmtpPasswordsCreateResponse, type SubAccountsSmtpPasswordsListResponse, type SubAccountsUsage, type SubAccountsUsageResponse, type SuccessResponse, Suppressions, type SuppressionsCreateOptions, type SuppressionsListEntry, type SuppressionsListOptions, type SuppressionsListResponse, type SuppressionsSource, type SuppressionsTypes, type WebhookEvent, type WebhookEventClick, type WebhookEventComplained, type WebhookEventDelivered, type WebhookEventDropped, type WebhookEventHardBounced, type WebhookEventOpen, type WebhookEventProcessed, type WebhookEventSoftBounced, type WebhookEventTest, type WebhookEventType, type WebhookEventUnsubscribed, Webhooks, type WebhooksBatch, type WebhooksBatchResponseStatus, type WebhooksBatchStatus, type WebhooksBatchesOptions, type WebhooksBatchesResponse, type WebhooksListResponse, type WebhooksResendBatch, type WebhooksResendBatchResponse, type WebhooksSigningKeyResponse, type WebhooksValidateResponse, type WebhooksVerifyOptions, type WebhooksVerifyResponse };
|