// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../core/resource'; import * as BrowsersAPI from './browsers/browsers'; import { ProfilesOffsetPagination } from './browsers/browsers'; import { APIPromise } from '../core/api-promise'; import { OffsetPagination, type OffsetPaginationParams, PagePromise } from '../core/pagination'; import { buildHeaders } from '../internal/headers'; import { RequestOptions } from '../internal/request-options'; import { path } from '../internal/utils/path'; /** * Create, list, retrieve, and delete browser profiles. */ export class Profiles extends APIResource { /** * Create a browser profile that can be used to load state into future browser * sessions. */ create(body: ProfileCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/profiles', { body, ...options }); } /** * Retrieve details for a single profile by its ID or name. */ retrieve(idOrName: string, options?: RequestOptions): APIPromise { return this._client.get(path`/profiles/${idOrName}`, options); } /** * List profiles with optional filtering and pagination. */ list( query: ProfileListParams | null | undefined = {}, options?: RequestOptions, ): PagePromise { return this._client.getAPIList('/profiles', OffsetPagination, { query, ...options }); } /** * Delete a profile by its ID or by its name. */ delete(idOrName: string, options?: RequestOptions): APIPromise { return this._client.delete(path`/profiles/${idOrName}`, { ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } /** * Returns a zstd-compressed tar file of the full user-data directory. */ download(idOrName: string, options?: RequestOptions): APIPromise { return this._client.get(path`/profiles/${idOrName}/download`, { ...options, headers: buildHeaders([{ Accept: 'application/octet-stream' }, options?.headers]), __binaryResponse: true, }); } } export interface ProfileCreateParams { /** * Optional name of the profile. Must be unique within the project. */ name?: string; } export interface ProfileListParams extends OffsetPaginationParams { /** * Search profiles by name or ID. */ query?: string; } export declare namespace Profiles { export { type ProfileCreateParams as ProfileCreateParams, type ProfileListParams as ProfileListParams }; } export { type ProfilesOffsetPagination };