mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-25 21:55:49 +08:00
rename smtpapi to match package name on npmjs
This commit is contained in:
39
smtpapi/smtpapi-tests.ts
Normal file
39
smtpapi/smtpapi-tests.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Created from usage code samples from //github.com/sendgrid/smtpapi-nodejs#usage
|
||||
*/
|
||||
|
||||
///<reference path="smtpapi-nodejs.d.ts" />
|
||||
|
||||
import smtpapi = require("smtpapi");
|
||||
var header = new smtpapi();
|
||||
|
||||
header.addTo('you@youremail.com');
|
||||
header.addTo('other@otheremail.com');
|
||||
header.setTos(['you@youremail.com', 'other@otheremail.com']);
|
||||
header.addSubstitution('keep', ['secret']);
|
||||
header.addSubstitution('other', ['one', 'two']);
|
||||
header.setSubstitutions({'keep': ['secret'], 'other': ['one', 'two']});
|
||||
header.addUniqueArg('cat', 'dogs');
|
||||
header.setUniqueArgs({cow: 'chicken'});
|
||||
header.setUniqueArgs({dad: 'proud'});
|
||||
header.addCategory('tactics');
|
||||
header.addCategory('advanced');
|
||||
header.setCategories(['tactics', 'advanced']);
|
||||
header.addSection('-charge-', 'This ship is useless.');
|
||||
header.setSections({'-charge-': 'This ship is useless.', '-other': 'Another section here'});
|
||||
header.addFilter('footer', 'enable', 1);
|
||||
header.addFilter('footer', 'text/html', '<strong>boo</strong>');
|
||||
header.setSendAt(1409348513);
|
||||
header.setSendEachAt([1409348513, 14093485134]);
|
||||
header.addSendEachAt([1409348513]);
|
||||
header.addSendEachAt(14093485134);
|
||||
header.setASMGroupID(123);
|
||||
header.setIpPool("testPool");
|
||||
header.setFilters({
|
||||
'footer': {
|
||||
'setting': {
|
||||
'enable': 1,
|
||||
'text/plain': 'You can haz footers!'
|
||||
}
|
||||
}
|
||||
});
|
||||
64
smtpapi/smtpapi.d.ts
vendored
Normal file
64
smtpapi/smtpapi.d.ts
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
// Type definitions for smtpapi-nodejs v1.2.0
|
||||
// Project: https://github.com/sendgrid/smtpapi-nodejs
|
||||
// Definitions by: Antonio Morales <https://github.com/a-morales>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module SmtpApi {
|
||||
|
||||
interface Header {
|
||||
to: string[];
|
||||
sub: Object;
|
||||
unique_args: Object;
|
||||
category: string[];
|
||||
section: Object;
|
||||
filters: Object;
|
||||
send_at: "" | number;
|
||||
send_each_at: number[];
|
||||
asm_group_id: number;
|
||||
ip_pool: string;
|
||||
}
|
||||
|
||||
interface Constructor {
|
||||
new (): Instance;
|
||||
new (header: Header): Instance;
|
||||
}
|
||||
|
||||
interface Instance {
|
||||
header: Header;
|
||||
version: string;
|
||||
|
||||
jsonObject(): Header;
|
||||
jsonString(): string;
|
||||
|
||||
addTo(to: string): void;
|
||||
addTo(tos: string[]): void;
|
||||
addSubstitution(key: string, val: string): void;
|
||||
addSubstitution(key: string, val: string[]): void;
|
||||
addUniqueArg(key: string, val: string): void;
|
||||
addCategory(cat: string): void;
|
||||
addCategory(cat: string[]): void;
|
||||
addSection(sec: string, val: string): void;
|
||||
addFilter(filter: string, setting:string , val: number): void;
|
||||
addFilter(filter: string, setting:string , val: string): void;
|
||||
addSendEachAt(send_each_at: number): void;
|
||||
addSendEachAt(send_each_at: number[]): void;
|
||||
|
||||
setTos(email: string): void;
|
||||
setTos(emails: string[]): void;
|
||||
setSubstitutions(subs: Object): void;
|
||||
setUniqueArgs(val: Object): void;
|
||||
setCategories(cats: string): void;
|
||||
setCategories(cats: string[]): void;
|
||||
setSections(sec: Object): void;
|
||||
setFilters(filters: Object): void;
|
||||
setSendAt(send_at: number): void;
|
||||
setSendEachAt(send_each_at: number[]): void;
|
||||
setASMGroupID(asm_group_id: number): void;
|
||||
setIpPool(ip_pool: string): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'smtpapi' {
|
||||
var smtp: SmtpApi.Constructor;
|
||||
export = smtp;
|
||||
}
|
||||
Reference in New Issue
Block a user