UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

118 lines • 4.29 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Telemetry = exports.BaseTelemetry = void 0; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../../core/resource.js"); const pagination_1 = require("../../../core/pagination.js"); const path_1 = require("../../../internal/utils/path.js"); var BaseTelemetry = /* @__PURE__ */ (() => { class BaseTelemetry extends resource_1.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((0, path_1.path) `/accounts/${account_id}/workers/observability/telemetry/keys`, (pagination_1.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((0, path_1.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((0, path_1.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((0, path_1.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((0, path_1.path) `/accounts/${account_id}/workers/observability/telemetry/values`, (pagination_1.SinglePage), { body, method: 'post', ...options }); } } BaseTelemetry._key = Object.freeze([ 'workers', 'observability', 'telemetry', ]); return BaseTelemetry; })(); exports.BaseTelemetry = BaseTelemetry; class Telemetry extends BaseTelemetry { } exports.Telemetry = Telemetry; //# sourceMappingURL=telemetry.js.map