UNPKG

@crowdin/crowdin-api-client

Version:
54 lines (53 loc) 2.1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.OrganizationWebhooks = void 0; const core_1 = require("../core"); /** * Webhooks allow you to collect information about events that happen in your Crowdin account. * * You can select the request type, content type, and add a custom payload, which allows you to create integrations with other systems on your own. */ class OrganizationWebhooks extends core_1.CrowdinApi { /** * @param options optional pagination parameters for the request * @see https://developer.crowdin.com/api/v2/#operation/api.webhooks.getMany */ listWebhooks(options) { const url = `${this.url}/webhooks`; return this.getList(url, options === null || options === void 0 ? void 0 : options.limit, options === null || options === void 0 ? void 0 : options.offset); } /** * @param request request body * @see https://developer.crowdin.com/api/v2/#operation/api.webhooks.post */ addWebhook(request) { const url = `${this.url}/webhooks`; return this.post(url, request, this.defaultConfig()); } /** * @param webhookId webhook identifier * @see https://developer.crowdin.com/api/v2/#operation/api.webhooks.get */ getWebhook(webhookId) { const url = `${this.url}/webhooks/${webhookId}`; return this.get(url, this.defaultConfig()); } /** * @param webhookId webhook identifier * @see https://developer.crowdin.com/api/v2/#operation/api.webhooks.delete */ deleteWebhook(webhookId) { const url = `${this.url}/webhooks/${webhookId}`; return this.delete(url, this.defaultConfig()); } /** * @param webhookId webhook identifier * @param request request body * @see https://developer.crowdin.com/api/v2/#operation/api.webhooks.patch */ editWebhook(webhookId, request) { const url = `${this.url}/webhooks/${webhookId}`; return this.patch(url, request, this.defaultConfig()); } } exports.OrganizationWebhooks = OrganizationWebhooks;