update Constructor

This commit is contained in:
Akinmade Bond
2017-03-19 04:32:08 +01:00
parent 3f70f8ae6a
commit 8295ee65d7
2 changed files with 17 additions and 0 deletions
+5
View File
@@ -834,10 +834,15 @@ declare class SparkPost {
constructor(apiKey?: string, options?: SparkPost.ConstructorOptions);
request(options: Request.Options, callback: SparkPost.Callback<any>): void;
request(options: Request.Options): Promise<SparkPost.Response<any>>;
get(options: Request.Options, callback: SparkPost.Callback<any>): void;
get(options: Request.Options): Promise<SparkPost.Response<any>>;
post(options: Request.Options, callback: SparkPost.Callback<any>): void;
post(options: Request.Options): Promise<SparkPost.Response<any>>;
put(options: Request.Options, callback: SparkPost.Callback<any>): void;
put(options: Request.Options): Promise<SparkPost.Response<any>>;
delete(options: Request.Options, callback: SparkPost.Callback<any>): void;
delete(options: Request.Options): Promise<SparkPost.Response<any>>;
}
declare namespace SparkPost {
+12
View File
@@ -3,6 +3,7 @@ import * as SparkPost from "sparkpost";
let key = "YOURAPIKEY";
let client = new SparkPost(key);
// Callback
client.get({
uri: "metrics/domains"
}, function(err, data) {
@@ -14,6 +15,17 @@ client.get({
console.log(data.body);
});
// Promise
client.get({
uri: 'metrics/domains'
})
.then(data => {
console.log(data);
})
.catch(err => {
console.log(err);
});
// Callback
client.inboundDomains.create({ domain: 'example1.com' }, function(err, res) {
if (err) {