mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
update relayWebhooks
This commit is contained in:
Vendored
+33
-4
@@ -175,31 +175,60 @@ declare class SparkPost {
|
||||
* List all your relay webhooks.
|
||||
* @param callback The request callback with RelayWebhook results array
|
||||
*/
|
||||
all(callback: SparkPost.ResultsCallback<SparkPost.RelayWebhook[]>): void;
|
||||
list(callback: SparkPost.ResultsCallback<SparkPost.RelayWebhook[]>): void;
|
||||
/**
|
||||
* List all your relay webhooks.
|
||||
* @returns Promise The RelayWebhook results array
|
||||
*/
|
||||
list(): SparkPost.ResultsPromise<SparkPost.RelayWebhook[]>;
|
||||
/**
|
||||
* Delete a relay webhook by specifying the webhook ID in the URI path.
|
||||
* @param relayWebhookId The webhook id
|
||||
* @param callback The request callback with RelayWebhook results
|
||||
*/
|
||||
find(relayWebhookId: string, callback: SparkPost.ResultsCallback<SparkPost.RelayWebhook>): void;
|
||||
get(relayWebhookId: string, callback: SparkPost.ResultsCallback<SparkPost.RelayWebhook>): void;
|
||||
/**
|
||||
* Delete a relay webhook by specifying the webhook ID in the URI path.
|
||||
* @param relayWebhookId The webhook id
|
||||
* @returns Promise The RelayWebhook results
|
||||
*/
|
||||
get(relayWebhookId: string): SparkPost.ResultsPromise<SparkPost.RelayWebhook>;
|
||||
/**
|
||||
* Create a relay webhook by providing a relay webhooks object as the POST request body.
|
||||
* @param options The create options
|
||||
* @param callback The request callback with webhook id results
|
||||
*/
|
||||
create(options: SparkPost.RelayWebhook, callback: SparkPost.ResultsCallback<{ id: string }>): void;
|
||||
/**
|
||||
* Create a relay webhook by providing a relay webhooks object as the POST request body.
|
||||
* @param options The create options
|
||||
* @returns Promise The webhook id results
|
||||
*/
|
||||
create(options: SparkPost.RelayWebhook): SparkPost.ResultsPromise<{ id: string }>;
|
||||
/**
|
||||
* Update a relay webhook by specifying the webhook ID in the URI path.
|
||||
* @param options The update options
|
||||
* @param callback The request callback with webhook id results
|
||||
*/
|
||||
update(options: SparkPost.UpdateRelayWebhook & { relayWebhookId: string }, callback: SparkPost.ResultsCallback<{ id: string }>): void;
|
||||
update(id: string, options: SparkPost.UpdateRelayWebhook, callback: SparkPost.ResultsCallback<{ id: string }>): void;
|
||||
/**
|
||||
* Update a relay webhook by specifying the webhook ID in the URI path.
|
||||
* @param options The update options
|
||||
* @returns Promise The webhook id results
|
||||
*/
|
||||
update(id: string, options: SparkPost.UpdateRelayWebhook): SparkPost.ResultsPromise<{ id: string }>;
|
||||
/**
|
||||
* Delete a relay webhook by specifying the webhook ID in the URI path.
|
||||
* @param relayWebhookId The webhook id
|
||||
* @param callback The request callback
|
||||
*/
|
||||
delete(relayWebhookId: string, callback: SparkPost.Callback<void>): void;
|
||||
/**
|
||||
* Delete a relay webhook by specifying the webhook ID in the URI path.
|
||||
* @param relayWebhookId The webhook id
|
||||
* @returns Promise void
|
||||
*/
|
||||
delete(relayWebhookId: string): Promise<void>;
|
||||
};
|
||||
sendingDomains: {
|
||||
/**
|
||||
@@ -688,7 +717,7 @@ declare namespace SparkPost {
|
||||
/** User-friendly name no example: Inbound Customer Replies */
|
||||
name?: string;
|
||||
/** URL of the target to which to POST relay batches */
|
||||
target?: string;
|
||||
target: string;
|
||||
/** Authentication token to present in the X-MessageSystems-Webhook-Token header of POST requests to target */
|
||||
auth_token?: string;
|
||||
/** Restrict which inbound messages will be relayed to the target */
|
||||
|
||||
@@ -380,6 +380,7 @@ client.recipientLists.update('EXISTING_TEST_ID', {
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
// Callback
|
||||
client.relayWebhooks.create({
|
||||
name: "Test Relay Webhook",
|
||||
target: "http://client.test.com/test-webhook",
|
||||
@@ -395,6 +396,24 @@ client.relayWebhooks.create({
|
||||
}
|
||||
});
|
||||
|
||||
// Promise
|
||||
client.relayWebhooks.create({
|
||||
name: 'Test Relay Webhook',
|
||||
target: 'http://client.test.com/test-webhook',
|
||||
match: {
|
||||
domain: 'inbound.example.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.relayWebhooks.delete("123456789", function(err, res) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
@@ -404,7 +423,19 @@ client.relayWebhooks.delete("123456789", function(err, res) {
|
||||
}
|
||||
});
|
||||
|
||||
client.relayWebhooks.find("123456789", function(err, res) {
|
||||
// Promise
|
||||
client.relayWebhooks.delete('123456789')
|
||||
.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.relayWebhooks.get('123456789', function(err, res) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
} else {
|
||||
@@ -413,7 +444,18 @@ client.relayWebhooks.find("123456789", function(err, res) {
|
||||
}
|
||||
});
|
||||
|
||||
client.relayWebhooks.all(function(err, res) {
|
||||
// Promise
|
||||
client.relayWebhooks.get('123456789')
|
||||
.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.relayWebhooks.list(function(err, res) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
} else {
|
||||
@@ -422,8 +464,19 @@ client.relayWebhooks.all(function(err, res) {
|
||||
}
|
||||
});
|
||||
|
||||
client.relayWebhooks.update({
|
||||
relayWebhookId: "123456789",
|
||||
// Promise
|
||||
client.relayWebhooks.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);
|
||||
});
|
||||
|
||||
// Callback
|
||||
client.relayWebhooks.update('123456789', {
|
||||
target: "http://client.test.com/test-webhook"
|
||||
}, function(err, res) {
|
||||
if (err) {
|
||||
@@ -434,6 +487,19 @@ client.relayWebhooks.update({
|
||||
}
|
||||
});
|
||||
|
||||
// Promise
|
||||
client.relayWebhooks.update('123456789', {
|
||||
target: 'http://client.test.com/test-webhook'
|
||||
})
|
||||
.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.sendingDomains.create({
|
||||
domain: "example1.com",
|
||||
dkim: {
|
||||
|
||||
Reference in New Issue
Block a user