cloudflare
Version:
The official TypeScript library for the Cloudflare API
165 lines • 6.09 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Webhooks = exports.BaseWebhooks = void 0;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../core/resource.js");
const path_1 = require("../../internal/utils/path.js");
var BaseWebhooks = /* @__PURE__ */ (() => {
class BaseWebhooks extends resource_1.APIResource {
/**
* Adds a new webhook to an App.
*
* @example
* ```ts
* const response =
* await client.realtimeKit.webhooks.createWebhook(
* '14a396e7-ca44-4937-bf1f-050a69118543',
* {
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* events: [
* 'meeting.started',
* 'meeting.ended',
* 'meeting.participantJoined',
* 'meeting.participantLeft',
* 'meeting.chatSynced',
* 'recording.statusUpdate',
* 'livestreaming.statusUpdate',
* 'meeting.transcript',
* 'meeting.summary',
* ],
* name: 'All events webhook',
* url: 'https://webhook.site/b23a5bbd-c7b0-4ced-a9e2-78ae7889897e',
* },
* );
* ```
*/
createWebhook(appID, params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/realtime/kit/${appID}/webhooks`, {
body,
...options,
});
}
/**
* Removes a webhook for the given webhook ID.
*
* @example
* ```ts
* const response =
* await client.realtimeKit.webhooks.deleteWebhook(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* {
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* app_id: '14a396e7-ca44-4937-bf1f-050a69118543',
* },
* );
* ```
*/
deleteWebhook(webhookID, params, options) {
const { account_id, app_id } = params;
return this._client.delete((0, path_1.path) `/accounts/${account_id}/realtime/kit/${app_id}/webhooks/${webhookID}`, options);
}
/**
* Edits the webhook details for the given webhook ID.
*
* @example
* ```ts
* const response =
* await client.realtimeKit.webhooks.editWebhook(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* {
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* app_id: '14a396e7-ca44-4937-bf1f-050a69118543',
* },
* );
* ```
*/
editWebhook(webhookID, params, options) {
const { account_id, app_id, ...body } = params;
return this._client.patch((0, path_1.path) `/accounts/${account_id}/realtime/kit/${app_id}/webhooks/${webhookID}`, {
body,
...options,
});
}
/**
* Returns webhook details for the given webhook ID.
*
* @example
* ```ts
* const response =
* await client.realtimeKit.webhooks.getWebhookByID(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* {
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* app_id: '14a396e7-ca44-4937-bf1f-050a69118543',
* },
* );
* ```
*/
getWebhookByID(webhookID, params, options) {
const { account_id, app_id } = params;
return this._client.get((0, path_1.path) `/accounts/${account_id}/realtime/kit/${app_id}/webhooks/${webhookID}`, options);
}
/**
* Returns details of all webhooks for an App.
*
* @example
* ```ts
* const response =
* await client.realtimeKit.webhooks.getWebhooks(
* '14a396e7-ca44-4937-bf1f-050a69118543',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
getWebhooks(appID, params, options) {
const { account_id } = params;
return this._client.get((0, path_1.path) `/accounts/${account_id}/realtime/kit/${appID}/webhooks`, options);
}
/**
* Replace all details for the given webhook ID.
*
* @example
* ```ts
* const response =
* await client.realtimeKit.webhooks.replaceWebhook(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* {
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* app_id: '14a396e7-ca44-4937-bf1f-050a69118543',
* events: [
* 'meeting.started',
* 'meeting.ended',
* 'meeting.participantJoined',
* 'meeting.participantLeft',
* 'meeting.chatSynced',
* 'recording.statusUpdate',
* 'livestreaming.statusUpdate',
* 'meeting.transcript',
* 'meeting.summary',
* ],
* name: 'All events webhook',
* url: 'https://webhook.site/b23a5bbd-c7b0-4ced-a9e2-78ae7889897e',
* },
* );
* ```
*/
replaceWebhook(webhookID, params, options) {
const { account_id, app_id, ...body } = params;
return this._client.put((0, path_1.path) `/accounts/${account_id}/realtime/kit/${app_id}/webhooks/${webhookID}`, {
body,
...options,
});
}
}
BaseWebhooks._key = Object.freeze([
'realtimeKit',
'webhooks',
]);
return BaseWebhooks;
})();
exports.BaseWebhooks = BaseWebhooks;
class Webhooks extends BaseWebhooks {
}
exports.Webhooks = Webhooks;
//# sourceMappingURL=webhooks.js.map