UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

64 lines • 2.29 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 BaseTail = /* @__PURE__ */ (() => { class BaseTail extends APIResource { /** * Starts a tail that receives logs and exceptions from a Worker. * * @example * ```ts * const tail = await client.workers.scripts.tail.create( * 'this-is_my_script-01', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ create(scriptName, params, options) { const { account_id } = params; return this._client.post(path `/accounts/${account_id}/workers/scripts/${scriptName}/tails`, options)._thenUnwrap((obj) => obj.result); } /** * Deletes a tail from a Worker. * * @example * ```ts * const tail = await client.workers.scripts.tail.delete( * '023e105f4ecef8ad9ca31a8372d0c353', * { * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * script_name: 'this-is_my_script-01', * }, * ); * ``` */ delete(id, params, options) { const { account_id, script_name } = params; return this._client.delete(path `/accounts/${account_id}/workers/scripts/${script_name}/tails/${id}`, options); } /** * Get a list of tails currently deployed on a Worker. * * @example * ```ts * const tail = await client.workers.scripts.tail.get( * 'this-is_my_script-01', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ get(scriptName, params, options) { const { account_id } = params; return this._client.get(path `/accounts/${account_id}/workers/scripts/${scriptName}/tails`, options)._thenUnwrap((obj) => obj.result); } } BaseTail._key = Object.freeze([ 'workers', 'scripts', 'tail', ]); return BaseTail; })(); export class Tail extends BaseTail { } //# sourceMappingURL=tail.mjs.map