mailisk 2.2.4 → 2.4.0

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 CHANGED
@@ -5,6 +5,7 @@ Mailisk is an end-to-end email and SMS testing platform. It allows you to receiv
5
5
  - Get a unique subdomain and unlimited email addresses for free.
6
6
  - Easily automate E2E password reset and account verification by catching emails.
7
7
  - Receive SMS messages and automate SMS tests.
8
+ - Generate TOTP authenticator codes and manage saved TOTP devices.
8
9
  - Virtual SMTP and SMS support to test without 3rd party clients.
9
10
 
10
11
  ## Get started
@@ -214,3 +215,105 @@ await mailisk.sendVirtualSms({
214
215
  body: "Test message",
215
216
  });
216
217
  ```
218
+
219
+ ## Client functions (TOTP)
220
+
221
+ TOTP methods call the Mailisk API to generate codes and manage saved authenticator devices. The client does not generate TOTP codes locally.
222
+
223
+ These endpoints require an organisation API key, prefixed with `sk_org_`.
224
+
225
+ ### `listTotpDevices(params?)`
226
+
227
+ List active saved TOTP devices.
228
+
229
+ ```js
230
+ const devices = await mailisk.listTotpDevices({
231
+ limit: 20,
232
+ offset: 0,
233
+ issuer: "GitHub",
234
+ username: "qa@example.com",
235
+ });
236
+ ```
237
+
238
+ ### `createTotpDevice(params)`
239
+
240
+ Create a saved TOTP device from a Base32 shared secret using default settings: 6 digits, 30 second period, and SHA1.
241
+
242
+ ```js
243
+ const device = await mailisk.createTotpDevice({
244
+ name: "GitHub staging",
245
+ shared_secret: "JBSWY3DPEHPK3PXP",
246
+ expires_at: "2026-06-01T12:00:00.000Z",
247
+ });
248
+ ```
249
+
250
+ ### `createCustomTotpDevice(params)`
251
+
252
+ Create a saved TOTP device with custom settings.
253
+
254
+ ```js
255
+ const device = await mailisk.createCustomTotpDevice({
256
+ name: "GitHub staging",
257
+ secret: "JBSWY3DPEHPK3PXP",
258
+ username: "qa@example.com",
259
+ issuer: "GitHub",
260
+ digits: 6,
261
+ period: 30,
262
+ algorithm: "SHA1",
263
+ });
264
+ ```
265
+
266
+ ### `createTotpDeviceFromBase32SecretKey(params)`
267
+
268
+ Create a saved TOTP device from a Base32 secret key.
269
+
270
+ ```js
271
+ const device = await mailisk.createTotpDeviceFromBase32SecretKey({
272
+ base32_secret_key: "JBSWY3DPEHPK3PXP",
273
+ username: "qa@example.com",
274
+ issuer: "GitHub",
275
+ });
276
+ ```
277
+
278
+ ### `createTotpDeviceFromOtpAuthUrl(params)`
279
+
280
+ Create a saved TOTP device from an `otpauth://totp/...` URL.
281
+
282
+ ```js
283
+ const device = await mailisk.createTotpDeviceFromOtpAuthUrl({
284
+ otp_auth_url: "otpauth://totp/GitHub:qa@example.com?secret=JBSWY3DPEHPK3PXP&issuer=GitHub",
285
+ });
286
+ ```
287
+
288
+ ### `getTotpOtpBySharedSecret(sharedSecret, params?)`
289
+
290
+ Generate a TOTP code from a shared secret without saving a device.
291
+ Pass `min_seconds_until_expire` to wait for the next TOTP period when the current code has fewer seconds left.
292
+
293
+ ```js
294
+ const otp = await mailisk.getTotpOtpBySharedSecret("JBSWY3DPEHPK3PXP", {
295
+ min_seconds_until_expire: 10,
296
+ });
297
+
298
+ console.log(otp.code);
299
+ console.log(otp.expires);
300
+ ```
301
+
302
+ ### `getTotpOtpByDeviceId(deviceId, params?)`
303
+
304
+ Generate a TOTP code for a saved device.
305
+ Pass `min_seconds_until_expire` to wait for the next TOTP period when the current code has fewer seconds left.
306
+
307
+ ```js
308
+ const otp = await mailisk.getTotpOtpByDeviceId(device.id, {
309
+ min_seconds_until_expire: 10,
310
+ });
311
+ ```
312
+
313
+ ### `deleteTotpDevice(deviceId)`
314
+
315
+ Delete a saved TOTP device.
316
+
317
+ ```js
318
+ await mailisk.deleteTotpDevice(device.id);
319
+ ```
@@ -0,0 +1,544 @@
1
+ import { AxiosBasicCredentials, AxiosRequestConfig } from 'axios';
2
+ import { Attachment } from 'nodemailer/lib/mailer';
3
+
4
+ interface EmailAddress {
5
+ /** Email address */
6
+ address: string;
7
+ /** Display name, if one is specified */
8
+ name?: string;
9
+ }
10
+ interface EmailAttachment {
11
+ /** Unique identifier for the attachment */
12
+ id: string;
13
+ /** Filename of the attachment */
14
+ filename: string;
15
+ /** Content type of the attachment */
16
+ content_type: string;
17
+ /** Size in bytes of the attachment */
18
+ size: number;
19
+ }
20
+ interface Email {
21
+ /** Namespace scoped ID */
22
+ id: string;
23
+ /** Sender of email */
24
+ from: EmailAddress;
25
+ /** Recepients of email */
26
+ to: EmailAddress[];
27
+ /** Carbon-copied recipients for email message */
28
+ cc?: EmailAddress[];
29
+ /** Blind carbon-copied recipients for email message */
30
+ bcc?: EmailAddress[];
31
+ /** Subject of email */
32
+ subject?: string;
33
+ /** Email content that was sent in HTML format */
34
+ html?: string;
35
+ /** Email content that was sent in plain text format */
36
+ text?: string;
37
+ /** The datetime that this email was received */
38
+ received_date: Date;
39
+ /** The unix timestamp (s) that this email was received */
40
+ received_timestamp: number;
41
+ /** The unix timestamp (s) when this email will be deleted */
42
+ expires_timestamp: number;
43
+ /** The spam score as reported by SpamAssassin */
44
+ spam_score?: number;
45
+ /** The headers of the email */
46
+ headers?: Record<string, string>;
47
+ /** The attachments of the email */
48
+ attachments?: EmailAttachment[];
49
+ }
50
+ interface SmsMessage {
51
+ /** Unique identifier for the message */
52
+ id: string;
53
+ /** Unique identifier for the SMS phone number */
54
+ sms_phone_number_id: string;
55
+ /** Body of the message */
56
+ body: string;
57
+ /** From number of the message */
58
+ from_number: string;
59
+ /** To number of the message */
60
+ to_number: string;
61
+ /** Provider message ID */
62
+ provider_message_id?: string;
63
+ /** Date and time the message was created */
64
+ created_at: string;
65
+ /** Direction of the message */
66
+ direction: "inbound" | "outbound";
67
+ }
68
+ interface SmsNumber {
69
+ /** Unique identifier for the SMS number */
70
+ id: string;
71
+ /** Unique identifier for the organisation */
72
+ organisation_id: string;
73
+ /** Status of the SMS number */
74
+ status: "requested" | "active" | "disabled";
75
+ /** Country of the SMS number */
76
+ country: string;
77
+ /** SMS Phone number */
78
+ phone_number?: string;
79
+ /** Date and time the SMS number was created */
80
+ created_at: string;
81
+ /** Date and time the SMS number was updated */
82
+ updated_at: string;
83
+ }
84
+ interface SearchInboxParams {
85
+ /**
86
+ * The maximum number of emails that can be returned in this request, used alongside `offset` for pagination.
87
+ */
88
+ limit?: number;
89
+ /**
90
+ * The number of emails to skip/ignore, used alongside `limit` for pagination.
91
+ */
92
+ offset?: number;
93
+ /**
94
+ * Filter emails by starting unix timestamp in seconds.
95
+ */
96
+ from_timestamp?: number;
97
+ /**
98
+ * Filter emails by ending unix timestamp in seconds.
99
+ */
100
+ to_timestamp?: number;
101
+ /**
102
+ * Filter emails by 'to' address. Address must start with this.
103
+ *
104
+ * 'foo' would return for 'foobar@namespace.mailisk.net' but not 'barfoo@namespace.mailisk.net'
105
+ */
106
+ to_addr_prefix?: string;
107
+ /**
108
+ * Filter emails by 'from' address. Address must include this.
109
+ *
110
+ * '@foo' would return for 'a@foo.com', 'b@foo.net'
111
+ */
112
+ from_addr_includes?: string;
113
+ /**
114
+ * Filter emails by subject. This is case insensitive. Subject must include this.
115
+ *
116
+ * 'password' would return for 'Password reset', 'Reset password notification' but not 'Reset'
117
+ */
118
+ subject_includes?: string;
119
+ /**
120
+ * Will keep the request going till at least one email would be returned.
121
+ *
122
+ * Default is `true`
123
+ */
124
+ wait?: boolean;
125
+ }
126
+ interface SearchInboxResponse {
127
+ /**
128
+ * Total number of emails matching query.
129
+ */
130
+ total_count: number;
131
+ /**
132
+ * Parameters that were used for the query
133
+ */
134
+ options: SearchInboxParams;
135
+ /**
136
+ * Emails
137
+ */
138
+ data: Email[];
139
+ }
140
+ interface SmtpSettings {
141
+ data: {
142
+ host: string;
143
+ port: number;
144
+ username: string;
145
+ password: string;
146
+ };
147
+ }
148
+ interface GetAttachmentResponse {
149
+ data: {
150
+ id: string;
151
+ filename: string;
152
+ content_type: string;
153
+ size: number;
154
+ expires_at: string | null;
155
+ download_url: string;
156
+ };
157
+ }
158
+ interface ListNamespacesResponse {
159
+ total_count: number;
160
+ data: {
161
+ id: string;
162
+ namespace: string;
163
+ }[];
164
+ }
165
+ interface SendVirtualEmailParams {
166
+ /** Sender of email */
167
+ from: string;
168
+ /**
169
+ * Recepients of email
170
+ *
171
+ * Must match namespace. E.g. if using namespace 'mynamespace' `to` must be 'something@mynamespace.mailisk.net'.
172
+ */
173
+ to: string;
174
+ /** The subject of the e-mail */
175
+ subject: string;
176
+ /** The plaintext version of the message */
177
+ text?: string | undefined;
178
+ /** The HTML version of the message */
179
+ html?: string | undefined;
180
+ /** Custom headers for the email */
181
+ headers?: Record<string, string>;
182
+ /** Attachments to the email */
183
+ attachments?: Attachment[];
184
+ }
185
+ interface SearchSmsMessagesParams {
186
+ /**
187
+ * The maximum number of SMS messages returned (1-100), used alongside `offset` for pagination.
188
+ */
189
+ limit?: number;
190
+ /**
191
+ * The number of SMS messages to skip/ignore, used alongside `limit` for pagination.
192
+ */
193
+ offset?: number;
194
+ /**
195
+ * Filter messages by body contents (case insensitive).
196
+ */
197
+ body?: string;
198
+ /**
199
+ * Filter messages by sender phone number prefix.
200
+ */
201
+ from_number?: string;
202
+ /**
203
+ * Filter messages created on or after this date.
204
+ * Provide an ISO 8601 timestamp string.
205
+ */
206
+ from_date?: string;
207
+ /**
208
+ * Filter messages created on or before this date.
209
+ * Provide an ISO 8601 timestamp string.
210
+ */
211
+ to_date?: string;
212
+ /**
213
+ * When true, keep the request open until at least one SMS is returned.
214
+ */
215
+ wait?: boolean;
216
+ }
217
+ interface SearchSmsMessagesResponse {
218
+ total_count: number;
219
+ options: SearchSmsMessagesParams;
220
+ data: SmsMessage[];
221
+ }
222
+ interface ListSmsNumbersResponse {
223
+ total_count: number;
224
+ data: SmsNumber[];
225
+ }
226
+ interface SendVirtualSmsParams {
227
+ /** The phone number to send the SMS from */
228
+ from_number: string;
229
+ /** The phone number to send the SMS to */
230
+ to_number: string;
231
+ /** The body of the SMS message */
232
+ body: string;
233
+ }
234
+ type TotpAlgorithm = "SHA1" | "SHA256" | "SHA512";
235
+ type KnownTotpDeviceSource = "shared_secret" | "custom" | "base32_secret_key" | "otpauth_url";
236
+ type TotpDeviceSource = KnownTotpDeviceSource | (string & {});
237
+ interface TotpDevice {
238
+ id: string;
239
+ organisation_id: string;
240
+ name: string;
241
+ username?: string | null;
242
+ issuer?: string | null;
243
+ digits: number;
244
+ period: number;
245
+ algorithm: TotpAlgorithm;
246
+ source: TotpDeviceSource;
247
+ expires_at?: string | null;
248
+ created_at: string;
249
+ updated_at: string;
250
+ }
251
+ interface ListTotpDevicesParams {
252
+ /** The maximum number of saved TOTP devices returned (1-100), used alongside `offset` for pagination. */
253
+ limit?: number;
254
+ /** The number of saved TOTP devices to skip/ignore, used alongside `limit` for pagination. Must be >= 0. */
255
+ offset?: number;
256
+ /** Case-insensitive partial username match. Trimmed before sending. */
257
+ username?: string;
258
+ /** Case-insensitive partial issuer match. Trimmed before sending. */
259
+ issuer?: string;
260
+ }
261
+ interface ListTotpDevicesResponse {
262
+ total_count: number;
263
+ options: ListTotpDevicesParams;
264
+ items: TotpDevice[];
265
+ }
266
+ interface CreateTotpDeviceParams {
267
+ /** Base32 shared secret. Uses default TOTP settings. */
268
+ shared_secret: string;
269
+ /** Optional saved-device display name. Max 120 characters. */
270
+ name?: string;
271
+ /** Future ISO timestamp after which the saved device expires. */
272
+ expires_at?: string;
273
+ }
274
+ interface CreateCustomTotpDeviceParams {
275
+ /** Base32 shared secret. */
276
+ secret: string;
277
+ /** Optional saved-device display name. Max 120 characters. */
278
+ name?: string;
279
+ /** Account label. Max 240 characters. */
280
+ username?: string;
281
+ /** Issuer/app label. Max 240 characters. */
282
+ issuer?: string;
283
+ /** Number of OTP digits. */
284
+ digits?: 6 | 8;
285
+ /** OTP period in seconds. Must be an integer from 10 to 300. */
286
+ period?: number;
287
+ /** Hashing algorithm. */
288
+ algorithm?: TotpAlgorithm;
289
+ /** Future ISO timestamp after which the saved device expires. */
290
+ expires_at?: string;
291
+ }
292
+ interface CreateBase32SecretKeyTotpDeviceParams {
293
+ /** Base32 shared secret key. */
294
+ base32_secret_key: string;
295
+ /** Optional saved-device display name. Max 120 characters. */
296
+ name?: string;
297
+ /** Account label. Max 240 characters. */
298
+ username?: string;
299
+ /** Issuer/app label. Max 240 characters. */
300
+ issuer?: string;
301
+ /** Number of OTP digits. */
302
+ digits?: 6 | 8;
303
+ /** OTP period in seconds. Must be an integer from 10 to 300. */
304
+ period?: number;
305
+ /** Hashing algorithm. */
306
+ algorithm?: TotpAlgorithm;
307
+ /** Future ISO timestamp after which the saved device expires. */
308
+ expires_at?: string;
309
+ }
310
+ interface CreateOtpAuthUrlTotpDeviceParams {
311
+ /** otpauth://totp URL with a secret query parameter. */
312
+ otp_auth_url: string;
313
+ /** Optional saved-device display name. Max 120 characters. */
314
+ name?: string;
315
+ /** Account label, used when missing from the URL label. Max 240 characters. */
316
+ username?: string;
317
+ /** Issuer/app label, used when missing from the URL. Max 240 characters. */
318
+ issuer?: string;
319
+ /** Number of OTP digits, used when missing from the URL. */
320
+ digits?: 6 | 8;
321
+ /** OTP period in seconds, used when missing from the URL. Must be an integer from 10 to 300. */
322
+ period?: number;
323
+ /** Hashing algorithm, used when missing from the URL. */
324
+ algorithm?: TotpAlgorithm;
325
+ /** Future ISO timestamp after which the saved device expires. */
326
+ expires_at?: string;
327
+ }
328
+ interface GetTotpOtpParams {
329
+ /** Minimum number of seconds the returned OTP should remain valid. Must be >= 0 and less than the TOTP period. */
330
+ min_seconds_until_expire?: number;
331
+ }
332
+ interface TotpOtpResponse {
333
+ code: string;
334
+ expires: string;
335
+ }
336
+
337
+ declare class MailiskClient {
338
+ constructor({ apiKey, baseUrl, auth }: {
339
+ apiKey: string;
340
+ baseUrl?: string;
341
+ auth?: AxiosBasicCredentials;
342
+ });
343
+ private readonly axiosInstance;
344
+ /**
345
+ * Search SMS messages sent to a phone number.
346
+ *
347
+ * @example
348
+ * Search for SMS messages sent to a phone number
349
+ * ```typescript
350
+ * const { data: smsMessages } = await client.searchSmsMessages("1234567890");
351
+ * ```
352
+ */
353
+ searchSmsMessages(phoneNumber: string, params?: SearchSmsMessagesParams, config?: AxiosRequestConfig): Promise<SearchSmsMessagesResponse>;
354
+ /**
355
+ * List all SMS phone numbers associated with the current account.
356
+ *
357
+ * @example
358
+ * List all SMS phone numbers
359
+ * ```typescript
360
+ * const { data: smsNumbers } = await client.listSmsNumbers();
361
+ * ```
362
+ */
363
+ listSmsNumbers(): Promise<ListSmsNumbersResponse>;
364
+ sendVirtualSms(params: SendVirtualSmsParams): Promise<void>;
365
+ /**
366
+ * List saved TOTP devices.
367
+ *
368
+ * @example
369
+ * List saved TOTP devices for an issuer and username
370
+ * ```typescript
371
+ * const { items: devices } = await client.listTotpDevices({
372
+ * issuer: "GitHub",
373
+ * username: "qa@example.com",
374
+ * });
375
+ * ```
376
+ */
377
+ listTotpDevices(params?: ListTotpDevicesParams): Promise<ListTotpDevicesResponse>;
378
+ /**
379
+ * Create a saved TOTP device from a Base32 shared secret using default TOTP settings.
380
+ *
381
+ * @example
382
+ * Create a saved TOTP device from a shared secret
383
+ * ```typescript
384
+ * const device = await client.createTotpDevice({
385
+ * name: "GitHub staging",
386
+ * shared_secret: "JBSWY3DPEHPK3PXP",
387
+ * });
388
+ * ```
389
+ */
390
+ createTotpDevice(params: CreateTotpDeviceParams): Promise<TotpDevice>;
391
+ /**
392
+ * Create a saved TOTP device with custom settings.
393
+ *
394
+ * @example
395
+ * Create a saved TOTP device with custom settings
396
+ * ```typescript
397
+ * const device = await client.createCustomTotpDevice({
398
+ * name: "GitHub staging",
399
+ * secret: "JBSWY3DPEHPK3PXP",
400
+ * username: "qa@example.com",
401
+ * issuer: "GitHub",
402
+ * digits: 6,
403
+ * period: 30,
404
+ * algorithm: "SHA1",
405
+ * });
406
+ * ```
407
+ */
408
+ createCustomTotpDevice(params: CreateCustomTotpDeviceParams): Promise<TotpDevice>;
409
+ /**
410
+ * Create a saved TOTP device from a Base32 secret key.
411
+ *
412
+ * @example
413
+ * Create a saved TOTP device from a Base32 secret key
414
+ * ```typescript
415
+ * const device = await client.createTotpDeviceFromBase32SecretKey({
416
+ * base32_secret_key: "JBSWY3DPEHPK3PXP",
417
+ * username: "qa@example.com",
418
+ * issuer: "GitHub",
419
+ * });
420
+ * ```
421
+ */
422
+ createTotpDeviceFromBase32SecretKey(params: CreateBase32SecretKeyTotpDeviceParams): Promise<TotpDevice>;
423
+ /**
424
+ * Create a saved TOTP device from an otpauth://totp URL.
425
+ *
426
+ * @example
427
+ * Create a saved TOTP device from an otpauth URL
428
+ * ```typescript
429
+ * const device = await client.createTotpDeviceFromOtpAuthUrl({
430
+ * otp_auth_url: "otpauth://totp/GitHub:qa@example.com?secret=JBSWY3DPEHPK3PXP&issuer=GitHub",
431
+ * });
432
+ * ```
433
+ */
434
+ createTotpDeviceFromOtpAuthUrl(params: CreateOtpAuthUrlTotpDeviceParams): Promise<TotpDevice>;
435
+ /**
436
+ * Generate a TOTP code from a shared secret without saving a device.
437
+ *
438
+ * @example
439
+ * Generate a TOTP code from a shared secret
440
+ * ```typescript
441
+ * const { code } = await client.getTotpOtpBySharedSecret("JBSWY3DPEHPK3PXP", {
442
+ * min_seconds_until_expire: 10,
443
+ * });
444
+ * ```
445
+ */
446
+ getTotpOtpBySharedSecret(sharedSecret: string, params?: GetTotpOtpParams): Promise<TotpOtpResponse>;
447
+ /**
448
+ * Generate a TOTP code for a saved device.
449
+ *
450
+ * @example
451
+ * Generate a TOTP code for a saved device
452
+ * ```typescript
453
+ * const { code } = await client.getTotpOtpByDeviceId(device.id, {
454
+ * min_seconds_until_expire: 10,
455
+ * });
456
+ * ```
457
+ */
458
+ getTotpOtpByDeviceId(deviceId: string, params?: GetTotpOtpParams): Promise<TotpOtpResponse>;
459
+ /**
460
+ * Delete a saved TOTP device.
461
+ *
462
+ * @example
463
+ * Delete a saved TOTP device
464
+ * ```typescript
465
+ * await client.deleteTotpDevice(device.id);
466
+ * ```
467
+ */
468
+ deleteTotpDevice(deviceId: string): Promise<void>;
469
+ /**
470
+ * List all namespaces that belong to the current account (API key).
471
+ */
472
+ listNamespaces(): Promise<ListNamespacesResponse>;
473
+ /**
474
+ * Send an email using the Virtual SMTP.
475
+ *
476
+ * These emails can only be sent to valid Mailisk namespaces, i.e. emails that end in @mynamespace.mailisk.net
477
+ *
478
+ * @example
479
+ * For example, sending a test email:
480
+ * ```typescript
481
+ * client.sendVirtualEmail(namespace, {
482
+ * from: "test@example.com",
483
+ * to: `john@${namespace}.mailisk.net`,
484
+ * subject: "This is a test",
485
+ * text: "Testing",
486
+ * });
487
+ * ```
488
+ */
489
+ sendVirtualEmail(namespace: string, params: SendVirtualEmailParams): Promise<void>;
490
+ /**
491
+ * Search inbox of a namespace.
492
+ *
493
+ * By default, this calls the api using the `wait` flag. This means the call won't timeout until at least one email is received or 5 minutes pass.
494
+ * It also uses a default `from_timestamp` of **current timestamp - 15 minutes**. This means that older emails will be ignored.
495
+ *
496
+ * Both of these settings can be overriden by passing them in the `params` object.
497
+ *
498
+ * @example
499
+ * Get the latest emails
500
+ * ```typescript
501
+ * const { data: emails } = await client.searchInbox(namespace);
502
+ * ```
503
+ *
504
+ * @example
505
+ * Get the latest emails for a specific email address
506
+ * ```typescript
507
+ * const { data: emails } = await client.searchInbox(namespace, {
508
+ * to_addr_prefix: 'john@mynamespace.mailisk.net'
509
+ * });
510
+ * ```
511
+ *
512
+ * @example
513
+ * Get the last 20 emails in the namespace
514
+ * ```typescript
515
+ * const { data: emails } = await mailisk.searchInbox(namespace, {
516
+ * wait: false,
517
+ * from_timestamp: 0,
518
+ * limit: 20
519
+ * });
520
+ * ```
521
+ */
522
+ searchInbox(namespace: string, params?: SearchInboxParams, config?: AxiosRequestConfig): Promise<SearchInboxResponse>;
523
+ /**
524
+ * Get the SMTP settings for a namespace.
525
+ */
526
+ getSmtpSettings(namespace: string): Promise<SmtpSettings>;
527
+ getAttachment(attachmentId: string): Promise<GetAttachmentResponse>;
528
+ /**
529
+ * Download an attachment from an attachment ID.
530
+ *
531
+ * @example
532
+ * Download an attachment from an email
533
+ * ```typescript
534
+ * const attachment = email.attachments[0];
535
+ * const attachmentBuffer = await client.downloadAttachment(attachment.id);
536
+ *
537
+ * // save to file
538
+ * fs.writeFileSync(attachment.filename, attachmentBuffer);
539
+ * ```
540
+ */
541
+ downloadAttachment(attachmentId: string): Promise<Buffer>;
542
+ }
543
+
544
+ export { type CreateBase32SecretKeyTotpDeviceParams, type CreateCustomTotpDeviceParams, type CreateOtpAuthUrlTotpDeviceParams, type CreateTotpDeviceParams, type Email, type EmailAddress, type EmailAttachment, type GetAttachmentResponse, type GetTotpOtpParams, type KnownTotpDeviceSource, type ListNamespacesResponse, type ListSmsNumbersResponse, type ListTotpDevicesParams, type ListTotpDevicesResponse, MailiskClient, type SearchInboxParams, type SearchInboxResponse, type SearchSmsMessagesParams, type SearchSmsMessagesResponse, type SendVirtualEmailParams, type SendVirtualSmsParams, type SmsMessage, type SmsNumber, type SmtpSettings, type TotpAlgorithm, type TotpDevice, type TotpDeviceSource, type TotpOtpResponse };