UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

62 lines • 2.28 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SharedQueries = exports.BaseSharedQueries = void 0; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../../core/resource.js"); const path_1 = require("../../../internal/utils/path.js"); var BaseSharedQueries = /* @__PURE__ */ (() => { class BaseSharedQueries extends resource_1.APIResource { /** * Shared queries store the results of a previously run query, allowing you to * share the results with others. * * @example * ```ts * const sharedQuery = * await client.workers.observability.sharedQueries.create({ * account_id: 'account_id', * queryId: 'queryId', * timeframe: { from: 0, to: 0 }, * }); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post((0, path_1.path) `/accounts/${account_id}/workers/observability/shared/query`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Shared queries store the results of a previously run query, allowing you to * share the results with others. * * @example * ```ts * const sharedQuery = * await client.workers.observability.sharedQueries.get( * 'id', * { account_id: 'account_id' }, * ); * ``` */ get(id, params, options) { const { account_id, ...query } = params; return this._client.get((0, path_1.path) `/accounts/${account_id}/workers/observability/shared/query/${id}`, { query, ...options, })._thenUnwrap((obj) => obj.result); } } BaseSharedQueries._key = Object.freeze([ 'workers', 'observability', 'sharedQueries', ]); return BaseSharedQueries; })(); exports.BaseSharedQueries = BaseSharedQueries; class SharedQueries extends BaseSharedQueries { } exports.SharedQueries = SharedQueries; //# sourceMappingURL=shared-queries.js.map