cloudflare
Version:
The official TypeScript library for the Cloudflare API
57 lines • 2.02 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../core/resource.mjs";
import { path } from "../../internal/utils/path.mjs";
export var BaseWebhooks = /* @__PURE__ */ (() => {
class BaseWebhooks extends APIResource {
/**
* Create a webhook for notifications about on-demand video uploads.
*
* @example
* ```ts
* const webhook = await client.stream.webhooks.update({
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
update(params, options) {
const { account_id, ...body } = params;
return this._client.put(path `/accounts/${account_id}/stream/webhook`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Deletes the on-demand video webhook.
*
* @example
* ```ts
* const webhook = await client.stream.webhooks.delete({
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
delete(params, options) {
const { account_id } = params;
return this._client.delete(path `/accounts/${account_id}/stream/webhook`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Retrieve current on-demand webhook information.
*
* @example
* ```ts
* const webhook = await client.stream.webhooks.get({
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
get(params, options) {
const { account_id } = params;
return this._client.get(path `/accounts/${account_id}/stream/webhook`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseWebhooks._key = Object.freeze([
'stream',
'webhooks',
]);
return BaseWebhooks;
})();
export class Webhooks extends BaseWebhooks {
}
//# sourceMappingURL=webhooks.mjs.map