@jesseditson/dnsimple
Version:
A Node.JS client for the DNSimple API.
69 lines (68 loc) • 2.46 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.Webhooks = void 0;
class Webhooks {
constructor(_client) {
this._client = _client;
/**
* List the webhooks in the account.
*
* GET /{account}/webhooks
*
* @see https://developer.dnsimple.com/v2/webhooks/webhooks/#listWebhooks
*
* @param account The account id
* @param params Query parameters
* @param params.sort Sort results. Default sorting is by name ascending.
*/
this.listWebhooks = (() => {
const method = (account, params = {}) => this._client.request("GET", `/${account}/webhooks`, null, params);
return method;
})();
/**
* Registers a webhook endpoint.
*
* POST /{account}/webhooks
*
* @see https://developer.dnsimple.com/v2/webhooks/webhooks/#createWebhook
*
* @param account The account id
* @param params Query parameters
*/
this.createWebhook = (() => {
const method = (account, data, params = {}) => this._client.request("POST", `/${account}/webhooks`, data, params);
return method;
})();
/**
* Retrieves the details of a registered webhook.
*
* GET /{account}/webhooks/{webhook}
*
* @see https://developer.dnsimple.com/v2/webhooks/webhooks/#getWebhook
*
* @param account The account id
* @param webhook The webhoook id
* @param params Query parameters
*/
this.getWebhook = (() => {
const method = (account, webhook, params = {}) => this._client.request("GET", `/${account}/webhooks/${webhook}`, null, params);
return method;
})();
/**
* De-registers a webhook endpoint.
*
* DELETE /{account}/webhooks/{webhook}
*
* @see https://developer.dnsimple.com/v2/webhooks/webhooks/#deleteWebhook
*
* @param account The account id
* @param webhook The webhoook id
* @param params Query parameters
*/
this.deleteWebhook = (() => {
const method = (account, webhook, params = {}) => this._client.request("DELETE", `/${account}/webhooks/${webhook}`, null, params);
return method;
})();
}
}
exports.Webhooks = Webhooks;
;