"use strict";
// @ts-nocheck
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
Object.defineProperty(exports, "__esModule", { value: true });
exports.Boxes = void 0;
const resource_js_1 = require("../../core/resource.cjs");
const headers_js_1 = require("../../internal/headers.cjs");
const path_js_1 = require("../../internal/utils/path.cjs");
class Boxes extends resource_js_1.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((0, path_js_1.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((0, path_js_1.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((0, path_js_1.path) `/v2/sandboxes/boxes/${name}`, {
            ...options,
            headers: (0, headers_js_1.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((0, path_js_1.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((0, path_js_1.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((0, path_js_1.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((0, path_js_1.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((0, path_js_1.path) `/v2/sandboxes/boxes/${name}/stop`, {
            ...options,
            headers: (0, headers_js_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
        });
    }
}
exports.Boxes = Boxes;
