UNPKG

mailosaur

Version:

The Mailosaur Node library lets you integrate email and SMS testing into your continuous integration process.

41 lines (33 loc) 978 B
class Files { constructor(client) { this.client = client; } getAttachment(attachmentId) { const self = this; const url = `api/files/attachments/${attachmentId}`; return new Promise((resolve, reject) => { self.client.request.get(url, { buffer: true }, (err, response, body) => ( err ? reject(err) : resolve(body) )); }); } getEmail(messageId) { const self = this; const url = `api/files/email/${messageId}`; return new Promise((resolve, reject) => { self.client.request.get(url, { buffer: true }, (err, response, body) => ( err ? reject(err) : resolve(body) )); }); } getPreview(previewId) { const self = this; const url = `api/files/previews/${previewId}`; return new Promise((resolve, reject) => { self.client.request.get(url, { buffer: true }, (err, response, body) => ( err ? reject(err) : resolve(body) )); }); } } module.exports = Files;