UNPKG

anchorbrowser

Version:

The official TypeScript library for the Anchorbrowser API

40 lines 1.67 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../core/resource.mjs"; import { multipartFormRequestOptions } from "../../../internal/uploads.mjs"; import { path } from "../../../internal/utils/path.mjs"; export class Files extends APIResource { /** * List all resources that have been uploaded to the browser session for agent use. * Returns resource metadata including name, size, type, and last modified * timestamp. * * @example * ```ts * const files = await client.sessions.agent.files.list( * '550e8400-e29b-41d4-a716-446655440000', * ); * ``` */ list(sessionID, options) { return this._client.get(path `/v1/sessions/${sessionID}/agent/files`, options); } /** * Upload files as agent resources to a browser session using multipart/form-data. * If you upload a ZIP file, it will be automatically extracted and the files will * be made available as agent resources. If you upload a single file, it will be * saved directly as an agent resource. Resources are then accessible to AI agents * for task completion and automation. * * @example * ```ts * const response = await client.sessions.agent.files.upload( * '550e8400-e29b-41d4-a716-446655440000', * { file: fs.createReadStream('path/to/file') }, * ); * ``` */ upload(sessionID, body, options) { return this._client.post(path `/v1/sessions/${sessionID}/agent/files`, multipartFormRequestOptions({ body, ...options }, this._client)); } } //# sourceMappingURL=files.mjs.map