// @ts-nocheck
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../core/resource.js';
import { buildHeaders } from '../../internal/headers.js';
import { path } from '../../internal/utils/path.js';
export class Boxes extends APIResource {
    /**
     * Create a new sandbox from a snapshot. Provide at most one of `snapshot_id` or
     * `snapshot_name`; if neither is provided, the server uses the default snapshot.
     */
    create(body, options) {
        return this._client.post('/v2/sandboxes/boxes', { body, ...options });
    }
    /**
     * Retrieve a sandbox by name. Stale provisioning sandboxes are auto-failed.
     */
    retrieve(name, options) {
        return this._client.get(path `/v2/sandboxes/boxes/${name}`, options);
    }
    /**
     * Update a sandbox's display name. The name must be unique within the tenant.
     */
    update(name, body, options) {
        return this._client.patch(path `/v2/sandboxes/boxes/${name}`, { body, ...options });
    }
    /**
     * List sandboxes for the authenticated tenant, with optional filtering, sorting,
     * and pagination.
     */
    list(query = {}, options) {
        return this._client.get('/v2/sandboxes/boxes', { query, ...options });
    }
    /**
     * Delete a sandbox by name or UUID. Tears down the sandbox runtime and removes the
     * DB record.
     */
    delete(name, options) {
        return this._client.delete(path `/v2/sandboxes/boxes/${name}`, {
            ...options,
            headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
        });
    }
    /**
     * Create a snapshot by capturing the current state of a sandbox or promoting an
     * existing checkpoint.
     */
    createSnapshot(name, body, options) {
        return this._client.post(path `/v2/sandboxes/boxes/${name}/snapshot`, { body, ...options });
    }
    /**
     * Create a short-lived JWT for accessing an HTTP service running on a specific
     * port inside a sandbox. Returns a browser_url (sets auth cookie via redirect), a
     * service_url (for use with the X-Langsmith-Sandbox-Service-Token header), the raw
     * token, and its expiry.
     */
    generateServiceURL(name, body, options) {
        return this._client.post(path `/v2/sandboxes/boxes/${name}/service-url`, { body, ...options });
    }
    /**
     * Retrieve the lightweight status of a sandbox for polling.
     */
    getStatus(name, options) {
        return this._client.get(path `/v2/sandboxes/boxes/${name}/status`, options);
    }
    /**
     * Start a stopped or failed sandbox. This endpoint is not idempotent.
     */
    start(name, options) {
        return this._client.post(path `/v2/sandboxes/boxes/${name}/start`, options);
    }
    /**
     * Stop a ready sandbox. This endpoint is not idempotent; the filesystem is
     * preserved for later restart.
     */
    stop(name, options) {
        return this._client.post(path `/v2/sandboxes/boxes/${name}/stop`, {
            ...options,
            headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
        });
    }
}
