UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

57 lines • 2.04 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../core/resource.mjs"; import { path } from "../../../internal/utils/path.mjs"; export var BaseSharedQueries = /* @__PURE__ */ (() => { class BaseSharedQueries extends 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(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(path `/accounts/${account_id}/workers/observability/shared/query/${id}`, { query, ...options, })._thenUnwrap((obj) => obj.result); } } BaseSharedQueries._key = Object.freeze([ 'workers', 'observability', 'sharedQueries', ]); return BaseSharedQueries; })(); export class SharedQueries extends BaseSharedQueries { } //# sourceMappingURL=shared-queries.mjs.map