mailgun: Expose namespace members (#29579)

This commit is contained in:
Andy
2018-10-09 21:23:07 -07:00
committed by GitHub
parent 9158d5c42c
commit 007411ded7
2 changed files with 13 additions and 15 deletions

View File

@@ -6,8 +6,8 @@
/// <reference types="node" />
declare const out: Mailgun.MailgunExport;
export = out;
declare const Mailgun: Mailgun.MailgunExport;
export = Mailgun;
declare namespace Mailgun {
interface ConstructorParams {
@@ -41,8 +41,7 @@ declare namespace Mailgun {
contentType?: string;
}
class Attachment {
constructor(params: AttachmentParams);
interface Attachment {
data: string | Buffer | NodeJS.ReadWriteStream;
filename?: string;
knownLength?: number;
@@ -134,7 +133,7 @@ declare namespace Mailgun {
interface Mailgun {
messages(): Messages;
lists(list: string): Lists;
Attachment: typeof Attachment;
Attachment: new (params: AttachmentParams) => Attachment;
validateWebhook(
bodyTimestamp: number,
bodyToken: string,

View File

@@ -20,13 +20,12 @@ mailgun.messages().send(
}
);
mailgun.messages().send(
{
to: "someone@email.com",
attachment: new mailgun.Attachment({
data: "filepath",
filename: "my_custom_name.png"
})
},
(err, body) => {}
);
const exampleSendData: mailgunFactory.messages.SendData = {
to: "someone@email.com",
attachment: new mailgun.Attachment({
data: "filepath",
filename: "my_custom_name.png"
})
};
mailgun.messages().send(exampleSendData, (err, body) => {});