UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

52 lines 2.14 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../resource.mjs"; export class EventNotifications extends APIResource { /** * Create event notification rule. */ update(bucketName, queueId, params, options) { const { account_id, jurisdiction, ...body } = params; return this._client.put(`/accounts/${account_id}/event_notifications/r2/${bucketName}/configuration/queues/${queueId}`, { body, ...options, headers: { ...(jurisdiction?.toString() != null ? { 'cf-r2-jurisdiction': jurisdiction?.toString() } : undefined), ...options?.headers, }, })._thenUnwrap((obj) => obj.result); } /** * Delete an event notification rule. **If no body is provided, all rules for * specified queue will be deleted**. */ delete(bucketName, queueId, params, options) { const { account_id, jurisdiction } = params; return this._client.delete(`/accounts/${account_id}/event_notifications/r2/${bucketName}/configuration/queues/${queueId}`, { ...options, headers: { ...(jurisdiction?.toString() != null ? { 'cf-r2-jurisdiction': jurisdiction?.toString() } : undefined), ...options?.headers, }, })._thenUnwrap((obj) => obj.result); } /** * List all event notification rules for a bucket. */ get(bucketName, params, options) { const { account_id, jurisdiction } = params; return this._client.get(`/accounts/${account_id}/event_notifications/r2/${bucketName}/configuration`, { ...options, headers: { ...(jurisdiction?.toString() != null ? { 'cf-r2-jurisdiction': jurisdiction?.toString() } : undefined), ...options?.headers, }, })._thenUnwrap((obj) => obj.result); } } //# sourceMappingURL=event-notifications.mjs.map