shipmail 0.1.22 → 0.1.24

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
@@ -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;
@@ -363,7 +447,7 @@ type InboxMessages = {
363
447
  readonly object: "inbox_messages";
364
448
  readonly mailbox_id: string;
365
449
  readonly address: string;
366
- readonly data: readonly InboxMessage[];
450
+ readonly data: readonly InboxFullMessage[];
367
451
  readonly pagination: {
368
452
  readonly position: number;
369
453
  readonly limit: number;
@@ -736,6 +820,7 @@ declare class ShipMailClient {
736
820
  private readonly timeout;
737
821
  private readonly fetchFn;
738
822
  private readonly defaultHeaders;
823
+ readonly audiences: Audiences;
739
824
  readonly domains: Domains;
740
825
  readonly mailboxes: Mailboxes;
741
826
  readonly messages: Messages;
@@ -825,4 +910,4 @@ declare function verifyWebhook(body: string, headers: WebhookHeaders | Headers,
825
910
  readonly toleranceInSeconds?: number | undefined;
826
911
  }): Promise<WebhookEvent>;
827
912
 
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 };
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 };
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;
@@ -363,7 +447,7 @@ type InboxMessages = {
363
447
  readonly object: "inbox_messages";
364
448
  readonly mailbox_id: string;
365
449
  readonly address: string;
366
- readonly data: readonly InboxMessage[];
450
+ readonly data: readonly InboxFullMessage[];
367
451
  readonly pagination: {
368
452
  readonly position: number;
369
453
  readonly limit: number;
@@ -736,6 +820,7 @@ declare class ShipMailClient {
736
820
  private readonly timeout;
737
821
  private readonly fetchFn;
738
822
  private readonly defaultHeaders;
823
+ readonly audiences: Audiences;
739
824
  readonly domains: Domains;
740
825
  readonly mailboxes: Mailboxes;
741
826
  readonly messages: Messages;
@@ -825,4 +910,4 @@ declare function verifyWebhook(body: string, headers: WebhookHeaders | Headers,
825
910
  readonly toleranceInSeconds?: number | undefined;
826
911
  }): Promise<WebhookEvent>;
827
912
 
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 };
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 };
package/dist/index.js CHANGED
@@ -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) {
@@ -657,7 +783,7 @@ var Webhooks = class extends ApiResource {
657
783
  };
658
784
 
659
785
  // src/version.ts
660
- var VERSION = "0.1.22";
786
+ var VERSION = "0.1.24";
661
787
 
662
788
  // src/client.ts
663
789
  var DEFAULT_BASE_URL = "https://shipmail.to/api/v1";
@@ -670,9 +796,9 @@ function calculateBackoff(attempt, retryAfterMs) {
670
796
  if (retryAfterMs !== void 0 && retryAfterMs > 0) {
671
797
  return retryAfterMs;
672
798
  }
673
- const base = Math.min(2 ** attempt * 500, 8e3);
674
- const jitter = Math.random() * base * 0.5;
675
- return base + jitter;
799
+ const base2 = Math.min(2 ** attempt * 500, 8e3);
800
+ const jitter = Math.random() * base2 * 0.5;
801
+ return base2 + jitter;
676
802
  }
677
803
  function isApiErrorBody(value) {
678
804
  if (typeof value !== "object" || value === null) return false;
@@ -702,6 +828,7 @@ var ShipMailClient = class {
702
828
  this.fetchFn = config.fetch ?? globalThis.fetch;
703
829
  this.defaultHeaders = config.defaultHeaders ? { ...config.defaultHeaders } : {};
704
830
  }
831
+ this.audiences = new Audiences(this);
705
832
  this.domains = new Domains(this);
706
833
  this.mailboxes = new Mailboxes(this);
707
834
  this.messages = new Messages(this);