mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
update inboundDomains
This commit is contained in:
Vendored
+40
-6
@@ -16,25 +16,48 @@ declare class SparkPost {
|
||||
* List all your inbound domains.
|
||||
* @param callback The request callback with Domain results array
|
||||
*/
|
||||
all(callback: SparkPost.ResultsCallback<SparkPost.Domain[]>): void;
|
||||
list(callback: SparkPost.ResultsCallback<SparkPost.Domain[]>): void;
|
||||
/**
|
||||
* List all your inbound domains.
|
||||
* @returns Promise The Domain results array
|
||||
*/
|
||||
list(): SparkPost.ResultsPromise<SparkPost.Domain[]>;
|
||||
/**
|
||||
* Retrieve an inbound domain by specifying its domain name in the URI path.
|
||||
* @param domain Domain name
|
||||
* @param callback The request callback with Domain results
|
||||
*/
|
||||
find(domain: string, callback: SparkPost.ResultsCallback<SparkPost.Domain>): void;
|
||||
get(domain: string, callback: SparkPost.ResultsCallback<SparkPost.Domain>): void;
|
||||
/**
|
||||
* Retrieve an inbound domain by specifying its domain name in the URI path.
|
||||
* @param domain Domain name
|
||||
* @returns Promise The Domain results
|
||||
*/
|
||||
get(domain: string): SparkPost.ResultsPromise<SparkPost.Domain>;
|
||||
/**
|
||||
* Create an inbound domain by providing an inbound domains object as the POST request body.
|
||||
* @param domain Domain name
|
||||
* @param createOpts a hash of [inbound domain attributes]{@link https://developers.sparkpost.com/api/inbound-domains#header-inbound-domains-attributes}
|
||||
* @param callback The request callback
|
||||
*/
|
||||
create(domain: string, callback: SparkPost.Callback<void>): void;
|
||||
create(createOpts: SparkPost.CreateOpts, callback: SparkPost.Callback<void>): void;
|
||||
/**
|
||||
* Create an inbound domain by providing an inbound domains object as the POST request body.
|
||||
* @param createOpts a hash of [inbound domain attributes]{@link https://developers.sparkpost.com/api/inbound-domains#header-inbound-domains-attributes}
|
||||
* @returns Promise void
|
||||
*/
|
||||
create(createOpts: SparkPost.CreateOpts): Promise<void>;
|
||||
/**
|
||||
* Delete an inbound domain by specifying its domain name in the URI path.
|
||||
* @param domain Domain name
|
||||
* @param callback The request callback
|
||||
*/
|
||||
delete(domain: string, callback: SparkPost.Callback<void>): void;
|
||||
/**
|
||||
* Delete an inbound domain by specifying its domain name in the URI path.
|
||||
* @param domain Domain name
|
||||
* @returns Promise void
|
||||
*/
|
||||
delete(domain: string): Promise<void>;
|
||||
};
|
||||
/** The Message Events API provides the means to search the raw events generated by SparkPost. */
|
||||
messageEvents: {
|
||||
@@ -167,7 +190,7 @@ declare class SparkPost {
|
||||
*/
|
||||
all(callback: SparkPost.ResultsCallback<SparkPost.SubaccountInformation[]>): void;
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param subaccountId The webhook id
|
||||
* @param callback The request callback with subaccount information results
|
||||
*/
|
||||
@@ -343,7 +366,7 @@ declare class SparkPost {
|
||||
}[]>): void;
|
||||
/**
|
||||
* Lists descriptions of the events, event types, and event fields that could be included in a Webhooks post to your target URL.
|
||||
* @param callback The request callback containing documentation results
|
||||
* @param callback The request callback containing documentation results
|
||||
*/
|
||||
getDocumentation(callback: SparkPost.ResultsCallback<any>): void;
|
||||
/**
|
||||
@@ -405,6 +428,7 @@ declare namespace SparkPost {
|
||||
(err: Error | SparkPostError | null, res: Response<T>): void;
|
||||
}
|
||||
export type ResultsCallback<T> = Callback<{ results: T }>;
|
||||
export type ResultsPromise<T> = Promise<{ results: T }>;
|
||||
|
||||
export interface Domain {
|
||||
domain: string;
|
||||
@@ -1061,6 +1085,16 @@ declare namespace SparkPost {
|
||||
method: string[];
|
||||
}[];
|
||||
}
|
||||
|
||||
export interface CreateOpts {
|
||||
/**
|
||||
* Domain (or subdomain) name for which SparkPost will receive inbound emails
|
||||
*
|
||||
* @type {string}
|
||||
* @memberOf CreateOpts
|
||||
*/
|
||||
domain: string;
|
||||
}
|
||||
}
|
||||
|
||||
export = SparkPost;
|
||||
|
||||
@@ -14,7 +14,8 @@ client.get({
|
||||
console.log(data.body);
|
||||
});
|
||||
|
||||
client.inboundDomains.create("example1.com", function(err, res) {
|
||||
// Callback
|
||||
client.inboundDomains.create({ domain: 'example1.com' }, function(err, res) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
} else {
|
||||
@@ -23,6 +24,18 @@ client.inboundDomains.create("example1.com", function(err, res) {
|
||||
}
|
||||
});
|
||||
|
||||
// Promise
|
||||
client.inboundDomains.create({ domain: 'example1.com' })
|
||||
.then(data => {
|
||||
console.log('Congrats you can use our client library!');
|
||||
console.log(data);
|
||||
})
|
||||
.catch(err => {
|
||||
console.log('Whoops! Something went wrong');
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
// Callback
|
||||
client.inboundDomains.delete("example1.com", function(err, res) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
@@ -32,7 +45,19 @@ client.inboundDomains.delete("example1.com", function(err, res) {
|
||||
}
|
||||
});
|
||||
|
||||
client.inboundDomains.find("example1.com", function(err, res) {
|
||||
// Promise
|
||||
client.inboundDomains.delete('example1.com')
|
||||
.then(data => {
|
||||
console.log('Congrats you can use our client library!');
|
||||
console.log(data);
|
||||
})
|
||||
.catch(err => {
|
||||
console.log('Whoops! Something went wrong');
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
// Callback
|
||||
client.inboundDomains.get("example1.com", function(err, res) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
} else {
|
||||
@@ -41,7 +66,19 @@ client.inboundDomains.find("example1.com", function(err, res) {
|
||||
}
|
||||
});
|
||||
|
||||
client.inboundDomains.all(function(err, res) {
|
||||
// Promise
|
||||
client.inboundDomains.get('example1.com')
|
||||
.then(data => {
|
||||
console.log('Congrats you can use our client library!');
|
||||
console.log(data);
|
||||
})
|
||||
.catch(err => {
|
||||
console.log('Whoops! Something went wrong');
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
// Callback
|
||||
client.inboundDomains.list(function(err, res) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
} else {
|
||||
@@ -50,6 +87,17 @@ client.inboundDomains.all(function(err, res) {
|
||||
}
|
||||
});
|
||||
|
||||
// Promise
|
||||
client.inboundDomains.list()
|
||||
.then(data => {
|
||||
console.log('Congrats you can use our client library!');
|
||||
console.log(data);
|
||||
})
|
||||
.catch(err => {
|
||||
console.log('Whoops! Something went wrong');
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
client.messageEvents.search({}, function(err, res) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
|
||||
Reference in New Issue
Block a user