shipmail 0.1.24 → 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.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
  };
@@ -683,6 +684,310 @@ declare class Messages extends ApiResource {
683
684
  reply(id: string, params: ReplyToMessageParams, options?: MethodOptions): Promise<Message>;
684
685
  }
685
686
 
687
+ type NewsletterStatus = "draft" | "pending_approval" | "approved" | "scheduled" | "sending" | "paused" | "sent" | "cancelled" | "failed";
688
+ type NewsletterArchiveVisibility = "private" | "public";
689
+ type NewsletterDomainStatus = "pending" | "verifying" | "verified" | "failed" | "disabled";
690
+ type NewsletterDomainRecordStatus = "pending" | "verified" | "failed";
691
+ type NewsletterPreflightStatus = "not_run" | "passed" | "warning" | "failed";
692
+ type NewsletterPreflightItemStatus = "pass" | "warn" | "fail";
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
+ };
717
+ type Newsletter = {
718
+ readonly object: "newsletter";
719
+ readonly id: string;
720
+ readonly audience_id: string | null;
721
+ readonly newsletter_domain_id: string;
722
+ readonly reply_to_mailbox_id: string | null;
723
+ readonly name: string;
724
+ readonly subject: string | null;
725
+ readonly preview_text: string | null;
726
+ readonly from_name: string | null;
727
+ readonly from_address: string;
728
+ readonly reply_to_address: string | null;
729
+ readonly blocks: readonly NewsletterBlock[] | null;
730
+ readonly body_html: string | null;
731
+ readonly body_text: string | null;
732
+ readonly status: NewsletterStatus;
733
+ readonly archive_visibility: NewsletterArchiveVisibility;
734
+ readonly preflight_status: NewsletterPreflightStatus;
735
+ readonly preflight_results: Record<string, unknown>;
736
+ readonly send_window_hours: number;
737
+ readonly send_rate_per_hour: number;
738
+ readonly recipient_count: number;
739
+ readonly sent_count: number;
740
+ readonly delivered_count: number;
741
+ readonly bounced_count: number;
742
+ readonly complained_count: number;
743
+ readonly failed_count: number;
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;
748
+ readonly scheduled_at: string | null;
749
+ readonly approved_at: string | null;
750
+ readonly started_at: string | null;
751
+ readonly completed_at: string | null;
752
+ readonly cancelled_at: string | null;
753
+ readonly created_at: string;
754
+ readonly updated_at: string;
755
+ };
756
+ type NewsletterPreflightItem = {
757
+ readonly key: string;
758
+ readonly label: string;
759
+ readonly status: NewsletterPreflightItemStatus;
760
+ readonly message: string;
761
+ };
762
+ type NewsletterPreflight = {
763
+ readonly object: "newsletter_preflight";
764
+ readonly newsletter_id: string;
765
+ readonly status: NewsletterPreflightStatus;
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;
795
+ };
796
+ type NewsletterTestSend = {
797
+ readonly object: "newsletter_test_send";
798
+ readonly id: string;
799
+ readonly newsletter_id: string;
800
+ readonly message_id: string | null;
801
+ readonly recipient_email: string;
802
+ readonly status: NewsletterTestSendStatus;
803
+ readonly last_error: string | null;
804
+ readonly sent_at: string | null;
805
+ readonly created_at: string;
806
+ };
807
+ type CreateNewsletterParams = {
808
+ readonly audience_id: string;
809
+ readonly newsletter_domain_id: string;
810
+ readonly name: string;
811
+ readonly subject: string;
812
+ readonly preview_text?: string | null | undefined;
813
+ readonly from_name?: string | null | undefined;
814
+ readonly body_html?: string | null | undefined;
815
+ readonly body_text?: string | null | undefined;
816
+ readonly blocks?: readonly NewsletterBlock[] | undefined;
817
+ readonly send_window_hours?: number | undefined;
818
+ readonly archive_visibility?: NewsletterArchiveVisibility | undefined;
819
+ };
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;
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
+ };
888
+ type SendNewsletterTestParams = {
889
+ readonly recipient_email: string;
890
+ };
891
+ type ScheduleNewsletterParams = {
892
+ readonly scheduled_at: string;
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
+ };
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
+ }
973
+ declare class Newsletters extends ApiResource {
974
+ readonly domains: NewsletterDomains;
975
+ readonly assets: NewsletterAssets;
976
+ constructor(client: ShipMailClient);
977
+ create(params: CreateNewsletterParams, options?: MethodOptions): Promise<Newsletter>;
978
+ createFromChangelog(params: CreateNewsletterFromChangelogParams, options?: MethodOptions): Promise<Newsletter>;
979
+ list(params?: ListNewslettersParams, options?: MethodOptions): Promise<PaginatedResponse<Newsletter>>;
980
+ listAutoPaginating(params?: Omit<ListNewslettersParams, "cursor">): Page<Newsletter>;
981
+ get(id: string, options?: MethodOptions): Promise<Newsletter>;
982
+ update(id: string, params: UpdateNewsletterParams, options?: MethodOptions): Promise<Newsletter>;
983
+ preflight(id: string, options?: MethodOptions): Promise<NewsletterPreflight>;
984
+ preview(id: string, options?: MethodOptions): Promise<NewsletterPreview>;
985
+ sendTest(id: string, params: SendNewsletterTestParams, options?: MethodOptions): Promise<NewsletterTestSend>;
986
+ schedule(id: string, params: ScheduleNewsletterParams, options?: MethodOptions): Promise<Newsletter>;
987
+ cancel(id: string, options?: MethodOptions): Promise<Newsletter>;
988
+ resume(id: string, options?: MethodOptions): Promise<Newsletter>;
989
+ }
990
+
686
991
  declare class Status extends ApiResource {
687
992
  get(options?: MethodOptions): Promise<StatusResponse>;
688
993
  }
