mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
[mailgun-js] add testMode and testModeLogger to Mailgun constr… (#36542)
* add testMode and testModeLogger to Mailgun constructor for version 0.22.0 * increase typescript version to match form-data as new dependency * remove patch version in definitions * revert of the formatting changes * cleanup formatting
This commit is contained in:
committed by
Ryan Cavanaugh
parent
faf2054aa9
commit
75b0473d21
Vendored
+20
-3
@@ -1,12 +1,15 @@
|
||||
// Type definitions for mailgun-js 0.16
|
||||
// Type definitions for mailgun-js 0.22
|
||||
// Project: https://github.com/bojand/mailgun-js
|
||||
// Definitions by: Sampson Oliver <https://github.com/sampsonjoliver>
|
||||
// Andi Pätzold <https://github.com/andipaetzold>
|
||||
// Jiri Balcar <https://github.com/JiriBalcar>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import * as FormData from 'form-data';
|
||||
|
||||
declare const Mailgun: Mailgun.MailgunExport;
|
||||
export = Mailgun;
|
||||
|
||||
@@ -28,6 +31,20 @@ declare namespace Mailgun {
|
||||
interval: number;
|
||||
};
|
||||
proxy?: string;
|
||||
testMode?: boolean;
|
||||
testModeLogger?: (httpOptions: LoggerHttpOptions, payload: string, form: FormData) => void;
|
||||
}
|
||||
|
||||
interface LoggerHttpOptions {
|
||||
hostname: string;
|
||||
port: number;
|
||||
protocol: string;
|
||||
path: string;
|
||||
method: string;
|
||||
headers: any;
|
||||
auth: string;
|
||||
agent: false;
|
||||
timeout: number;
|
||||
}
|
||||
|
||||
interface Error {
|
||||
@@ -88,7 +105,7 @@ declare namespace Mailgun {
|
||||
}
|
||||
|
||||
interface BatchData extends SendData {
|
||||
"recipient-variables"?: BatchSendRecipientVars;
|
||||
'recipient-variables'?: BatchSendRecipientVars;
|
||||
}
|
||||
|
||||
interface BatchSendRecipientVars {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import * as mailgunFactory from "mailgun-js";
|
||||
import mailgunFactory2 = require('mailgun-js');
|
||||
|
||||
import * as FormData from 'form-data';
|
||||
|
||||
const mailgun = new mailgunFactory({
|
||||
apiKey: "auth.api_key",
|
||||
domain: "auth.domain"
|
||||
@@ -11,6 +13,17 @@ const mailgun2 = new mailgunFactory2({
|
||||
domain: "auth.domain"
|
||||
});
|
||||
|
||||
const logger = (httpOptions: mailgunFactory.LoggerHttpOptions, payload: string, form: FormData) => {};
|
||||
|
||||
const mailgun3 = new mailgunFactory2({
|
||||
apiKey: 'auth.api_key',
|
||||
domain: 'auth.domain',
|
||||
|
||||
testMode: true,
|
||||
|
||||
testModeLogger: logger,
|
||||
});
|
||||
|
||||
mailgun.messages().send(
|
||||
{
|
||||
to: "fixture.message.to"
|
||||
|
||||
Reference in New Issue
Block a user