shipmail 0.1.23 → 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/dist/index.d.ts CHANGED
@@ -72,6 +72,90 @@ type MethodOptions = {
72
72
  readonly idempotencyKey?: string | undefined;
73
73
  };
74
74
 
75
+ type MergeFields = Record<string, string | number | boolean | null>;
76
+ type SubscriberStatus = "subscribed" | "unsubscribed" | "bounced" | "complained" | "suppressed" | "transactional_only";
77
+ type SubscriberOutcome = "created" | "updated" | "skipped_not_mailable" | "skipped_invalid" | "skipped_cap" | "skipped_quota";
78
+ type Audience = {
79
+ readonly object: "audience";
80
+ readonly id: string;
81
+ readonly name: string;
82
+ readonly description: string | null;
83
+ readonly member_count: number;
84
+ readonly subscribed_count: number;
85
+ readonly consent_source: string | null;
86
+ readonly created_at: string;
87
+ readonly updated_at: string;
88
+ };
89
+ type Subscriber = {
90
+ readonly object: "subscriber";
91
+ readonly id: string;
92
+ readonly audience_id: string;
93
+ readonly email_address: string;
94
+ readonly display_name: string | null;
95
+ readonly status: SubscriberStatus;
96
+ readonly merge_fields: MergeFields;
97
+ readonly consent_source: string | null;
98
+ readonly created_at: string;
99
+ readonly updated_at: string;
100
+ };
101
+ type CreateAudienceParams = {
102
+ readonly name: string;
103
+ readonly description?: string | null | undefined;
104
+ readonly consent_source: string;
105
+ };
106
+ type UpdateAudienceParams = {
107
+ readonly name?: string | undefined;
108
+ readonly description?: string | null | undefined;
109
+ };
110
+ type ListAudiencesParams = PaginationParams;
111
+ type AddSubscriberParams = {
112
+ readonly email_address: string;
113
+ readonly display_name?: string | null | undefined;
114
+ readonly merge_fields?: MergeFields | undefined;
115
+ readonly consent_source?: string | null | undefined;
116
+ readonly consent_ip?: string | null | undefined;
117
+ };
118
+ type AddSubscribersBatchParams = {
119
+ readonly subscribers: readonly AddSubscriberParams[];
120
+ };
121
+ type UpdateSubscriberParams = {
122
+ readonly display_name?: string | null | undefined;
123
+ readonly merge_fields?: MergeFields | undefined;
124
+ };
125
+ type SubscriberResult = {
126
+ readonly email_address: string;
127
+ readonly outcome: SubscriberOutcome;
128
+ };
129
+ type AddSubscribersBatchResult = {
130
+ readonly results: readonly SubscriberResult[];
131
+ };
132
+ type ListSubscribersParams = PaginationParams & {
133
+ readonly status?: SubscriberStatus | undefined;
134
+ readonly email?: string | undefined;
135
+ };
136
+
137
+ declare class Subscribers extends ApiResource {
138
+ add(audienceId: string, params: AddSubscriberParams, options?: MethodOptions): Promise<SubscriberResult>;
139
+ addBatch(audienceId: string, params: AddSubscribersBatchParams, options?: MethodOptions): Promise<AddSubscribersBatchResult>;
140
+ list(audienceId: string, params?: ListSubscribersParams, options?: MethodOptions): Promise<PaginatedResponse<Subscriber>>;
141
+ listAutoPaginating(audienceId: string, params?: Omit<ListSubscribersParams, "cursor">): Page<Subscriber>;
142
+ get(audienceId: string, subscriberId: string, options?: MethodOptions): Promise<Subscriber>;
143
+ getByEmail(audienceId: string, email: string, options?: MethodOptions): Promise<Subscriber>;
144
+ update(audienceId: string, subscriberId: string, params: UpdateSubscriberParams, options?: MethodOptions): Promise<Subscriber>;
145
+ unsubscribe(audienceId: string, subscriberId: string, options?: MethodOptions): Promise<Subscriber>;
146
+ remove(audienceId: string, subscriberId: string, options?: MethodOptions): Promise<void>;
147
+ }
148
+ declare class Audiences extends ApiResource {
149
+ readonly subscribers: Subscribers;
150
+ constructor(client: ShipMailClient);
151
+ create(params: CreateAudienceParams, options?: MethodOptions): Promise<Audience>;
152
+ list(params?: ListAudiencesParams, options?: MethodOptions): Promise<PaginatedResponse<Audience>>;
153
+ listAutoPaginating(params?: Omit<ListAudiencesParams, "cursor">): Page<Audience>;
154
+ get(id: string, options?: MethodOptions): Promise<Audience>;
155
+ update(id: string, params: UpdateAudienceParams, options?: MethodOptions): Promise<Audience>;
156
+ delete(id: string, options?: MethodOptions): Promise<void>;
157
+ }
158
+
75
159
  type Domain = {
76
160
  readonly object: "domain";
77
161
  readonly id: string;
@@ -599,6 +683,103 @@ declare class Messages extends ApiResource {
599
683
  reply(id: string, params: ReplyToMessageParams, options?: MethodOptions): Promise<Message>;
600
684
  }
601
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
+
602
783
  declare class Status extends ApiResource {
603
784
  get(options?: MethodOptions): Promise<StatusResponse>;
604
785
  }
@@ -736,9 +917,11 @@ declare class ShipMailClient {
736
917
  private readonly timeout;
737
918
  private readonly fetchFn;
738
919
  private readonly defaultHeaders;
920
+ readonly audiences: Audiences;
739
921
  readonly domains: Domains;
740
922
  readonly mailboxes: Mailboxes;
741
923
  readonly messages: Messages;
924
+ readonly newsletters: Newsletters;
742
925
  readonly suppressions: Suppressions;
743
926
  readonly threads: Threads;
744
927
  readonly webhooks: Webhooks;
@@ -825,4 +1008,4 @@ declare function verifyWebhook(body: string, headers: WebhookHeaders | Headers,
825
1008
  readonly toleranceInSeconds?: number | undefined;
826
1009
  }): Promise<WebhookEvent>;
827
1010
 
828
- export { type ApiErrorBody, AuthenticationError, AuthorizationError, ConflictError, ConnectionError, 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 ListDeliveriesParams, type ListDomainsParams, type ListInboxMessagesParams, type ListMailboxesParams, type ListMessagesParams, 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 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 Suppression, type TestWebhookResponse, type Thread, type UpdateAutoReplyParams, type UpdateDomainParams, type UpdateInboxMessageParams, type UpdateMailboxFolderParams, type UpdateMailboxParams, type UpdateMailboxRulesParams, type UpdateSpamFilterParams, 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, 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]() {
@@ -142,6 +142,132 @@ var ApiResource = class {
142
142
  }
143
143
  };
144
144
 
145
+ // src/resources/audiences.ts
146
+ function base(audienceId) {
147
+ return `/audiences/${encodeURIComponent(audienceId)}/subscribers`;
148
+ }
149
+ var Subscribers = class extends ApiResource {
150
+ add(audienceId, params, options) {
151
+ return this.client.request({
152
+ method: "POST",
153
+ path: base(audienceId),
154
+ body: params,
155
+ methodOptions: options
156
+ });
157
+ }
158
+ addBatch(audienceId, params, options) {
159
+ return this.client.request({
160
+ method: "POST",
161
+ path: `${base(audienceId)}/batch`,
162
+ body: params,
163
+ methodOptions: options
164
+ });
165
+ }
166
+ list(audienceId, params, options) {
167
+ return this.client.request({
168
+ method: "GET",
169
+ path: base(audienceId),
170
+ query: {
171
+ cursor: params?.cursor,
172
+ limit: params?.limit,
173
+ status: params?.status,
174
+ email: params?.email
175
+ },
176
+ methodOptions: options
177
+ });
178
+ }
179
+ listAutoPaginating(audienceId, params) {
180
+ return new Page(this.client, base(audienceId), {
181
+ limit: params?.limit,
182
+ status: params?.status,
183
+ email: params?.email
184
+ });
185
+ }
186
+ get(audienceId, subscriberId, options) {
187
+ return this.client.request({
188
+ method: "GET",
189
+ path: `${base(audienceId)}/${encodeURIComponent(subscriberId)}`,
190
+ methodOptions: options
191
+ });
192
+ }
193
+ getByEmail(audienceId, email, options) {
194
+ return this.client.request({
195
+ method: "GET",
196
+ path: `${base(audienceId)}/by-email/${encodeURIComponent(email)}`,
197
+ methodOptions: options
198
+ });
199
+ }
200
+ update(audienceId, subscriberId, params, options) {
201
+ return this.client.request({
202
+ method: "PATCH",
203
+ path: `${base(audienceId)}/${encodeURIComponent(subscriberId)}`,
204
+ body: params,
205
+ methodOptions: options
206
+ });
207
+ }
208
+ unsubscribe(audienceId, subscriberId, options) {
209
+ return this.client.request({
210
+ method: "POST",
211
+ path: `${base(audienceId)}/${encodeURIComponent(subscriberId)}/unsubscribe`,
212
+ methodOptions: options
213
+ });
214
+ }
215
+ remove(audienceId, subscriberId, options) {
216
+ return this.client.request({
217
+ method: "DELETE",
218
+ path: `${base(audienceId)}/${encodeURIComponent(subscriberId)}`,
219
+ methodOptions: options
220
+ });
221
+ }
222
+ };
223
+ var Audiences = class extends ApiResource {
224
+ constructor(client) {
225
+ super(client);
226
+ this.subscribers = new Subscribers(client);
227
+ }
228
+ create(params, options) {
229
+ return this.client.request({
230
+ method: "POST",
231
+ path: "/audiences",
232
+ body: params,
233
+ methodOptions: options
234
+ });
235
+ }
236
+ list(params, options) {
237
+ return this.client.request({
238
+ method: "GET",
239
+ path: "/audiences",
240
+ query: { cursor: params?.cursor, limit: params?.limit },
241
+ methodOptions: options
242
+ });
243
+ }
244
+ listAutoPaginating(params) {
245
+ return new Page(this.client, "/audiences", { limit: params?.limit });
246
+ }
247
+ get(id, options) {
248
+ return this.client.request({
249
+ method: "GET",
250
+ path: `/audiences/${encodeURIComponent(id)}`,
251
+ methodOptions: options
252
+ });
253
+ }
254
+ update(id, params, options) {
255
+ return this.client.request({
256
+ method: "PATCH",
257
+ path: `/audiences/${encodeURIComponent(id)}`,
258
+ body: params,
259
+ methodOptions: options
260
+ });
261
+ }
262
+ delete(id, options) {
263
+ return this.client.request({
264
+ method: "DELETE",
265
+ path: `/audiences/${encodeURIComponent(id)}`,
266
+ methodOptions: options
267
+ });
268
+ }
269
+ };
270
+
145
271
  // src/resources/domains.ts
146
272
  var Domains = class extends ApiResource {
147
273
  create(params, options) {
@@ -489,6 +615,84 @@ var Messages = class extends ApiResource {
489
615
  }
490
616
  };
491
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
+
492
696
  // src/resources/status.ts
493
697
  var Status = class extends ApiResource {
494
698
  get(options) {
@@ -657,7 +861,7 @@ var Webhooks = class extends ApiResource {
657
861
  };
658
862
 
659
863
  // src/version.ts
660
- var VERSION = "0.1.23";
864
+ var VERSION = "0.1.25";
661
865
 
662
866
  // src/client.ts
663
867
  var DEFAULT_BASE_URL = "https://shipmail.to/api/v1";
@@ -670,9 +874,9 @@ function calculateBackoff(attempt, retryAfterMs) {
670
874
  if (retryAfterMs !== void 0 && retryAfterMs > 0) {
671
875
  return retryAfterMs;
672
876
  }
673
- const base = Math.min(2 ** attempt * 500, 8e3);
674
- const jitter = Math.random() * base * 0.5;
675
- return base + jitter;
877
+ const base2 = Math.min(2 ** attempt * 500, 8e3);
878
+ const jitter = Math.random() * base2 * 0.5;
879
+ return base2 + jitter;
676
880
  }
677
881
  function isApiErrorBody(value) {
678
882
  if (typeof value !== "object" || value === null) return false;
@@ -702,9 +906,11 @@ var ShipMailClient = class {
702
906
  this.fetchFn = config.fetch ?? globalThis.fetch;
703
907
  this.defaultHeaders = config.defaultHeaders ? { ...config.defaultHeaders } : {};
704
908
  }
909
+ this.audiences = new Audiences(this);
705
910
  this.domains = new Domains(this);
706
911
  this.mailboxes = new Mailboxes(this);
707
912
  this.messages = new Messages(this);
913
+ this.newsletters = new Newsletters(this);
708
914
  this.suppressions = new Suppressions(this);
709
915
  this.threads = new Threads(this);
710
916
  this.webhooks = new Webhooks(this);
@@ -788,8 +994,8 @@ var ShipMailClient = class {
788
994
  }
789
995
  throw lastError ?? new ShipMailError("Request failed after retries");
790
996
  }
791
- buildUrl(path, query) {
792
- const url = new URL(`${this.baseUrl}${path}`);
997
+ buildUrl(path2, query) {
998
+ const url = new URL(`${this.baseUrl}${path2}`);
793
999
  if (query) {
794
1000
  for (const [key, value] of Object.entries(query)) {
795
1001
  if (value !== void 0) {