mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
mailgun: Expose namespace members (#29579)
This commit is contained in:
9
types/mailgun-js/index.d.ts
vendored
9
types/mailgun-js/index.d.ts
vendored
@@ -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,
|
||||
|
||||
@@ -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) => {});
|
||||
|
||||
Reference in New Issue
Block a user