UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

113 lines • 4 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 BaseTelemetry = /* @__PURE__ */ (() => { class BaseTelemetry extends APIResource { /** * List all the keys in your telemetry events. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const telemetryKeysResponse of client.workers.observability.telemetry.keys( * { account_id: 'account_id' }, * )) { * // ... * } * ``` */ keys(params, options) { const { account_id, ...body } = params; return this._client.getAPIList(path `/accounts/${account_id}/workers/observability/telemetry/keys`, (SinglePage), { body, method: 'post', ...options }); } /** * Prepare websocket server for live tail. * * @example * ```ts * const response = * await client.workers.observability.telemetry.liveTail({ * account_id: 'account_id', * }); * ``` */ liveTail(params, options) { const { account_id, ...body } = params; return this._client.post(path `/accounts/${account_id}/workers/observability/telemetry/live-tail`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Notify live tail that user is still eligible to receive live events. * * @example * ```ts * const response = * await client.workers.observability.telemetry.liveTailHeartbeat( * { account_id: 'account_id' }, * ); * ``` */ liveTailHeartbeat(params, options) { const { account_id, ...body } = params; return this._client.post(path `/accounts/${account_id}/workers/observability/telemetry/live-tail/heartbeat`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Run a temporary or saved query. * * @example * ```ts * const response = * await client.workers.observability.telemetry.query({ * account_id: 'account_id', * queryId: 'queryId', * timeframe: { from: 0, to: 0 }, * }); * ``` */ query(params, options) { const { account_id, ...body } = params; return this._client.post(path `/accounts/${account_id}/workers/observability/telemetry/query`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * List unique values found in your events. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const telemetryValuesResponse of client.workers.observability.telemetry.values( * { * account_id: 'account_id', * datasets: ['string'], * key: 'key', * timeframe: { from: 0, to: 0 }, * type: 'string', * }, * )) { * // ... * } * ``` */ values(params, options) { const { account_id, ...body } = params; return this._client.getAPIList(path `/accounts/${account_id}/workers/observability/telemetry/values`, (SinglePage), { body, method: 'post', ...options }); } } BaseTelemetry._key = Object.freeze([ 'workers', 'observability', 'telemetry', ]); return BaseTelemetry; })(); export class Telemetry extends BaseTelemetry { } //# sourceMappingURL=telemetry.mjs.map