shipmail 0.1.0 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -15
- package/dist/index.cjs +249 -97
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +204 -54
- package/dist/index.d.ts +204 -54
- package/dist/index.js +243 -96
- package/dist/index.js.map +1 -1
- package/package.json +9 -5
package/dist/index.d.cts
CHANGED
|
@@ -17,6 +17,7 @@ type ShipMailConfig = {
|
|
|
17
17
|
readonly maxRetries?: number | undefined;
|
|
18
18
|
readonly timeout?: number | undefined;
|
|
19
19
|
readonly fetch?: typeof fetch | undefined;
|
|
20
|
+
readonly defaultHeaders?: Record<string, string> | undefined;
|
|
20
21
|
};
|
|
21
22
|
type PaginationParams = {
|
|
22
23
|
readonly cursor?: string | undefined;
|
|
@@ -27,9 +28,10 @@ type PaginatedResponse<T> = {
|
|
|
27
28
|
readonly pagination: {
|
|
28
29
|
readonly next_cursor: string | null;
|
|
29
30
|
readonly has_more: boolean;
|
|
31
|
+
readonly limit: number;
|
|
30
32
|
};
|
|
31
33
|
};
|
|
32
|
-
type ErrorType = "validation_error" | "authentication_error" | "authorization_error" | "not_found" | "rate_limit_error" | "conflict" | "internal_error";
|
|
34
|
+
type ErrorType = "validation_error" | "authentication_error" | "authorization_error" | "quota_exceeded" | "not_found" | "rate_limit_error" | "conflict" | "internal_error";
|
|
33
35
|
type ApiErrorBody = {
|
|
34
36
|
readonly error: {
|
|
35
37
|
readonly type: ErrorType;
|
|
@@ -46,7 +48,8 @@ type EmailRecipient = {
|
|
|
46
48
|
readonly address: string;
|
|
47
49
|
readonly name?: string | null | undefined;
|
|
48
50
|
};
|
|
49
|
-
|
|
51
|
+
type EmailRecipientInput = EmailRecipient | string;
|
|
52
|
+
declare const WEBHOOK_EVENT_TYPES: readonly ["message.received", "message.sent", "message.delivered", "message.bounced", "message.complained", "domain.verified", "domain.verification_failed", "domain.degraded", "org.reputation_warning", "org.sending_throttled", "org.sending_suspended", "org.reputation_recovered"];
|
|
50
53
|
type WebhookEventType = (typeof WEBHOOK_EVENT_TYPES)[number];
|
|
51
54
|
type StatusResponse = {
|
|
52
55
|
readonly status: string;
|
|
@@ -54,22 +57,39 @@ type StatusResponse = {
|
|
|
54
57
|
readonly time: string;
|
|
55
58
|
readonly request_id: string;
|
|
56
59
|
};
|
|
60
|
+
declare const DOMAIN_STATUSES: readonly ["pending", "verifying", "verified", "degraded", "failed"];
|
|
61
|
+
type DomainStatus = (typeof DOMAIN_STATUSES)[number];
|
|
62
|
+
declare const MESSAGE_STATUSES: readonly ["queued", "sent", "delivered", "bounced", "complained", "failed"];
|
|
63
|
+
type MessageStatus = (typeof MESSAGE_STATUSES)[number];
|
|
64
|
+
declare const MESSAGE_SOURCES: readonly ["api", "dashboard", "inbound", "smtp"];
|
|
65
|
+
type MessageSource = (typeof MESSAGE_SOURCES)[number];
|
|
66
|
+
declare const WEBHOOK_DELIVERY_STATUSES: readonly ["pending", "delivered", "failed"];
|
|
67
|
+
type WebhookDeliveryStatus = (typeof WEBHOOK_DELIVERY_STATUSES)[number];
|
|
68
|
+
type MethodOptions = {
|
|
69
|
+
readonly timeout?: number | undefined;
|
|
70
|
+
readonly signal?: AbortSignal | undefined;
|
|
71
|
+
readonly headers?: Record<string, string> | undefined;
|
|
72
|
+
readonly idempotencyKey?: string | undefined;
|
|
73
|
+
};
|
|
57
74
|
|
|
58
75
|
type Domain = {
|
|
76
|
+
readonly object: "domain";
|
|
59
77
|
readonly id: string;
|
|
60
78
|
readonly name: string;
|
|
61
|
-
readonly status:
|
|
79
|
+
readonly status: DomainStatus;
|
|
80
|
+
readonly managed_by: "external" | "namecom";
|
|
62
81
|
readonly dns_provider: string | null;
|
|
63
|
-
readonly ownership_verified: boolean;
|
|
64
82
|
readonly mx_verified: boolean;
|
|
65
83
|
readonly spf_verified: boolean;
|
|
66
84
|
readonly dkim_verified: boolean;
|
|
67
85
|
readonly dmarc_verified: boolean;
|
|
68
|
-
readonly
|
|
86
|
+
readonly dmarc_managed_externally: boolean;
|
|
87
|
+
readonly outbound_verified: boolean;
|
|
69
88
|
readonly catch_all_mailbox_id: string | null;
|
|
70
89
|
readonly verified_at: string | null;
|
|
71
90
|
readonly created_at: string;
|
|
72
91
|
readonly updated_at: string;
|
|
92
|
+
readonly registration?: DomainRegistrationInfo | undefined;
|
|
73
93
|
};
|
|
74
94
|
type CreateDomainParams = {
|
|
75
95
|
readonly name: string;
|
|
@@ -81,35 +101,87 @@ type ListDomainsParams = PaginationParams;
|
|
|
81
101
|
type DomainVerificationResult = {
|
|
82
102
|
readonly all_verified: boolean;
|
|
83
103
|
readonly records: {
|
|
84
|
-
readonly ownership: boolean;
|
|
85
104
|
readonly mx: boolean;
|
|
86
105
|
readonly spf: boolean;
|
|
87
106
|
readonly dkim: boolean;
|
|
88
107
|
readonly dmarc: boolean;
|
|
89
108
|
};
|
|
90
|
-
readonly
|
|
91
|
-
readonly
|
|
109
|
+
readonly outbound_verified: boolean;
|
|
110
|
+
readonly outbound_error: boolean;
|
|
92
111
|
readonly existing_spf: string | null;
|
|
93
112
|
readonly suggested_spf: string | null;
|
|
94
113
|
readonly conflicting_mx: readonly string[];
|
|
114
|
+
readonly dmarc_valid: boolean;
|
|
115
|
+
readonly dmarc_exact_match: boolean;
|
|
116
|
+
readonly dmarc_record_value: string | null;
|
|
117
|
+
readonly dmarc_managed_externally: boolean;
|
|
118
|
+
};
|
|
119
|
+
type DomainSearchResult = {
|
|
120
|
+
readonly domain_name: string;
|
|
121
|
+
readonly available: boolean;
|
|
122
|
+
readonly purchase_price: number | null;
|
|
123
|
+
readonly renewal_price: number | null;
|
|
124
|
+
readonly currency: string;
|
|
125
|
+
readonly premium: boolean;
|
|
126
|
+
};
|
|
127
|
+
type SearchDomainsParams = {
|
|
128
|
+
readonly keyword: string;
|
|
129
|
+
};
|
|
130
|
+
type RegistrationContact = {
|
|
131
|
+
readonly first_name: string;
|
|
132
|
+
readonly last_name: string;
|
|
133
|
+
readonly address1: string;
|
|
134
|
+
readonly address2?: string | undefined;
|
|
135
|
+
readonly city: string;
|
|
136
|
+
readonly state?: string | undefined;
|
|
137
|
+
readonly zip: string;
|
|
138
|
+
readonly country: string;
|
|
139
|
+
readonly phone: string;
|
|
140
|
+
readonly email: string;
|
|
141
|
+
};
|
|
142
|
+
type RegisterDomainParams = {
|
|
143
|
+
readonly name: string;
|
|
144
|
+
readonly years?: number | undefined;
|
|
145
|
+
readonly contact: RegistrationContact;
|
|
146
|
+
};
|
|
147
|
+
type DomainRegistrationInfo = {
|
|
148
|
+
readonly expires_at: string;
|
|
149
|
+
readonly auto_renew: boolean;
|
|
150
|
+
readonly renewal_price: number;
|
|
151
|
+
readonly privacy_enabled: boolean;
|
|
152
|
+
readonly currency: string;
|
|
153
|
+
readonly registered_at: string;
|
|
95
154
|
};
|
|
96
155
|
|
|
97
156
|
declare class Domains extends ApiResource {
|
|
98
|
-
create(params: CreateDomainParams): Promise<Domain>;
|
|
99
|
-
list(params?: ListDomainsParams): Promise<PaginatedResponse<Domain>>;
|
|
157
|
+
create(params: CreateDomainParams, options?: MethodOptions): Promise<Domain>;
|
|
158
|
+
list(params?: ListDomainsParams, options?: MethodOptions): Promise<PaginatedResponse<Domain>>;
|
|
100
159
|
listAutoPaginating(params?: Omit<ListDomainsParams, "cursor">): Page<Domain>;
|
|
101
|
-
get(id: string): Promise<Domain>;
|
|
102
|
-
update(id: string, params: UpdateDomainParams): Promise<Domain>;
|
|
103
|
-
delete(id: string): Promise<void>;
|
|
104
|
-
verify(id: string): Promise<DomainVerificationResult>;
|
|
160
|
+
get(id: string, options?: MethodOptions): Promise<Domain>;
|
|
161
|
+
update(id: string, params: UpdateDomainParams, options?: MethodOptions): Promise<Domain>;
|
|
162
|
+
delete(id: string, options?: MethodOptions): Promise<void>;
|
|
163
|
+
verify(id: string, options?: MethodOptions): Promise<DomainVerificationResult>;
|
|
164
|
+
search(params: SearchDomainsParams, options?: MethodOptions): Promise<{
|
|
165
|
+
readonly results: readonly DomainSearchResult[];
|
|
166
|
+
}>;
|
|
167
|
+
register(params: RegisterDomainParams, options?: MethodOptions): Promise<Domain>;
|
|
105
168
|
}
|
|
106
169
|
|
|
170
|
+
type AutoReply = {
|
|
171
|
+
readonly enabled: boolean;
|
|
172
|
+
readonly subject: string | null;
|
|
173
|
+
readonly body: string | null;
|
|
174
|
+
readonly from_date: string | null;
|
|
175
|
+
readonly to_date: string | null;
|
|
176
|
+
};
|
|
107
177
|
type Mailbox = {
|
|
178
|
+
readonly object: "mailbox";
|
|
108
179
|
readonly id: string;
|
|
109
180
|
readonly domain_id: string;
|
|
110
181
|
readonly address: string;
|
|
111
182
|
readonly display_name: string | null;
|
|
112
|
-
readonly
|
|
183
|
+
readonly suspended_at: string | null;
|
|
184
|
+
readonly auto_reply: AutoReply;
|
|
113
185
|
readonly created_at: string;
|
|
114
186
|
readonly updated_at: string;
|
|
115
187
|
};
|
|
@@ -124,50 +196,109 @@ type UpdateMailboxParams = {
|
|
|
124
196
|
type ListMailboxesParams = PaginationParams & {
|
|
125
197
|
readonly domain_id?: string | undefined;
|
|
126
198
|
};
|
|
127
|
-
type
|
|
128
|
-
readonly
|
|
199
|
+
type UpdateAutoReplyParams = {
|
|
200
|
+
readonly enabled: boolean;
|
|
201
|
+
readonly subject?: string | null | undefined;
|
|
202
|
+
readonly body?: string | null | undefined;
|
|
203
|
+
readonly from_date?: string | null | undefined;
|
|
204
|
+
readonly to_date?: string | null | undefined;
|
|
129
205
|
};
|
|
130
206
|
|
|
131
207
|
declare class Mailboxes extends ApiResource {
|
|
132
|
-
create(params: CreateMailboxParams): Promise<Mailbox>;
|
|
133
|
-
list(params?: ListMailboxesParams): Promise<PaginatedResponse<Mailbox>>;
|
|
208
|
+
create(params: CreateMailboxParams, options?: MethodOptions): Promise<Mailbox>;
|
|
209
|
+
list(params?: ListMailboxesParams, options?: MethodOptions): Promise<PaginatedResponse<Mailbox>>;
|
|
134
210
|
listAutoPaginating(params?: Omit<ListMailboxesParams, "cursor">): Page<Mailbox>;
|
|
135
|
-
get(id: string): Promise<Mailbox>;
|
|
136
|
-
update(id: string, params: UpdateMailboxParams): Promise<Mailbox>;
|
|
137
|
-
delete(id: string): Promise<void>;
|
|
138
|
-
|
|
139
|
-
deleteAvatar(id: string): Promise<void>;
|
|
211
|
+
get(id: string, options?: MethodOptions): Promise<Mailbox>;
|
|
212
|
+
update(id: string, params: UpdateMailboxParams, options?: MethodOptions): Promise<Mailbox>;
|
|
213
|
+
delete(id: string, options?: MethodOptions): Promise<void>;
|
|
214
|
+
updateAutoReply(id: string, params: UpdateAutoReplyParams, options?: MethodOptions): Promise<Mailbox>;
|
|
140
215
|
}
|
|
141
216
|
|
|
142
217
|
type Message = {
|
|
218
|
+
readonly object: "message";
|
|
143
219
|
readonly id: string;
|
|
144
220
|
readonly mailbox_id: string;
|
|
145
221
|
readonly thread_id: string | null;
|
|
146
|
-
readonly
|
|
147
|
-
readonly
|
|
222
|
+
readonly subject: string | null;
|
|
223
|
+
readonly from_address: string | null;
|
|
224
|
+
readonly to_addresses: readonly {
|
|
225
|
+
readonly address: string;
|
|
226
|
+
readonly name?: string | null;
|
|
227
|
+
}[] | null;
|
|
228
|
+
readonly cc_addresses: readonly {
|
|
229
|
+
readonly address: string;
|
|
230
|
+
readonly name?: string | null;
|
|
231
|
+
}[] | null;
|
|
232
|
+
readonly bcc_addresses: readonly {
|
|
233
|
+
readonly address: string;
|
|
234
|
+
readonly name?: string | null;
|
|
235
|
+
}[] | null;
|
|
236
|
+
readonly attachments: readonly {
|
|
237
|
+
readonly filename: string;
|
|
238
|
+
readonly size: number;
|
|
239
|
+
readonly content_type: string;
|
|
240
|
+
}[] | null;
|
|
241
|
+
readonly source: MessageSource;
|
|
242
|
+
readonly status: MessageStatus;
|
|
148
243
|
readonly created_at: string;
|
|
149
244
|
readonly updated_at: string;
|
|
150
245
|
};
|
|
246
|
+
type Attachment = {
|
|
247
|
+
readonly filename: string;
|
|
248
|
+
readonly content: string;
|
|
249
|
+
readonly content_type?: string | undefined;
|
|
250
|
+
};
|
|
151
251
|
type SendMessageParams = {
|
|
152
|
-
readonly mailbox_id
|
|
153
|
-
readonly
|
|
154
|
-
readonly
|
|
155
|
-
readonly
|
|
156
|
-
readonly
|
|
252
|
+
readonly mailbox_id?: string | undefined;
|
|
253
|
+
readonly from?: string | undefined;
|
|
254
|
+
readonly to: readonly EmailRecipientInput[];
|
|
255
|
+
readonly cc?: readonly EmailRecipientInput[] | undefined;
|
|
256
|
+
readonly bcc?: readonly EmailRecipientInput[] | undefined;
|
|
257
|
+
readonly reply_to?: EmailRecipientInput | undefined;
|
|
157
258
|
readonly subject: string;
|
|
158
|
-
readonly
|
|
159
|
-
readonly
|
|
259
|
+
readonly html?: string | undefined;
|
|
260
|
+
readonly text?: string | undefined;
|
|
160
261
|
readonly in_reply_to?: string | undefined;
|
|
161
262
|
readonly references?: readonly string[] | undefined;
|
|
263
|
+
readonly attachments?: readonly Attachment[] | undefined;
|
|
264
|
+
};
|
|
265
|
+
type ListMessagesParams = PaginationParams & {
|
|
266
|
+
readonly mailbox_id: string;
|
|
267
|
+
};
|
|
268
|
+
type ReplyToMessageParams = {
|
|
269
|
+
readonly html?: string | undefined;
|
|
270
|
+
readonly text?: string | undefined;
|
|
271
|
+
readonly to: readonly EmailRecipientInput[];
|
|
272
|
+
readonly cc?: readonly EmailRecipientInput[] | undefined;
|
|
162
273
|
};
|
|
163
274
|
|
|
164
275
|
declare class Messages extends ApiResource {
|
|
165
|
-
send(params: SendMessageParams): Promise<Message>;
|
|
166
|
-
|
|
276
|
+
send(params: SendMessageParams, options?: MethodOptions): Promise<Message>;
|
|
277
|
+
list(params: ListMessagesParams, options?: MethodOptions): Promise<PaginatedResponse<Message>>;
|
|
278
|
+
listAutoPaginating(params: Omit<ListMessagesParams, "cursor">): Page<Message>;
|
|
279
|
+
get(id: string, options?: MethodOptions): Promise<Message>;
|
|
280
|
+
reply(id: string, params: ReplyToMessageParams, options?: MethodOptions): Promise<Message>;
|
|
167
281
|
}
|
|
168
282
|
|
|
169
283
|
declare class Status extends ApiResource {
|
|
170
|
-
get(): Promise<StatusResponse>;
|
|
284
|
+
get(options?: MethodOptions): Promise<StatusResponse>;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
type Suppression = {
|
|
288
|
+
readonly object: "suppression";
|
|
289
|
+
readonly email_address: string;
|
|
290
|
+
readonly reason: string;
|
|
291
|
+
readonly created_at: string;
|
|
292
|
+
};
|
|
293
|
+
type ListSuppressionsParams = {
|
|
294
|
+
readonly cursor?: string;
|
|
295
|
+
readonly limit?: number;
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
declare class Suppressions extends ApiResource {
|
|
299
|
+
list(params?: ListSuppressionsParams, options?: MethodOptions): Promise<PaginatedResponse<Suppression>>;
|
|
300
|
+
listAutoPaginating(params?: Omit<ListSuppressionsParams, "cursor">): Page<Suppression>;
|
|
301
|
+
remove(email: string, options?: MethodOptions): Promise<void>;
|
|
171
302
|
}
|
|
172
303
|
|
|
173
304
|
type ListThreadsParams = PaginationParams & {
|
|
@@ -175,20 +306,21 @@ type ListThreadsParams = PaginationParams & {
|
|
|
175
306
|
};
|
|
176
307
|
type GetThreadParams = PaginationParams;
|
|
177
308
|
type ReplyToThreadParams = {
|
|
178
|
-
readonly
|
|
179
|
-
readonly
|
|
180
|
-
readonly to?: readonly
|
|
181
|
-
readonly cc?: readonly
|
|
309
|
+
readonly html?: string | undefined;
|
|
310
|
+
readonly text?: string | undefined;
|
|
311
|
+
readonly to?: readonly EmailRecipientInput[] | undefined;
|
|
312
|
+
readonly cc?: readonly EmailRecipientInput[] | undefined;
|
|
182
313
|
};
|
|
183
314
|
|
|
184
315
|
declare class Threads extends ApiResource {
|
|
185
|
-
list(params: ListThreadsParams): Promise<PaginatedResponse<Message>>;
|
|
316
|
+
list(params: ListThreadsParams, options?: MethodOptions): Promise<PaginatedResponse<Message>>;
|
|
186
317
|
listAutoPaginating(params: Omit<ListThreadsParams, "cursor">): Page<Message>;
|
|
187
|
-
get(id: string, params?: GetThreadParams): Promise<PaginatedResponse<Message>>;
|
|
188
|
-
reply(id: string, params: ReplyToThreadParams): Promise<Message>;
|
|
318
|
+
get(id: string, params?: GetThreadParams, options?: MethodOptions): Promise<PaginatedResponse<Message>>;
|
|
319
|
+
reply(id: string, params: ReplyToThreadParams, options?: MethodOptions): Promise<Message>;
|
|
189
320
|
}
|
|
190
321
|
|
|
191
322
|
type Webhook = {
|
|
323
|
+
readonly object: "webhook";
|
|
192
324
|
readonly id: string;
|
|
193
325
|
readonly url: string;
|
|
194
326
|
readonly events: readonly string[];
|
|
@@ -220,10 +352,11 @@ type TestWebhookResponse = {
|
|
|
220
352
|
readonly event_id: string;
|
|
221
353
|
};
|
|
222
354
|
type WebhookDelivery = {
|
|
355
|
+
readonly object: "webhook_delivery";
|
|
223
356
|
readonly id: string;
|
|
224
357
|
readonly event_id: string;
|
|
225
358
|
readonly event_type: string;
|
|
226
|
-
readonly status:
|
|
359
|
+
readonly status: WebhookDeliveryStatus;
|
|
227
360
|
readonly attempts: number;
|
|
228
361
|
readonly last_status_code: number | null;
|
|
229
362
|
readonly last_error: string | null;
|
|
@@ -242,15 +375,15 @@ type WebhookEvent<T = unknown> = {
|
|
|
242
375
|
};
|
|
243
376
|
|
|
244
377
|
declare class Webhooks extends ApiResource {
|
|
245
|
-
create(params: CreateWebhookParams): Promise<WebhookWithSecret>;
|
|
246
|
-
list(params?: ListWebhooksParams): Promise<PaginatedResponse<Webhook>>;
|
|
378
|
+
create(params: CreateWebhookParams, options?: MethodOptions): Promise<WebhookWithSecret>;
|
|
379
|
+
list(params?: ListWebhooksParams, options?: MethodOptions): Promise<PaginatedResponse<Webhook>>;
|
|
247
380
|
listAutoPaginating(params?: Omit<ListWebhooksParams, "cursor">): Page<Webhook>;
|
|
248
|
-
get(id: string): Promise<Webhook>;
|
|
249
|
-
update(id: string, params: UpdateWebhookParams): Promise<Webhook>;
|
|
250
|
-
delete(id: string): Promise<void>;
|
|
251
|
-
rotateSecret(id: string): Promise<RotateSecretResponse>;
|
|
252
|
-
test(id: string): Promise<TestWebhookResponse>;
|
|
253
|
-
listDeliveries(id: string, params?: ListDeliveriesParams): Promise<PaginatedResponse<WebhookDelivery>>;
|
|
381
|
+
get(id: string, options?: MethodOptions): Promise<Webhook>;
|
|
382
|
+
update(id: string, params: UpdateWebhookParams, options?: MethodOptions): Promise<Webhook>;
|
|
383
|
+
delete(id: string, options?: MethodOptions): Promise<void>;
|
|
384
|
+
rotateSecret(id: string, options?: MethodOptions): Promise<RotateSecretResponse>;
|
|
385
|
+
test(id: string, options?: MethodOptions): Promise<TestWebhookResponse>;
|
|
386
|
+
listDeliveries(id: string, params?: ListDeliveriesParams, options?: MethodOptions): Promise<PaginatedResponse<WebhookDelivery>>;
|
|
254
387
|
listDeliveriesAutoPaginating(id: string, params?: Omit<ListDeliveriesParams, "cursor">): Page<WebhookDelivery>;
|
|
255
388
|
}
|
|
256
389
|
|
|
@@ -261,19 +394,29 @@ type RequestOptions = {
|
|
|
261
394
|
readonly query?: Record<string, string | number | boolean | undefined> | undefined;
|
|
262
395
|
readonly rawBody?: ArrayBuffer | undefined;
|
|
263
396
|
readonly contentType?: string | undefined;
|
|
397
|
+
readonly methodOptions?: MethodOptions | undefined;
|
|
264
398
|
};
|
|
399
|
+
/**
|
|
400
|
+
* Client for the ShipMail API. Handles authentication, retries, and resource access.
|
|
401
|
+
*/
|
|
265
402
|
declare class ShipMailClient {
|
|
266
403
|
private readonly apiKey;
|
|
267
404
|
private readonly baseUrl;
|
|
268
405
|
private readonly maxRetries;
|
|
269
406
|
private readonly timeout;
|
|
270
407
|
private readonly fetchFn;
|
|
408
|
+
private readonly defaultHeaders;
|
|
271
409
|
readonly domains: Domains;
|
|
272
410
|
readonly mailboxes: Mailboxes;
|
|
273
411
|
readonly messages: Messages;
|
|
412
|
+
readonly suppressions: Suppressions;
|
|
274
413
|
readonly threads: Threads;
|
|
275
414
|
readonly webhooks: Webhooks;
|
|
276
415
|
readonly status: Status;
|
|
416
|
+
/**
|
|
417
|
+
* Create a new ShipMail client.
|
|
418
|
+
* @param config - API key string or full configuration object.
|
|
419
|
+
*/
|
|
277
420
|
constructor(config: string | ShipMailConfig);
|
|
278
421
|
request<T>(options: RequestOptions): Promise<T>;
|
|
279
422
|
private buildUrl;
|
|
@@ -310,6 +453,9 @@ declare class ValidationError extends ShipMailError {
|
|
|
310
453
|
}[] | undefined;
|
|
311
454
|
});
|
|
312
455
|
}
|
|
456
|
+
declare class QuotaExceededError extends ShipMailError {
|
|
457
|
+
constructor(message: string, requestId?: string);
|
|
458
|
+
}
|
|
313
459
|
declare class NotFoundError extends ShipMailError {
|
|
314
460
|
constructor(message: string, requestId?: string);
|
|
315
461
|
}
|
|
@@ -339,8 +485,12 @@ type WebhookHeaders = {
|
|
|
339
485
|
readonly "x-shipmail-event-id"?: string;
|
|
340
486
|
readonly [key: string]: string | undefined;
|
|
341
487
|
};
|
|
488
|
+
/**
|
|
489
|
+
* Verify an incoming webhook signature. Throws `WebhookVerificationError` on failure.
|
|
490
|
+
* Returns the parsed webhook event on success.
|
|
491
|
+
*/
|
|
342
492
|
declare function verifyWebhook(body: string, headers: WebhookHeaders | Headers, secret: string, options?: {
|
|
343
493
|
readonly toleranceInSeconds?: number | undefined;
|
|
344
|
-
}): WebhookEvent
|
|
494
|
+
}): Promise<WebhookEvent>;
|
|
345
495
|
|
|
346
|
-
export { type ApiErrorBody, AuthenticationError, AuthorizationError, ConflictError, ConnectionError, type CreateDomainParams, type CreateMailboxParams, type CreateWebhookParams, type Domain, type DomainVerificationResult, type EmailRecipient, type ErrorType, type GetThreadParams, InternalServerError, type ListDeliveriesParams, type ListDomainsParams, type ListMailboxesParams, type ListThreadsParams, type ListWebhooksParams, type Message, NotFoundError, Page, type PaginatedResponse, type PaginationParams, RateLimitError, type ReplyToThreadParams, type RotateSecretResponse, type SendMessageParams, ShipMailClient, type ShipMailConfig, ShipMailError, type StatusResponse, type TestWebhookResponse, type
|
|
496
|
+
export { type ApiErrorBody, AuthenticationError, AuthorizationError, ConflictError, ConnectionError, type CreateDomainParams, type CreateMailboxParams, type CreateWebhookParams, DOMAIN_STATUSES, type Domain, type DomainRegistrationInfo, type DomainSearchResult, type DomainStatus, type DomainVerificationResult, type EmailRecipient, type EmailRecipientInput, type ErrorType, type GetThreadParams, InternalServerError, type ListDeliveriesParams, type ListDomainsParams, type ListMailboxesParams, type ListMessagesParams, type ListSuppressionsParams, type ListThreadsParams, type ListWebhooksParams, MESSAGE_SOURCES, MESSAGE_STATUSES, type Mailbox, type Message, type MessageSource, type MessageStatus, type MethodOptions, NotFoundError, Page, type PaginatedResponse, type PaginationParams, QuotaExceededError, RateLimitError, type RegisterDomainParams, type RegistrationContact, type ReplyToMessageParams, type ReplyToThreadParams, type RequestOptions, type RotateSecretResponse, type SearchDomainsParams, type SendMessageParams, ShipMailClient, type ShipMailConfig, ShipMailError, type StatusResponse, type Suppression, type TestWebhookResponse, type UpdateAutoReplyParams, type UpdateDomainParams, type UpdateMailboxParams, 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 };
|