shipmail 0.1.25 → 0.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -40,6 +40,7 @@ type ApiErrorBody = {
40
40
  readonly details?: readonly {
41
41
  readonly field: string;
42
42
  readonly message: string;
43
+ readonly code?: string | undefined;
43
44
  }[] | undefined;
44
45
  readonly retry_after?: number | undefined;
45
46
  };
@@ -685,9 +686,34 @@ declare class Messages extends ApiResource {
685
686
 
686
687
  type NewsletterStatus = "draft" | "pending_approval" | "approved" | "scheduled" | "sending" | "paused" | "sent" | "cancelled" | "failed";
687
688
  type NewsletterArchiveVisibility = "private" | "public";
689
+ type NewsletterDomainStatus = "pending" | "verifying" | "verified" | "failed" | "disabled";
690
+ type NewsletterDomainRecordStatus = "pending" | "verified" | "failed";
688
691
  type NewsletterPreflightStatus = "not_run" | "passed" | "warning" | "failed";
689
692
  type NewsletterPreflightItemStatus = "pass" | "warn" | "fail";
690
693
  type NewsletterTestSendStatus = "pending" | "sent" | "failed";
694
+ type NewsletterAssetKind = "image" | "video";
695
+ type NewsletterUrlSource = "href" | "image_src" | "video_href" | "text";
696
+ type NewsletterChangelogTone = "concise" | "friendly" | "technical";
697
+ type NewsletterCalloutVariant = "accent" | "info" | "warning" | "success";
698
+ type NewsletterColumnRatio = "50-50" | "33-67" | "67-33";
699
+ type NewsletterDomain = {
700
+ readonly object: "newsletter_domain";
701
+ readonly id: string;
702
+ readonly root_domain_id: string;
703
+ readonly domain_name: string;
704
+ readonly from_local_part: string;
705
+ readonly from_address: string;
706
+ readonly mail_from_domain: string;
707
+ readonly reply_to_mailbox_id: string | null;
708
+ readonly status: NewsletterDomainStatus;
709
+ readonly dkim_status: NewsletterDomainRecordStatus;
710
+ readonly mail_from_status: NewsletterDomainRecordStatus;
711
+ readonly spf_status: NewsletterDomainRecordStatus;
712
+ readonly dmarc_status: NewsletterDomainRecordStatus;
713
+ readonly verified_at: string | null;
714
+ readonly created_at: string;
715
+ readonly updated_at: string;
716
+ };
691
717
  type Newsletter = {
692
718
  readonly object: "newsletter";
693
719
  readonly id: string;
@@ -700,6 +726,7 @@ type Newsletter = {
700
726
  readonly from_name: string | null;
701
727
  readonly from_address: string;
702
728
  readonly reply_to_address: string | null;
729
+ readonly blocks: readonly NewsletterBlock[] | null;
703
730
  readonly body_html: string | null;
704
731
  readonly body_text: string | null;
705
732
  readonly status: NewsletterStatus;
@@ -715,6 +742,9 @@ type Newsletter = {
715
742
  readonly complained_count: number;
716
743
  readonly failed_count: number;
717
744
  readonly skipped_count: number;
745
+ readonly last_test_sent_at: string | null;
746
+ readonly last_test_recipient: string | null;
747
+ readonly content_changed_since_test_send: boolean;
718
748
  readonly scheduled_at: string | null;
719
749
  readonly approved_at: string | null;
720
750
  readonly started_at: string | null;
@@ -734,6 +764,34 @@ type NewsletterPreflight = {
734
764
  readonly newsletter_id: string;
735
765
  readonly status: NewsletterPreflightStatus;
736
766
  readonly items: readonly NewsletterPreflightItem[];
767
+ readonly url_breakdown: NewsletterUrlBreakdown;
768
+ };
769
+ type NewsletterCountedUrl = {
770
+ readonly url: string;
771
+ readonly source: NewsletterUrlSource;
772
+ };
773
+ type NewsletterUrlBreakdown = {
774
+ readonly href_count: number;
775
+ readonly image_src_count: number;
776
+ readonly video_href_count: number;
777
+ readonly text_url_count: number;
778
+ readonly unique_url_count: number;
779
+ readonly max_unique_urls: number;
780
+ readonly urls: readonly NewsletterCountedUrl[];
781
+ readonly offending_urls: readonly string[];
782
+ };
783
+ type NewsletterPreview = {
784
+ readonly object: "newsletter_preview";
785
+ readonly newsletter_id: string;
786
+ readonly html: string;
787
+ readonly archive_html: string;
788
+ readonly text: string;
789
+ readonly warnings: readonly {
790
+ readonly kind: string;
791
+ readonly severity: "fail" | "warn";
792
+ readonly message: string;
793
+ }[];
794
+ readonly url_breakdown: NewsletterUrlBreakdown;
737
795
  };
738
796
  type NewsletterTestSend = {
739
797
  readonly object: "newsletter_test_send";
@@ -755,25 +813,175 @@ type CreateNewsletterParams = {
755
813
  readonly from_name?: string | null | undefined;
756
814
  readonly body_html?: string | null | undefined;
757
815
  readonly body_text?: string | null | undefined;
816
+ readonly blocks?: readonly NewsletterBlock[] | undefined;
758
817
  readonly send_window_hours?: number | undefined;
759
818
  readonly archive_visibility?: NewsletterArchiveVisibility | undefined;
760
819
  };
761
820
  type UpdateNewsletterParams = Partial<CreateNewsletterParams>;
821
+ type NewsletterChangelogMedia = {
822
+ readonly kind: "image";
823
+ readonly url: string;
824
+ readonly alt: string;
825
+ readonly caption?: string | null | undefined;
826
+ readonly link_url?: string | null | undefined;
827
+ } | {
828
+ readonly kind: "video";
829
+ readonly video_url: string;
830
+ readonly thumbnail_url: string;
831
+ readonly label: string;
832
+ };
833
+ type NewsletterChangelogEntry = {
834
+ readonly title: string;
835
+ readonly body?: string | null | undefined;
836
+ readonly url?: string | null | undefined;
837
+ readonly media?: readonly NewsletterChangelogMedia[] | undefined;
838
+ readonly cta_label?: string | null | undefined;
839
+ readonly cta_url?: string | null | undefined;
840
+ };
841
+ type CreateNewsletterFromChangelogParams = {
842
+ readonly audience_id: string;
843
+ readonly newsletter_domain_id: string;
844
+ readonly name: string;
845
+ readonly subject: string;
846
+ readonly preview_text?: string | null | undefined;
847
+ readonly from_name?: string | null | undefined;
848
+ readonly tone?: NewsletterChangelogTone | undefined;
849
+ readonly entries: readonly NewsletterChangelogEntry[];
850
+ readonly final_cta?: {
851
+ readonly label: string;
852
+ readonly url: string;
853
+ readonly body?: string | null | undefined;
854
+ } | undefined;
855
+ readonly send_window_hours?: number | undefined;
856
+ readonly archive_visibility?: NewsletterArchiveVisibility | undefined;
857
+ };
858
+ type ListNewsletterDomainsParams = PaginationParams;
762
859
  type ListNewslettersParams = PaginationParams;
860
+ type ListNewsletterAssetsParams = PaginationParams & {
861
+ readonly kind?: NewsletterAssetKind | undefined;
862
+ readonly q?: string | undefined;
863
+ };
864
+ type NewsletterAsset = {
865
+ readonly object: "newsletter_asset";
866
+ readonly id: string;
867
+ readonly kind: NewsletterAssetKind;
868
+ readonly filename: string;
869
+ readonly content_type: string;
870
+ readonly byte_size: number;
871
+ readonly checksum_sha256: string;
872
+ readonly url: string;
873
+ readonly image_url: string | null;
874
+ readonly video_url: string | null;
875
+ readonly thumbnail_url: string | null;
876
+ readonly thumbnail_content_type: string | null;
877
+ readonly thumbnail_byte_size: number | null;
878
+ readonly duration_seconds: number | null;
879
+ readonly width: number | null;
880
+ readonly height: number | null;
881
+ readonly created_at: string;
882
+ };
883
+ type UploadNewsletterAssetParams = {
884
+ readonly filename: string;
885
+ readonly data: ArrayBuffer | Uint8Array;
886
+ readonly content_type?: string | undefined;
887
+ };
763
888
  type SendNewsletterTestParams = {
764
889
  readonly recipient_email: string;
765
890
  };
766
891
  type ScheduleNewsletterParams = {
767
892
  readonly scheduled_at: string;
768
893
  };
894
+ type NewsletterColumnContent = {
895
+ readonly title?: string | null | undefined;
896
+ readonly body: string;
897
+ readonly image_url?: string | null | undefined;
898
+ readonly image_alt?: string | null | undefined;
899
+ readonly cta_label?: string | null | undefined;
900
+ readonly cta_url?: string | null | undefined;
901
+ };
902
+ type NewsletterBlock = {
903
+ readonly type: "heading";
904
+ readonly text: string;
905
+ readonly level?: 1 | 2 | 3 | undefined;
906
+ } | {
907
+ readonly type: "paragraph";
908
+ readonly body: string;
909
+ } | {
910
+ readonly type: "list";
911
+ readonly ordered?: boolean | undefined;
912
+ readonly items: readonly string[];
913
+ } | {
914
+ readonly type: "callout";
915
+ readonly title?: string | null | undefined;
916
+ readonly body: string;
917
+ readonly variant?: NewsletterCalloutVariant | undefined;
918
+ } | {
919
+ readonly type: "button";
920
+ readonly label: string;
921
+ readonly url: string;
922
+ } | {
923
+ readonly type: "image";
924
+ readonly url: string;
925
+ readonly alt: string;
926
+ readonly link_url?: string | null | undefined;
927
+ readonly caption?: string | null | undefined;
928
+ readonly caption_url?: string | null | undefined;
929
+ } | {
930
+ readonly type: "video";
931
+ readonly video_url: string;
932
+ readonly thumbnail_url: string;
933
+ readonly label: string;
934
+ } | {
935
+ readonly type: "columns";
936
+ readonly ratio?: NewsletterColumnRatio | undefined;
937
+ readonly left: NewsletterColumnContent;
938
+ readonly right: NewsletterColumnContent;
939
+ } | {
940
+ readonly type: "link_list";
941
+ readonly title?: string | null | undefined;
942
+ readonly items: readonly {
943
+ readonly label: string;
944
+ readonly url: string;
945
+ readonly description?: string | null | undefined;
946
+ }[];
947
+ } | {
948
+ readonly type: "quote";
949
+ readonly body: string;
950
+ readonly cite?: string | null | undefined;
951
+ } | {
952
+ readonly type: "divider";
953
+ } | {
954
+ readonly type: "spacer";
955
+ readonly height?: number | undefined;
956
+ } | {
957
+ readonly type: "code";
958
+ readonly code: string;
959
+ } | {
960
+ readonly type: "custom_html";
961
+ readonly html: string;
962
+ };
769
963
 
964
+ declare class NewsletterDomains extends ApiResource {
965
+ list(params?: ListNewsletterDomainsParams, options?: MethodOptions): Promise<PaginatedResponse<NewsletterDomain>>;
966
+ listAutoPaginating(params?: Omit<ListNewsletterDomainsParams, "cursor">): Page<NewsletterDomain>;
967
+ }
968
+ declare class NewsletterAssets extends ApiResource {
969
+ list(params?: ListNewsletterAssetsParams, options?: MethodOptions): Promise<PaginatedResponse<NewsletterAsset>>;
970
+ listAutoPaginating(params?: Omit<ListNewsletterAssetsParams, "cursor">): Page<NewsletterAsset>;
971
+ upload(params: UploadNewsletterAssetParams, options?: MethodOptions): Promise<NewsletterAsset>;
972
+ }
770
973
  declare class Newsletters extends ApiResource {
974
+ readonly domains: NewsletterDomains;
975
+ readonly assets: NewsletterAssets;
976
+ constructor(client: ShipMailClient);
771
977
  create(params: CreateNewsletterParams, options?: MethodOptions): Promise<Newsletter>;
978
+ createFromChangelog(params: CreateNewsletterFromChangelogParams, options?: MethodOptions): Promise<Newsletter>;
772
979
  list(params?: ListNewslettersParams, options?: MethodOptions): Promise<PaginatedResponse<Newsletter>>;
773
980
  listAutoPaginating(params?: Omit<ListNewslettersParams, "cursor">): Page<Newsletter>;
774
981
  get(id: string, options?: MethodOptions): Promise<Newsletter>;
775
982
  update(id: string, params: UpdateNewsletterParams, options?: MethodOptions): Promise<Newsletter>;
776
983
  preflight(id: string, options?: MethodOptions): Promise<NewsletterPreflight>;
984
+ preview(id: string, options?: MethodOptions): Promise<NewsletterPreview>;
777
985
  sendTest(id: string, params: SendNewsletterTestParams, options?: MethodOptions): Promise<NewsletterTestSend>;
778
986
  schedule(id: string, params: ScheduleNewsletterParams, options?: MethodOptions): Promise<Newsletter>;
779
987
  cancel(id: string, options?: MethodOptions): Promise<Newsletter>;
@@ -903,7 +1111,7 @@ type RequestOptions = {
903
1111
  readonly path: string;
904
1112
  readonly body?: unknown | undefined;
905
1113
  readonly query?: Record<string, string | number | boolean | undefined> | undefined;
906
- readonly rawBody?: ArrayBuffer | undefined;
1114
+ readonly rawBody?: ArrayBuffer | Uint8Array | undefined;
907
1115
  readonly contentType?: string | undefined;
908
1116
  readonly methodOptions?: MethodOptions | undefined;
909
1117
  };
@@ -959,12 +1167,14 @@ declare class ValidationError extends ShipMailError {
959
1167
  readonly details: readonly {
960
1168
  readonly field: string;
961
1169
  readonly message: string;
1170
+ readonly code?: string | undefined;
962
1171
  }[] | undefined;
963
1172
  constructor(message: string, options?: {
964
1173
  readonly requestId?: string | undefined;
965
1174
  readonly details?: readonly {
966
1175
  readonly field: string;
967
1176
  readonly message: string;
1177
+ readonly code?: string | undefined;
968
1178
  }[] | undefined;
969
1179
  });
970
1180
  }
@@ -1008,4 +1218,4 @@ declare function verifyWebhook(body: string, headers: WebhookHeaders | Headers,
1008
1218
  readonly toleranceInSeconds?: number | undefined;
1009
1219
  }): Promise<WebhookEvent>;
1010
1220
 
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 };
1221
+ export { type AddSubscriberParams, type AddSubscribersBatchParams, type AddSubscribersBatchResult, type ApiErrorBody, type Audience, AuthenticationError, AuthorizationError, ConflictError, ConnectionError, type CreateAudienceParams, type CreateDomainParams, type CreateMailboxFolderParams, type CreateMailboxParams, type CreateNewsletterFromChangelogParams, 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 ListNewsletterAssetsParams, type ListNewsletterDomainsParams, 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 NewsletterAsset, type NewsletterAssetKind, type NewsletterBlock, type NewsletterCalloutVariant, type NewsletterChangelogEntry, type NewsletterChangelogMedia, type NewsletterChangelogTone, type NewsletterColumnContent, type NewsletterColumnRatio, type NewsletterCountedUrl, type NewsletterDomain, type NewsletterDomainRecordStatus, type NewsletterDomainStatus, type NewsletterPreflight, type NewsletterPreflightItem, type NewsletterPreflightItemStatus, type NewsletterPreflightStatus, type NewsletterPreview, type NewsletterStatus, type NewsletterTestSend, type NewsletterTestSendStatus, type NewsletterUrlBreakdown, type NewsletterUrlSource, 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, type UploadNewsletterAssetParams, 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
@@ -40,6 +40,7 @@ type ApiErrorBody = {
40
40
  readonly details?: readonly {
41
41
  readonly field: string;
42
42
  readonly message: string;
43
+ readonly code?: string | undefined;
43
44
  }[] | undefined;
44
45
  readonly retry_after?: number | undefined;
45
46
  };
@@ -685,9 +686,34 @@ declare class Messages extends ApiResource {
685
686
 
686
687
  type NewsletterStatus = "draft" | "pending_approval" | "approved" | "scheduled" | "sending" | "paused" | "sent" | "cancelled" | "failed";
687
688
  type NewsletterArchiveVisibility = "private" | "public";
689
+ type NewsletterDomainStatus = "pending" | "verifying" | "verified" | "failed" | "disabled";
690
+ type NewsletterDomainRecordStatus = "pending" | "verified" | "failed";
688
691
  type NewsletterPreflightStatus = "not_run" | "passed" | "warning" | "failed";
689
692
  type NewsletterPreflightItemStatus = "pass" | "warn" | "fail";
690
693
  type NewsletterTestSendStatus = "pending" | "sent" | "failed";
694
+ type NewsletterAssetKind = "image" | "video";
695
+ type NewsletterUrlSource = "href" | "image_src" | "video_href" | "text";
696
+ type NewsletterChangelogTone = "concise" | "friendly" | "technical";
697
+ type NewsletterCalloutVariant = "accent" | "info" | "warning" | "success";
698
+ type NewsletterColumnRatio = "50-50" | "33-67" | "67-33";
699
+ type NewsletterDomain = {
700
+ readonly object: "newsletter_domain";
701
+ readonly id: string;
702
+ readonly root_domain_id: string;
703
+ readonly domain_name: string;
704
+ readonly from_local_part: string;
705
+ readonly from_address: string;
706
+ readonly mail_from_domain: string;
707
+ readonly reply_to_mailbox_id: string | null;
708
+ readonly status: NewsletterDomainStatus;
709
+ readonly dkim_status: NewsletterDomainRecordStatus;
710
+ readonly mail_from_status: NewsletterDomainRecordStatus;
711
+ readonly spf_status: NewsletterDomainRecordStatus;
712
+ readonly dmarc_status: NewsletterDomainRecordStatus;
713
+ readonly verified_at: string | null;
714
+ readonly created_at: string;
715
+ readonly updated_at: string;
716
+ };
691
717
  type Newsletter = {
692
718
  readonly object: "newsletter";
693
719
  readonly id: string;
@@ -700,6 +726,7 @@ type Newsletter = {
700
726
  readonly from_name: string | null;
701
727
  readonly from_address: string;
702
728
  readonly reply_to_address: string | null;
729
+ readonly blocks: readonly NewsletterBlock[] | null;
703
730
  readonly body_html: string | null;
704
731
  readonly body_text: string | null;
705
732
  readonly status: NewsletterStatus;
@@ -715,6 +742,9 @@ type Newsletter = {
715
742
  readonly complained_count: number;
716
743
  readonly failed_count: number;
717
744
  readonly skipped_count: number;
745
+ readonly last_test_sent_at: string | null;
746
+ readonly last_test_recipient: string | null;
747
+ readonly content_changed_since_test_send: boolean;
718
748
  readonly scheduled_at: string | null;
719
749
  readonly approved_at: string | null;
720
750
  readonly started_at: string | null;
@@ -734,6 +764,34 @@ type NewsletterPreflight = {
734
764
  readonly newsletter_id: string;
735
765
  readonly status: NewsletterPreflightStatus;
736
766
  readonly items: readonly NewsletterPreflightItem[];
767
+ readonly url_breakdown: NewsletterUrlBreakdown;
768
+ };
769
+ type NewsletterCountedUrl = {
770
+ readonly url: string;
771
+ readonly source: NewsletterUrlSource;
772
+ };
773
+ type NewsletterUrlBreakdown = {
774
+ readonly href_count: number;
775
+ readonly image_src_count: number;
776
+ readonly video_href_count: number;
777
+ readonly text_url_count: number;
778
+ readonly unique_url_count: number;
779
+ readonly max_unique_urls: number;
780
+ readonly urls: readonly NewsletterCountedUrl[];
781
+ readonly offending_urls: readonly string[];
782
+ };
783
+ type NewsletterPreview = {
784
+ readonly object: "newsletter_preview";
785
+ readonly newsletter_id: string;
786
+ readonly html: string;
787
+ readonly archive_html: string;
788
+ readonly text: string;
789
+ readonly warnings: readonly {
790
+ readonly kind: string;
791
+ readonly severity: "fail" | "warn";
792
+ readonly message: string;
793
+ }[];
794
+ readonly url_breakdown: NewsletterUrlBreakdown;
737
795
  };
738
796
  type NewsletterTestSend = {
739
797
  readonly object: "newsletter_test_send";
@@ -755,25 +813,175 @@ type CreateNewsletterParams = {
755
813
  readonly from_name?: string | null | undefined;
756
814
  readonly body_html?: string | null | undefined;
757
815
  readonly body_text?: string | null | undefined;
816
+ readonly blocks?: readonly NewsletterBlock[] | undefined;
758
817
  readonly send_window_hours?: number | undefined;
759
818
  readonly archive_visibility?: NewsletterArchiveVisibility | undefined;
760
819
  };
761
820
  type UpdateNewsletterParams = Partial<CreateNewsletterParams>;
821
+ type NewsletterChangelogMedia = {
822
+ readonly kind: "image";
823
+ readonly url: string;
824
+ readonly alt: string;
825
+ readonly caption?: string | null | undefined;
826
+ readonly link_url?: string | null | undefined;
827
+ } | {
828
+ readonly kind: "video";
829
+ readonly video_url: string;
830
+ readonly thumbnail_url: string;
831
+ readonly label: string;
832
+ };
833
+ type NewsletterChangelogEntry = {
834
+ readonly title: string;
835
+ readonly body?: string | null | undefined;
836
+ readonly url?: string | null | undefined;
837
+ readonly media?: readonly NewsletterChangelogMedia[] | undefined;
838
+ readonly cta_label?: string | null | undefined;
839
+ readonly cta_url?: string | null | undefined;
840
+ };
841
+ type CreateNewsletterFromChangelogParams = {
842
+ readonly audience_id: string;
843
+ readonly newsletter_domain_id: string;
844
+ readonly name: string;
845
+ readonly subject: string;
846
+ readonly preview_text?: string | null | undefined;
847
+ readonly from_name?: string | null | undefined;
848
+ readonly tone?: NewsletterChangelogTone | undefined;
849
+ readonly entries: readonly NewsletterChangelogEntry[];
850
+ readonly final_cta?: {
851
+ readonly label: string;
852
+ readonly url: string;
853
+ readonly body?: string | null | undefined;
854
+ } | undefined;
855
+ readonly send_window_hours?: number | undefined;
856
+ readonly archive_visibility?: NewsletterArchiveVisibility | undefined;
857
+ };
858
+ type ListNewsletterDomainsParams = PaginationParams;
762
859
  type ListNewslettersParams = PaginationParams;
860
+ type ListNewsletterAssetsParams = PaginationParams & {
861
+ readonly kind?: NewsletterAssetKind | undefined;
862
+ readonly q?: string | undefined;
863
+ };
864
+ type NewsletterAsset = {
865
+ readonly object: "newsletter_asset";
866
+ readonly id: string;
867
+ readonly kind: NewsletterAssetKind;
868
+ readonly filename: string;
869
+ readonly content_type: string;
870
+ readonly byte_size: number;
871
+ readonly checksum_sha256: string;
872
+ readonly url: string;
873
+ readonly image_url: string | null;
874
+ readonly video_url: string | null;
875
+ readonly thumbnail_url: string | null;
876
+ readonly thumbnail_content_type: string | null;
877
+ readonly thumbnail_byte_size: number | null;
878
+ readonly duration_seconds: number | null;
879
+ readonly width: number | null;
880
+ readonly height: number | null;
881
+ readonly created_at: string;
882
+ };
883
+ type UploadNewsletterAssetParams = {
884
+ readonly filename: string;
885
+ readonly data: ArrayBuffer | Uint8Array;
886
+ readonly content_type?: string | undefined;
887
+ };
763
888
  type SendNewsletterTestParams = {
764
889
  readonly recipient_email: string;
765
890
  };
766
891
  type ScheduleNewsletterParams = {
767
892
  readonly scheduled_at: string;
768
893
  };
894
+ type NewsletterColumnContent = {
895
+ readonly title?: string | null | undefined;
896
+ readonly body: string;
897
+ readonly image_url?: string | null | undefined;
898
+ readonly image_alt?: string | null | undefined;
899
+ readonly cta_label?: string | null | undefined;
900
+ readonly cta_url?: string | null | undefined;
901
+ };
902
+ type NewsletterBlock = {
903
+ readonly type: "heading";
904
+ readonly text: string;
905
+ readonly level?: 1 | 2 | 3 | undefined;
906
+ } | {
907
+ readonly type: "paragraph";
908
+ readonly body: string;
909
+ } | {
910
+ readonly type: "list";
911
+ readonly ordered?: boolean | undefined;
912
+ readonly items: readonly string[];
913
+ } | {
914
+ readonly type: "callout";
915
+ readonly title?: string | null | undefined;
916
+ readonly body: string;
917
+ readonly variant?: NewsletterCalloutVariant | undefined;
918
+ } | {
919
+ readonly type: "button";
920
+ readonly label: string;
921
+ readonly url: string;
922
+ } | {
923
+ readonly type: "image";
924
+ readonly url: string;
925
+ readonly alt: string;
926
+ readonly link_url?: string | null | undefined;
927
+ readonly caption?: string | null | undefined;
928
+ readonly caption_url?: string | null | undefined;
929
+ } | {
930
+ readonly type: "video";
931
+ readonly video_url: string;
932
+ readonly thumbnail_url: string;
933
+ readonly label: string;
934
+ } | {
935
+ readonly type: "columns";
936
+ readonly ratio?: NewsletterColumnRatio | undefined;
937
+ readonly left: NewsletterColumnContent;
938
+ readonly right: NewsletterColumnContent;
939
+ } | {
940
+ readonly type: "link_list";
941
+ readonly title?: string | null | undefined;
942
+ readonly items: readonly {
943
+ readonly label: string;
944
+ readonly url: string;
945
+ readonly description?: string | null | undefined;
946
+ }[];
947
+ } | {
948
+ readonly type: "quote";
949
+ readonly body: string;
950
+ readonly cite?: string | null | undefined;
951
+ } | {
952
+ readonly type: "divider";
953
+ } | {
954
+ readonly type: "spacer";
955
+ readonly height?: number | undefined;
956
+ } | {
957
+ readonly type: "code";
958
+ readonly code: string;
959
+ } | {
960
+ readonly type: "custom_html";
961
+ readonly html: string;
962
+ };
769
963
 
964
+ declare class NewsletterDomains extends ApiResource {
965
+ list(params?: ListNewsletterDomainsParams, options?: MethodOptions): Promise<PaginatedResponse<NewsletterDomain>>;
966
+ listAutoPaginating(params?: Omit<ListNewsletterDomainsParams, "cursor">): Page<NewsletterDomain>;
967
+ }
968
+ declare class NewsletterAssets extends ApiResource {
969
+ list(params?: ListNewsletterAssetsParams, options?: MethodOptions): Promise<PaginatedResponse<NewsletterAsset>>;
970
+ listAutoPaginating(params?: Omit<ListNewsletterAssetsParams, "cursor">): Page<NewsletterAsset>;
971
+ upload(params: UploadNewsletterAssetParams, options?: MethodOptions): Promise<NewsletterAsset>;
972
+ }
770
973
  declare class Newsletters extends ApiResource {
974
+ readonly domains: NewsletterDomains;
975
+ readonly assets: NewsletterAssets;
976
+ constructor(client: ShipMailClient);
771
977
  create(params: CreateNewsletterParams, options?: MethodOptions): Promise<Newsletter>;
978
+ createFromChangelog(params: CreateNewsletterFromChangelogParams, options?: MethodOptions): Promise<Newsletter>;
772
979
  list(params?: ListNewslettersParams, options?: MethodOptions): Promise<PaginatedResponse<Newsletter>>;
773
980
  listAutoPaginating(params?: Omit<ListNewslettersParams, "cursor">): Page<Newsletter>;
774
981
  get(id: string, options?: MethodOptions): Promise<Newsletter>;
775
982
  update(id: string, params: UpdateNewsletterParams, options?: MethodOptions): Promise<Newsletter>;
776
983
  preflight(id: string, options?: MethodOptions): Promise<NewsletterPreflight>;
984
+ preview(id: string, options?: MethodOptions): Promise<NewsletterPreview>;
777
985
  sendTest(id: string, params: SendNewsletterTestParams, options?: MethodOptions): Promise<NewsletterTestSend>;
778
986
  schedule(id: string, params: ScheduleNewsletterParams, options?: MethodOptions): Promise<Newsletter>;
779
987
  cancel(id: string, options?: MethodOptions): Promise<Newsletter>;
@@ -903,7 +1111,7 @@ type RequestOptions = {
903
1111
  readonly path: string;
904
1112
  readonly body?: unknown | undefined;
905
1113
  readonly query?: Record<string, string | number | boolean | undefined> | undefined;
906
- readonly rawBody?: ArrayBuffer | undefined;
1114
+ readonly rawBody?: ArrayBuffer | Uint8Array | undefined;
907
1115
  readonly contentType?: string | undefined;
908
1116
  readonly methodOptions?: MethodOptions | undefined;
909
1117
  };
@@ -959,12 +1167,14 @@ declare class ValidationError extends ShipMailError {
959
1167
  readonly details: readonly {
960
1168
  readonly field: string;
961
1169
  readonly message: string;
1170
+ readonly code?: string | undefined;
962
1171
  }[] | undefined;
963
1172
  constructor(message: string, options?: {
964
1173
  readonly requestId?: string | undefined;
965
1174
  readonly details?: readonly {
966
1175
  readonly field: string;
967
1176
  readonly message: string;
1177
+ readonly code?: string | undefined;
968
1178
  }[] | undefined;
969
1179
  });
970
1180
  }
@@ -1008,4 +1218,4 @@ declare function verifyWebhook(body: string, headers: WebhookHeaders | Headers,
1008
1218
  readonly toleranceInSeconds?: number | undefined;
1009
1219
  }): Promise<WebhookEvent>;
1010
1220
 
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 };
1221
+ export { type AddSubscriberParams, type AddSubscribersBatchParams, type AddSubscribersBatchResult, type ApiErrorBody, type Audience, AuthenticationError, AuthorizationError, ConflictError, ConnectionError, type CreateAudienceParams, type CreateDomainParams, type CreateMailboxFolderParams, type CreateMailboxParams, type CreateNewsletterFromChangelogParams, 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 ListNewsletterAssetsParams, type ListNewsletterDomainsParams, 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 NewsletterAsset, type NewsletterAssetKind, type NewsletterBlock, type NewsletterCalloutVariant, type NewsletterChangelogEntry, type NewsletterChangelogMedia, type NewsletterChangelogTone, type NewsletterColumnContent, type NewsletterColumnRatio, type NewsletterCountedUrl, type NewsletterDomain, type NewsletterDomainRecordStatus, type NewsletterDomainStatus, type NewsletterPreflight, type NewsletterPreflightItem, type NewsletterPreflightItemStatus, type NewsletterPreflightStatus, type NewsletterPreview, type NewsletterStatus, type NewsletterTestSend, type NewsletterTestSendStatus, type NewsletterUrlBreakdown, type NewsletterUrlSource, 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, type UploadNewsletterAssetParams, ValidationError, WEBHOOK_DELIVERY_STATUSES, WEBHOOK_EVENT_TYPES, type Webhook, type WebhookDelivery, type WebhookDeliveryStatus, type WebhookEvent, type WebhookEventType, WebhookVerificationError, type WebhookWithSecret, ShipMailClient as default, verifyWebhook };