shipmail 0.1.24 → 0.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -0
- package/dist/index.cjs +84 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +99 -1
- package/dist/index.d.ts +99 -1
- package/dist/index.js +84 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -683,6 +683,103 @@ declare class Messages extends ApiResource {
|
|
|
683
683
|
reply(id: string, params: ReplyToMessageParams, options?: MethodOptions): Promise<Message>;
|
|
684
684
|
}
|
|
685
685
|
|
|
686
|
+
type NewsletterStatus = "draft" | "pending_approval" | "approved" | "scheduled" | "sending" | "paused" | "sent" | "cancelled" | "failed";
|
|
687
|
+
type NewsletterArchiveVisibility = "private" | "public";
|
|
688
|
+
type NewsletterPreflightStatus = "not_run" | "passed" | "warning" | "failed";
|
|
689
|
+
type NewsletterPreflightItemStatus = "pass" | "warn" | "fail";
|
|
690
|
+
type NewsletterTestSendStatus = "pending" | "sent" | "failed";
|
|
691
|
+
type Newsletter = {
|
|
692
|
+
readonly object: "newsletter";
|
|
693
|
+
readonly id: string;
|
|
694
|
+
readonly audience_id: string | null;
|
|
695
|
+
readonly newsletter_domain_id: string;
|
|
696
|
+
readonly reply_to_mailbox_id: string | null;
|
|
697
|
+
readonly name: string;
|
|
698
|
+
readonly subject: string | null;
|
|
699
|
+
readonly preview_text: string | null;
|
|
700
|
+
readonly from_name: string | null;
|
|
701
|
+
readonly from_address: string;
|
|
702
|
+
readonly reply_to_address: string | null;
|
|
703
|
+
readonly body_html: string | null;
|
|
704
|
+
readonly body_text: string | null;
|
|
705
|
+
readonly status: NewsletterStatus;
|
|
706
|
+
readonly archive_visibility: NewsletterArchiveVisibility;
|
|
707
|
+
readonly preflight_status: NewsletterPreflightStatus;
|
|
708
|
+
readonly preflight_results: Record<string, unknown>;
|
|
709
|
+
readonly send_window_hours: number;
|
|
710
|
+
readonly send_rate_per_hour: number;
|
|
711
|
+
readonly recipient_count: number;
|
|
712
|
+
readonly sent_count: number;
|
|
713
|
+
readonly delivered_count: number;
|
|
714
|
+
readonly bounced_count: number;
|
|
715
|
+
readonly complained_count: number;
|
|
716
|
+
readonly failed_count: number;
|
|
717
|
+
readonly skipped_count: number;
|
|
718
|
+
readonly scheduled_at: string | null;
|
|
719
|
+
readonly approved_at: string | null;
|
|
720
|
+
readonly started_at: string | null;
|
|
721
|
+
readonly completed_at: string | null;
|
|
722
|
+
readonly cancelled_at: string | null;
|
|
723
|
+
readonly created_at: string;
|
|
724
|
+
readonly updated_at: string;
|
|
725
|
+
};
|
|
726
|
+
type NewsletterPreflightItem = {
|
|
727
|
+
readonly key: string;
|
|
728
|
+
readonly label: string;
|
|
729
|
+
readonly status: NewsletterPreflightItemStatus;
|
|
730
|
+
readonly message: string;
|
|
731
|
+
};
|
|
732
|
+
type NewsletterPreflight = {
|
|
733
|
+
readonly object: "newsletter_preflight";
|
|
734
|
+
readonly newsletter_id: string;
|
|
735
|
+
readonly status: NewsletterPreflightStatus;
|
|
736
|
+
readonly items: readonly NewsletterPreflightItem[];
|
|
737
|
+
};
|
|
738
|
+
type NewsletterTestSend = {
|
|
739
|
+
readonly object: "newsletter_test_send";
|
|
740
|
+
readonly id: string;
|
|
741
|
+
readonly newsletter_id: string;
|
|
742
|
+
readonly message_id: string | null;
|
|
743
|
+
readonly recipient_email: string;
|
|
744
|
+
readonly status: NewsletterTestSendStatus;
|
|
745
|
+
readonly last_error: string | null;
|
|
746
|
+
readonly sent_at: string | null;
|
|
747
|
+
readonly created_at: string;
|
|
748
|
+
};
|
|
749
|
+
type CreateNewsletterParams = {
|
|
750
|
+
readonly audience_id: string;
|
|
751
|
+
readonly newsletter_domain_id: string;
|
|
752
|
+
readonly name: string;
|
|
753
|
+
readonly subject: string;
|
|
754
|
+
readonly preview_text?: string | null | undefined;
|
|
755
|
+
readonly from_name?: string | null | undefined;
|
|
756
|
+
readonly body_html?: string | null | undefined;
|
|
757
|
+
readonly body_text?: string | null | undefined;
|
|
758
|
+
readonly send_window_hours?: number | undefined;
|
|
759
|
+
readonly archive_visibility?: NewsletterArchiveVisibility | undefined;
|
|
760
|
+
};
|
|
761
|
+
type UpdateNewsletterParams = Partial<CreateNewsletterParams>;
|
|
762
|
+
type ListNewslettersParams = PaginationParams;
|
|
763
|
+
type SendNewsletterTestParams = {
|
|
764
|
+
readonly recipient_email: string;
|
|
765
|
+
};
|
|
766
|
+
type ScheduleNewsletterParams = {
|
|
767
|
+
readonly scheduled_at: string;
|
|
768
|
+
};
|
|
769
|
+
|
|
770
|
+
declare class Newsletters extends ApiResource {
|
|
771
|
+
create(params: CreateNewsletterParams, options?: MethodOptions): Promise<Newsletter>;
|
|
772
|
+
list(params?: ListNewslettersParams, options?: MethodOptions): Promise<PaginatedResponse<Newsletter>>;
|
|
773
|
+
listAutoPaginating(params?: Omit<ListNewslettersParams, "cursor">): Page<Newsletter>;
|
|
774
|
+
get(id: string, options?: MethodOptions): Promise<Newsletter>;
|
|
775
|
+
update(id: string, params: UpdateNewsletterParams, options?: MethodOptions): Promise<Newsletter>;
|
|
776
|
+
preflight(id: string, options?: MethodOptions): Promise<NewsletterPreflight>;
|
|
777
|
+
sendTest(id: string, params: SendNewsletterTestParams, options?: MethodOptions): Promise<NewsletterTestSend>;
|
|
778
|
+
schedule(id: string, params: ScheduleNewsletterParams, options?: MethodOptions): Promise<Newsletter>;
|
|
779
|
+
cancel(id: string, options?: MethodOptions): Promise<Newsletter>;
|
|
780
|
+
resume(id: string, options?: MethodOptions): Promise<Newsletter>;
|
|
781
|
+
}
|
|
782
|
+
|
|
686
783
|
declare class Status extends ApiResource {
|
|
687
784
|
get(options?: MethodOptions): Promise<StatusResponse>;
|
|
688
785
|
}
|
|
@@ -824,6 +921,7 @@ declare class ShipMailClient {
|
|
|
824
921
|
readonly domains: Domains;
|
|
825
922
|
readonly mailboxes: Mailboxes;
|
|
826
923
|
readonly messages: Messages;
|
|
924
|
+
readonly newsletters: Newsletters;
|
|
827
925
|
readonly suppressions: Suppressions;
|
|
828
926
|
readonly threads: Threads;
|
|
829
927
|
readonly webhooks: Webhooks;
|
|
@@ -910,4 +1008,4 @@ declare function verifyWebhook(body: string, headers: WebhookHeaders | Headers,
|
|
|
910
1008
|
readonly toleranceInSeconds?: number | undefined;
|
|
911
1009
|
}): Promise<WebhookEvent>;
|
|
912
1010
|
|
|
913
|
-
export { type AddSubscriberParams, type AddSubscribersBatchParams, type AddSubscribersBatchResult, type ApiErrorBody, type Audience, AuthenticationError, AuthorizationError, ConflictError, ConnectionError, type CreateAudienceParams, type CreateDomainParams, type CreateMailboxFolderParams, type CreateMailboxParams, type CreateWebhookParams, DOMAIN_STATUSES, type Domain, type DomainRegistrationInfo, type DomainSearchResult, type DomainStatus, type DomainVerificationResult, type DownloadInboxAttachmentParams, type EmailRecipient, type EmailRecipientInput, type ErrorType, type GetThreadParams, type InboxAttachment, type InboxBodyPart, type InboxBodyValue, type InboxEmailHeader, type InboxFullMessage, type InboxKeyword, type InboxMessage, type InboxMessageAction, type InboxMessages, type InboxThread, InternalServerError, type ListAudiencesParams, type ListDeliveriesParams, type ListDomainsParams, type ListInboxMessagesParams, type ListMailboxesParams, type ListMessagesParams, type ListSubscribersParams, type ListSuppressionsParams, type ListThreadsParams, type ListWebhooksParams, MESSAGE_SOURCES, MESSAGE_STATUSES, type Mailbox, type MailboxFolder, type MailboxFolders, type MailboxIdentities, type MailboxIdentity, type MailboxRule, type MailboxRuleAction, type MailboxRuleCondition, type MailboxRuleFolder, type MailboxRuleMatchMode, type MailboxRuleMoveTarget, type MailboxRules, type MergeFields, type Message, type MessageSource, type MessageStatus, type MethodOptions, type MoveInboxMessageParams, NotFoundError, Page, type PaginatedResponse, type PaginationParams, QuotaExceededError, RateLimitError, type RegisterDomainParams, type RegistrationContact, type ReplyToMessageParams, type ReplyToThreadParams, type RequestOptions, type ResetMailboxPasswordParams, type RotateSecretResponse, type SearchDomainsParams, type SendMessageParams, ShipMailClient, type ShipMailConfig, ShipMailError, type StatusResponse, type Subscriber, type SubscriberOutcome, type SubscriberResult, type SubscriberStatus, type Suppression, type TestWebhookResponse, type Thread, type UpdateAudienceParams, type UpdateAutoReplyParams, type UpdateDomainParams, type UpdateInboxMessageParams, type UpdateMailboxFolderParams, type UpdateMailboxParams, type UpdateMailboxRulesParams, type UpdateSpamFilterParams, type UpdateSubscriberParams, type UpdateWebhookParams, ValidationError, WEBHOOK_DELIVERY_STATUSES, WEBHOOK_EVENT_TYPES, type Webhook, type WebhookDelivery, type WebhookDeliveryStatus, type WebhookEvent, type WebhookEventType, WebhookVerificationError, type WebhookWithSecret, ShipMailClient as default, verifyWebhook };
|
|
1011
|
+
export { type AddSubscriberParams, type AddSubscribersBatchParams, type AddSubscribersBatchResult, type ApiErrorBody, type Audience, AuthenticationError, AuthorizationError, ConflictError, ConnectionError, type CreateAudienceParams, type CreateDomainParams, type CreateMailboxFolderParams, type CreateMailboxParams, type CreateNewsletterParams, type CreateWebhookParams, DOMAIN_STATUSES, type Domain, type DomainRegistrationInfo, type DomainSearchResult, type DomainStatus, type DomainVerificationResult, type DownloadInboxAttachmentParams, type EmailRecipient, type EmailRecipientInput, type ErrorType, type GetThreadParams, type InboxAttachment, type InboxBodyPart, type InboxBodyValue, type InboxEmailHeader, type InboxFullMessage, type InboxKeyword, type InboxMessage, type InboxMessageAction, type InboxMessages, type InboxThread, InternalServerError, type ListAudiencesParams, type ListDeliveriesParams, type ListDomainsParams, type ListInboxMessagesParams, type ListMailboxesParams, type ListMessagesParams, type ListNewslettersParams, type ListSubscribersParams, type ListSuppressionsParams, type ListThreadsParams, type ListWebhooksParams, MESSAGE_SOURCES, MESSAGE_STATUSES, type Mailbox, type MailboxFolder, type MailboxFolders, type MailboxIdentities, type MailboxIdentity, type MailboxRule, type MailboxRuleAction, type MailboxRuleCondition, type MailboxRuleFolder, type MailboxRuleMatchMode, type MailboxRuleMoveTarget, type MailboxRules, type MergeFields, type Message, type MessageSource, type MessageStatus, type MethodOptions, type MoveInboxMessageParams, type Newsletter, type NewsletterArchiveVisibility, type NewsletterPreflight, type NewsletterPreflightItem, type NewsletterPreflightItemStatus, type NewsletterPreflightStatus, type NewsletterStatus, type NewsletterTestSend, type NewsletterTestSendStatus, NotFoundError, Page, type PaginatedResponse, type PaginationParams, QuotaExceededError, RateLimitError, type RegisterDomainParams, type RegistrationContact, type ReplyToMessageParams, type ReplyToThreadParams, type RequestOptions, type ResetMailboxPasswordParams, type RotateSecretResponse, type ScheduleNewsletterParams, type SearchDomainsParams, type SendMessageParams, type SendNewsletterTestParams, ShipMailClient, type ShipMailConfig, ShipMailError, type StatusResponse, type Subscriber, type SubscriberOutcome, type SubscriberResult, type SubscriberStatus, type Suppression, type TestWebhookResponse, type Thread, type UpdateAudienceParams, type UpdateAutoReplyParams, type UpdateDomainParams, type UpdateInboxMessageParams, type UpdateMailboxFolderParams, type UpdateMailboxParams, type UpdateMailboxRulesParams, type UpdateNewsletterParams, type UpdateSpamFilterParams, type UpdateSubscriberParams, type UpdateWebhookParams, ValidationError, WEBHOOK_DELIVERY_STATUSES, WEBHOOK_EVENT_TYPES, type Webhook, type WebhookDelivery, type WebhookDeliveryStatus, type WebhookEvent, type WebhookEventType, WebhookVerificationError, type WebhookWithSecret, ShipMailClient as default, verifyWebhook };
|
package/dist/index.d.ts
CHANGED
|
@@ -683,6 +683,103 @@ declare class Messages extends ApiResource {
|
|
|
683
683
|
reply(id: string, params: ReplyToMessageParams, options?: MethodOptions): Promise<Message>;
|
|
684
684
|
}
|
|
685
685
|
|
|
686
|
+
type NewsletterStatus = "draft" | "pending_approval" | "approved" | "scheduled" | "sending" | "paused" | "sent" | "cancelled" | "failed";
|
|
687
|
+
type NewsletterArchiveVisibility = "private" | "public";
|
|
688
|
+
type NewsletterPreflightStatus = "not_run" | "passed" | "warning" | "failed";
|
|
689
|
+
type NewsletterPreflightItemStatus = "pass" | "warn" | "fail";
|
|
690
|
+
type NewsletterTestSendStatus = "pending" | "sent" | "failed";
|
|
691
|
+
type Newsletter = {
|
|
692
|
+
readonly object: "newsletter";
|
|
693
|
+
readonly id: string;
|
|
694
|
+
readonly audience_id: string | null;
|
|
695
|
+
readonly newsletter_domain_id: string;
|
|
696
|
+
readonly reply_to_mailbox_id: string | null;
|
|
697
|
+
readonly name: string;
|
|
698
|
+
readonly subject: string | null;
|
|
699
|
+
readonly preview_text: string | null;
|
|
700
|
+
readonly from_name: string | null;
|
|
701
|
+
readonly from_address: string;
|
|
702
|
+
readonly reply_to_address: string | null;
|
|
703
|
+
readonly body_html: string | null;
|
|
704
|
+
readonly body_text: string | null;
|
|
705
|
+
readonly status: NewsletterStatus;
|
|
706
|
+
readonly archive_visibility: NewsletterArchiveVisibility;
|
|
707
|
+
readonly preflight_status: NewsletterPreflightStatus;
|
|
708
|
+
readonly preflight_results: Record<string, unknown>;
|
|
709
|
+
readonly send_window_hours: number;
|
|
710
|
+
readonly send_rate_per_hour: number;
|
|
711
|
+
readonly recipient_count: number;
|
|
712
|
+
readonly sent_count: number;
|
|
713
|
+
readonly delivered_count: number;
|
|
714
|
+
readonly bounced_count: number;
|
|
715
|
+
readonly complained_count: number;
|
|
716
|
+
readonly failed_count: number;
|
|
717
|
+
readonly skipped_count: number;
|
|
718
|
+
readonly scheduled_at: string | null;
|
|
719
|
+
readonly approved_at: string | null;
|
|
720
|
+
readonly started_at: string | null;
|
|
721
|
+
readonly completed_at: string | null;
|
|
722
|
+
readonly cancelled_at: string | null;
|
|
723
|
+
readonly created_at: string;
|
|
724
|
+
readonly updated_at: string;
|
|
725
|
+
};
|
|
726
|
+
type NewsletterPreflightItem = {
|
|
727
|
+
readonly key: string;
|
|
728
|
+
readonly label: string;
|
|
729
|
+
readonly status: NewsletterPreflightItemStatus;
|
|
730
|
+
readonly message: string;
|
|
731
|
+
};
|
|
732
|
+
type NewsletterPreflight = {
|
|
733
|
+
readonly object: "newsletter_preflight";
|
|
734
|
+
readonly newsletter_id: string;
|
|
735
|
+
readonly status: NewsletterPreflightStatus;
|
|
736
|
+
readonly items: readonly NewsletterPreflightItem[];
|
|
737
|
+
};
|
|
738
|
+
type NewsletterTestSend = {
|
|
739
|
+
readonly object: "newsletter_test_send";
|
|
740
|
+
readonly id: string;
|
|
741
|
+
readonly newsletter_id: string;
|
|
742
|
+
readonly message_id: string | null;
|
|
743
|
+
readonly recipient_email: string;
|
|
744
|
+
readonly status: NewsletterTestSendStatus;
|
|
745
|
+
readonly last_error: string | null;
|
|
746
|
+
readonly sent_at: string | null;
|
|
747
|
+
readonly created_at: string;
|
|
748
|
+
};
|
|
749
|
+
type CreateNewsletterParams = {
|
|
750
|
+
readonly audience_id: string;
|
|
751
|
+
readonly newsletter_domain_id: string;
|
|
752
|
+
readonly name: string;
|
|
753
|
+
readonly subject: string;
|
|
754
|
+
readonly preview_text?: string | null | undefined;
|
|
755
|
+
readonly from_name?: string | null | undefined;
|
|
756
|
+
readonly body_html?: string | null | undefined;
|
|
757
|
+
readonly body_text?: string | null | undefined;
|
|
758
|
+
readonly send_window_hours?: number | undefined;
|
|
759
|
+
readonly archive_visibility?: NewsletterArchiveVisibility | undefined;
|
|
760
|
+
};
|
|
761
|
+
type UpdateNewsletterParams = Partial<CreateNewsletterParams>;
|
|
762
|
+
type ListNewslettersParams = PaginationParams;
|
|
763
|
+
type SendNewsletterTestParams = {
|
|
764
|
+
readonly recipient_email: string;
|
|
765
|
+
};
|
|
766
|
+
type ScheduleNewsletterParams = {
|
|
767
|
+
readonly scheduled_at: string;
|
|
768
|
+
};
|
|
769
|
+
|
|
770
|
+
declare class Newsletters extends ApiResource {
|
|
771
|
+
create(params: CreateNewsletterParams, options?: MethodOptions): Promise<Newsletter>;
|
|
772
|
+
list(params?: ListNewslettersParams, options?: MethodOptions): Promise<PaginatedResponse<Newsletter>>;
|
|
773
|
+
listAutoPaginating(params?: Omit<ListNewslettersParams, "cursor">): Page<Newsletter>;
|
|
774
|
+
get(id: string, options?: MethodOptions): Promise<Newsletter>;
|
|
775
|
+
update(id: string, params: UpdateNewsletterParams, options?: MethodOptions): Promise<Newsletter>;
|
|
776
|
+
preflight(id: string, options?: MethodOptions): Promise<NewsletterPreflight>;
|
|
777
|
+
sendTest(id: string, params: SendNewsletterTestParams, options?: MethodOptions): Promise<NewsletterTestSend>;
|
|
778
|
+
schedule(id: string, params: ScheduleNewsletterParams, options?: MethodOptions): Promise<Newsletter>;
|
|
779
|
+
cancel(id: string, options?: MethodOptions): Promise<Newsletter>;
|
|
780
|
+
resume(id: string, options?: MethodOptions): Promise<Newsletter>;
|
|
781
|
+
}
|
|
782
|
+
|
|
686
783
|
declare class Status extends ApiResource {
|
|
687
784
|
get(options?: MethodOptions): Promise<StatusResponse>;
|
|
688
785
|
}
|
|
@@ -824,6 +921,7 @@ declare class ShipMailClient {
|
|
|
824
921
|
readonly domains: Domains;
|
|
825
922
|
readonly mailboxes: Mailboxes;
|
|
826
923
|
readonly messages: Messages;
|
|
924
|
+
readonly newsletters: Newsletters;
|
|
827
925
|
readonly suppressions: Suppressions;
|
|
828
926
|
readonly threads: Threads;
|
|
829
927
|
readonly webhooks: Webhooks;
|
|
@@ -910,4 +1008,4 @@ declare function verifyWebhook(body: string, headers: WebhookHeaders | Headers,
|
|
|
910
1008
|
readonly toleranceInSeconds?: number | undefined;
|
|
911
1009
|
}): Promise<WebhookEvent>;
|
|
912
1010
|
|
|
913
|
-
export { type AddSubscriberParams, type AddSubscribersBatchParams, type AddSubscribersBatchResult, type ApiErrorBody, type Audience, AuthenticationError, AuthorizationError, ConflictError, ConnectionError, type CreateAudienceParams, type CreateDomainParams, type CreateMailboxFolderParams, type CreateMailboxParams, type CreateWebhookParams, DOMAIN_STATUSES, type Domain, type DomainRegistrationInfo, type DomainSearchResult, type DomainStatus, type DomainVerificationResult, type DownloadInboxAttachmentParams, type EmailRecipient, type EmailRecipientInput, type ErrorType, type GetThreadParams, type InboxAttachment, type InboxBodyPart, type InboxBodyValue, type InboxEmailHeader, type InboxFullMessage, type InboxKeyword, type InboxMessage, type InboxMessageAction, type InboxMessages, type InboxThread, InternalServerError, type ListAudiencesParams, type ListDeliveriesParams, type ListDomainsParams, type ListInboxMessagesParams, type ListMailboxesParams, type ListMessagesParams, type ListSubscribersParams, type ListSuppressionsParams, type ListThreadsParams, type ListWebhooksParams, MESSAGE_SOURCES, MESSAGE_STATUSES, type Mailbox, type MailboxFolder, type MailboxFolders, type MailboxIdentities, type MailboxIdentity, type MailboxRule, type MailboxRuleAction, type MailboxRuleCondition, type MailboxRuleFolder, type MailboxRuleMatchMode, type MailboxRuleMoveTarget, type MailboxRules, type MergeFields, type Message, type MessageSource, type MessageStatus, type MethodOptions, type MoveInboxMessageParams, NotFoundError, Page, type PaginatedResponse, type PaginationParams, QuotaExceededError, RateLimitError, type RegisterDomainParams, type RegistrationContact, type ReplyToMessageParams, type ReplyToThreadParams, type RequestOptions, type ResetMailboxPasswordParams, type RotateSecretResponse, type SearchDomainsParams, type SendMessageParams, ShipMailClient, type ShipMailConfig, ShipMailError, type StatusResponse, type Subscriber, type SubscriberOutcome, type SubscriberResult, type SubscriberStatus, type Suppression, type TestWebhookResponse, type Thread, type UpdateAudienceParams, type UpdateAutoReplyParams, type UpdateDomainParams, type UpdateInboxMessageParams, type UpdateMailboxFolderParams, type UpdateMailboxParams, type UpdateMailboxRulesParams, type UpdateSpamFilterParams, type UpdateSubscriberParams, type UpdateWebhookParams, ValidationError, WEBHOOK_DELIVERY_STATUSES, WEBHOOK_EVENT_TYPES, type Webhook, type WebhookDelivery, type WebhookDeliveryStatus, type WebhookEvent, type WebhookEventType, WebhookVerificationError, type WebhookWithSecret, ShipMailClient as default, verifyWebhook };
|
|
1011
|
+
export { type AddSubscriberParams, type AddSubscribersBatchParams, type AddSubscribersBatchResult, type ApiErrorBody, type Audience, AuthenticationError, AuthorizationError, ConflictError, ConnectionError, type CreateAudienceParams, type CreateDomainParams, type CreateMailboxFolderParams, type CreateMailboxParams, type CreateNewsletterParams, type CreateWebhookParams, DOMAIN_STATUSES, type Domain, type DomainRegistrationInfo, type DomainSearchResult, type DomainStatus, type DomainVerificationResult, type DownloadInboxAttachmentParams, type EmailRecipient, type EmailRecipientInput, type ErrorType, type GetThreadParams, type InboxAttachment, type InboxBodyPart, type InboxBodyValue, type InboxEmailHeader, type InboxFullMessage, type InboxKeyword, type InboxMessage, type InboxMessageAction, type InboxMessages, type InboxThread, InternalServerError, type ListAudiencesParams, type ListDeliveriesParams, type ListDomainsParams, type ListInboxMessagesParams, type ListMailboxesParams, type ListMessagesParams, type ListNewslettersParams, type ListSubscribersParams, type ListSuppressionsParams, type ListThreadsParams, type ListWebhooksParams, MESSAGE_SOURCES, MESSAGE_STATUSES, type Mailbox, type MailboxFolder, type MailboxFolders, type MailboxIdentities, type MailboxIdentity, type MailboxRule, type MailboxRuleAction, type MailboxRuleCondition, type MailboxRuleFolder, type MailboxRuleMatchMode, type MailboxRuleMoveTarget, type MailboxRules, type MergeFields, type Message, type MessageSource, type MessageStatus, type MethodOptions, type MoveInboxMessageParams, type Newsletter, type NewsletterArchiveVisibility, type NewsletterPreflight, type NewsletterPreflightItem, type NewsletterPreflightItemStatus, type NewsletterPreflightStatus, type NewsletterStatus, type NewsletterTestSend, type NewsletterTestSendStatus, NotFoundError, Page, type PaginatedResponse, type PaginationParams, QuotaExceededError, RateLimitError, type RegisterDomainParams, type RegistrationContact, type ReplyToMessageParams, type ReplyToThreadParams, type RequestOptions, type ResetMailboxPasswordParams, type RotateSecretResponse, type ScheduleNewsletterParams, type SearchDomainsParams, type SendMessageParams, type SendNewsletterTestParams, ShipMailClient, type ShipMailConfig, ShipMailError, type StatusResponse, type Subscriber, type SubscriberOutcome, type SubscriberResult, type SubscriberStatus, type Suppression, type TestWebhookResponse, type Thread, type UpdateAudienceParams, type UpdateAutoReplyParams, type UpdateDomainParams, type UpdateInboxMessageParams, type UpdateMailboxFolderParams, type UpdateMailboxParams, type UpdateMailboxRulesParams, type UpdateNewsletterParams, type UpdateSpamFilterParams, type UpdateSubscriberParams, type UpdateWebhookParams, ValidationError, WEBHOOK_DELIVERY_STATUSES, WEBHOOK_EVENT_TYPES, type Webhook, type WebhookDelivery, type WebhookDeliveryStatus, type WebhookEvent, type WebhookEventType, WebhookVerificationError, type WebhookWithSecret, ShipMailClient as default, verifyWebhook };
|
package/dist/index.js
CHANGED
|
@@ -113,9 +113,9 @@ function mapErrorFromResponse(status, body, requestId) {
|
|
|
113
113
|
|
|
114
114
|
// src/pagination.ts
|
|
115
115
|
var Page = class {
|
|
116
|
-
constructor(client,
|
|
116
|
+
constructor(client, path2, query) {
|
|
117
117
|
this.client = client;
|
|
118
|
-
this.path =
|
|
118
|
+
this.path = path2;
|
|
119
119
|
this.query = query;
|
|
120
120
|
}
|
|
121
121
|
async *[Symbol.asyncIterator]() {
|
|
@@ -615,6 +615,84 @@ var Messages = class extends ApiResource {
|
|
|
615
615
|
}
|
|
616
616
|
};
|
|
617
617
|
|
|
618
|
+
// src/resources/newsletters.ts
|
|
619
|
+
function path(id) {
|
|
620
|
+
return `/newsletters/${encodeURIComponent(id)}`;
|
|
621
|
+
}
|
|
622
|
+
var Newsletters = class extends ApiResource {
|
|
623
|
+
create(params, options) {
|
|
624
|
+
return this.client.request({
|
|
625
|
+
method: "POST",
|
|
626
|
+
path: "/newsletters",
|
|
627
|
+
body: params,
|
|
628
|
+
methodOptions: options
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
list(params, options) {
|
|
632
|
+
return this.client.request({
|
|
633
|
+
method: "GET",
|
|
634
|
+
path: "/newsletters",
|
|
635
|
+
query: { cursor: params?.cursor, limit: params?.limit },
|
|
636
|
+
methodOptions: options
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
listAutoPaginating(params) {
|
|
640
|
+
return new Page(this.client, "/newsletters", { limit: params?.limit });
|
|
641
|
+
}
|
|
642
|
+
get(id, options) {
|
|
643
|
+
return this.client.request({
|
|
644
|
+
method: "GET",
|
|
645
|
+
path: path(id),
|
|
646
|
+
methodOptions: options
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
update(id, params, options) {
|
|
650
|
+
return this.client.request({
|
|
651
|
+
method: "PATCH",
|
|
652
|
+
path: path(id),
|
|
653
|
+
body: params,
|
|
654
|
+
methodOptions: options
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
preflight(id, options) {
|
|
658
|
+
return this.client.request({
|
|
659
|
+
method: "POST",
|
|
660
|
+
path: `${path(id)}/preflight`,
|
|
661
|
+
methodOptions: options
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
sendTest(id, params, options) {
|
|
665
|
+
return this.client.request({
|
|
666
|
+
method: "POST",
|
|
667
|
+
path: `${path(id)}/test-send`,
|
|
668
|
+
body: params,
|
|
669
|
+
methodOptions: options
|
|
670
|
+
});
|
|
671
|
+
}
|
|
672
|
+
schedule(id, params, options) {
|
|
673
|
+
return this.client.request({
|
|
674
|
+
method: "POST",
|
|
675
|
+
path: `${path(id)}/schedule`,
|
|
676
|
+
body: params,
|
|
677
|
+
methodOptions: options
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
cancel(id, options) {
|
|
681
|
+
return this.client.request({
|
|
682
|
+
method: "POST",
|
|
683
|
+
path: `${path(id)}/cancel`,
|
|
684
|
+
methodOptions: options
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
resume(id, options) {
|
|
688
|
+
return this.client.request({
|
|
689
|
+
method: "POST",
|
|
690
|
+
path: `${path(id)}/resume`,
|
|
691
|
+
methodOptions: options
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
};
|
|
695
|
+
|
|
618
696
|
// src/resources/status.ts
|
|
619
697
|
var Status = class extends ApiResource {
|
|
620
698
|
get(options) {
|
|
@@ -783,7 +861,7 @@ var Webhooks = class extends ApiResource {
|
|
|
783
861
|
};
|
|
784
862
|
|
|
785
863
|
// src/version.ts
|
|
786
|
-
var VERSION = "0.1.
|
|
864
|
+
var VERSION = "0.1.25";
|
|
787
865
|
|
|
788
866
|
// src/client.ts
|
|
789
867
|
var DEFAULT_BASE_URL = "https://shipmail.to/api/v1";
|
|
@@ -832,6 +910,7 @@ var ShipMailClient = class {
|
|
|
832
910
|
this.domains = new Domains(this);
|
|
833
911
|
this.mailboxes = new Mailboxes(this);
|
|
834
912
|
this.messages = new Messages(this);
|
|
913
|
+
this.newsletters = new Newsletters(this);
|
|
835
914
|
this.suppressions = new Suppressions(this);
|
|
836
915
|
this.threads = new Threads(this);
|
|
837
916
|
this.webhooks = new Webhooks(this);
|
|
@@ -915,8 +994,8 @@ var ShipMailClient = class {
|
|
|
915
994
|
}
|
|
916
995
|
throw lastError ?? new ShipMailError("Request failed after retries");
|
|
917
996
|
}
|
|
918
|
-
buildUrl(
|
|
919
|
-
const url = new URL(`${this.baseUrl}${
|
|
997
|
+
buildUrl(path2, query) {
|
|
998
|
+
const url = new URL(`${this.baseUrl}${path2}`);
|
|
920
999
|
if (query) {
|
|
921
1000
|
for (const [key, value] of Object.entries(query)) {
|
|
922
1001
|
if (value !== void 0) {
|