* Set attachments
(attachments)
| 375 | * Set attachments |
| 376 | */ |
| 377 | setAttachments(attachments) { |
| 378 | if (this._doArrayCheck('attachments', attachments)) { |
| 379 | if (!attachments.every(attachment => typeof attachment.content === 'string')) { |
| 380 | throw new Error('Expected each attachment to contain a `content` string'); |
| 381 | } |
| 382 | if (!attachments.every(attachment => typeof attachment.filename === 'string')) { |
| 383 | throw new Error('Expected each attachment to contain a `filename` string'); |
| 384 | } |
| 385 | if (!attachments.every(attachment => !attachment.type || typeof attachment.type === 'string')) { |
| 386 | throw new Error('Expected the attachment\'s `type` field to be a string'); |
| 387 | } |
| 388 | if (!attachments.every(attachment => !attachment.disposition || typeof attachment.disposition === 'string')) { |
| 389 | throw new Error('Expected the attachment\'s `disposition` field to be a string'); |
| 390 | } |
| 391 | this.attachments = attachments; |
| 392 | } |
| 393 | } |
| 394 | |
| 395 | /** |
| 396 | * Add attachment |