UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

69 lines • 2.49 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Tail = exports.BaseTail = 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 BaseTail = /* @__PURE__ */ (() => { class BaseTail extends resource_1.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((0, path_1.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((0, path_1.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((0, path_1.path) `/accounts/${account_id}/workers/scripts/${scriptName}/tails`, options)._thenUnwrap((obj) => obj.result); } } BaseTail._key = Object.freeze([ 'workers', 'scripts', 'tail', ]); return BaseTail; })(); exports.BaseTail = BaseTail; class Tail extends BaseTail { } exports.Tail = Tail; //# sourceMappingURL=tail.js.map