cloudflare
Version:
The official TypeScript library for the Cloudflare API
57 lines • 1.86 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../resource.mjs";
export class Tail extends APIResource {
/**
* Starts a tail that receives logs and exception from a Worker.
*
* @example
* ```ts
* const tail = await client.workers.scripts.tail.create(
* 'this-is_my_script-01',
* {
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* body: {},
* },
* );
* ```
*/
create(scriptName, params, options) {
const { account_id, body } = params;
return this._client.post(`/accounts/${account_id}/workers/scripts/${scriptName}/tails`, {
body: body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Deletes a tail from a Worker.
*
* @example
* ```ts
* const tail = await client.workers.scripts.tail.delete(
* 'this-is_my_script-01',
* '023e105f4ecef8ad9ca31a8372d0c353',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
delete(scriptName, id, params, options) {
const { account_id } = params;
return this._client.delete(`/accounts/${account_id}/workers/scripts/${scriptName}/tails/${id}`, options);
}
/**
* Get 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(`/accounts/${account_id}/workers/scripts/${scriptName}/tails`, options)._thenUnwrap((obj) => obj.result);
}
}
//# sourceMappingURL=tail.mjs.map