/* tslint:disable */ /* eslint-disable */ /** * Boat Public API v1 * Public JSON API for creating, operating, prompting, observing, and exposing Boat sandboxes from backend services, CI jobs, hosted workers, and Boat automation products. The v1 reference intentionally documents the developer integration surface only. Dashboard billing actions are not part of v1. * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import * as runtime from '../runtime'; import { type AddEnvironmentRepoRequest, AddEnvironmentRepoRequestFromJSON, AddEnvironmentRepoRequestToJSON, } from '../models/AddEnvironmentRepoRequest'; import { type ApiKeyRevokeResponse, ApiKeyRevokeResponseFromJSON, ApiKeyRevokeResponseToJSON, } from '../models/ApiKeyRevokeResponse'; import { type ApiKeySecretResponse, ApiKeySecretResponseFromJSON, ApiKeySecretResponseToJSON, } from '../models/ApiKeySecretResponse'; import { type ApiKeyUsageResponse, ApiKeyUsageResponseFromJSON, ApiKeyUsageResponseToJSON, } from '../models/ApiKeyUsageResponse'; import { type ApiKeysResponse, ApiKeysResponseFromJSON, ApiKeysResponseToJSON, } from '../models/ApiKeysResponse'; import { type BoxActionResponse, BoxActionResponseFromJSON, BoxActionResponseToJSON, } from '../models/BoxActionResponse'; import { type BoxEnvironmentListResponse, BoxEnvironmentListResponseFromJSON, BoxEnvironmentListResponseToJSON, } from '../models/BoxEnvironmentListResponse'; import { type BoxEnvironmentResponse, BoxEnvironmentResponseFromJSON, BoxEnvironmentResponseToJSON, } from '../models/BoxEnvironmentResponse'; import { type BoxInfoResponse, BoxInfoResponseFromJSON, BoxInfoResponseToJSON, } from '../models/BoxInfoResponse'; import { type BoxListResponse, BoxListResponseFromJSON, BoxListResponseToJSON, } from '../models/BoxListResponse'; import { type BoxUsageResponse, BoxUsageResponseFromJSON, BoxUsageResponseToJSON, } from '../models/BoxUsageResponse'; import { type Command200Response, Command200ResponseFromJSON, Command200ResponseToJSON, } from '../models/Command200Response'; import { type CommandRequest, CommandRequestFromJSON, CommandRequestToJSON, } from '../models/CommandRequest'; import { type CommandStatusResponse, CommandStatusResponseFromJSON, CommandStatusResponseToJSON, } from '../models/CommandStatusResponse'; import { type ConversationsResponse, ConversationsResponseFromJSON, ConversationsResponseToJSON, } from '../models/ConversationsResponse'; import { type CreateBoxEnvironmentRequest, CreateBoxEnvironmentRequestFromJSON, CreateBoxEnvironmentRequestToJSON, } from '../models/CreateBoxEnvironmentRequest'; import { type CreateBoxRequest, CreateBoxRequestFromJSON, CreateBoxRequestToJSON, } from '../models/CreateBoxRequest'; import { type CreateBoxResponse, CreateBoxResponseFromJSON, CreateBoxResponseToJSON, } from '../models/CreateBoxResponse'; import { type CreateScopedApiKey503Response, CreateScopedApiKey503ResponseFromJSON, CreateScopedApiKey503ResponseToJSON, } from '../models/CreateScopedApiKey503Response'; import { type CreateScopedApiKeyRequest, CreateScopedApiKeyRequestFromJSON, CreateScopedApiKeyRequestToJSON, } from '../models/CreateScopedApiKeyRequest'; import { type DataRetentionPolicyResponse, DataRetentionPolicyResponseFromJSON, DataRetentionPolicyResponseToJSON, } from '../models/DataRetentionPolicyResponse'; import { type DataRetentionUpdateRequest, DataRetentionUpdateRequestFromJSON, DataRetentionUpdateRequestToJSON, } from '../models/DataRetentionUpdateRequest'; import { type DeletionOperationResponse, DeletionOperationResponseFromJSON, DeletionOperationResponseToJSON, } from '../models/DeletionOperationResponse'; import { type DesktopRequest, DesktopRequestFromJSON, DesktopRequestToJSON, } from '../models/DesktopRequest'; import { type DesktopResponse, DesktopResponseFromJSON, DesktopResponseToJSON, } from '../models/DesktopResponse'; import { type EnvironmentItemChangeResponse, EnvironmentItemChangeResponseFromJSON, EnvironmentItemChangeResponseToJSON, } from '../models/EnvironmentItemChangeResponse'; import { type ErrorEnvelope, ErrorEnvelopeFromJSON, ErrorEnvelopeToJSON, } from '../models/ErrorEnvelope'; import { type EventsResponse, EventsResponseFromJSON, EventsResponseToJSON, } from '../models/EventsResponse'; import { type FileReadResponse, FileReadResponseFromJSON, FileReadResponseToJSON, } from '../models/FileReadResponse'; import { type FileWriteRequest, FileWriteRequestFromJSON, FileWriteRequestToJSON, } from '../models/FileWriteRequest'; import { type FileWriteResponse, FileWriteResponseFromJSON, FileWriteResponseToJSON, } from '../models/FileWriteResponse'; import { type ForkRequest, ForkRequestFromJSON, ForkRequestToJSON, } from '../models/ForkRequest'; import { type HostPortRequest, HostPortRequestFromJSON, HostPortRequestToJSON, } from '../models/HostPortRequest'; import { type HostPortResponse, HostPortResponseFromJSON, HostPortResponseToJSON, } from '../models/HostPortResponse'; import { type LimitsResponse, LimitsResponseFromJSON, LimitsResponseToJSON, } from '../models/LimitsResponse'; import { type MeResponse, MeResponseFromJSON, MeResponseToJSON, } from '../models/MeResponse'; import { type NamedSnapshotDeletedResponse, NamedSnapshotDeletedResponseFromJSON, NamedSnapshotDeletedResponseToJSON, } from '../models/NamedSnapshotDeletedResponse'; import { type NamedSnapshotInfoResponse, NamedSnapshotInfoResponseFromJSON, NamedSnapshotInfoResponseToJSON, } from '../models/NamedSnapshotInfoResponse'; import { type NamedSnapshotListResponse, NamedSnapshotListResponseFromJSON, NamedSnapshotListResponseToJSON, } from '../models/NamedSnapshotListResponse'; import { type NamedSnapshotSaveRequest, NamedSnapshotSaveRequestFromJSON, NamedSnapshotSaveRequestToJSON, } from '../models/NamedSnapshotSaveRequest'; import { type NamedSnapshotSavingResponse, NamedSnapshotSavingResponseFromJSON, NamedSnapshotSavingResponseToJSON, } from '../models/NamedSnapshotSavingResponse'; import { type PromptRequest, PromptRequestFromJSON, PromptRequestToJSON, } from '../models/PromptRequest'; import { type PromptResponse, PromptResponseFromJSON, PromptResponseToJSON, } from '../models/PromptResponse'; import { type PromptRunResponse, PromptRunResponseFromJSON, PromptRunResponseToJSON, } from '../models/PromptRunResponse'; import { type RepoSelectionRequest, RepoSelectionRequestFromJSON, RepoSelectionRequestToJSON, } from '../models/RepoSelectionRequest'; import { type RepoSelectionResponse, RepoSelectionResponseFromJSON, RepoSelectionResponseToJSON, } from '../models/RepoSelectionResponse'; import { type ReposResponse, ReposResponseFromJSON, ReposResponseToJSON, } from '../models/ReposResponse'; import { type ResumeRequest, ResumeRequestFromJSON, ResumeRequestToJSON, } from '../models/ResumeRequest'; import { type RotateApiKey409Response, RotateApiKey409ResponseFromJSON, RotateApiKey409ResponseToJSON, } from '../models/RotateApiKey409Response'; import { type SecretsResponse, SecretsResponseFromJSON, SecretsResponseToJSON, } from '../models/SecretsResponse'; import { type SecretsUpdateRequest, SecretsUpdateRequestFromJSON, SecretsUpdateRequestToJSON, } from '../models/SecretsUpdateRequest'; import { type SetEnvironmentSecretFileRequest, SetEnvironmentSecretFileRequestFromJSON, SetEnvironmentSecretFileRequestToJSON, } from '../models/SetEnvironmentSecretFileRequest'; import { type SetEnvironmentVarRequest, SetEnvironmentVarRequestFromJSON, SetEnvironmentVarRequestToJSON, } from '../models/SetEnvironmentVarRequest'; import { type SnapshotDownloadResponse, SnapshotDownloadResponseFromJSON, SnapshotDownloadResponseToJSON, } from '../models/SnapshotDownloadResponse'; import { type SnapshotLatestResponse, SnapshotLatestResponseFromJSON, SnapshotLatestResponseToJSON, } from '../models/SnapshotLatestResponse'; import { type SnapshotListResponse, SnapshotListResponseFromJSON, SnapshotListResponseToJSON, } from '../models/SnapshotListResponse'; import { type SnapshotTreeResponse, SnapshotTreeResponseFromJSON, SnapshotTreeResponseToJSON, } from '../models/SnapshotTreeResponse'; import { type SshKeyRequest, SshKeyRequestFromJSON, SshKeyRequestToJSON, } from '../models/SshKeyRequest'; import { type SshKeyResponse, SshKeyResponseFromJSON, SshKeyResponseToJSON, } from '../models/SshKeyResponse'; import { type SteerRequest, SteerRequestFromJSON, SteerRequestToJSON, } from '../models/SteerRequest'; import { type SteerResponse, SteerResponseFromJSON, SteerResponseToJSON, } from '../models/SteerResponse'; import { type StopRequest, StopRequestFromJSON, StopRequestToJSON, } from '../models/StopRequest'; import { type UpdateBoxEnvironmentRequest, UpdateBoxEnvironmentRequestFromJSON, UpdateBoxEnvironmentRequestToJSON, } from '../models/UpdateBoxEnvironmentRequest'; import { type UpdateBoxRequest, UpdateBoxRequestFromJSON, UpdateBoxRequestToJSON, } from '../models/UpdateBoxRequest'; import { type UpgradeBoxEnvironmentRequest, UpgradeBoxEnvironmentRequestFromJSON, UpgradeBoxEnvironmentRequestToJSON, } from '../models/UpgradeBoxEnvironmentRequest'; import { type UpgradeBoxEnvironmentResponse, UpgradeBoxEnvironmentResponseFromJSON, UpgradeBoxEnvironmentResponseToJSON, } from '../models/UpgradeBoxEnvironmentResponse'; import { type WebhookCreateRequest, WebhookCreateRequestFromJSON, WebhookCreateRequestToJSON, } from '../models/WebhookCreateRequest'; import { type WebhookDeleteResponse, WebhookDeleteResponseFromJSON, WebhookDeleteResponseToJSON, } from '../models/WebhookDeleteResponse'; import { type WebhookListResponse, WebhookListResponseFromJSON, WebhookListResponseToJSON, } from '../models/WebhookListResponse'; import { type WebhookResponse, WebhookResponseFromJSON, WebhookResponseToJSON, } from '../models/WebhookResponse'; import { type WebhookSecretResponse, WebhookSecretResponseFromJSON, WebhookSecretResponseToJSON, } from '../models/WebhookSecretResponse'; import { type WebhookUpdateRequest, WebhookUpdateRequestFromJSON, WebhookUpdateRequestToJSON, } from '../models/WebhookUpdateRequest'; export interface AddEnvironmentRepoOperationRequest { environmentId: string; addEnvironmentRepoRequest: AddEnvironmentRepoRequest; } export interface ApiKeyUsageRequest { apiKeyId: string; } export interface ArtifactRequest { boxId: string; path: string; } export interface BoxesRequest { limit?: number; cursor?: string | null; sort?: BoxesSortEnum; state?: string; } export interface CommandOperationRequest { boxId: string; commandRequest: CommandRequest; } export interface CommandStatusRequest { boxId: string; processId: number; tailBytes?: number; } export interface ConversationsRequest { boxId: string; } export interface CreateRequest { idempotencyKey?: string; org?: string; xBoxOrg?: string; createBoxRequest?: CreateBoxRequest; } export interface CreateEnvironmentRequest { createBoxEnvironmentRequest: CreateBoxEnvironmentRequest; } export interface CreateScopedApiKeyOperationRequest { createScopedApiKeyRequest: CreateScopedApiKeyRequest; } export interface CreateWebhookRequest { webhookCreateRequest: WebhookCreateRequest; } export interface DeleteBoxRequest { xAsciiConfirmDelete: string; boxId: string; } export interface DeleteEnvironmentRequest { environmentId: string; } export interface DeleteEnvironmentRepoRequest { environmentId: string; repositoryId: string; } export interface DeleteEnvironmentSecretFileRequest { path: string; environmentId: string; } export interface DeleteEnvironmentVarRequest { environmentId: string; key: string; } export interface DeleteNamedSnapshotRequest { name: string; } export interface DeleteSnapshotRequest { snapshotId: string; xAsciiConfirmDelete: string; } export interface DeleteWebhookRequest { webhookId: string; } export interface DesktopOperationRequest { boxId: string; vnc?: DesktopOperationVncEnum; theme?: DesktopOperationThemeEnum; desktopRequest?: DesktopRequest; } export interface EventsRequest { boxId: string; limit?: number; cursor?: string | null; sort?: EventsSortEnum; type?: string; conversation?: string; } export interface ForkOperationRequest { boxId: string; idempotencyKey?: string; forkRequest?: ForkRequest; } export interface GetRequest { boxId: string; } export interface GetDeletionOperationRequest { operationId: string; } export interface GetLatestBoxSnapshotRequest { boxId: string; } export interface GetNamedSnapshotRequest { name: string; } export interface GetSnapshotDownloadRequest { snapshotId: string; } export interface GetSnapshotFileRequest { snapshotId: string; path?: string; } export interface GetSnapshotTreeRequest { snapshotId: string; } export interface GetWebhookRequest { webhookId: string; } export interface HostPortOperationRequest { boxId: string; hostPortRequest: HostPortRequest; } export interface InterruptRequest { boxId: string; conversation?: string; } export interface LimitsRequest { org?: string; xBoxOrg?: string; teamId?: string; } export interface ListBoxSnapshotsRequest { boxId: string; limit?: number; cursor?: string | null; sort?: ListBoxSnapshotsSortEnum; } export interface ListSnapshotsRequest { limit?: number; cursor?: string | null; sort?: ListSnapshotsSortEnum; } export interface PromptOperationRequest { boxId: string; promptRequest: PromptRequest; } export interface PromptRunStatusRequest { boxId: string; promptId: string; } export interface ReadFileRequest { boxId: string; path: string; encoding?: ReadFileEncodingEnum; } export interface ReposRequest { sync?: boolean; limit?: number; cursor?: string | null; sort?: ReposSortEnum; q?: string; selected?: boolean; } export interface ResumeOperationRequest { boxId: string; resumeRequest?: ResumeRequest; } export interface RevokeApiKeyRequest { apiKeyId: string; } export interface RotateApiKeyRequest { apiKeyId: string; } export interface RotateWebhookSigningSecretRequest { webhookId: string; } export interface SaveNamedSnapshotRequest { namedSnapshotSaveRequest: NamedSnapshotSaveRequest; } export interface SelectRepoRequest { repoSelectionRequest: RepoSelectionRequest; } export interface SetEnvironmentSecretFileOperationRequest { environmentId: string; setEnvironmentSecretFileRequest: SetEnvironmentSecretFileRequest; } export interface SetEnvironmentVarOperationRequest { environmentId: string; key: string; setEnvironmentVarRequest: SetEnvironmentVarRequest; } export interface SshKeyOperationRequest { boxId: string; sshKeyRequest: SshKeyRequest; } export interface SteerOperationRequest { boxId: string; steerRequest: SteerRequest; conversation?: string; } export interface StopOperationRequest { boxId: string; stopRequest?: StopRequest; } export interface UpdateRequest { boxId: string; updateBoxRequest: UpdateBoxRequest; } export interface UpdateDataRetentionRequest { dataRetentionUpdateRequest: DataRetentionUpdateRequest; } export interface UpdateEnvironmentRequest { environmentId: string; updateBoxEnvironmentRequest: UpdateBoxEnvironmentRequest; } export interface UpdateSecretsRequest { secretsUpdateRequest: SecretsUpdateRequest; } export interface UpdateWebhookRequest { webhookId: string; webhookUpdateRequest: WebhookUpdateRequest; } export interface UpgradeEnvironmentRequest { environmentId: string; upgradeBoxEnvironmentRequest?: UpgradeBoxEnvironmentRequest; } export interface UsageRequest { boxId: string; since?: string; until?: string; } export interface WriteFileRequest { boxId: string; fileWriteRequest: FileWriteRequest; } /** * */ export class BoxApi extends runtime.BaseAPI { /** * Creates request options for addEnvironmentRepo without sending the request */ async addEnvironmentRepoRequestOpts(requestParameters: AddEnvironmentRepoOperationRequest): Promise { if (requestParameters['environmentId'] == null) { throw new runtime.RequiredError( 'environmentId', 'Required parameter "environmentId" was null or undefined when calling addEnvironmentRepo().' ); } if (requestParameters['addEnvironmentRepoRequest'] == null) { throw new runtime.RequiredError( 'addEnvironmentRepoRequest', 'Required parameter "addEnvironmentRepoRequest" was null or undefined when calling addEnvironmentRepo().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/environments/{environmentId}/repos`; urlPath = urlPath.replace('{environmentId}', encodeURIComponent(String(requestParameters['environmentId']))); return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: AddEnvironmentRepoRequestToJSON(requestParameters['addEnvironmentRepoRequest']), }; } /** * Adds a repository (or updates its base branch) by database id from the repository list. Mints a new immutable version. * Add a repository to an environment */ async addEnvironmentRepoRaw(requestParameters: AddEnvironmentRepoOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.addEnvironmentRepoRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EnvironmentItemChangeResponseFromJSON(jsonValue)); } /** * Adds a repository (or updates its base branch) by database id from the repository list. Mints a new immutable version. * Add a repository to an environment */ async addEnvironmentRepo(requestParameters: AddEnvironmentRepoOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.addEnvironmentRepoRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for apiKeyUsage without sending the request */ async apiKeyUsageRequestOpts(requestParameters: ApiKeyUsageRequest): Promise { if (requestParameters['apiKeyId'] == null) { throw new runtime.RequiredError( 'apiKeyId', 'Required parameter "apiKeyId" was null or undefined when calling apiKeyUsage().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/api-keys/{apiKeyId}/usage`; urlPath = urlPath.replace('{apiKeyId}', encodeURIComponent(String(requestParameters['apiKeyId']))); return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }; } /** * Returns the key\'s request total for the 30-day UTC window and the boxes and Agents it created that still exist, including Boxes that never got a Sandbox row. Works for revoked keys owned by the authenticated account. * Get API key usage */ async apiKeyUsageRaw(requestParameters: ApiKeyUsageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.apiKeyUsageRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiKeyUsageResponseFromJSON(jsonValue)); } /** * Returns the key\'s request total for the 30-day UTC window and the boxes and Agents it created that still exist, including Boxes that never got a Sandbox row. Works for revoked keys owned by the authenticated account. * Get API key usage */ async apiKeyUsage(requestParameters: ApiKeyUsageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.apiKeyUsageRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for apiKeys without sending the request */ async apiKeysRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/api-keys`; return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }; } /** * Lists API key metadata only. Raw key secrets are not returned after creation/rotation. Results include expiry and scope. A restricted API-key caller receives `apiKeys: []`; only an unrestricted account key or browser/CLI session receives the account inventory. Bearer header is unchanged; scope lives on the key. * List API keys */ async apiKeysRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.apiKeysRequestOpts(); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiKeysResponseFromJSON(jsonValue)); } /** * Lists API key metadata only. Raw key secrets are not returned after creation/rotation. Results include expiry and scope. A restricted API-key caller receives `apiKeys: []`; only an unrestricted account key or browser/CLI session receives the account inventory. Bearer header is unchanged; scope lives on the key. * List API keys */ async apiKeys(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.apiKeysRaw(initOverrides); return await response.value(); } /** * Creates request options for artifact without sending the request */ async artifactRequestOpts(requestParameters: ArtifactRequest): Promise { if (requestParameters['boxId'] == null) { throw new runtime.RequiredError( 'boxId', 'Required parameter "boxId" was null or undefined when calling artifact().' ); } if (requestParameters['path'] == null) { throw new runtime.RequiredError( 'path', 'Required parameter "path" was null or undefined when calling artifact().' ); } const queryParameters: any = {}; if (requestParameters['path'] != null) { queryParameters['path'] = requestParameters['path']; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/boxes/{boxId}/artifacts`; urlPath = urlPath.replace('{boxId}', encodeURIComponent(String(requestParameters['boxId']))); return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }; } /** * Download a Boat artifact */ async artifactRaw(requestParameters: ArtifactRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.artifactRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.BlobApiResponse(response); } /** * Download a Boat artifact */ async artifact(requestParameters: ArtifactRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.artifactRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for boxes without sending the request */ async boxesRequestOpts(requestParameters: BoxesRequest): Promise { const queryParameters: any = {}; if (requestParameters['limit'] != null) { queryParameters['limit'] = requestParameters['limit']; } if (requestParameters['cursor'] != null) { queryParameters['cursor'] = requestParameters['cursor']; } if (requestParameters['sort'] != null) { queryParameters['sort'] = requestParameters['sort']; } if (requestParameters['state'] != null) { queryParameters['state'] = requestParameters['state']; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/boxes`; return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }; } /** * List boxes */ async boxesRaw(requestParameters: BoxesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.boxesRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => BoxListResponseFromJSON(jsonValue)); } /** * List boxes */ async boxes(requestParameters: BoxesRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.boxesRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for command without sending the request */ async commandRequestOpts(requestParameters: CommandOperationRequest): Promise { if (requestParameters['boxId'] == null) { throw new runtime.RequiredError( 'boxId', 'Required parameter "boxId" was null or undefined when calling command().' ); } if (requestParameters['commandRequest'] == null) { throw new runtime.RequiredError( 'commandRequest', 'Required parameter "commandRequest" was null or undefined when calling command().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/boxes/{boxId}/commands`; urlPath = urlPath.replace('{boxId}', encodeURIComponent(String(requestParameters['boxId']))); return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: CommandRequestToJSON(requestParameters['commandRequest']), }; } /** * Runs the command synchronously by default (timeout configurable via `timeoutSeconds`, 600s cap). With `detached: true` the command starts in the background and a process id is returned immediately; poll `/boxes/{boxId}/commands/{processId}` for status and logs. Returns 400 invalid_timeout when `timeoutSeconds` is not an integer in 1-600. Returns 409 box_starting (retryable) while the Boat is still provisioning -- wait until the Boat state is ready before running commands. Command execution is never retried automatically: a 502 box_direct_failed means the command may already be running on the Boat. * Execute a command in a Boat */ async commandRaw(requestParameters: CommandOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.commandRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => Command200ResponseFromJSON(jsonValue)); } /** * Runs the command synchronously by default (timeout configurable via `timeoutSeconds`, 600s cap). With `detached: true` the command starts in the background and a process id is returned immediately; poll `/boxes/{boxId}/commands/{processId}` for status and logs. Returns 400 invalid_timeout when `timeoutSeconds` is not an integer in 1-600. Returns 409 box_starting (retryable) while the Boat is still provisioning -- wait until the Boat state is ready before running commands. Command execution is never retried automatically: a 502 box_direct_failed means the command may already be running on the Boat. * Execute a command in a Boat */ async command(requestParameters: CommandOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.commandRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for commandStatus without sending the request */ async commandStatusRequestOpts(requestParameters: CommandStatusRequest): Promise { if (requestParameters['boxId'] == null) { throw new runtime.RequiredError( 'boxId', 'Required parameter "boxId" was null or undefined when calling commandStatus().' ); } if (requestParameters['processId'] == null) { throw new runtime.RequiredError( 'processId', 'Required parameter "processId" was null or undefined when calling commandStatus().' ); } const queryParameters: any = {}; if (requestParameters['tailBytes'] != null) { queryParameters['tailBytes'] = requestParameters['tailBytes']; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/boxes/{boxId}/commands/{processId}`; urlPath = urlPath.replace('{boxId}', encodeURIComponent(String(requestParameters['boxId']))); urlPath = urlPath.replace('{processId}', encodeURIComponent(String(requestParameters['processId']))); return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }; } /** * Get detached command status and logs */ async commandStatusRaw(requestParameters: CommandStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.commandStatusRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => CommandStatusResponseFromJSON(jsonValue)); } /** * Get detached command status and logs */ async commandStatus(requestParameters: CommandStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.commandStatusRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for conversations without sending the request */ async conversationsRequestOpts(requestParameters: ConversationsRequest): Promise { if (requestParameters['boxId'] == null) { throw new runtime.RequiredError( 'boxId', 'Required parameter "boxId" was null or undefined when calling conversations().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/boxes/{boxId}/conversations`; urlPath = urlPath.replace('{boxId}', encodeURIComponent(String(requestParameters['boxId']))); return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }; } /** * Every conversation on the Box, most recently prompted first, with what you need to pick one: how many prompts it holds, whether a turn is running in it right now, the last harness and model it ran on, a preview of its last prompt, and `current`, the one a `POST /prompt` without `new` or `conversationId` would continue. Pass an `id` back as `conversationId` on `POST /prompt` to resume that thread, or as `conversation` on `POST /steer`, `POST /interrupt` and `GET /events` to scope those. See [Integrated agents](/box/integrated-agents). * List box conversations */ async conversationsRaw(requestParameters: ConversationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.conversationsRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ConversationsResponseFromJSON(jsonValue)); } /** * Every conversation on the Box, most recently prompted first, with what you need to pick one: how many prompts it holds, whether a turn is running in it right now, the last harness and model it ran on, a preview of its last prompt, and `current`, the one a `POST /prompt` without `new` or `conversationId` would continue. Pass an `id` back as `conversationId` on `POST /prompt` to resume that thread, or as `conversation` on `POST /steer`, `POST /interrupt` and `GET /events` to scope those. See [Integrated agents](/box/integrated-agents). * List box conversations */ async conversations(requestParameters: ConversationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.conversationsRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for create without sending the request */ async createRequestOpts(requestParameters: CreateRequest): Promise { const queryParameters: any = {}; if (requestParameters['org'] != null) { queryParameters['org'] = requestParameters['org']; } const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (requestParameters['idempotencyKey'] != null) { headerParameters['Idempotency-Key'] = String(requestParameters['idempotencyKey']); } if (requestParameters['xBoxOrg'] != null) { headerParameters['X-Box-Org'] = String(requestParameters['xBoxOrg']); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/boxes`; return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: CreateBoxRequestToJSON(requestParameters['createBoxRequest']), }; } /** * Provision a new cloud computer. Store the returned `box.id` with your product job/session record. Send an `Idempotency-Key` header to make this call safe to retry after a lost response without creating a second billable box. * Create box */ async createRaw(requestParameters: CreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.createRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => CreateBoxResponseFromJSON(jsonValue)); } /** * Provision a new cloud computer. Store the returned `box.id` with your product job/session record. Send an `Idempotency-Key` header to make this call safe to retry after a lost response without creating a second billable box. * Create box */ async create(requestParameters: CreateRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.createRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for createEnvironment without sending the request */ async createEnvironmentRequestOpts(requestParameters: CreateEnvironmentRequest): Promise { if (requestParameters['createBoxEnvironmentRequest'] == null) { throw new runtime.RequiredError( 'createBoxEnvironmentRequest', 'Required parameter "createBoxEnvironmentRequest" was null or undefined when calling createEnvironment().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/environments`; return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: CreateBoxEnvironmentRequestToJSON(requestParameters['createBoxEnvironmentRequest']), }; } /** * Create a new named environment. It starts on version 1 with all fine-grained flags on and `safeForThirdParties` off. * Create a Boat environment */ async createEnvironmentRaw(requestParameters: CreateEnvironmentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.createEnvironmentRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => BoxEnvironmentListResponseFromJSON(jsonValue)); } /** * Create a new named environment. It starts on version 1 with all fine-grained flags on and `safeForThirdParties` off. * Create a Boat environment */ async createEnvironment(requestParameters: CreateEnvironmentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.createEnvironmentRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for createScopedApiKey without sending the request */ async createScopedApiKeyRequestOpts(requestParameters: CreateScopedApiKeyOperationRequest): Promise { if (requestParameters['createScopedApiKeyRequest'] == null) { throw new runtime.RequiredError( 'createScopedApiKeyRequest', 'Required parameter "createScopedApiKeyRequest" was null or undefined when calling createScopedApiKey().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/api-keys/scoped`; return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: CreateScopedApiKeyRequestToJSON(requestParameters['createScopedApiKeyRequest']), }; } /** * Creates a scoped, expiring API key. Requires a dashboard/CLI session or an admin-scoped token. The secret is returned once. This dedicated path returns a typed 503 until scoped credential creation is activated. * Create a scoped API key */ async createScopedApiKeyRaw(requestParameters: CreateScopedApiKeyOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.createScopedApiKeyRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiKeySecretResponseFromJSON(jsonValue)); } /** * Creates a scoped, expiring API key. Requires a dashboard/CLI session or an admin-scoped token. The secret is returned once. This dedicated path returns a typed 503 until scoped credential creation is activated. * Create a scoped API key */ async createScopedApiKey(requestParameters: CreateScopedApiKeyOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.createScopedApiKeyRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for createWebhook without sending the request */ async createWebhookRequestOpts(requestParameters: CreateWebhookRequest): Promise { if (requestParameters['webhookCreateRequest'] == null) { throw new runtime.RequiredError( 'webhookCreateRequest', 'Required parameter "webhookCreateRequest" was null or undefined when calling createWebhook().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/webhooks`; return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: WebhookCreateRequestToJSON(requestParameters['webhookCreateRequest']), }; } /** * Registers an account-wide endpoint for Boat lifecycle events. The endpoint must use HTTPS on port 443 and resolve only to public addresses. Redirects are not followed during delivery. The signing secret is returned only in this response. An account can register at most 10 unique endpoint URLs. * Create webhook */ async createWebhookRaw(requestParameters: CreateWebhookRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.createWebhookRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => WebhookSecretResponseFromJSON(jsonValue)); } /** * Registers an account-wide endpoint for Boat lifecycle events. The endpoint must use HTTPS on port 443 and resolve only to public addresses. Redirects are not followed during delivery. The signing secret is returned only in this response. An account can register at most 10 unique endpoint URLs. * Create webhook */ async createWebhook(requestParameters: CreateWebhookRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.createWebhookRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for deleteBox without sending the request */ async deleteBoxRequestOpts(requestParameters: DeleteBoxRequest): Promise { if (requestParameters['xAsciiConfirmDelete'] == null) { throw new runtime.RequiredError( 'xAsciiConfirmDelete', 'Required parameter "xAsciiConfirmDelete" was null or undefined when calling deleteBox().' ); } if (requestParameters['boxId'] == null) { throw new runtime.RequiredError( 'boxId', 'Required parameter "boxId" was null or undefined when calling deleteBox().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (requestParameters['xAsciiConfirmDelete'] != null) { headerParameters['X-Ascii-Confirm-Delete'] = String(requestParameters['xAsciiConfirmDelete']); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/boxes/{boxId}`; urlPath = urlPath.replace('{boxId}', encodeURIComponent(String(requestParameters['boxId']))); return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, }; } /** * Accept irreversible background deletion of the Boat machine, snapshots, and content-bearing records. This is not archive: the Boat cannot be resumed. Named snapshots and other shared artifacts remain independent. Poll the returned operation until `completed`. * Permanently delete Boat data */ async deleteBoxRaw(requestParameters: DeleteBoxRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.deleteBoxRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DeletionOperationResponseFromJSON(jsonValue)); } /** * Accept irreversible background deletion of the Boat machine, snapshots, and content-bearing records. This is not archive: the Boat cannot be resumed. Named snapshots and other shared artifacts remain independent. Poll the returned operation until `completed`. * Permanently delete Boat data */ async deleteBox(requestParameters: DeleteBoxRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.deleteBoxRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for deleteEnvironment without sending the request */ async deleteEnvironmentRequestOpts(requestParameters: DeleteEnvironmentRequest): Promise { if (requestParameters['environmentId'] == null) { throw new runtime.RequiredError( 'environmentId', 'Required parameter "environmentId" was null or undefined when calling deleteEnvironment().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/environments/{environmentId}`; urlPath = urlPath.replace('{environmentId}', encodeURIComponent(String(requestParameters['environmentId']))); return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, }; } /** * Soft-deletes an environment. The default environment cannot be deleted, and at least one environment is always kept. * Delete a Boat environment */ async deleteEnvironmentRaw(requestParameters: DeleteEnvironmentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.deleteEnvironmentRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => BoxEnvironmentResponseFromJSON(jsonValue)); } /** * Soft-deletes an environment. The default environment cannot be deleted, and at least one environment is always kept. * Delete a Boat environment */ async deleteEnvironment(requestParameters: DeleteEnvironmentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.deleteEnvironmentRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for deleteEnvironmentRepo without sending the request */ async deleteEnvironmentRepoRequestOpts(requestParameters: DeleteEnvironmentRepoRequest): Promise { if (requestParameters['environmentId'] == null) { throw new runtime.RequiredError( 'environmentId', 'Required parameter "environmentId" was null or undefined when calling deleteEnvironmentRepo().' ); } if (requestParameters['repositoryId'] == null) { throw new runtime.RequiredError( 'repositoryId', 'Required parameter "repositoryId" was null or undefined when calling deleteEnvironmentRepo().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/environments/{environmentId}/repos/{repositoryId}`; urlPath = urlPath.replace('{environmentId}', encodeURIComponent(String(requestParameters['environmentId']))); urlPath = urlPath.replace('{repositoryId}', encodeURIComponent(String(requestParameters['repositoryId']))); return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, }; } /** * Removes one repository from the environment\'s selection. Mints a new immutable version. * Remove a repository from an environment */ async deleteEnvironmentRepoRaw(requestParameters: DeleteEnvironmentRepoRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.deleteEnvironmentRepoRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EnvironmentItemChangeResponseFromJSON(jsonValue)); } /** * Removes one repository from the environment\'s selection. Mints a new immutable version. * Remove a repository from an environment */ async deleteEnvironmentRepo(requestParameters: DeleteEnvironmentRepoRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.deleteEnvironmentRepoRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for deleteEnvironmentSecretFile without sending the request */ async deleteEnvironmentSecretFileRequestOpts(requestParameters: DeleteEnvironmentSecretFileRequest): Promise { if (requestParameters['path'] == null) { throw new runtime.RequiredError( 'path', 'Required parameter "path" was null or undefined when calling deleteEnvironmentSecretFile().' ); } if (requestParameters['environmentId'] == null) { throw new runtime.RequiredError( 'environmentId', 'Required parameter "environmentId" was null or undefined when calling deleteEnvironmentSecretFile().' ); } const queryParameters: any = {}; if (requestParameters['path'] != null) { queryParameters['path'] = requestParameters['path']; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/environments/{environmentId}/secret-files`; urlPath = urlPath.replace('{environmentId}', encodeURIComponent(String(requestParameters['environmentId']))); return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, }; } /** * Removes the secret file at `path`. Mints a new immutable version. * Remove one secret file */ async deleteEnvironmentSecretFileRaw(requestParameters: DeleteEnvironmentSecretFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.deleteEnvironmentSecretFileRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EnvironmentItemChangeResponseFromJSON(jsonValue)); } /** * Removes the secret file at `path`. Mints a new immutable version. * Remove one secret file */ async deleteEnvironmentSecretFile(requestParameters: DeleteEnvironmentSecretFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.deleteEnvironmentSecretFileRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for deleteEnvironmentVar without sending the request */ async deleteEnvironmentVarRequestOpts(requestParameters: DeleteEnvironmentVarRequest): Promise { if (requestParameters['environmentId'] == null) { throw new runtime.RequiredError( 'environmentId', 'Required parameter "environmentId" was null or undefined when calling deleteEnvironmentVar().' ); } if (requestParameters['key'] == null) { throw new runtime.RequiredError( 'key', 'Required parameter "key" was null or undefined when calling deleteEnvironmentVar().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/environments/{environmentId}/vars/{key}`; urlPath = urlPath.replace('{environmentId}', encodeURIComponent(String(requestParameters['environmentId']))); urlPath = urlPath.replace('{key}', encodeURIComponent(String(requestParameters['key']))); return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, }; } /** * Removes a single variable. Mints a new immutable version. * Remove one environment variable */ async deleteEnvironmentVarRaw(requestParameters: DeleteEnvironmentVarRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.deleteEnvironmentVarRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EnvironmentItemChangeResponseFromJSON(jsonValue)); } /** * Removes a single variable. Mints a new immutable version. * Remove one environment variable */ async deleteEnvironmentVar(requestParameters: DeleteEnvironmentVarRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.deleteEnvironmentVarRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for deleteNamedSnapshot without sending the request */ async deleteNamedSnapshotRequestOpts(requestParameters: DeleteNamedSnapshotRequest): Promise { if (requestParameters['name'] == null) { throw new runtime.RequiredError( 'name', 'Required parameter "name" was null or undefined when calling deleteNamedSnapshot().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/named-snapshots/{name}`; urlPath = urlPath.replace('{name}', encodeURIComponent(String(requestParameters['name']))); return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, }; } /** * Remove a named snapshot and release its storage (`box snapshot rm ` in the CLI). Boxes already deployed from it are unaffected. * Remove a named snapshot */ async deleteNamedSnapshotRaw(requestParameters: DeleteNamedSnapshotRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.deleteNamedSnapshotRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => NamedSnapshotDeletedResponseFromJSON(jsonValue)); } /** * Remove a named snapshot and release its storage (`box snapshot rm ` in the CLI). Boxes already deployed from it are unaffected. * Remove a named snapshot */ async deleteNamedSnapshot(requestParameters: DeleteNamedSnapshotRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.deleteNamedSnapshotRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for deleteSnapshot without sending the request */ async deleteSnapshotRequestOpts(requestParameters: DeleteSnapshotRequest): Promise { if (requestParameters['snapshotId'] == null) { throw new runtime.RequiredError( 'snapshotId', 'Required parameter "snapshotId" was null or undefined when calling deleteSnapshot().' ); } if (requestParameters['xAsciiConfirmDelete'] == null) { throw new runtime.RequiredError( 'xAsciiConfirmDelete', 'Required parameter "xAsciiConfirmDelete" was null or undefined when calling deleteSnapshot().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (requestParameters['xAsciiConfirmDelete'] != null) { headerParameters['X-Ascii-Confirm-Delete'] = String(requestParameters['xAsciiConfirmDelete']); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/snapshots/{snapshotId}`; urlPath = urlPath.replace('{snapshotId}', encodeURIComponent(String(requestParameters['snapshotId']))); return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, }; } /** * Accept irreversible background deletion of an unpinned snapshot owned by the authenticated account. Snapshots required by another incremental snapshot or active restore return `409`. Poll the returned operation until `completed`. * Permanently delete snapshot data */ async deleteSnapshotRaw(requestParameters: DeleteSnapshotRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.deleteSnapshotRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DeletionOperationResponseFromJSON(jsonValue)); } /** * Accept irreversible background deletion of an unpinned snapshot owned by the authenticated account. Snapshots required by another incremental snapshot or active restore return `409`. Poll the returned operation until `completed`. * Permanently delete snapshot data */ async deleteSnapshot(requestParameters: DeleteSnapshotRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.deleteSnapshotRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for deleteWebhook without sending the request */ async deleteWebhookRequestOpts(requestParameters: DeleteWebhookRequest): Promise { if (requestParameters['webhookId'] == null) { throw new runtime.RequiredError( 'webhookId', 'Required parameter "webhookId" was null or undefined when calling deleteWebhook().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/webhooks/{webhookId}`; urlPath = urlPath.replace('{webhookId}', encodeURIComponent(String(requestParameters['webhookId']))); return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, }; } /** * Deletes the endpoint and its queued deliveries. An attempt already in flight can still arrive. * Delete webhook */ async deleteWebhookRaw(requestParameters: DeleteWebhookRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.deleteWebhookRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => WebhookDeleteResponseFromJSON(jsonValue)); } /** * Deletes the endpoint and its queued deliveries. An attempt already in flight can still arrive. * Delete webhook */ async deleteWebhook(requestParameters: DeleteWebhookRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.deleteWebhookRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for desktop without sending the request */ async desktopRequestOpts(requestParameters: DesktopOperationRequest): Promise { if (requestParameters['boxId'] == null) { throw new runtime.RequiredError( 'boxId', 'Required parameter "boxId" was null or undefined when calling desktop().' ); } const queryParameters: any = {}; if (requestParameters['vnc'] != null) { queryParameters['vnc'] = requestParameters['vnc']; } if (requestParameters['theme'] != null) { queryParameters['theme'] = requestParameters['theme']; } const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/boxes/{boxId}/desktop`; urlPath = urlPath.replace('{boxId}', encodeURIComponent(String(requestParameters['boxId']))); return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: DesktopRequestToJSON(requestParameters['desktopRequest']), }; } /** * Create or fetch a secret-bearing desktop/noVNC URL for live computer-use visibility. Use `?vnc=1` for noVNC; a `provisioning: true` response means poll again. * Get desktop streaming URL */ async desktopRaw(requestParameters: DesktopOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.desktopRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DesktopResponseFromJSON(jsonValue)); } /** * Create or fetch a secret-bearing desktop/noVNC URL for live computer-use visibility. Use `?vnc=1` for noVNC; a `provisioning: true` response means poll again. * Get desktop streaming URL */ async desktop(requestParameters: DesktopOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.desktopRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for environments without sending the request */ async environmentsRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/environments`; return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }; } /** * Returns every non-deleted Boat environment with its latest-version flags, contents, and per-version box usage. A default environment named `base` is created on first access if none exists. * List Boat environments */ async environmentsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.environmentsRequestOpts(); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => BoxEnvironmentListResponseFromJSON(jsonValue)); } /** * Returns every non-deleted Boat environment with its latest-version flags, contents, and per-version box usage. A default environment named `base` is created on first access if none exists. * List Boat environments */ async environments(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.environmentsRaw(initOverrides); return await response.value(); } /** * Creates request options for events without sending the request */ async eventsRequestOpts(requestParameters: EventsRequest): Promise { if (requestParameters['boxId'] == null) { throw new runtime.RequiredError( 'boxId', 'Required parameter "boxId" was null or undefined when calling events().' ); } const queryParameters: any = {}; if (requestParameters['limit'] != null) { queryParameters['limit'] = requestParameters['limit']; } if (requestParameters['cursor'] != null) { queryParameters['cursor'] = requestParameters['cursor']; } if (requestParameters['sort'] != null) { queryParameters['sort'] = requestParameters['sort']; } if (requestParameters['type'] != null) { queryParameters['type'] = requestParameters['type']; } if (requestParameters['conversation'] != null) { queryParameters['conversation'] = requestParameters['conversation']; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/boxes/{boxId}/events`; urlPath = urlPath.replace('{boxId}', encodeURIComponent(String(requestParameters['boxId']))); return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }; } /** * Return Boat work, lifecycle, and progress events so product UIs can show what the box is doing. A Box runs many conversations in parallel; this streams **all** of them by default and every event carries a `conversationId`. Filter to one or more with `conversation`. Event payloads are extensible. Clients can long-poll this endpoint with `sort=asc` and a cursor to stream responses. Response events expose agent text, streaming partials via `data.is_streaming`, and tool calls/results via `data.tools`. * List box events */ async eventsRaw(requestParameters: EventsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.eventsRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EventsResponseFromJSON(jsonValue)); } /** * Return Boat work, lifecycle, and progress events so product UIs can show what the box is doing. A Box runs many conversations in parallel; this streams **all** of them by default and every event carries a `conversationId`. Filter to one or more with `conversation`. Event payloads are extensible. Clients can long-poll this endpoint with `sort=asc` and a cursor to stream responses. Response events expose agent text, streaming partials via `data.is_streaming`, and tool calls/results via `data.tools`. * List box events */ async events(requestParameters: EventsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.eventsRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for fork without sending the request */ async forkRequestOpts(requestParameters: ForkOperationRequest): Promise { if (requestParameters['boxId'] == null) { throw new runtime.RequiredError( 'boxId', 'Required parameter "boxId" was null or undefined when calling fork().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (requestParameters['idempotencyKey'] != null) { headerParameters['Idempotency-Key'] = String(requestParameters['idempotencyKey']); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/boxes/{boxId}/fork`; urlPath = urlPath.replace('{boxId}', encodeURIComponent(String(requestParameters['boxId']))); return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: ForkRequestToJSON(requestParameters['forkRequest']), }; } /** * Provision a new box from an existing one. Send an `Idempotency-Key` header to make this call safe to retry after a lost response without creating a second billable fork. * Fork box */ async forkRaw(requestParameters: ForkOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.forkRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => BoxActionResponseFromJSON(jsonValue)); } /** * Provision a new box from an existing one. Send an `Idempotency-Key` header to make this call safe to retry after a lost response without creating a second billable fork. * Fork box */ async fork(requestParameters: ForkOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.forkRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for get without sending the request */ async getRequestOpts(requestParameters: GetRequest): Promise { if (requestParameters['boxId'] == null) { throw new runtime.RequiredError( 'boxId', 'Required parameter "boxId" was null or undefined when calling get().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/boxes/{boxId}`; urlPath = urlPath.replace('{boxId}', encodeURIComponent(String(requestParameters['boxId']))); return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }; } /** * Poll this endpoint after create, stop, resume, or fork operations. * Get box */ async getRaw(requestParameters: GetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.getRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => BoxInfoResponseFromJSON(jsonValue)); } /** * Poll this endpoint after create, stop, resume, or fork operations. * Get box */ async get(requestParameters: GetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for getDataRetention without sending the request */ async getDataRetentionRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/account/data-retention`; return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }; } /** * Returns the current zero-data-retention policy. Per-box API keys cannot access this account-wide setting. Responses are never cached. * Get account data-retention policy */ async getDataRetentionRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.getDataRetentionRequestOpts(); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DataRetentionPolicyResponseFromJSON(jsonValue)); } /** * Returns the current zero-data-retention policy. Per-box API keys cannot access this account-wide setting. Responses are never cached. * Get account data-retention policy */ async getDataRetention(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getDataRetentionRaw(initOverrides); return await response.value(); } /** * Creates request options for getDeletionOperation without sending the request */ async getDeletionOperationRequestOpts(requestParameters: GetDeletionOperationRequest): Promise { if (requestParameters['operationId'] == null) { throw new runtime.RequiredError( 'operationId', 'Required parameter "operationId" was null or undefined when calling getDeletionOperation().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/deletion-operations/{operationId}`; urlPath = urlPath.replace('{operationId}', encodeURIComponent(String(requestParameters['operationId']))); return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }; } /** * Poll an accepted Boat or snapshot deletion. Only operations owned by the authenticated account are returned. Responses are never cached. * Get deletion operation */ async getDeletionOperationRaw(requestParameters: GetDeletionOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.getDeletionOperationRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DeletionOperationResponseFromJSON(jsonValue)); } /** * Poll an accepted Boat or snapshot deletion. Only operations owned by the authenticated account are returned. Responses are never cached. * Get deletion operation */ async getDeletionOperation(requestParameters: GetDeletionOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getDeletionOperationRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for getLatestBoxSnapshot without sending the request */ async getLatestBoxSnapshotRequestOpts(requestParameters: GetLatestBoxSnapshotRequest): Promise { if (requestParameters['boxId'] == null) { throw new runtime.RequiredError( 'boxId', 'Required parameter "boxId" was null or undefined when calling getLatestBoxSnapshot().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/boxes/{boxId}/snapshots/latest`; urlPath = urlPath.replace('{boxId}', encodeURIComponent(String(requestParameters['boxId']))); return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }; } /** * Return the most recent completed snapshot for this box, or `null` if it has none. * Get latest box snapshot */ async getLatestBoxSnapshotRaw(requestParameters: GetLatestBoxSnapshotRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.getLatestBoxSnapshotRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => SnapshotLatestResponseFromJSON(jsonValue)); } /** * Return the most recent completed snapshot for this box, or `null` if it has none. * Get latest box snapshot */ async getLatestBoxSnapshot(requestParameters: GetLatestBoxSnapshotRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getLatestBoxSnapshotRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for getNamedSnapshot without sending the request */ async getNamedSnapshotRequestOpts(requestParameters: GetNamedSnapshotRequest): Promise { if (requestParameters['name'] == null) { throw new runtime.RequiredError( 'name', 'Required parameter "name" was null or undefined when calling getNamedSnapshot().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/named-snapshots/{name}`; urlPath = urlPath.replace('{name}', encodeURIComponent(String(requestParameters['name']))); return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }; } /** * Get a named snapshot */ async getNamedSnapshotRaw(requestParameters: GetNamedSnapshotRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.getNamedSnapshotRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => NamedSnapshotInfoResponseFromJSON(jsonValue)); } /** * Get a named snapshot */ async getNamedSnapshot(requestParameters: GetNamedSnapshotRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getNamedSnapshotRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for getSnapshotDownload without sending the request */ async getSnapshotDownloadRequestOpts(requestParameters: GetSnapshotDownloadRequest): Promise { if (requestParameters['snapshotId'] == null) { throw new runtime.RequiredError( 'snapshotId', 'Required parameter "snapshotId" was null or undefined when calling getSnapshotDownload().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/snapshots/{snapshotId}/download`; urlPath = urlPath.replace('{snapshotId}', encodeURIComponent(String(requestParameters['snapshotId']))); return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }; } /** * Return time-limited signed URLs for every chunk needed to reconstruct the box filesystem at this snapshot (the full chain, base through this generation), plus the inventory. Download the chunks and reassemble them as described by `reconstruct`. The `box snapshot pull` CLI command does this for you. * Get snapshot download */ async getSnapshotDownloadRaw(requestParameters: GetSnapshotDownloadRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.getSnapshotDownloadRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => SnapshotDownloadResponseFromJSON(jsonValue)); } /** * Return time-limited signed URLs for every chunk needed to reconstruct the box filesystem at this snapshot (the full chain, base through this generation), plus the inventory. Download the chunks and reassemble them as described by `reconstruct`. The `box snapshot pull` CLI command does this for you. * Get snapshot download */ async getSnapshotDownload(requestParameters: GetSnapshotDownloadRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getSnapshotDownloadRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for getSnapshotFile without sending the request */ async getSnapshotFileRequestOpts(requestParameters: GetSnapshotFileRequest): Promise { if (requestParameters['snapshotId'] == null) { throw new runtime.RequiredError( 'snapshotId', 'Required parameter "snapshotId" was null or undefined when calling getSnapshotFile().' ); } const queryParameters: any = {}; if (requestParameters['path'] != null) { queryParameters['path'] = requestParameters['path']; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/snapshots/{snapshotId}/files`; urlPath = urlPath.replace('{snapshotId}', encodeURIComponent(String(requestParameters['snapshotId']))); return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }; } /** * Stream a single file\'s bytes, or a folder subtree as a tar archive, directly out of a snapshot, the box can be stopped or archived; the machine is never contacted. Use `GET /snapshots/{snapshotId}/tree` to list paths, then pass one here. Paths are relative to the snapshot root (same space as `tree` entries; docker volumes under `__dockervol__/`). An empty or `/` path downloads the whole snapshot as a tar. Folder responses set `X-Snapshot-File-Count`, `X-Snapshot-Total-Size-Bytes` and `X-Snapshot-Skipped-Base-Image-Files` headers; both response shapes set `X-Snapshot-Entry-Kind` (`file` or `dir`). * Download a file or folder from a snapshot */ async getSnapshotFileRaw(requestParameters: GetSnapshotFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.getSnapshotFileRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.BlobApiResponse(response); } /** * Stream a single file\'s bytes, or a folder subtree as a tar archive, directly out of a snapshot, the box can be stopped or archived; the machine is never contacted. Use `GET /snapshots/{snapshotId}/tree` to list paths, then pass one here. Paths are relative to the snapshot root (same space as `tree` entries; docker volumes under `__dockervol__/`). An empty or `/` path downloads the whole snapshot as a tar. Folder responses set `X-Snapshot-File-Count`, `X-Snapshot-Total-Size-Bytes` and `X-Snapshot-Skipped-Base-Image-Files` headers; both response shapes set `X-Snapshot-Entry-Kind` (`file` or `dir`). * Download a file or folder from a snapshot */ async getSnapshotFile(requestParameters: GetSnapshotFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getSnapshotFileRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for getSnapshotTree without sending the request */ async getSnapshotTreeRequestOpts(requestParameters: GetSnapshotTreeRequest): Promise { if (requestParameters['snapshotId'] == null) { throw new runtime.RequiredError( 'snapshotId', 'Required parameter "snapshotId" was null or undefined when calling getSnapshotTree().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/snapshots/{snapshotId}/tree`; urlPath = urlPath.replace('{snapshotId}', encodeURIComponent(String(requestParameters['snapshotId']))); return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }; } /** * List the files and folders captured in a snapshot, with sizes. Returns a flat list of entries you can render as a tree. * Get snapshot file tree */ async getSnapshotTreeRaw(requestParameters: GetSnapshotTreeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.getSnapshotTreeRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => SnapshotTreeResponseFromJSON(jsonValue)); } /** * List the files and folders captured in a snapshot, with sizes. Returns a flat list of entries you can render as a tree. * Get snapshot file tree */ async getSnapshotTree(requestParameters: GetSnapshotTreeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getSnapshotTreeRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for getWebhook without sending the request */ async getWebhookRequestOpts(requestParameters: GetWebhookRequest): Promise { if (requestParameters['webhookId'] == null) { throw new runtime.RequiredError( 'webhookId', 'Required parameter "webhookId" was null or undefined when calling getWebhook().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/webhooks/{webhookId}`; urlPath = urlPath.replace('{webhookId}', encodeURIComponent(String(requestParameters['webhookId']))); return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }; } /** * Returns webhook metadata without the signing secret. * Get webhook */ async getWebhookRaw(requestParameters: GetWebhookRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.getWebhookRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => WebhookResponseFromJSON(jsonValue)); } /** * Returns webhook metadata without the signing secret. * Get webhook */ async getWebhook(requestParameters: GetWebhookRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getWebhookRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for hostPort without sending the request */ async hostPortRequestOpts(requestParameters: HostPortOperationRequest): Promise { if (requestParameters['boxId'] == null) { throw new runtime.RequiredError( 'boxId', 'Required parameter "boxId" was null or undefined when calling hostPort().' ); } if (requestParameters['hostPortRequest'] == null) { throw new runtime.RequiredError( 'hostPortRequest', 'Required parameter "hostPortRequest" was null or undefined when calling hostPort().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/boxes/{boxId}/host`; urlPath = urlPath.replace('{boxId}', encodeURIComponent(String(requestParameters['boxId']))); return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: HostPortRequestToJSON(requestParameters['hostPortRequest']), }; } /** * Registers a stable `https://-.on.ascii.dev` route for a port inside the Boat and opens the Boat firewall for it. Idempotent: calling it again for the same Boat and port returns the same URL and token. * Expose a box port on a public HTTPS URL */ async hostPortRaw(requestParameters: HostPortOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.hostPortRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => HostPortResponseFromJSON(jsonValue)); } /** * Registers a stable `https://-.on.ascii.dev` route for a port inside the Boat and opens the Boat firewall for it. Idempotent: calling it again for the same Boat and port returns the same URL and token. * Expose a box port on a public HTTPS URL */ async hostPort(requestParameters: HostPortOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.hostPortRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for interrupt without sending the request */ async interruptRequestOpts(requestParameters: InterruptRequest): Promise { if (requestParameters['boxId'] == null) { throw new runtime.RequiredError( 'boxId', 'Required parameter "boxId" was null or undefined when calling interrupt().' ); } const queryParameters: any = {}; if (requestParameters['conversation'] != null) { queryParameters['conversation'] = requestParameters['conversation']; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/boxes/{boxId}/interrupt`; urlPath = urlPath.replace('{boxId}', encodeURIComponent(String(requestParameters['boxId']))); return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, }; } /** * Interrupt running agent work. By default this stops **every** conversation on the Box. Pass `conversation` to stop just one, leaving the others running. See [Integrated agents](/box/integrated-agents). * Interrupt running work */ async interruptRaw(requestParameters: InterruptRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.interruptRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => BoxActionResponseFromJSON(jsonValue)); } /** * Interrupt running agent work. By default this stops **every** conversation on the Box. Pass `conversation` to stop just one, leaving the others running. See [Integrated agents](/box/integrated-agents). * Interrupt running work */ async interrupt(requestParameters: InterruptRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.interruptRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for limits without sending the request */ async limitsRequestOpts(requestParameters: LimitsRequest): Promise { const queryParameters: any = {}; if (requestParameters['org'] != null) { queryParameters['org'] = requestParameters['org']; } if (requestParameters['teamId'] != null) { queryParameters['teamId'] = requestParameters['teamId']; } const headerParameters: runtime.HTTPHeaders = {}; if (requestParameters['xBoxOrg'] != null) { headerParameters['X-Box-Org'] = String(requestParameters['xBoxOrg']); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/limits`; return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }; } /** * Check remaining machine starts, compute time, credits, access readiness, and concurrent-box capacity for the authenticated account. Pass `org` / `X-Box-Org` (or `teamId`) to read a team wallet you belong to. * Get Boat limits */ async limitsRaw(requestParameters: LimitsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.limitsRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => LimitsResponseFromJSON(jsonValue)); } /** * Check remaining machine starts, compute time, credits, access readiness, and concurrent-box capacity for the authenticated account. Pass `org` / `X-Box-Org` (or `teamId`) to read a team wallet you belong to. * Get Boat limits */ async limits(requestParameters: LimitsRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.limitsRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for listBoxSnapshots without sending the request */ async listBoxSnapshotsRequestOpts(requestParameters: ListBoxSnapshotsRequest): Promise { if (requestParameters['boxId'] == null) { throw new runtime.RequiredError( 'boxId', 'Required parameter "boxId" was null or undefined when calling listBoxSnapshots().' ); } const queryParameters: any = {}; if (requestParameters['limit'] != null) { queryParameters['limit'] = requestParameters['limit']; } if (requestParameters['cursor'] != null) { queryParameters['cursor'] = requestParameters['cursor']; } if (requestParameters['sort'] != null) { queryParameters['sort'] = requestParameters['sort']; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/boxes/{boxId}/snapshots`; urlPath = urlPath.replace('{boxId}', encodeURIComponent(String(requestParameters['boxId']))); return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }; } /** * List visible completed snapshots for one Box with uncapped cursor pagination. * List box snapshots */ async listBoxSnapshotsRaw(requestParameters: ListBoxSnapshotsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.listBoxSnapshotsRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => SnapshotListResponseFromJSON(jsonValue)); } /** * List visible completed snapshots for one Box with uncapped cursor pagination. * List box snapshots */ async listBoxSnapshots(requestParameters: ListBoxSnapshotsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.listBoxSnapshotsRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for listNamedSnapshots without sending the request */ async listNamedSnapshotsRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/named-snapshots`; return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }; } /** * List your named snapshots, newest first. * List named snapshots */ async listNamedSnapshotsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.listNamedSnapshotsRequestOpts(); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => NamedSnapshotListResponseFromJSON(jsonValue)); } /** * List your named snapshots, newest first. * List named snapshots */ async listNamedSnapshots(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.listNamedSnapshotsRaw(initOverrides); return await response.value(); } /** * Creates request options for listSnapshots without sending the request */ async listSnapshotsRequestOpts(requestParameters: ListSnapshotsRequest): Promise { const queryParameters: any = {}; if (requestParameters['limit'] != null) { queryParameters['limit'] = requestParameters['limit']; } if (requestParameters['cursor'] != null) { queryParameters['cursor'] = requestParameters['cursor']; } if (requestParameters['sort'] != null) { queryParameters['sort'] = requestParameters['sort']; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/snapshots`; return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }; } /** * List visible completed snapshots across all of your boxes using immutable ownership attribution. Pinned, deletion-scheduled, and privacy-fenced Box snapshots are omitted. Follow `nextCursor` through the complete history; there is no hidden 500-snapshot cap. * List snapshots */ async listSnapshotsRaw(requestParameters: ListSnapshotsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.listSnapshotsRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => SnapshotListResponseFromJSON(jsonValue)); } /** * List visible completed snapshots across all of your boxes using immutable ownership attribution. Pinned, deletion-scheduled, and privacy-fenced Box snapshots are omitted. Follow `nextCursor` through the complete history; there is no hidden 500-snapshot cap. * List snapshots */ async listSnapshots(requestParameters: ListSnapshotsRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.listSnapshotsRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for listWebhooks without sending the request */ async listWebhooksRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/webhooks`; return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }; } /** * Lists account-wide Boat lifecycle webhook endpoints. Signing secrets are never included. * List webhooks */ async listWebhooksRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.listWebhooksRequestOpts(); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => WebhookListResponseFromJSON(jsonValue)); } /** * Lists account-wide Boat lifecycle webhook endpoints. Signing secrets are never included. * List webhooks */ async listWebhooks(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.listWebhooksRaw(initOverrides); return await response.value(); } /** * Creates request options for me without sending the request */ async meRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/me`; return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }; } /** * Returns GitHub identity for the authenticated Boat account. * Get current Boat user */ async meRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.meRequestOpts(); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => MeResponseFromJSON(jsonValue)); } /** * Returns GitHub identity for the authenticated Boat account. * Get current Boat user */ async me(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.meRaw(initOverrides); return await response.value(); } /** * Creates request options for prompt without sending the request */ async promptRequestOpts(requestParameters: PromptOperationRequest): Promise { if (requestParameters['boxId'] == null) { throw new runtime.RequiredError( 'boxId', 'Required parameter "boxId" was null or undefined when calling prompt().' ); } if (requestParameters['promptRequest'] == null) { throw new runtime.RequiredError( 'promptRequest', 'Required parameter "promptRequest" was null or undefined when calling prompt().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/boxes/{boxId}/prompt`; urlPath = urlPath.replace('{boxId}', encodeURIComponent(String(requestParameters['boxId']))); return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: PromptRequestToJSON(requestParameters['promptRequest']), }; } /** * Queue a natural-language work item for an agent harness (Codex, Claude Code, pi, OpenCode, or Prime Agent) inside the box. Observe progress with `GET /boxes/{boxId}/events`. A Box runs many conversations in parallel. Set `new: true` to start a fresh one, `conversationId` to continue a specific one, or omit both to continue the most-recently-active conversation; the response returns the `conversationId`. See [Integrated agents](/box/integrated-agents). * Prompt Boat */ async promptRaw(requestParameters: PromptOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.promptRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => PromptResponseFromJSON(jsonValue)); } /** * Queue a natural-language work item for an agent harness (Codex, Claude Code, pi, OpenCode, or Prime Agent) inside the box. Observe progress with `GET /boxes/{boxId}/events`. A Box runs many conversations in parallel. Set `new: true` to start a fresh one, `conversationId` to continue a specific one, or omit both to continue the most-recently-active conversation; the response returns the `conversationId`. See [Integrated agents](/box/integrated-agents). * Prompt Boat */ async prompt(requestParameters: PromptOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.promptRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for promptRunStatus without sending the request */ async promptRunStatusRequestOpts(requestParameters: PromptRunStatusRequest): Promise { if (requestParameters['boxId'] == null) { throw new runtime.RequiredError( 'boxId', 'Required parameter "boxId" was null or undefined when calling promptRunStatus().' ); } if (requestParameters['promptId'] == null) { throw new runtime.RequiredError( 'promptId', 'Required parameter "promptId" was null or undefined when calling promptRunStatus().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/boxes/{boxId}/prompts/{promptId}`; urlPath = urlPath.replace('{boxId}', encodeURIComponent(String(requestParameters['boxId']))); urlPath = urlPath.replace('{promptId}', encodeURIComponent(String(requestParameters['promptId']))); return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }; } /** * Returns first-class status for a queued/running/finished prompt so clients do not infer completion from box state and events. * Get prompt run status */ async promptRunStatusRaw(requestParameters: PromptRunStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.promptRunStatusRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => PromptRunResponseFromJSON(jsonValue)); } /** * Returns first-class status for a queued/running/finished prompt so clients do not infer completion from box state and events. * Get prompt run status */ async promptRunStatus(requestParameters: PromptRunStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.promptRunStatusRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for readFile without sending the request */ async readFileRequestOpts(requestParameters: ReadFileRequest): Promise { if (requestParameters['boxId'] == null) { throw new runtime.RequiredError( 'boxId', 'Required parameter "boxId" was null or undefined when calling readFile().' ); } if (requestParameters['path'] == null) { throw new runtime.RequiredError( 'path', 'Required parameter "path" was null or undefined when calling readFile().' ); } const queryParameters: any = {}; if (requestParameters['path'] != null) { queryParameters['path'] = requestParameters['path']; } if (requestParameters['encoding'] != null) { queryParameters['encoding'] = requestParameters['encoding']; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/boxes/{boxId}/files`; urlPath = urlPath.replace('{boxId}', encodeURIComponent(String(requestParameters['boxId']))); return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }; } /** * Read a file from a Boat */ async readFileRaw(requestParameters: ReadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.readFileRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => FileReadResponseFromJSON(jsonValue)); } /** * Read a file from a Boat */ async readFile(requestParameters: ReadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.readFileRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for repos without sending the request */ async reposRequestOpts(requestParameters: ReposRequest): Promise { const queryParameters: any = {}; if (requestParameters['sync'] != null) { queryParameters['sync'] = requestParameters['sync']; } if (requestParameters['limit'] != null) { queryParameters['limit'] = requestParameters['limit']; } if (requestParameters['cursor'] != null) { queryParameters['cursor'] = requestParameters['cursor']; } if (requestParameters['sort'] != null) { queryParameters['sort'] = requestParameters['sort']; } if (requestParameters['q'] != null) { queryParameters['q'] = requestParameters['q']; } if (requestParameters['selected'] != null) { queryParameters['selected'] = requestParameters['selected']; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/repos`; return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }; } /** * Returns GitHub repositories grouped by installation plus the current selected repositories for new Boxes. * List GitHub repositories available to Boat */ async reposRaw(requestParameters: ReposRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.reposRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ReposResponseFromJSON(jsonValue)); } /** * Returns GitHub repositories grouped by installation plus the current selected repositories for new Boxes. * List GitHub repositories available to Boat */ async repos(requestParameters: ReposRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.reposRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for resume without sending the request */ async resumeRequestOpts(requestParameters: ResumeOperationRequest): Promise { if (requestParameters['boxId'] == null) { throw new runtime.RequiredError( 'boxId', 'Required parameter "boxId" was null or undefined when calling resume().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/boxes/{boxId}/resume`; urlPath = urlPath.replace('{boxId}', encodeURIComponent(String(requestParameters['boxId']))); return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: ResumeRequestToJSON(requestParameters['resumeRequest']), }; } /** * Resume box */ async resumeRaw(requestParameters: ResumeOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.resumeRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => BoxActionResponseFromJSON(jsonValue)); } /** * Resume box */ async resume(requestParameters: ResumeOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.resumeRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for revokeApiKey without sending the request */ async revokeApiKeyRequestOpts(requestParameters: RevokeApiKeyRequest): Promise { if (requestParameters['apiKeyId'] == null) { throw new runtime.RequiredError( 'apiKeyId', 'Required parameter "apiKeyId" was null or undefined when calling revokeApiKey().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/api-keys/{apiKeyId}`; urlPath = urlPath.replace('{apiKeyId}', encodeURIComponent(String(requestParameters['apiKeyId']))); return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, }; } /** * Revokes the key immediately. Requires a dashboard or CLI session. * Revoke an API key */ async revokeApiKeyRaw(requestParameters: RevokeApiKeyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.revokeApiKeyRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiKeyRevokeResponseFromJSON(jsonValue)); } /** * Revokes the key immediately. Requires a dashboard or CLI session. * Revoke an API key */ async revokeApiKey(requestParameters: RevokeApiKeyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.revokeApiKeyRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for rotateApiKey without sending the request */ async rotateApiKeyRequestOpts(requestParameters: RotateApiKeyRequest): Promise { if (requestParameters['apiKeyId'] == null) { throw new runtime.RequiredError( 'apiKeyId', 'Required parameter "apiKeyId" was null or undefined when calling rotateApiKey().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/api-keys/{apiKeyId}/rotate`; urlPath = urlPath.replace('{apiKeyId}', encodeURIComponent(String(requestParameters['apiKeyId']))); return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, }; } /** * Replaces the raw secret without changing expiry or scope. Requires a dashboard or CLI session. * Rotate an API key */ async rotateApiKeyRaw(requestParameters: RotateApiKeyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.rotateApiKeyRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiKeySecretResponseFromJSON(jsonValue)); } /** * Replaces the raw secret without changing expiry or scope. Requires a dashboard or CLI session. * Rotate an API key */ async rotateApiKey(requestParameters: RotateApiKeyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.rotateApiKeyRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for rotateWebhookSigningSecret without sending the request */ async rotateWebhookSigningSecretRequestOpts(requestParameters: RotateWebhookSigningSecretRequest): Promise { if (requestParameters['webhookId'] == null) { throw new runtime.RequiredError( 'webhookId', 'Required parameter "webhookId" was null or undefined when calling rotateWebhookSigningSecret().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/webhooks/{webhookId}/rotate`; urlPath = urlPath.replace('{webhookId}', encodeURIComponent(String(requestParameters['webhookId']))); return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, }; } /** * Replaces the endpoint\'s signing secret. The new secret is returned only in this response; briefly accept the old secret for attempts already in flight. * Rotate webhook signing secret */ async rotateWebhookSigningSecretRaw(requestParameters: RotateWebhookSigningSecretRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.rotateWebhookSigningSecretRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => WebhookSecretResponseFromJSON(jsonValue)); } /** * Replaces the endpoint\'s signing secret. The new secret is returned only in this response; briefly accept the old secret for attempts already in flight. * Rotate webhook signing secret */ async rotateWebhookSigningSecret(requestParameters: RotateWebhookSigningSecretRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.rotateWebhookSigningSecretRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for saveNamedSnapshot without sending the request */ async saveNamedSnapshotRequestOpts(requestParameters: SaveNamedSnapshotRequest): Promise { if (requestParameters['namedSnapshotSaveRequest'] == null) { throw new runtime.RequiredError( 'namedSnapshotSaveRequest', 'Required parameter "namedSnapshotSaveRequest" was null or undefined when calling saveNamedSnapshot().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/named-snapshots`; return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: NamedSnapshotSaveRequestToJSON(requestParameters['namedSnapshotSaveRequest']), }; } /** * Freeze a box\'s current state under a name (`box snapshot ` in the CLI). Answers `202` immediately with the snapshot in `saving`; a running box takes a fresh capture first, which can run minutes. Poll `GET /named-snapshots/{name}` until the status settles at `ready` or `failed`. Reusing one of your existing names replaces that snapshot\'s artifact once the new save is ready. * Save a named snapshot */ async saveNamedSnapshotRaw(requestParameters: SaveNamedSnapshotRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.saveNamedSnapshotRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => NamedSnapshotSavingResponseFromJSON(jsonValue)); } /** * Freeze a box\'s current state under a name (`box snapshot ` in the CLI). Answers `202` immediately with the snapshot in `saving`; a running box takes a fresh capture first, which can run minutes. Poll `GET /named-snapshots/{name}` until the status settles at `ready` or `failed`. Reusing one of your existing names replaces that snapshot\'s artifact once the new save is ready. * Save a named snapshot */ async saveNamedSnapshot(requestParameters: SaveNamedSnapshotRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.saveNamedSnapshotRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for secrets without sending the request */ async secretsRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/secrets`; return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }; } /** * Returns the environment variables and secret files configured for Boxes. * Get Boat secrets setup */ async secretsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.secretsRequestOpts(); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => SecretsResponseFromJSON(jsonValue)); } /** * Returns the environment variables and secret files configured for Boxes. * Get Boat secrets setup */ async secrets(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.secretsRaw(initOverrides); return await response.value(); } /** * Creates request options for selectRepo without sending the request */ async selectRepoRequestOpts(requestParameters: SelectRepoRequest): Promise { if (requestParameters['repoSelectionRequest'] == null) { throw new runtime.RequiredError( 'repoSelectionRequest', 'Required parameter "repoSelectionRequest" was null or undefined when calling selectRepo().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/repos`; return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: RepoSelectionRequestToJSON(requestParameters['repoSelectionRequest']), }; } /** * Idempotently selects one repository for the Boat environment. Use `databaseId` from `GET /repos` as `repositoryId`; selecting an already-selected repository updates its `baseBranch`. * Select repository for boxes */ async selectRepoRaw(requestParameters: SelectRepoRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.selectRepoRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => RepoSelectionResponseFromJSON(jsonValue)); } /** * Idempotently selects one repository for the Boat environment. Use `databaseId` from `GET /repos` as `repositoryId`; selecting an already-selected repository updates its `baseBranch`. * Select repository for boxes */ async selectRepo(requestParameters: SelectRepoRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.selectRepoRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for setEnvironmentSecretFile without sending the request */ async setEnvironmentSecretFileRequestOpts(requestParameters: SetEnvironmentSecretFileOperationRequest): Promise { if (requestParameters['environmentId'] == null) { throw new runtime.RequiredError( 'environmentId', 'Required parameter "environmentId" was null or undefined when calling setEnvironmentSecretFile().' ); } if (requestParameters['setEnvironmentSecretFileRequest'] == null) { throw new runtime.RequiredError( 'setEnvironmentSecretFileRequest', 'Required parameter "setEnvironmentSecretFileRequest" was null or undefined when calling setEnvironmentSecretFile().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/environments/{environmentId}/secret-files`; urlPath = urlPath.replace('{environmentId}', encodeURIComponent(String(requestParameters['environmentId']))); return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: SetEnvironmentSecretFileRequestToJSON(requestParameters['setEnvironmentSecretFileRequest']), }; } /** * Adds or replaces a single secret file by path. Mints a new immutable version. * Write one secret file */ async setEnvironmentSecretFileRaw(requestParameters: SetEnvironmentSecretFileOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.setEnvironmentSecretFileRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EnvironmentItemChangeResponseFromJSON(jsonValue)); } /** * Adds or replaces a single secret file by path. Mints a new immutable version. * Write one secret file */ async setEnvironmentSecretFile(requestParameters: SetEnvironmentSecretFileOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.setEnvironmentSecretFileRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for setEnvironmentVar without sending the request */ async setEnvironmentVarRequestOpts(requestParameters: SetEnvironmentVarOperationRequest): Promise { if (requestParameters['environmentId'] == null) { throw new runtime.RequiredError( 'environmentId', 'Required parameter "environmentId" was null or undefined when calling setEnvironmentVar().' ); } if (requestParameters['key'] == null) { throw new runtime.RequiredError( 'key', 'Required parameter "key" was null or undefined when calling setEnvironmentVar().' ); } if (requestParameters['setEnvironmentVarRequest'] == null) { throw new runtime.RequiredError( 'setEnvironmentVarRequest', 'Required parameter "setEnvironmentVarRequest" was null or undefined when calling setEnvironmentVar().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/environments/{environmentId}/vars/{key}`; urlPath = urlPath.replace('{environmentId}', encodeURIComponent(String(requestParameters['environmentId']))); urlPath = urlPath.replace('{key}', encodeURIComponent(String(requestParameters['key']))); return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: SetEnvironmentVarRequestToJSON(requestParameters['setEnvironmentVarRequest']), }; } /** * Sets or replaces a single variable without reading or rewriting the rest. Mints a new immutable version. * Set one environment variable */ async setEnvironmentVarRaw(requestParameters: SetEnvironmentVarOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.setEnvironmentVarRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EnvironmentItemChangeResponseFromJSON(jsonValue)); } /** * Sets or replaces a single variable without reading or rewriting the rest. Mints a new immutable version. * Set one environment variable */ async setEnvironmentVar(requestParameters: SetEnvironmentVarOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.setEnvironmentVarRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for sshKey without sending the request */ async sshKeyRequestOpts(requestParameters: SshKeyOperationRequest): Promise { if (requestParameters['boxId'] == null) { throw new runtime.RequiredError( 'boxId', 'Required parameter "boxId" was null or undefined when calling sshKey().' ); } if (requestParameters['sshKeyRequest'] == null) { throw new runtime.RequiredError( 'sshKeyRequest', 'Required parameter "sshKeyRequest" was null or undefined when calling sshKey().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/boxes/{boxId}/sshkey`; urlPath = urlPath.replace('{boxId}', encodeURIComponent(String(requestParameters['boxId']))); return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: SshKeyRequestToJSON(requestParameters['sshKeyRequest']), }; } /** * Adds an OpenSSH public key to the running Boat so the caller can SSH as user `user`. The response carries `machineIp`, which is the host to connect to on port 22. This is also how you reach your own machine from inside a Box without the CLI: authorize the key, then open a reverse tunnel with stock OpenSSH, and a port on your machine answers at `127.0.0.1:` inside the Box for as long as the ssh process runs. ```bash ssh -o ExitOnForwardFailure=yes -i ~/.ssh/id_ed25519 -N -R 7777:127.0.0.1:7777 user@ ``` `box forward --reverse --local 7777` is the same tunnel with the key handling and redial done for you. * Configure box SSH key */ async sshKeyRaw(requestParameters: SshKeyOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.sshKeyRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => SshKeyResponseFromJSON(jsonValue)); } /** * Adds an OpenSSH public key to the running Boat so the caller can SSH as user `user`. The response carries `machineIp`, which is the host to connect to on port 22. This is also how you reach your own machine from inside a Box without the CLI: authorize the key, then open a reverse tunnel with stock OpenSSH, and a port on your machine answers at `127.0.0.1:` inside the Box for as long as the ssh process runs. ```bash ssh -o ExitOnForwardFailure=yes -i ~/.ssh/id_ed25519 -N -R 7777:127.0.0.1:7777 user@ ``` `box forward --reverse --local 7777` is the same tunnel with the key handling and redial done for you. * Configure box SSH key */ async sshKey(requestParameters: SshKeyOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.sshKeyRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for steer without sending the request */ async steerRequestOpts(requestParameters: SteerOperationRequest): Promise { if (requestParameters['boxId'] == null) { throw new runtime.RequiredError( 'boxId', 'Required parameter "boxId" was null or undefined when calling steer().' ); } if (requestParameters['steerRequest'] == null) { throw new runtime.RequiredError( 'steerRequest', 'Required parameter "steerRequest" was null or undefined when calling steer().' ); } const queryParameters: any = {}; if (requestParameters['conversation'] != null) { queryParameters['conversation'] = requestParameters['conversation']; } const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/boxes/{boxId}/steer`; urlPath = urlPath.replace('{boxId}', encodeURIComponent(String(requestParameters['boxId']))); return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: SteerRequestToJSON(requestParameters['steerRequest']), }; } /** * Send a new message to a turn that is already running, without losing what the agent is doing. This is what typing into a coding agent while it works does: the instruction is taken into account and the work continues. Where the harness has a native mid-turn primitive (Claude Code, Codex, pi, Prime Agent) nothing is interrupted and the response has `native: true`. Where it does not (OpenCode), Box interrupts that turn and immediately continues the SAME conversation with the instruction, keeping the session and its memory, and the response has `native: false`. Refused with **409 `no_running_turn`** when the conversation has nothing in flight; queue work with `POST /prompt` instead. The steer shows up in `GET /events` as a `steer` event. See [Integrated agents](/box/integrated-agents). * Steer a running turn */ async steerRaw(requestParameters: SteerOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.steerRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => SteerResponseFromJSON(jsonValue)); } /** * Send a new message to a turn that is already running, without losing what the agent is doing. This is what typing into a coding agent while it works does: the instruction is taken into account and the work continues. Where the harness has a native mid-turn primitive (Claude Code, Codex, pi, Prime Agent) nothing is interrupted and the response has `native: true`. Where it does not (OpenCode), Box interrupts that turn and immediately continues the SAME conversation with the instruction, keeping the session and its memory, and the response has `native: false`. Refused with **409 `no_running_turn`** when the conversation has nothing in flight; queue work with `POST /prompt` instead. The steer shows up in `GET /events` as a `steer` event. See [Integrated agents](/box/integrated-agents). * Steer a running turn */ async steer(requestParameters: SteerOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.steerRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for stop without sending the request */ async stopRequestOpts(requestParameters: StopOperationRequest): Promise { if (requestParameters['boxId'] == null) { throw new runtime.RequiredError( 'boxId', 'Required parameter "boxId" was null or undefined when calling stop().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/boxes/{boxId}/stop`; urlPath = urlPath.replace('{boxId}', encodeURIComponent(String(requestParameters['boxId']))); return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: StopRequestToJSON(requestParameters['stopRequest']), }; } /** * Stop active work and archive/snapshot the box for later resume or fork. A stop always saves the box\'s disk first. If that save is failing, the stop is refused and the box keeps running so your work is not discarded, we retry automatically and email you. You are not billed for time spent in that state. Set `force: true` to stop anyway, accepting the loss of everything written since the last successful snapshot. This is irreversible; only reach for it after a stop has already failed. * Stop and archive box */ async stopRaw(requestParameters: StopOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.stopRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => BoxActionResponseFromJSON(jsonValue)); } /** * Stop active work and archive/snapshot the box for later resume or fork. A stop always saves the box\'s disk first. If that save is failing, the stop is refused and the box keeps running so your work is not discarded, we retry automatically and email you. You are not billed for time spent in that state. Set `force: true` to stop anyway, accepting the loss of everything written since the last successful snapshot. This is irreversible; only reach for it after a stop has already failed. * Stop and archive box */ async stop(requestParameters: StopOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.stopRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for update without sending the request */ async updateRequestOpts(requestParameters: UpdateRequest): Promise { if (requestParameters['boxId'] == null) { throw new runtime.RequiredError( 'boxId', 'Required parameter "boxId" was null or undefined when calling update().' ); } if (requestParameters['updateBoxRequest'] == null) { throw new runtime.RequiredError( 'updateBoxRequest', 'Required parameter "updateBoxRequest" was null or undefined when calling update().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/boxes/{boxId}`; urlPath = urlPath.replace('{boxId}', encodeURIComponent(String(requestParameters['boxId']))); return { path: urlPath, method: 'PATCH', headers: headerParameters, query: queryParameters, body: UpdateBoxRequestToJSON(requestParameters['updateBoxRequest']), }; } /** * Update box */ async updateRaw(requestParameters: UpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.updateRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => BoxInfoResponseFromJSON(jsonValue)); } /** * Update box */ async update(requestParameters: UpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.updateRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for updateDataRetention without sending the request */ async updateDataRetentionRequestOpts(requestParameters: UpdateDataRetentionRequest): Promise { if (requestParameters['dataRetentionUpdateRequest'] == null) { throw new runtime.RequiredError( 'dataRetentionUpdateRequest', 'Required parameter "dataRetentionUpdateRequest" was null or undefined when calling updateDataRetention().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/account/data-retention`; return { path: urlPath, method: 'PATCH', headers: headerParameters, query: queryParameters, body: DataRetentionUpdateRequestToJSON(requestParameters['dataRetentionUpdateRequest']), }; } /** * Requires an interactive Boat session; API keys and legacy permanent tokens are refused. Enabling requires the exact confirmation phrase `delete archived box data`. Disabling affects future archives only and cannot cancel deletion operations already accepted. * Update account data-retention policy */ async updateDataRetentionRaw(requestParameters: UpdateDataRetentionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.updateDataRetentionRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DataRetentionPolicyResponseFromJSON(jsonValue)); } /** * Requires an interactive Boat session; API keys and legacy permanent tokens are refused. Enabling requires the exact confirmation phrase `delete archived box data`. Disabling affects future archives only and cannot cancel deletion operations already accepted. * Update account data-retention policy */ async updateDataRetention(requestParameters: UpdateDataRetentionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.updateDataRetentionRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for updateEnvironment without sending the request */ async updateEnvironmentRequestOpts(requestParameters: UpdateEnvironmentRequest): Promise { if (requestParameters['environmentId'] == null) { throw new runtime.RequiredError( 'environmentId', 'Required parameter "environmentId" was null or undefined when calling updateEnvironment().' ); } if (requestParameters['updateBoxEnvironmentRequest'] == null) { throw new runtime.RequiredError( 'updateBoxEnvironmentRequest', 'Required parameter "updateBoxEnvironmentRequest" was null or undefined when calling updateEnvironment().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/environments/{environmentId}`; urlPath = urlPath.replace('{environmentId}', encodeURIComponent(String(requestParameters['environmentId']))); return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: UpdateBoxEnvironmentRequestToJSON(requestParameters['updateBoxEnvironmentRequest']), }; } /** * Rename, set as default, and/or edit flags and contents. Any flag or content change mints a new immutable version; existing boxes stay on their pinned version until you call upgrade. * Update a Boat environment */ async updateEnvironmentRaw(requestParameters: UpdateEnvironmentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.updateEnvironmentRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => BoxEnvironmentResponseFromJSON(jsonValue)); } /** * Rename, set as default, and/or edit flags and contents. Any flag or content change mints a new immutable version; existing boxes stay on their pinned version until you call upgrade. * Update a Boat environment */ async updateEnvironment(requestParameters: UpdateEnvironmentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.updateEnvironmentRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for updateSecrets without sending the request */ async updateSecretsRequestOpts(requestParameters: UpdateSecretsRequest): Promise { if (requestParameters['secretsUpdateRequest'] == null) { throw new runtime.RequiredError( 'secretsUpdateRequest', 'Required parameter "secretsUpdateRequest" was null or undefined when calling updateSecrets().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/secrets`; return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: SecretsUpdateRequestToJSON(requestParameters['secretsUpdateRequest']), }; } /** * Update Boat secrets setup */ async updateSecretsRaw(requestParameters: UpdateSecretsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.updateSecretsRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => SecretsResponseFromJSON(jsonValue)); } /** * Update Boat secrets setup */ async updateSecrets(requestParameters: UpdateSecretsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.updateSecretsRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for updateWebhook without sending the request */ async updateWebhookRequestOpts(requestParameters: UpdateWebhookRequest): Promise { if (requestParameters['webhookId'] == null) { throw new runtime.RequiredError( 'webhookId', 'Required parameter "webhookId" was null or undefined when calling updateWebhook().' ); } if (requestParameters['webhookUpdateRequest'] == null) { throw new runtime.RequiredError( 'webhookUpdateRequest', 'Required parameter "webhookUpdateRequest" was null or undefined when calling updateWebhook().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/webhooks/{webhookId}`; urlPath = urlPath.replace('{webhookId}', encodeURIComponent(String(requestParameters['webhookId']))); return { path: urlPath, method: 'PATCH', headers: headerParameters, query: queryParameters, body: WebhookUpdateRequestToJSON(requestParameters['webhookUpdateRequest']), }; } /** * Updates the name, endpoint URL, or subscribed events without changing the signing secret. * Update webhook */ async updateWebhookRaw(requestParameters: UpdateWebhookRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.updateWebhookRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => WebhookResponseFromJSON(jsonValue)); } /** * Updates the name, endpoint URL, or subscribed events without changing the signing secret. * Update webhook */ async updateWebhook(requestParameters: UpdateWebhookRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.updateWebhookRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for upgradeEnvironment without sending the request */ async upgradeEnvironmentRequestOpts(requestParameters: UpgradeEnvironmentRequest): Promise { if (requestParameters['environmentId'] == null) { throw new runtime.RequiredError( 'environmentId', 'Required parameter "environmentId" was null or undefined when calling upgradeEnvironment().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/environments/{environmentId}/upgrade`; urlPath = urlPath.replace('{environmentId}', encodeURIComponent(String(requestParameters['environmentId']))); return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: UpgradeBoxEnvironmentRequestToJSON(requestParameters['upgradeBoxEnvironmentRequest']), }; } /** * Repoints the caller\'s active boxes from an older version of this environment to its latest version, scrubbing any owner secrets the new version drops and hot-pushing the new config. * Upgrade boxes to an environment\'s latest version */ async upgradeEnvironmentRaw(requestParameters: UpgradeEnvironmentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.upgradeEnvironmentRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => UpgradeBoxEnvironmentResponseFromJSON(jsonValue)); } /** * Repoints the caller\'s active boxes from an older version of this environment to its latest version, scrubbing any owner secrets the new version drops and hot-pushing the new config. * Upgrade boxes to an environment\'s latest version */ async upgradeEnvironment(requestParameters: UpgradeEnvironmentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.upgradeEnvironmentRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for usage without sending the request */ async usageRequestOpts(requestParameters: UsageRequest): Promise { if (requestParameters['boxId'] == null) { throw new runtime.RequiredError( 'boxId', 'Required parameter "boxId" was null or undefined when calling usage().' ); } const queryParameters: any = {}; if (requestParameters['since'] != null) { queryParameters['since'] = requestParameters['since']; } if (requestParameters['until'] != null) { queryParameters['until'] = requestParameters['until']; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/boxes/{boxId}/usage`; urlPath = urlPath.replace('{boxId}', encodeURIComponent(String(requestParameters['boxId']))); return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }; } /** * Machine time one box consumed, and what it costs, so you can bill your own users per box. Same meter as `GET /limits`: billable seconds with the box type\'s multiplier applied, paused past a refused stop, never counting time stopped. Narrow it to a billing period with `since` and `until`; a period boundary that falls inside a running stretch splits that stretch pro rata. Works while the box runs and after it stops. * Get box usage */ async usageRaw(requestParameters: UsageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.usageRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => BoxUsageResponseFromJSON(jsonValue)); } /** * Machine time one box consumed, and what it costs, so you can bill your own users per box. Same meter as `GET /limits`: billable seconds with the box type\'s multiplier applied, paused past a refused stop, never counting time stopped. Narrow it to a billing period with `since` and `until`; a period boundary that falls inside a running stretch splits that stretch pro rata. Works while the box runs and after it stops. * Get box usage */ async usage(requestParameters: UsageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.usageRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for writeFile without sending the request */ async writeFileRequestOpts(requestParameters: WriteFileRequest): Promise { if (requestParameters['boxId'] == null) { throw new runtime.RequiredError( 'boxId', 'Required parameter "boxId" was null or undefined when calling writeFile().' ); } if (requestParameters['fileWriteRequest'] == null) { throw new runtime.RequiredError( 'fileWriteRequest', 'Required parameter "fileWriteRequest" was null or undefined when calling writeFile().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BoxBearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/boxes/{boxId}/files`; urlPath = urlPath.replace('{boxId}', encodeURIComponent(String(requestParameters['boxId']))); return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: FileWriteRequestToJSON(requestParameters['fileWriteRequest']), }; } /** * Write a file in a Boat */ async writeFileRaw(requestParameters: WriteFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.writeFileRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => FileWriteResponseFromJSON(jsonValue)); } /** * Write a file in a Boat */ async writeFile(requestParameters: WriteFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.writeFileRaw(requestParameters, initOverrides); return await response.value(); } } /** * @export */ export const BoxesSortEnum = { Asc: 'asc', Desc: 'desc' } as const; export type BoxesSortEnum = typeof BoxesSortEnum[keyof typeof BoxesSortEnum]; /** * @export */ export const DesktopOperationVncEnum = { NUMBER_1: 1 } as const; export type DesktopOperationVncEnum = typeof DesktopOperationVncEnum[keyof typeof DesktopOperationVncEnum]; /** * @export */ export const DesktopOperationThemeEnum = { Light: 'light', Dark: 'dark' } as const; export type DesktopOperationThemeEnum = typeof DesktopOperationThemeEnum[keyof typeof DesktopOperationThemeEnum]; /** * @export */ export const EventsSortEnum = { Asc: 'asc', Desc: 'desc' } as const; export type EventsSortEnum = typeof EventsSortEnum[keyof typeof EventsSortEnum]; /** * @export */ export const ListBoxSnapshotsSortEnum = { Asc: 'asc', Desc: 'desc' } as const; export type ListBoxSnapshotsSortEnum = typeof ListBoxSnapshotsSortEnum[keyof typeof ListBoxSnapshotsSortEnum]; /** * @export */ export const ListSnapshotsSortEnum = { Asc: 'asc', Desc: 'desc' } as const; export type ListSnapshotsSortEnum = typeof ListSnapshotsSortEnum[keyof typeof ListSnapshotsSortEnum]; /** * @export */ export const ReadFileEncodingEnum = { Utf8: 'utf8', Base64: 'base64' } as const; export type ReadFileEncodingEnum = typeof ReadFileEncodingEnum[keyof typeof ReadFileEncodingEnum]; /** * @export */ export const ReposSortEnum = { Asc: 'asc', Desc: 'desc' } as const; export type ReposSortEnum = typeof ReposSortEnum[keyof typeof ReposSortEnum];