UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

103 lines • 3.64 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../core/resource.mjs"; import { SinglePage } from "../../../core/pagination.mjs"; import { path } from "../../../internal/utils/path.mjs"; export var BaseDestinations = /* @__PURE__ */ (() => { class BaseDestinations extends APIResource { /** * Create a new Workers Observability Telemetry Destination. * * @example * ```ts * const destination = * await client.workers.observability.destinations.create({ * account_id: 'account_id', * configuration: { * headers: { foo: 'string' }, * logpushDataset: 'opentelemetry-traces', * type: 'logpush', * url: 'url', * }, * enabled: true, * name: 'name', * }); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post(path `/accounts/${account_id}/workers/observability/destinations`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Update an existing Workers Observability Telemetry Destination. * * @example * ```ts * const destination = * await client.workers.observability.destinations.update( * 'slug', * { * account_id: 'account_id', * configuration: { * headers: { foo: 'string' }, * type: 'logpush', * url: 'url', * }, * enabled: true, * }, * ); * ``` */ update(slug, params, options) { const { account_id, ...body } = params; return this._client.patch(path `/accounts/${account_id}/workers/observability/destinations/${slug}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * List your Workers Observability Telemetry Destinations. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const destinationListResponse of client.workers.observability.destinations.list( * { account_id: 'account_id' }, * )) { * // ... * } * ``` */ list(params, options) { const { account_id, ...query } = params; return this._client.getAPIList(path `/accounts/${account_id}/workers/observability/destinations`, (SinglePage), { query, ...options }); } /** * Delete a Workers Observability Telemetry Destination. * * @example * ```ts * const destination = * await client.workers.observability.destinations.delete( * 'slug', * { account_id: 'account_id' }, * ); * ``` */ delete(slug, params, options) { const { account_id } = params; return this._client.delete(path `/accounts/${account_id}/workers/observability/destinations/${slug}`, options)._thenUnwrap((obj) => obj.result); } } BaseDestinations._key = Object.freeze([ 'workers', 'observability', 'destinations', ]); return BaseDestinations; })(); export class Destinations extends BaseDestinations { } //# sourceMappingURL=destinations.mjs.map