@@ -806,7 +1111,7 @@ type RequestOptions = {
806
1111
  readonly path: string;
807
1112
  readonly body?: unknown | undefined;
808
1113
  readonly query?: Record<string, string | number | boolean | undefined> | undefined;
809
- readonly rawBody?: ArrayBuffer | undefined;
1114
+ readonly rawBody?: ArrayBuffer | Uint8Array | undefined;
810
1115
  readonly contentType?: string | undefined;
811
1116
  readonly methodOptions?: MethodOptions | undefined;
812
1117
  };
@@ -824,6 +1129,7 @@ declare class ShipMailClient {
824
1129
  readonly domains: Domains;
825
1130
  readonly mailboxes: Mailboxes;
826
1131
  readonly messages: Messages;
1132
+ readonly newsletters: Newsletters;
827
1133
  readonly suppressions: Suppressions;
828
1134
  readonly threads: Threads;
829
1135
  readonly webhooks: Webhooks;
@@ -861,12 +1167,14 @@ declare class ValidationError extends ShipMailError {
861
1167
  readonly details: readonly {
862
1168
  readonly field: string;
863
1169
  readonly message: string;
1170
+ readonly code?: string | undefined;
864
1171
  }[] | undefined;
865
1172
  constructor(message: string, options?: {
866
1173
  readonly requestId?: string | undefined;
867
1174
  readonly details?: readonly {
868
1175
  readonly field: string;
869
1176
  readonly message: string;
1177
+ readonly code?: string | undefined;
870
1178
  }[] | undefined;
871
1179
  });
872
1180
  }
@@ -910,4 +1218,4 @@ declare function verifyWebhook(body: string, headers: WebhookHeaders | Headers,
910
1218
  readonly toleranceInSeconds?: number | undefined;
911
1219
  }): Promise<WebhookEvent>;
