UNPKG

anchorbrowser

Version:

The official TypeScript library for the Anchorbrowser API

60 lines 1.99 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../core/resource.mjs"; import { buildHeaders } from "../internal/headers.mjs"; export class Tools extends APIResource { /** * Retrieve the rendered content of a webpage, optionally formatted as Markdown or * HTML. * * @example * ```ts * const response = await client.tools.fetchWebpage(); * ``` */ fetchWebpage(params, options) { const { sessionId, ...body } = params; return this._client.post('/v1/tools/fetch-webpage', { query: { sessionId }, body, ...options, headers: buildHeaders([{ Accept: 'text/plain' }, options?.headers]), }); } /** * Start from a URL and perform the given task. * * @example * ```ts * const response = await client.tools.performWebTask({ * prompt: 'Collect the node names and their CPU average %', * }); * ``` */ performWebTask(params, options) { const { sessionId, ...body } = params; return this._client.post('/v1/tools/perform-web-task', { query: { sessionId }, body, ...options }); } /** * This endpoint captures a screenshot of the specified webpage using Chromium. * Users can customize the viewport dimensions and capture options. * * @example * ```ts * const response = await client.tools.screenshotWebpage(); * * const content = await response.blob(); * console.log(content); * ``` */ screenshotWebpage(params, options) { const { sessionId, ...body } = params; return this._client.post('/v1/tools/screenshot', { query: { sessionId }, body, ...options, headers: buildHeaders([{ Accept: 'image/png' }, options?.headers]), __binaryResponse: true, }); } } //# sourceMappingURL=tools.mjs.map