mailchannels-sdk 0.8.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 +86 -9
- package/dist/_chunks/simulator.mjs +1 -1
- package/dist/mailchannels.d.mts +421 -367
- package/dist/mailchannels.mjs +463 -347
- package/package.json +10 -9
package/dist/mailchannels.d.mts
CHANGED
|
@@ -44,6 +44,7 @@ declare class MailChannelsClient {
|
|
|
44
44
|
put<T>(path: string, options?: Omit<FetchOptions<"json">, "method">): Promise<T>;
|
|
45
45
|
patch<T>(path: string, options?: Omit<FetchOptions<"json">, "method">): Promise<T>;
|
|
46
46
|
}
|
|
47
|
+
type ErrorType = "invalid_request_error" | "authentication_error" | "permission_error" | "not_found" | "conflict_error" | "payload_too_large_error" | "unprocessable_entity_error" | "rate_limit_error" | "internal_server_error" | "validation_error" | "application_error" | "api_error";
|
|
47
48
|
interface ErrorResponse {
|
|
48
49
|
/**
|
|
49
50
|
* A human-readable description of the error.
|
|
@@ -55,6 +56,12 @@ interface ErrorResponse {
|
|
|
55
56
|
* This field is intended for diagnostic use only and should not be relied upon.
|
|
56
57
|
*/
|
|
57
58
|
statusCode: number | null;
|
|
59
|
+
/**
|
|
60
|
+
* A string identifier for the type of error.
|
|
61
|
+
*
|
|
62
|
+
* This field is intended for diagnostic use only and should not be relied upon.
|
|
63
|
+
*/
|
|
64
|
+
type: ErrorType;
|
|
58
65
|
}
|
|
59
66
|
interface SuccessResponse {
|
|
60
67
|
/**
|
|
@@ -467,6 +474,7 @@ type EmailsQueueResponse = DataResponse<{
|
|
|
467
474
|
*/
|
|
468
475
|
requestId: string;
|
|
469
476
|
}>;
|
|
477
|
+
/** @deprecated Use `EmailsQueueResponse` instead. */
|
|
470
478
|
type EmailsSendAsyncResponse = EmailsQueueResponse;
|
|
471
479
|
declare class Emails {
|
|
472
480
|
protected mailchannels: MailChannelsClient;
|
|
@@ -577,6 +585,118 @@ interface DomainsDkimKey {
|
|
|
577
585
|
statusModifiedAt?: string;
|
|
578
586
|
}
|
|
579
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
|
+
}
|
|
580
700
|
interface DomainsCheck {
|
|
581
701
|
/**
|
|
582
702
|
* Domain used for DKIM signing.
|
|
@@ -669,58 +789,6 @@ type DomainsCheckResponse = DataResponse<{
|
|
|
669
789
|
};
|
|
670
790
|
references?: string[];
|
|
671
791
|
}>;
|
|
672
|
-
interface DomainsDkimListOptions {
|
|
673
|
-
/**
|
|
674
|
-
* Selector to filter keys by. Must be a maximum of 63 characters.
|
|
675
|
-
*/
|
|
676
|
-
selector?: string;
|
|
677
|
-
/**
|
|
678
|
-
* Status to filter keys by.
|
|
679
|
-
*/
|
|
680
|
-
status?: DomainsDkimKey["status"];
|
|
681
|
-
/**
|
|
682
|
-
* Number of keys to skip before returning results.
|
|
683
|
-
* @default 0
|
|
684
|
-
*/
|
|
685
|
-
offset?: number;
|
|
686
|
-
/**
|
|
687
|
-
* Maximum number of keys to return. Maximum is `100` and minimum is `1`.
|
|
688
|
-
* @default 10
|
|
689
|
-
*/
|
|
690
|
-
limit?: number;
|
|
691
|
-
/**
|
|
692
|
-
* If `true`, includes the suggested DKIM DNS record for each returned key.
|
|
693
|
-
* @default false
|
|
694
|
-
*/
|
|
695
|
-
includeDnsRecord?: boolean;
|
|
696
|
-
}
|
|
697
|
-
type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
698
|
-
type DomainsDkimListResponse = DataResponse<Optional<DomainsDkimKey, "dnsRecords">[]>;
|
|
699
|
-
interface DomainsDkimUpdateStatusOptions {
|
|
700
|
-
/**
|
|
701
|
-
* Selector of the DKIM key pair to update. Must be a maximum of 63 characters.
|
|
702
|
-
*/
|
|
703
|
-
selector: string;
|
|
704
|
-
/**
|
|
705
|
-
* New status of the DKIM key pair.
|
|
706
|
-
* - `revoked`: Indicates that the key is compromised and should not be used.
|
|
707
|
-
* - `retired`: Indicates that the key has been rotated and is no longer in use.
|
|
708
|
-
* - `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.
|
|
709
|
-
*/
|
|
710
|
-
status: Exclude<DomainsDkimKey["status"], "active">;
|
|
711
|
-
}
|
|
712
|
-
interface DomainsDkimRotateOptions {
|
|
713
|
-
newKey: {
|
|
714
|
-
/**
|
|
715
|
-
* Selector for the new key pair. Must be a maximum of 63 characters.
|
|
716
|
-
*/
|
|
717
|
-
selector: string;
|
|
718
|
-
};
|
|
719
|
-
}
|
|
720
|
-
type DomainsDkimRotateResponse = DataResponse<{
|
|
721
|
-
new: DomainsDkimKey;
|
|
722
|
-
rotated: DomainsDkimKey;
|
|
723
|
-
}>;
|
|
724
792
|
declare class Domains {
|
|
725
793
|
protected mailchannels: MailChannelsClient;
|
|
726
794
|
readonly dkim: DomainsDkim;
|
|
@@ -744,66 +812,6 @@ declare class Domains {
|
|
|
744
812
|
*/
|
|
745
813
|
check(domain: string, options?: DomainsCheckOptions): Promise<DomainsCheckResponse>;
|
|
746
814
|
}
|
|
747
|
-
declare class DomainsDkim {
|
|
748
|
-
private mailchannels;
|
|
749
|
-
constructor(mailchannels: MailChannelsClient);
|
|
750
|
-
/**
|
|
751
|
-
* Create a DKIM key pair for a specified domain and selector using the specified algorithm and key length, for the current customer.
|
|
752
|
-
* @param domain - The domain to create the DKIM key for.
|
|
753
|
-
* @param options - DKIM key creation options.
|
|
754
|
-
* @example
|
|
755
|
-
* ```ts
|
|
756
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
757
|
-
* const { data, error } = await mailchannels.domains.dkim.create('example.com', {
|
|
758
|
-
* selector: 'mailchannels'
|
|
759
|
-
* })
|
|
760
|
-
* ```
|
|
761
|
-
*/
|
|
762
|
-
create(domain: string, options: DomainsDkimCreateOptions): Promise<DomainsDkimCreateResponse>;
|
|
763
|
-
/**
|
|
764
|
-
* Search for DKIM keys by domain, with optional filters. If selector is provided, at most one key will be returned.
|
|
765
|
-
* @param domain - The domain to search DKIM keys for.
|
|
766
|
-
* @param options - The options to filter DKIM keys by.
|
|
767
|
-
* @example
|
|
768
|
-
* ```ts
|
|
769
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
770
|
-
* const { data, error } = await mailchannels.domains.dkim.list('example.com', {
|
|
771
|
-
* includeDnsRecord: true
|
|
772
|
-
* })
|
|
773
|
-
* ```
|
|
774
|
-
*/
|
|
775
|
-
list(domain: string, options?: DomainsDkimListOptions): Promise<DomainsDkimListResponse>;
|
|
776
|
-
/**
|
|
777
|
-
* 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.
|
|
778
|
-
* @param domain - The domain the DKIM key belongs to.
|
|
779
|
-
* @param options - The options to update the DKIM key.
|
|
780
|
-
* @example
|
|
781
|
-
* ```ts
|
|
782
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
783
|
-
* const { success, error } = await mailchannels.domains.dkim.updateStatus('example.com', {
|
|
784
|
-
* selector: 'mailchannels',
|
|
785
|
-
* status: 'retired'
|
|
786
|
-
* })
|
|
787
|
-
*/
|
|
788
|
-
updateStatus(domain: string, options: DomainsDkimUpdateStatusOptions): Promise<SuccessResponse>;
|
|
789
|
-
/**
|
|
790
|
-
* 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.
|
|
791
|
-
* @param domain - The domain the DKIM key belongs to.
|
|
792
|
-
* @param selector - The selector of the DKIM key to rotate.
|
|
793
|
-
* @param options - The options to rotate the DKIM key.
|
|
794
|
-
* @param options.newKey.selector - The selector for the new key pair. Must be a maximum of 63 characters.
|
|
795
|
-
* @example
|
|
796
|
-
* ```ts
|
|
797
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
798
|
-
* const { data, error } = await mailchannels.domains.dkim.rotate('example.com', 'mailchannels', {
|
|
799
|
-
* newKey: {
|
|
800
|
-
* selector: 'new-selector'
|
|
801
|
-
* }
|
|
802
|
-
* })
|
|
803
|
-
* ```
|
|
804
|
-
*/
|
|
805
|
-
rotate(domain: string, selector: string, options: DomainsDkimRotateOptions): Promise<DomainsDkimRotateResponse>;
|
|
806
|
-
}
|
|
807
815
|
type WebhooksListResponse = DataResponse<{
|
|
808
816
|
/**
|
|
809
817
|
* A customer's webhook that events will be sent to
|
|
@@ -952,13 +960,13 @@ type WebhooksBatchStatus = "1xx" | "2xx" | "3xx" | "4xx" | "5xx" | "no_response"
|
|
|
952
960
|
type WebhooksBatchResponseStatus = "1xx_response" | "2xx_response" | "3xx_response" | "4xx_response" | "5xx_response" | "no_response";
|
|
953
961
|
interface WebhooksBatchesOptions {
|
|
954
962
|
/**
|
|
955
|
-
* 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.
|
|
956
964
|
*/
|
|
957
|
-
createdAfter?: string;
|
|
965
|
+
createdAfter?: string | Date;
|
|
958
966
|
/**
|
|
959
|
-
* 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.
|
|
960
968
|
*/
|
|
961
|
-
createdBefore?: string;
|
|
969
|
+
createdBefore?: string | Date;
|
|
962
970
|
/**
|
|
963
971
|
* Filters webhook batches by webhook response status category. If not provided, batches with all categories are returned.
|
|
964
972
|
*/
|
|
@@ -1138,7 +1146,7 @@ declare class Webhooks {
|
|
|
1138
1146
|
*/
|
|
1139
1147
|
resendBatch(batchId: number): Promise<WebhooksResendBatchResponse>;
|
|
1140
1148
|
}
|
|
1141
|
-
interface
|
|
1149
|
+
interface SubAccount {
|
|
1142
1150
|
/**
|
|
1143
1151
|
* The name of the company associated with the sub-account.
|
|
1144
1152
|
*/
|
|
@@ -1152,7 +1160,9 @@ interface SubAccountsAccount {
|
|
|
1152
1160
|
*/
|
|
1153
1161
|
handle: string;
|
|
1154
1162
|
}
|
|
1155
|
-
type SubAccountsCreateResponse = DataResponse<
|
|
1163
|
+
type SubAccountsCreateResponse = DataResponse<SubAccount>;
|
|
1164
|
+
/** @deprecated Use `SubAccount` instead. */
|
|
1165
|
+
type SubAccountsAccount = SubAccount;
|
|
1156
1166
|
interface SubAccountsListOptions {
|
|
1157
1167
|
/**
|
|
1158
1168
|
* Possible values are `1` to `1000`.
|
|
@@ -1165,7 +1175,7 @@ interface SubAccountsListOptions {
|
|
|
1165
1175
|
*/
|
|
1166
1176
|
offset?: number;
|
|
1167
1177
|
}
|
|
1168
|
-
type SubAccountsListResponse = DataResponse<
|
|
1178
|
+
type SubAccountsListResponse = DataResponse<SubAccount[]>;
|
|
1169
1179
|
interface SubAccountsApiKey {
|
|
1170
1180
|
/**
|
|
1171
1181
|
* The API key ID for the sub-account.
|
|
@@ -1176,8 +1186,8 @@ interface SubAccountsApiKey {
|
|
|
1176
1186
|
*/
|
|
1177
1187
|
key: string;
|
|
1178
1188
|
}
|
|
1179
|
-
type
|
|
1180
|
-
interface
|
|
1189
|
+
type SubAccountsApiKeysCreateResponse = DataResponse<SubAccountsApiKey>;
|
|
1190
|
+
interface SubAccountsApiKeysListOptions {
|
|
1181
1191
|
/**
|
|
1182
1192
|
* The maximum number of API keys included in the response. Possible values are `1` to `1000`.
|
|
1183
1193
|
* @default 100
|
|
@@ -1189,7 +1199,13 @@ interface SubAccountsListApiKeyOptions {
|
|
|
1189
1199
|
*/
|
|
1190
1200
|
offset?: number;
|
|
1191
1201
|
}
|
|
1192
|
-
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;
|
|
1193
1209
|
interface SubAccountsSmtpPassword {
|
|
1194
1210
|
/**
|
|
1195
1211
|
* Whether the SMTP password is enabled.
|
|
@@ -1204,12 +1220,19 @@ interface SubAccountsSmtpPassword {
|
|
|
1204
1220
|
*/
|
|
1205
1221
|
smtpPassword: string;
|
|
1206
1222
|
}
|
|
1207
|
-
type
|
|
1208
|
-
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;
|
|
1209
1229
|
interface SubAccountsLimit {
|
|
1210
1230
|
sends: number;
|
|
1211
1231
|
}
|
|
1212
|
-
|
|
1232
|
+
interface SubAccountsLimitsSetOptions extends SubAccountsLimit {}
|
|
1233
|
+
type SubAccountsLimitsGetResponse = DataResponse<SubAccountsLimit>;
|
|
1234
|
+
/** @deprecated Use `SubAccountsLimitsGetResponse` instead. */
|
|
1235
|
+
type SubAccountsLimitResponse = SubAccountsLimitsGetResponse;
|
|
1213
1236
|
interface SubAccountsUsage {
|
|
1214
1237
|
/**
|
|
1215
1238
|
* The end date of the current billing period (ISO 8601 format).
|
|
@@ -1227,170 +1250,9 @@ interface SubAccountsUsage {
|
|
|
1227
1250
|
total: number;
|
|
1228
1251
|
}
|
|
1229
1252
|
type SubAccountsUsageResponse = DataResponse<SubAccountsUsage>;
|
|
1230
|
-
|
|
1231
|
-
protected mailchannels: MailChannelsClient;
|
|
1232
|
-
private static readonly COMPANY_PATTERN;
|
|
1233
|
-
private static readonly HANDLE_PATTERN;
|
|
1234
|
-
constructor(mailchannels: MailChannelsClient);
|
|
1235
|
-
/**
|
|
1236
|
-
* 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.
|
|
1237
|
-
* @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.
|
|
1238
|
-
* @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.
|
|
1239
|
-
* @example
|
|
1240
|
-
* ```ts
|
|
1241
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1242
|
-
* const { data, error } = await mailchannels.subAccounts.create('My Company', 'validhandle123')
|
|
1243
|
-
* ```
|
|
1244
|
-
*/
|
|
1245
|
-
create(companyName: string, handle?: string): Promise<SubAccountsCreateResponse>;
|
|
1253
|
+
interface MetricsEngagement {
|
|
1246
1254
|
/**
|
|
1247
|
-
*
|
|
1248
|
-
* @param options - The options to filter the list of sub-accounts.
|
|
1249
|
-
* @example
|
|
1250
|
-
* ```ts
|
|
1251
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1252
|
-
* const { data, error } = await mailchannels.subAccounts.list()
|
|
1253
|
-
* ```
|
|
1254
|
-
*/
|
|
1255
|
-
list(options?: SubAccountsListOptions): Promise<SubAccountsListResponse>;
|
|
1256
|
-
/**
|
|
1257
|
-
* Deletes the sub-account identified by its handle.
|
|
1258
|
-
* @param handle - Handle of sub-account to be deleted.
|
|
1259
|
-
* @example
|
|
1260
|
-
* ```ts
|
|
1261
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1262
|
-
* const { success, error } = await mailchannels.subAccounts.delete('validhandle123')
|
|
1263
|
-
* ```
|
|
1264
|
-
*/
|
|
1265
|
-
delete(handle: string): Promise<SuccessResponse>;
|
|
1266
|
-
/**
|
|
1267
|
-
* Suspends the sub-account identified by its handle. This action disables the account, preventing it from sending any emails until it is reactivated.
|
|
1268
|
-
* @param handle - Handle of sub-account to be suspended.
|
|
1269
|
-
* @example
|
|
1270
|
-
* ```ts
|
|
1271
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1272
|
-
* const { success, error } = await mailchannels.subAccounts.suspend('validhandle123')
|
|
1273
|
-
* ```
|
|
1274
|
-
*/
|
|
1275
|
-
suspend(handle: string): Promise<SuccessResponse>;
|
|
1276
|
-
/**
|
|
1277
|
-
* Activates a suspended sub-account identified by its handle, restoring its ability to send emails.
|
|
1278
|
-
* @param handle - Handle of sub-account to be activated.
|
|
1279
|
-
* @example
|
|
1280
|
-
* ```ts
|
|
1281
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1282
|
-
* const { success, error } = await mailchannels.subAccounts.activate('validhandle123')
|
|
1283
|
-
* ```
|
|
1284
|
-
*/
|
|
1285
|
-
activate(handle: string): Promise<SuccessResponse>;
|
|
1286
|
-
/**
|
|
1287
|
-
* Creates a new API key for the specified sub-account.
|
|
1288
|
-
* @param handle - Handle of the sub-account to create API key for.
|
|
1289
|
-
* @example
|
|
1290
|
-
* ```ts
|
|
1291
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1292
|
-
* const { data, error } = await mailchannels.subAccounts.createApiKey('validhandle123')
|
|
1293
|
-
* ```
|
|
1294
|
-
*/
|
|
1295
|
-
createApiKey(handle: string): Promise<SubAccountsCreateApiKeyResponse>;
|
|
1296
|
-
/**
|
|
1297
|
-
* 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.
|
|
1298
|
-
* @param handle - Handle of the sub-account to retrieve the API key for.
|
|
1299
|
-
* @param options - The options to filter the list of API keys.
|
|
1300
|
-
* @example
|
|
1301
|
-
* ```ts
|
|
1302
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1303
|
-
* const { data, error } = await mailchannels.subAccounts.listApiKeys('validhandle123')
|
|
1304
|
-
* ```
|
|
1305
|
-
*/
|
|
1306
|
-
listApiKeys(handle: string, options?: SubAccountsListApiKeyOptions): Promise<SubAccountsListApiKeyResponse>;
|
|
1307
|
-
/**
|
|
1308
|
-
* Deletes the API key identified by its ID for the specified sub-account.
|
|
1309
|
-
* @param handle - Handle of the sub-account for which the API key should be deleted.
|
|
1310
|
-
* @param id - The ID of the API key to delete.
|
|
1311
|
-
* @example
|
|
1312
|
-
* ```ts
|
|
1313
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1314
|
-
* const { success, error } = await mailchannels.subAccounts.deleteApiKey('validhandle123', 1)
|
|
1315
|
-
* ```
|
|
1316
|
-
*/
|
|
1317
|
-
deleteApiKey(handle: string, id: number): Promise<SuccessResponse>;
|
|
1318
|
-
/**
|
|
1319
|
-
* Creates a new SMTP password for the specified sub-account.
|
|
1320
|
-
* @param handle - Handle of the sub-account to create SMTP password for.
|
|
1321
|
-
* @example
|
|
1322
|
-
* ```ts
|
|
1323
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1324
|
-
* const { data, error } = await mailchannels.subAccounts.createSmtpPassword('validhandle123')
|
|
1325
|
-
* ```
|
|
1326
|
-
*/
|
|
1327
|
-
createSmtpPassword(handle: string): Promise<SubAccountsCreateSmtpPasswordResponse>;
|
|
1328
|
-
/**
|
|
1329
|
-
* 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.
|
|
1330
|
-
* @param handle - Handle of the sub-account to retrieve the SMTP password for.
|
|
1331
|
-
* @example
|
|
1332
|
-
* ```ts
|
|
1333
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1334
|
-
* const { data, error } = await mailchannels.subAccounts.listSmtpPasswords('validhandle123')
|
|
1335
|
-
* ```
|
|
1336
|
-
*/
|
|
1337
|
-
listSmtpPasswords(handle: string): Promise<SubAccountsListSmtpPasswordResponse>;
|
|
1338
|
-
/**
|
|
1339
|
-
* Deletes the SMTP password identified by its ID for the specified sub-account.
|
|
1340
|
-
* @param handle - Handle of the sub-account for which the SMTP password should be deleted.
|
|
1341
|
-
* @param id - The ID of the SMTP password to delete.
|
|
1342
|
-
* @example
|
|
1343
|
-
* ```ts
|
|
1344
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1345
|
-
* const { success, error } = await mailchannels.subAccounts.deleteSmtpPassword('validhandle123', 1)
|
|
1346
|
-
* ```
|
|
1347
|
-
*/
|
|
1348
|
-
deleteSmtpPassword(handle: string, id: number): Promise<SuccessResponse>;
|
|
1349
|
-
/**
|
|
1350
|
-
* 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.
|
|
1351
|
-
* @param handle - Handle of the sub-account to retrieve the limit for.
|
|
1352
|
-
* @example
|
|
1353
|
-
* ```ts
|
|
1354
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1355
|
-
* const { data, error } = await mailchannels.subAccounts.getLimit('validhandle123')
|
|
1356
|
-
* ```
|
|
1357
|
-
*/
|
|
1358
|
-
getLimit(handle: string): Promise<SubAccountsLimitResponse>;
|
|
1359
|
-
/**
|
|
1360
|
-
* Sets the limit for the specified sub-account.
|
|
1361
|
-
* @param handle - Handle of the sub-account to set limit for.
|
|
1362
|
-
* @param limit - The limits to set for the sub-account. The minimum allowed sends is `0`
|
|
1363
|
-
* @example
|
|
1364
|
-
* ```ts
|
|
1365
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1366
|
-
* const { success, error } = await mailchannels.subAccounts.setLimit('validhandle123', { sends: 1000 })
|
|
1367
|
-
* ```
|
|
1368
|
-
*/
|
|
1369
|
-
setLimit(handle: string, limit: SubAccountsLimit): Promise<SuccessResponse>;
|
|
1370
|
-
/**
|
|
1371
|
-
* 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.
|
|
1372
|
-
* @param handle - Handle of the sub-account to delete limit for.
|
|
1373
|
-
* @example
|
|
1374
|
-
* ```ts
|
|
1375
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1376
|
-
* const { success, error } = await mailchannels.subAccounts.deleteLimit('validhandle123')
|
|
1377
|
-
* ```
|
|
1378
|
-
*/
|
|
1379
|
-
deleteLimit(handle: string): Promise<SuccessResponse>;
|
|
1380
|
-
/**
|
|
1381
|
-
* Retrieves usage statistics for the specified sub-account during the current billing period.
|
|
1382
|
-
* @param handle - Handle of the sub-account to query usage stats for.
|
|
1383
|
-
* @example
|
|
1384
|
-
* ```ts
|
|
1385
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1386
|
-
* const { data, error } = await mailchannels.subAccounts.getUsage('validhandle123')
|
|
1387
|
-
* ```
|
|
1388
|
-
*/
|
|
1389
|
-
getUsage(handle: string): Promise<SubAccountsUsageResponse>;
|
|
1390
|
-
}
|
|
1391
|
-
interface MetricsEngagement {
|
|
1392
|
-
/**
|
|
1393
|
-
* A series of metrics aggregations bucketed by time interval (e.g. hour, day).
|
|
1255
|
+
* A series of metrics aggregations bucketed by time interval (e.g. hour, day).
|
|
1394
1256
|
*/
|
|
1395
1257
|
buckets: {
|
|
1396
1258
|
click: MetricsBucket[];
|
|
@@ -1513,15 +1375,15 @@ type MetricsUsageResponse = DataResponse<{
|
|
|
1513
1375
|
type MetricsSendersType = "sub-accounts" | "campaigns";
|
|
1514
1376
|
interface MetricsSendersOptions {
|
|
1515
1377
|
/**
|
|
1516
|
-
* 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.
|
|
1517
1379
|
* @example "2025-11-02T03:13:35.761763554Z"
|
|
1518
1380
|
*/
|
|
1519
|
-
startTime?: string;
|
|
1381
|
+
startTime?: string | Date;
|
|
1520
1382
|
/**
|
|
1521
|
-
* 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.
|
|
1522
1384
|
* @example "2025-12-02T03:13:35.761763554Z"
|
|
1523
1385
|
*/
|
|
1524
|
-
endTime?: string;
|
|
1386
|
+
endTime?: string | Date;
|
|
1525
1387
|
/**
|
|
1526
1388
|
* The maximum number of senders to return. Possible values are 1 to 1000.
|
|
1527
1389
|
* @default 10
|
|
@@ -1571,15 +1433,15 @@ interface MetricsBucket {
|
|
|
1571
1433
|
}
|
|
1572
1434
|
interface MetricsOptions {
|
|
1573
1435
|
/**
|
|
1574
|
-
* 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.
|
|
1575
1437
|
* @example "2025-05-26"
|
|
1576
1438
|
*/
|
|
1577
|
-
startTime?: string;
|
|
1439
|
+
startTime?: string | Date;
|
|
1578
1440
|
/**
|
|
1579
|
-
* 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.
|
|
1580
1442
|
* @example "2025-05-31T15:16:17Z"
|
|
1581
1443
|
*/
|
|
1582
|
-
endTime?: string;
|
|
1444
|
+
endTime?: string | Date;
|
|
1583
1445
|
/**
|
|
1584
1446
|
* The ID of the campaign to filter metrics by. If not provided, metrics for all campaigns will be returned.
|
|
1585
1447
|
*/
|
|
@@ -1590,6 +1452,267 @@ interface MetricsOptions {
|
|
|
1590
1452
|
*/
|
|
1591
1453
|
interval?: "hour" | "day" | "week" | "month";
|
|
1592
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
|
+
}
|
|
1593
1716
|
declare class Metrics {
|
|
1594
1717
|
protected mailchannels: MailChannelsClient;
|
|
1595
1718
|
constructor(mailchannels: MailChannelsClient);
|
|
@@ -1654,73 +1777,6 @@ declare class Metrics {
|
|
|
1654
1777
|
*/
|
|
1655
1778
|
senders(type: MetricsSendersType, options?: MetricsSendersOptions): Promise<MetricsSendersResponse>;
|
|
1656
1779
|
}
|
|
1657
|
-
type SuppressionsTypes = "transactional" | "non-transactional";
|
|
1658
|
-
interface SuppressionsCreateOptions {
|
|
1659
|
-
/**
|
|
1660
|
-
* 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.
|
|
1661
|
-
* @default false
|
|
1662
|
-
*/
|
|
1663
|
-
addToSubAccounts?: boolean;
|
|
1664
|
-
/**
|
|
1665
|
-
* The total number of suppression entries to create, for the parent and/or its sub-accounts, must not exceed `1000`.
|
|
1666
|
-
*/
|
|
1667
|
-
entries: {
|
|
1668
|
-
/**
|
|
1669
|
-
* Must be less than `1024` characters.
|
|
1670
|
-
*/
|
|
1671
|
-
notes?: string;
|
|
1672
|
-
/**
|
|
1673
|
-
* The email address to suppress. Must be a valid email address format and less than `255` characters.
|
|
1674
|
-
*/
|
|
1675
|
-
recipient: string;
|
|
1676
|
-
/**
|
|
1677
|
-
* An array of types of suppression to apply to the recipient.
|
|
1678
|
-
* @default ["non-transactional"]
|
|
1679
|
-
*/
|
|
1680
|
-
types?: SuppressionsTypes[];
|
|
1681
|
-
}[];
|
|
1682
|
-
}
|
|
1683
|
-
type SuppressionsSource = "api" | "unsubscribe_link" | "list_unsubscribe" | "hard_bounce" | "spam_complaint" | "all";
|
|
1684
|
-
interface SuppressionsListOptions {
|
|
1685
|
-
/**
|
|
1686
|
-
* 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.
|
|
1687
|
-
*/
|
|
1688
|
-
recipient?: string;
|
|
1689
|
-
/**
|
|
1690
|
-
* The source of the suppression entries to filter by. If not provided, suppression entries from all sources will be returned.
|
|
1691
|
-
*/
|
|
1692
|
-
source?: Exclude<SuppressionsSource, "all">;
|
|
1693
|
-
/**
|
|
1694
|
-
* The date and/or time before which the suppression entries were created. Format: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ`.
|
|
1695
|
-
*/
|
|
1696
|
-
createdBefore?: string;
|
|
1697
|
-
/**
|
|
1698
|
-
* The date and/or time after which the suppression entries were created. Format: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ`.
|
|
1699
|
-
*/
|
|
1700
|
-
createdAfter?: string;
|
|
1701
|
-
/**
|
|
1702
|
-
* The maximum number of suppression entries to return. Must be between `1` and `1000`.
|
|
1703
|
-
* @default 1000
|
|
1704
|
-
*/
|
|
1705
|
-
limit?: number;
|
|
1706
|
-
/**
|
|
1707
|
-
* The number of suppression entries to skip before returning results.
|
|
1708
|
-
* @default 0
|
|
1709
|
-
*/
|
|
1710
|
-
offset?: number;
|
|
1711
|
-
}
|
|
1712
|
-
interface SuppressionsListEntry {
|
|
1713
|
-
createdAt: string;
|
|
1714
|
-
notes?: string;
|
|
1715
|
-
/**
|
|
1716
|
-
* The email address that is suppressed.
|
|
1717
|
-
*/
|
|
1718
|
-
recipient: string;
|
|
1719
|
-
sender?: string;
|
|
1720
|
-
source: SuppressionsSource;
|
|
1721
|
-
types: SuppressionsTypes[];
|
|
1722
|
-
}
|
|
1723
|
-
type SuppressionsListResponse = DataResponse<SuppressionsListEntry[]>;
|
|
1724
1780
|
declare class Suppressions {
|
|
1725
1781
|
protected mailchannels: MailChannelsClient;
|
|
1726
1782
|
constructor(mailchannels: MailChannelsClient);
|
|
@@ -1760,9 +1816,7 @@ declare class Suppressions {
|
|
|
1760
1816
|
type AttachmentOptions = Omit<EmailsSendAttachment, "content">;
|
|
1761
1817
|
declare class Attachment {
|
|
1762
1818
|
static fromBytes(data: ArrayBuffer | Uint8Array, options: AttachmentOptions): EmailsSendAttachment;
|
|
1763
|
-
static
|
|
1764
|
-
static fromUrl(url: string, options?: Partial<AttachmentOptions>): Promise<EmailsSendAttachment>;
|
|
1765
|
-
static inlineFile(path: string | URL, options?: Partial<Omit<AttachmentOptions, "disposition">>): Promise<EmailsSendAttachment>;
|
|
1819
|
+
static fromBlob(blob: Blob, options: AttachmentOptions): Promise<EmailsSendAttachment>;
|
|
1766
1820
|
}
|
|
1767
1821
|
declare class MailChannels extends MailChannelsClient {
|
|
1768
1822
|
readonly emails: Emails;
|
|
@@ -1773,4 +1827,4 @@ declare class MailChannels extends MailChannelsClient {
|
|
|
1773
1827
|
readonly suppressions: Suppressions;
|
|
1774
1828
|
constructor(key: string, options?: MailChannelsClientOptions);
|
|
1775
1829
|
}
|
|
1776
|
-
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, 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 };
|