mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
update Constructor
This commit is contained in:
Vendored
+5
@@ -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 {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user