UNPKG

anchorbrowser

Version:

The official TypeScript library for the Anchorbrowser API

64 lines 2.14 kB
"use strict"; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. Object.defineProperty(exports, "__esModule", { value: true }); exports.Tools = void 0; const resource_1 = require("../core/resource.js"); const headers_1 = require("../internal/headers.js"); class Tools extends resource_1.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: (0, headers_1.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: (0, headers_1.buildHeaders)([{ Accept: 'image/png' }, options?.headers]), __binaryResponse: true, }); } } exports.Tools = Tools; //# sourceMappingURL=tools.js.map