912
1220
 
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 };
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.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, path, query) {
116
+ constructor(client, path2, query) {
117
117
  this.client = client;
118
- this.path = path;
118
+ this.path = path2;
119
119
  this.query = query;
120
120
  }
121
121
  async *[Symbol.asyncIterator]() {
@@ -615,6 +615,149 @@ 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 NewsletterDomains = class extends ApiResource {
623
+ list(params, options) {
624
+ return this.client.request({
625
+ method: "GET",
626
+ path: "/newsletter-domains",
627
+ query: { cursor: params?.cursor, limit: params?.limit },
628
+ methodOptions: options
629
+ });
630
+ }
631
+ listAutoPaginating(params) {
632
+ return new Page(this.client, "/newsletter-domains", { limit: params?.limit });
633
+ }
634
+ };
635
+ var NewsletterAssets = class extends ApiResource {
636
+ list(params, options) {
637
+ return this.client.request({
638
+ method: "GET",
639
+ path: "/newsletter-assets",
640
+ query: {
641
+ cursor: params?.cursor,
642
+ limit: params?.limit,
643
+ kind: params?.kind,
644
+ q: params?.q
645
+ },
646
+ methodOptions: options
647
+ });
648
+ }
649
+ listAutoPaginating(params) {
650
+ return new Page(this.client, "/newsletter-assets", {
651
+ limit: params?.limit,
652
+ kind: params?.kind,
653
+ q: params?.q
654
+ });
655
+ }
656
+ upload(params, options) {
657
+ return this.client.request({
658
+ method: "POST",
659
+ path: "/newsletter-assets",
660
+ query: { filename: params.filename },
661
+ rawBody: params.data,
662
+ contentType: params.content_type,
663
+ methodOptions: options
664
+ });
665
+ }
666
+ };
667
+ var Newsletters = class extends ApiResource {
668
+ constructor(client) {
669
+ super(client);
670
+ this.domains = new NewsletterDomains(client);
671
+ this.assets = new NewsletterAssets(client);
672
+ }
673
+ create(params, options) {
674
+ return this.client.request({
675
+ method: "POST",
676
+ path: "/newsletters",
677
+ body: params,
678
+ methodOptions: options
679
+ });
680
+ }
681
+ createFromChangelog(params, options) {
682
+ return this.client.request({
683
+ method: "POST",
684
+ path: "/newsletters/from-changelog",
685
+ body: params,
686
+ methodOptions: options
687
+ });
688
+ }
689
+ list(params, options) {
690
+ return this.client.request({
691
+ method: "GET",
692
+ path: "/newsletters",
693
+ query: { cursor: params?.cursor, limit: params?.limit },
694
+ methodOptions: options
695
+ });
696
+ }
697
+ listAutoPaginating(params) {
698
+ return new Page(this.client, "/newsletters", { limit: params?.limit });
699
+ }
700
+ get(id, options) {
701
+ return this.client.request({
702
+ method: "GET",
703
+ path: path(id),
704
+ methodOptions: options
705
+ });
706
+ }
707
+ update(id, params, options) {
708
+ return this.client.request({
709
+ method: "PATCH",
710
+ path: path(id),
711
+ body: params,
712
+ methodOptions: options
713
+ });
714
+ }
715
+ preflight(id, options) {
716
+ return this.client.request({
717
+ method: "POST",
718
+ path: `${path(id)}/preflight`,
719
+ methodOptions: options
720
+ });
721
+ }
722
+ preview(id, options) {
723
+ return this.client.request({
724
+ method: "POST",
725
+ path: `${path(id)}/preview`,
726
+ methodOptions: options
727
+ });
728
+ }
729
+ sendTest(id, params, options) {
730
+ return this.client.request({
731
+ method: "POST",
732
+ path: `${path(id)}/test-send`,
733
+ body: params,
734
+ methodOptions: options
735
+ });
736
+ }
737
+ schedule(id, params, options) {
738
+ return this.client.request({
739
+ method: "POST",
740
+ path: `${path(id)}/schedule`,
741
+ body: params,
742
+ methodOptions: options
743
+ });
744
+ }
745
+ cancel(id, options) {
746
+ return this.client.request({
747
+ method: "POST",
748
+ path: `${path(id)}/cancel`,
749
+ methodOptions: options
750
+ });
751
+ }
752
+ resume(id, options) {
753
+ return this.client.request({
754
+ method: "POST",
755
+ path: `${path(id)}/resume`,
756
+ methodOptions: options
757
+ });
758
+ }
759
+ };
760
+
618
761
  // src/resources/status.ts
619
762
  var Status = class extends ApiResource {
620
763
  get(options) {
@@ -783,7 +926,7 @@ var Webhooks = class extends ApiResource {
783
926
  };
784
927
 
785
928
  // src/version.ts
786
- var VERSION = "0.1.24";
929
+ var VERSION = "0.1.26";
787
930
 
788
931
  // src/client.ts
789
932
  var DEFAULT_BASE_URL = "https://shipmail.to/api/v1";
@@ -807,6 +950,12 @@ function isApiErrorBody(value) {
807
950
  const error = obj["error"];
808
951
  return typeof error["type"] === "string" && typeof error["message"] === "string";
809
952
  }
953
+ function rawBodyToBlobPart(rawBody) {
954
+ if (rawBody instanceof ArrayBuffer) return rawBody;
955
+ const buffer = new ArrayBuffer(rawBody.byteLength);
956
+ new Uint8Array(buffer).set(rawBody);
957
+ return buffer;
958
+ }
810
959
  var ShipMailClient = class {
811
960
  /**
812
961
  * Create a new ShipMail client.
@@ -832,6 +981,7 @@ var ShipMailClient = class {
832
981
  this.domains = new Domains(this);
833
982
  this.mailboxes = new Mailboxes(this);
834
983
  this.messages = new Messages(this);
984
+ this.newsletters = new Newsletters(this);
835
985
  this.suppressions = new Suppressions(this);
836
986
  this.threads = new Threads(this);
837
987
  this.webhooks = new Webhooks(this);
@@ -875,7 +1025,7 @@ var ShipMailClient = class {
875
1025
  let body = null;
876
1026
  if (options.rawBody !== void 0) {
877
1027
  headers["Content-Type"] = options.contentType ?? "application/octet-stream";
878
- body = new Blob([options.rawBody]);
1028
+ body = new Blob([rawBodyToBlobPart(options.rawBody)]);
879
1029
  } else if (options.body !== void 0) {
880
1030
  headers["Content-Type"] = "application/json";
881
1031
  body = JSON.stringify(options.body);
@@ -915,8 +1065,8 @@ var ShipMailClient = class {
915
1065
  }
916
1066
  throw lastError ?? new ShipMailError("Request failed after retries");
917
1067
  }
918
- buildUrl(path, query) {
919
- const url = new URL(`${this.baseUrl}${path}`);
1068
+ buildUrl(path2, query) {
1069
+ const url = new URL(`${this.baseUrl}${path2}`);
920
1070
  if (query) {
921
1071
  for (const [key, value] of Object.entries(query)) {
922
1072
  if (value !== void 0) {