mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 23:07:06 +00:00
Add Tests
Add tslint.json file to enable tests. Only Arrow function config is truned off.
This commit is contained in:
Vendored
+64
-10
@@ -3,7 +3,6 @@
|
||||
// Definitions by: Joshua DeVinney <https://github.com/geoffreak>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="request"/>
|
||||
/// <reference types="node"/>
|
||||
|
||||
import * as Request from "request";
|
||||
@@ -820,7 +819,8 @@ declare class SparkPost {
|
||||
/**
|
||||
* List an example of the event data that will be posted by a Webhook for the specified events.
|
||||
*
|
||||
* @param {{ events?: string }} options [event types]{@link https://support.sparkpost.com/customer/portal/articles/1976204} for which to get a sample payload | Default: all event types returned
|
||||
* @param {{ events?: string }} options [event types]{@link https://support.sparkpost.com/customer/portal/articles/1976204} for which to get a sample payload
|
||||
* Default: all event types returned
|
||||
* @returns {Promise<SparkPost.Response<any>>}
|
||||
*/
|
||||
getSamples(options?: { events?: string }): Promise<SparkPost.Response<any>>;
|
||||
@@ -1035,9 +1035,21 @@ declare namespace SparkPost {
|
||||
address: Address | string;
|
||||
}
|
||||
export interface RecipientWithMultichannelAddresses {
|
||||
/** Address information for a recipient. At a minimum, address or multichannel_addresses is required. If both address and multichannel_addresses are specified only multichannel_addresses will be used. */
|
||||
/**
|
||||
* Address information for a recipient. At a minimum, address or multichannel_addresses is required.
|
||||
* If both address and multichannel_addresses are specified only multichannel_addresses will be used.
|
||||
*
|
||||
* @type {(Address | string)}
|
||||
* @memberOf RecipientWithMultichannelAddresses
|
||||
*/
|
||||
address?: Address | string;
|
||||
/** Array of Multichannel Address objects for a recipient. At a minimum, address or multichannel_addresses is required. If both address and multichannel_addresses are specified only multichannel_addresses will be used. */
|
||||
/**
|
||||
* Array of Multichannel Address objects for a recipient. At a minimum, address or multichannel_addresses is required.
|
||||
* If both address and multichannel_addresses are specified only multichannel_addresses will be used.
|
||||
*
|
||||
* @type {MultichannelAddress[]}
|
||||
* @memberOf RecipientWithMultichannelAddresses
|
||||
*/
|
||||
multichannel_addresses: MultichannelAddress[];
|
||||
}
|
||||
export type Recipient = (RecipientWithAddress | RecipientWithMultichannelAddresses) & BaseRecipient;
|
||||
@@ -1420,7 +1432,13 @@ declare namespace SparkPost {
|
||||
text: string;
|
||||
/** Email subject line. */
|
||||
subject: string;
|
||||
/** Address “from” : "deals@company.com" or JSON object composed of the “name” and “email” fields “from” : { “name” : “My Company”, “email” : "deals@company.com" } used to compose the email’s “From” header. */
|
||||
/**
|
||||
* Address "from" : "deals@company.com" or JSON object composed of the "name" and "email" fields.
|
||||
* "from" : { "name" : "My Company", "email" : "deals@company.com" } used to compose the email’s "From" header.
|
||||
*
|
||||
* @type {(Address | string)}
|
||||
* @memberOf TemplateContent
|
||||
*/
|
||||
from: Address | string;
|
||||
/** Email address used to compose the email’s “Reply-To” header. */
|
||||
reply_to?: string;
|
||||
@@ -1435,7 +1453,13 @@ declare namespace SparkPost {
|
||||
text?: string;
|
||||
/** Email subject line. */
|
||||
subject: string;
|
||||
/** Address “from” : "deals@company.com" or JSON object composed of the “name” and “email” fields “from” : { “name” : “My Company”, “email” : "deals@company.com" } used to compose the email’s “From” header. */
|
||||
/**
|
||||
* Address "from" : "deals@company.com" or JSON object composed of the "name" and "email" fields.
|
||||
* "from" : { "name" : "My Company", "email" : "deals@company.com" } used to compose the email’s "From" header.
|
||||
*
|
||||
* @type {(Address | string)}
|
||||
* @memberOf TemplateContent
|
||||
*/
|
||||
from: Address | string;
|
||||
/** Email address used to compose the email’s “Reply-To” header. */
|
||||
reply_to?: string;
|
||||
@@ -1455,7 +1479,15 @@ declare namespace SparkPost {
|
||||
}
|
||||
|
||||
export interface Template {
|
||||
/** Short, unique, alphanumeric ID used to reference the template At a minimum, id or name is required upon creation. It is auto generated if not provided. After a template has been created, this property cannot be changed. Maximum length - 64 bytes */
|
||||
/**
|
||||
* Short, unique, alphanumeric ID used to reference the template.
|
||||
* At a minimum, id or name is required upon creation.
|
||||
* It is auto generated if not provided.
|
||||
* After a template has been created, this property cannot be changed. Maximum length - 64 bytes
|
||||
*
|
||||
* @type {string}
|
||||
* @memberOf Template
|
||||
*/
|
||||
id: string;
|
||||
/** Content that will be used to construct a message yes For a full description, see the Content Attributes. Maximum length - 20 MBs */
|
||||
content: TemplateContent | { email_rfc822: string };
|
||||
@@ -1474,7 +1506,15 @@ declare namespace SparkPost {
|
||||
}
|
||||
|
||||
export interface CreateTemplate {
|
||||
/** Short, unique, alphanumeric ID used to reference the template At a minimum, id or name is required upon creation. It is auto generated if not provided. After a template has been created, this property cannot be changed. Maximum length - 64 bytes */
|
||||
/**
|
||||
* Short, unique, alphanumeric ID used to reference the template.
|
||||
* At a minimum, id or name is required upon creation.
|
||||
* It is auto generated if not provided.
|
||||
* After a template has been created, this property cannot be changed. Maximum length - 64 bytes
|
||||
*
|
||||
* @type {string}
|
||||
* @memberOf CreateTemplate
|
||||
*/
|
||||
id?: string;
|
||||
/** Content that will be used to construct a message yes For a full description, see the Content Attributes. Maximum length - 20 MBs */
|
||||
content: CreateTemplateContent | { email_rfc822: string };
|
||||
@@ -1640,11 +1680,25 @@ declare namespace SparkPost {
|
||||
}
|
||||
|
||||
export interface Attachment {
|
||||
/** The MIME type of the attachment; e.g., “text/plain”, “image/jpeg”, “audio/mp3”, “video/mp4”, “application/msword”, “application/pdf”, etc., including the “charset” parameter (text/html; charset=“UTF-8”) if needed. The value will apply “as-is” to the “Content-Type” header of the generated MIME part for the attachment. */
|
||||
/**
|
||||
* The MIME type of the attachment; e.g., “text/plain”, “image/jpeg”, “audio/mp3”, “video/mp4”, “application/msword”, “application/pdf”, etc.,
|
||||
* including the “charset” parameter (text/html; charset=“UTF-8”) if needed.
|
||||
* The value will apply “as-is” to the “Content-Type” header of the generated MIME part for the attachment.
|
||||
*
|
||||
* @type {string}
|
||||
* @memberOf Attachment
|
||||
*/
|
||||
type: string;
|
||||
/** The filename of the attachment (for example, “document.pdf”). This is inserted into the filename parameter of the Content-Disposition header. */
|
||||
name: string;
|
||||
/** The content of the attachment as a Base64 encoded string. The string should not contain \r\n line breaks. The SparkPost systems will add line breaks as necessary to ensure the Base64 encoded lines contain no more than 76 characters each. */
|
||||
/**
|
||||
* The content of the attachment as a Base64 encoded string.
|
||||
* The string should not contain \r\n line breaks.
|
||||
* The SparkPost systems will add line breaks as necessary to ensure the Base64 encoded lines contain no more than 76 characters each.
|
||||
*
|
||||
* @type {string}
|
||||
* @memberOf Attachment
|
||||
*/
|
||||
data: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -516,8 +516,8 @@ client.relayWebhooks.update('123456789', {
|
||||
client.sendingDomains.create({
|
||||
domain: "example1.com",
|
||||
dkim: {
|
||||
"private": "MIICXgIBAAKBgQC+W6scd3XWwvC/hPRksfDYFi3ztgyS9OSqnnjtNQeDdTSD1DRx/xFar2wjmzxp2+SnJ5pspaF77VZveN3P/HVmXZVghr3asoV9WBx/uW1nDIUxU35L4juXiTwsMAbgMyh3NqIKTNKyMDy4P8vpEhtH1iv/BrwMdBjHDVCycB8WnwIDAQABAoGBAITb3BCRPBi5lGhHdn+1RgC7cjUQEbSb4eFHm+ULRwQ0UIPWHwiVWtptZ09usHq989fKp1g/PfcNzm8c78uTS6gCxfECweFCRK6EdO6cCCr1cfWvmBdSjzYhODUdQeyWZi2ozqd0FhGWoV4VHseh4iLj36DzleTLtOZj3FhAo1WJAkEA68T+KkGeDyWwvttYtuSiQCCTrXYAWTQnkIUxduCp7Ap6tVeIDn3TaXTj74UbEgaNgLhjG4bX//fdeDW6PaK9YwJBAM6xJmwHLPMgwNVjiz3u/6fhY3kaZTWcxtMkXCjh1QE82KzDwqyrCg7EFjTtFysSHCAZxXZMcivGl4TZLHnydJUCQQCx16+M+mAatuiCnvxlQUMuMiSTNK6Amzm45u9v53nlZeY3weYMYFdHdfe1pebMiwrT7MI9clKebz6svYJVmdtXAkApDAc8VuR3WB7TgdRKNWdyGJGfoD1PO1ZE4iinOcoKV+IT1UCY99Kkgg6C7j62n/8T5OpRBvd5eBPpHxP1F9BNAkEA5Nf2VO9lcTetksHdIeKK+F7sio6UZn0Rv7iUo3ALrN1D1cGfWIh2dj3ko1iSreyNVSwGW0ePP27qDmU+u6/Y1g==",
|
||||
"public": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+W6scd3XWwvC/hPRksfDYFi3ztgyS9OSqnnjtNQeDdTSD1DRx/xFar2wjmzxp2+SnJ5pspaF77VZveN3P/HVmXZVghr3asoV9WBx/uW1nDIUxU35L4juXiTwsMAbgMyh3NqIKTNKyMDy4P8vpEhtH1iv/BrwMdBjHDVCycB8WnwIDAQAB",
|
||||
"private": "MIICXgIBAAKBgQC+W6scd3XWwvC/hPRksfDYFi3ztgyS9OSqnnjtNQeDdTSD1DRx/==",
|
||||
"public": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+W6scd3XWwvC/==",
|
||||
selector: "brisbane",
|
||||
headers: "from:to:subject:date"
|
||||
}
|
||||
@@ -534,8 +534,8 @@ client.sendingDomains.create({
|
||||
client.sendingDomains.create({
|
||||
domain: 'example1.com',
|
||||
dkim: {
|
||||
'private': 'MIICXgIBAAKBgQC+W6scd3XWwvC/hPRksfDYFi3ztgyS9OSqnnjtNQeDdTSD1DRx/xFar2wjmzxp2+SnJ5pspaF77VZveN3P/HVmXZVghr3asoV9WBx/uW1nDIUxU35L4juXiTwsMAbgMyh3NqIKTNKyMDy4P8vpEhtH1iv/BrwMdBjHDVCycB8WnwIDAQABAoGBAITb3BCRPBi5lGhHdn+1RgC7cjUQEbSb4eFHm+ULRwQ0UIPWHwiVWtptZ09usHq989fKp1g/PfcNzm8c78uTS6gCxfECweFCRK6EdO6cCCr1cfWvmBdSjzYhODUdQeyWZi2ozqd0FhGWoV4VHseh4iLj36DzleTLtOZj3FhAo1WJAkEA68T+KkGeDyWwvttYtuSiQCCTrXYAWTQnkIUxduCp7Ap6tVeIDn3TaXTj74UbEgaNgLhjG4bX//fdeDW6PaK9YwJBAM6xJmwHLPMgwNVjiz3u/6fhY3kaZTWcxtMkXCjh1QE82KzDwqyrCg7EFjTtFysSHCAZxXZMcivGl4TZLHnydJUCQQCx16+M+mAatuiCnvxlQUMuMiSTNK6Amzm45u9v53nlZeY3weYMYFdHdfe1pebMiwrT7MI9clKebz6svYJVmdtXAkApDAc8VuR3WB7TgdRKNWdyGJGfoD1PO1ZE4iinOcoKV+IT1UCY99Kkgg6C7j62n/8T5OpRBvd5eBPpHxP1F9BNAkEA5Nf2VO9lcTetksHdIeKK+F7sio6UZn0Rv7iUo3ALrN1D1cGfWIh2dj3ko1iSreyNVSwGW0ePP27qDmU+u6/Y1g==',
|
||||
'public': 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+W6scd3XWwvC/hPRksfDYFi3ztgyS9OSqnnjtNQeDdTSD1DRx/xFar2wjmzxp2+SnJ5pspaF77VZveN3P/HVmXZVghr3asoV9WBx/uW1nDIUxU35L4juXiTwsMAbgMyh3NqIKTNKyMDy4P8vpEhtH1iv/BrwMdBjHDVCycB8WnwIDAQAB',
|
||||
'private': 'MIICXgIBAAKBgQC+W6scd3XWwvC/hPRksfDYFi3ztgyS9OSqnnjtNQeDdTSD1DRx/==',
|
||||
'public': 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+W6scd3XWwvC/==',
|
||||
selector: 'brisbane',
|
||||
headers: 'from:to:subject:date'
|
||||
}
|
||||
@@ -615,8 +615,8 @@ client.sendingDomains.get('example1.com')
|
||||
// Callback
|
||||
client.sendingDomains.update('example1.com', {
|
||||
dkim: {
|
||||
"private": "MIICXgIBAAKBgQC+W6scd3XWwvC/hPRksfDYFi3ztgyS9OSqnnjtNQeDdTSD1DRx/xFar2wjmzxp2+SnJ5pspaF77VZveN3P/HVmXZVghr3asoV9WBx/uW1nDIUxU35L4juXiTwsMAbgMyh3NqIKTNKyMDy4P8vpEhtH1iv/BrwMdBjHDVCycB8WnwIDAQABAoGBAITb3BCRPBi5lGhHdn+1RgC7cjUQEbSb4eFHm+ULRwQ0UIPWHwiVWtptZ09usHq989fKp1g/PfcNzm8c78uTS6gCxfECweFCRK6EdO6cCCr1cfWvmBdSjzYhODUdQeyWZi2ozqd0FhGWoV4VHseh4iLj36DzleTLtOZj3FhAo1WJAkEA68T+KkGeDyWwvttYtuSiQCCTrXYAWTQnkIUxduCp7Ap6tVeIDn3TaXTj74UbEgaNgLhjG4bX//fdeDW6PaK9YwJBAM6xJmwHLPMgwNVjiz3u/6fhY3kaZTWcxtMkXCjh1QE82KzDwqyrCg7EFjTtFysSHCAZxXZMcivGl4TZLHnydJUCQQCx16+M+mAatuiCnvxlQUMuMiSTNK6Amzm45u9v53nlZeY3weYMYFdHdfe1pebMiwrT7MI9clKebz6svYJVmdtXAkApDAc8VuR3WB7TgdRKNWdyGJGfoD1PO1ZE4iinOcoKV+IT1UCY99Kkgg6C7j62n/8T5OpRBvd5eBPpHxP1F9BNAkEA5Nf2VO9lcTetksHdIeKK+F7sio6UZn0Rv7iUo3ALrN1D1cGfWIh2dj3ko1iSreyNVSwGW0ePP27qDmU+u6/Y1g==",
|
||||
"public": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+W6scd3XWwvC/hPRksfDYFi3ztgyS9OSqnnjtNQeDdTSD1DRx/xFar2wjmzxp2+SnJ5pspaF77VZveN3P/HVmXZVghr3asoV9WBx/uW1nDIUxU35L4juXiTwsMAbgMyh3NqIKTNKyMDy4P8vpEhtH1iv/BrwMdBjHDVCycB8WnwIDAQAB",
|
||||
"private": "MIICXgIBAAKBgQC+W6scd3XWwvC/hPRksfDYFi3ztgyS9OSqnnjtNQeDdTSD1DRx/Y1g==",
|
||||
"public": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+W6scd3XWwvC/==",
|
||||
selector: "hello_selector",
|
||||
headers: "from:to:subject:date"
|
||||
}
|
||||
@@ -631,8 +631,8 @@ client.sendingDomains.update('example1.com', {
|
||||
|
||||
client.sendingDomains.update('example1.com', {
|
||||
dkim: {
|
||||
'private': 'MIICXgIBAAKBgQC+W6scd3XWwvC/hPRksfDYFi3ztgyS9OSqnnjtNQeDdTSD1DRx/xFar2wjmzxp2+SnJ5pspaF77VZveN3P/HVmXZVghr3asoV9WBx/uW1nDIUxU35L4juXiTwsMAbgMyh3NqIKTNKyMDy4P8vpEhtH1iv/BrwMdBjHDVCycB8WnwIDAQABAoGBAITb3BCRPBi5lGhHdn+1RgC7cjUQEbSb4eFHm+ULRwQ0UIPWHwiVWtptZ09usHq989fKp1g/PfcNzm8c78uTS6gCxfECweFCRK6EdO6cCCr1cfWvmBdSjzYhODUdQeyWZi2ozqd0FhGWoV4VHseh4iLj36DzleTLtOZj3FhAo1WJAkEA68T+KkGeDyWwvttYtuSiQCCTrXYAWTQnkIUxduCp7Ap6tVeIDn3TaXTj74UbEgaNgLhjG4bX//fdeDW6PaK9YwJBAM6xJmwHLPMgwNVjiz3u/6fhY3kaZTWcxtMkXCjh1QE82KzDwqyrCg7EFjTtFysSHCAZxXZMcivGl4TZLHnydJUCQQCx16+M+mAatuiCnvxlQUMuMiSTNK6Amzm45u9v53nlZeY3weYMYFdHdfe1pebMiwrT7MI9clKebz6svYJVmdtXAkApDAc8VuR3WB7TgdRKNWdyGJGfoD1PO1ZE4iinOcoKV+IT1UCY99Kkgg6C7j62n/8T5OpRBvd5eBPpHxP1F9BNAkEA5Nf2VO9lcTetksHdIeKK+F7sio6UZn0Rv7iUo3ALrN1D1cGfWIh2dj3ko1iSreyNVSwGW0ePP27qDmU+u6/Y1g==',
|
||||
'public': 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+W6scd3XWwvC/hPRksfDYFi3ztgyS9OSqnnjtNQeDdTSD1DRx/xFar2wjmzxp2+SnJ5pspaF77VZveN3P/HVmXZVghr3asoV9WBx/uW1nDIUxU35L4juXiTwsMAbgMyh3NqIKTNKyMDy4P8vpEhtH1iv/BrwMdBjHDVCycB8WnwIDAQAB',
|
||||
'private': 'MIICXgIBAAKBgQC+W6scd3XWwvC/hPRksfDYFi3ztgyS9OSqnnjtNQeDdTSD1DRx/Y1g==',
|
||||
'public': 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+W6scd3XWwvC/==',
|
||||
selector: 'hello_selector',
|
||||
headers: 'from:to:subject:date'
|
||||
}
|
||||
@@ -1297,7 +1297,7 @@ client.transmissions.send({
|
||||
"X-Customer-Campaign-ID": "christmas_campaign"
|
||||
},
|
||||
text: "Hi {{address.name}} \nSave big this Christmas in your area {{place}}! \nClick http://www.mysite.com and get huge discount\n Hurry, this offer is only to {{customer_type}}\n {{sender}}",
|
||||
html: "<p>Hi {{address.name}} \nSave big this Christmas in your area {{place}}! \nClick http://www.mysite.com and get huge discount\n</p><p>Hurry, this offer is only to {{customer_type}}\n</p><p>{{sender}}</p>"
|
||||
html: "<p>Hi {{address.name}} \nSave big this Christmas in your area {{place}}! \nClick http://www.mysite.com and get huge discount\n</p>"
|
||||
}
|
||||
}, function(err, res) {
|
||||
if (err) {
|
||||
@@ -1496,7 +1496,7 @@ client.transmissions.send({
|
||||
'X-Customer-Campaign-ID': 'christmas_campaign'
|
||||
},
|
||||
text: 'Hi {{address.name}} \nSave big this Christmas in your area {{place}}! \nClick http://www.mysite.com and get huge discount\n Hurry, this offer is only to {{customer_type}}\n {{sender}}',
|
||||
html: '<p>Hi {{address.name}} \nSave big this Christmas in your area {{place}}! \nClick http://www.mysite.com and get huge discount\n</p><p>Hurry, this offer is only to {{customer_type}}\n</p><p>{{sender}}</p>'
|
||||
html: '<p>Hi {{address.name}} \nSave big this Christmas in your area {{place}}! \nClick http://www.mysite.com and get huge discount\n</p>'
|
||||
}
|
||||
})
|
||||
.then(data => {
|
||||
@@ -1767,7 +1767,7 @@ client.webhooks.update('TEST_WEBHOOK_UUID', {
|
||||
});
|
||||
|
||||
// Callback
|
||||
client.webhooks.validate('TEST_WEBHOOK_UUID',{
|
||||
client.webhooks.validate('TEST_WEBHOOK_UUID', {
|
||||
message: {
|
||||
msys: {}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
@@ -19,4 +19,4 @@
|
||||
"index.d.ts",
|
||||
"sparkpost-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../tslint.json",
|
||||
"rules": {
|
||||
"only-arrow-functions-2": [
|
||||
false
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user