UNPKG

@codesandbox/sdk

Version:
205 lines (204 loc) 12.3 kB
import type { Options as ClientOptions, TDataShape, Client } from "@hey-api/client-fetch"; import type { MetaInfoData, WorkspaceCreateData, TokenCreateData, TokenUpdateData, SandboxListData, SandboxCreateData, SandboxGetData, SandboxForkData, PreviewTokenRevokeAllData, PreviewTokenListData, PreviewTokenCreateData, PreviewTokenUpdateData, TemplatesCreateData, VmAssignTagAliasData, VmListClustersData, VmListRunningVmsData, VmCreateTagData, VmHibernateData, VmUpdateHibernationTimeoutData, VmCreateSessionData, VmShutdownData, VmUpdateSpecsData, VmStartData, VmUpdateSpecs2Data, PreviewHostListData, PreviewHostCreateData, PreviewHostUpdateData } from "./types.gen"; export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & { /** * You can provide a client instance returned by `createClient()` instead of * individual options. This might be also useful if you want to implement a * custom client. */ client?: Client; }; /** * Metadata about the API */ export declare const metaInfo: <ThrowOnError extends boolean = false>(options?: Options<MetaInfoData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").MetaInformation, unknown, ThrowOnError>; /** * Create a Workspace * Create a new, empty, workspace in the current organization * */ export declare const workspaceCreate: <ThrowOnError extends boolean = false>(options?: Options<WorkspaceCreateData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").WorkspaceCreateResponse, unknown, ThrowOnError>; /** * Create an API Token * Create a new API token for a workspace that is part of the current organization. * */ export declare const tokenCreate: <ThrowOnError extends boolean = false>(options: Options<TokenCreateData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").TokenCreateResponse, unknown, ThrowOnError>; /** * Update an API Token * Update an API token for a workspace that is part of the current organization. * */ export declare const tokenUpdate: <ThrowOnError extends boolean = false>(options: Options<TokenUpdateData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").TokenUpdateResponse, unknown, ThrowOnError>; /** * List Sandboxes * List sandboxes from the current workspace with optional filters. * Results are limited to a maximum of 50 sandboxes per request. * */ export declare const sandboxList: <ThrowOnError extends boolean = false>(options?: Options<SandboxListData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").SandboxListResponse, unknown, ThrowOnError>; /** * Create a Sandbox * Create a new sandbox in the current workspace with file contents * */ export declare const sandboxCreate: <ThrowOnError extends boolean = false>(options?: Options<SandboxCreateData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").SandboxCreateResponse, unknown, ThrowOnError>; /** * Get a Sandbox * Retrieve a sandbox by its ID * */ export declare const sandboxGet: <ThrowOnError extends boolean = false>(options: Options<SandboxGetData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").SandboxGetResponse, unknown, ThrowOnError>; /** * Fork a Sandbox * Fork an existing sandbox to the current workspace * */ export declare const sandboxFork: <ThrowOnError extends boolean = false>(options: Options<SandboxForkData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").SandboxForkResponse, unknown, ThrowOnError>; /** * Revoke preview tokens * Immediately expires all active preview tokens associated with this sandbox * */ export declare const previewTokenRevokeAll: <ThrowOnError extends boolean = false>(options: Options<PreviewTokenRevokeAllData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").PreviewTokenRevokeAllResponse, unknown, ThrowOnError>; /** * List Preview Tokens * List information about the preview tokens associated with the current sandbox * */ export declare const previewTokenList: <ThrowOnError extends boolean = false>(options: Options<PreviewTokenListData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").PreviewTokenListResponse, unknown, ThrowOnError>; /** * Create a Preview Token * Create a new Preview token that allow access to a private sandbox * */ export declare const previewTokenCreate: <ThrowOnError extends boolean = false>(options: Options<PreviewTokenCreateData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").PreviewTokenCreateResponse, unknown, ThrowOnError>; /** * Update a Preview Token * Update a Preview token that allow access to a private sandbox * */ export declare const previewTokenUpdate: <ThrowOnError extends boolean = false>(options: Options<PreviewTokenUpdateData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").PreviewTokenUpdateResponse, unknown, ThrowOnError>; /** * Create a template * Create a new template in the current workspace (creates 3 sandboxes and tags them) * */ export declare const templatesCreate: <ThrowOnError extends boolean = false>(options?: Options<TemplatesCreateData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").TemplateCreateResponse, unknown, ThrowOnError>; /** * Assign a tag alias to a VM tag * Assign a tag alias to a VM tag. * */ export declare const vmAssignTagAlias: <ThrowOnError extends boolean = false>(options: Options<VmAssignTagAliasData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").VmAssignTagAliasResponse, unknown, ThrowOnError>; /** * List all available clusters * List all available clusters. * */ export declare const vmListClusters: <ThrowOnError extends boolean = false>(options?: Options<VmListClustersData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").VmListClustersResponse, unknown, ThrowOnError>; /** * List information about currently running VMs * List information about currently running VMs. This information is updated roughly every 30 seconds, so this data is not guaranteed to be perfectly up-to-date. * */ export declare const vmListRunningVms: <ThrowOnError extends boolean = false>(options?: Options<VmListRunningVmsData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").VmListRunningVmsResponse, unknown, ThrowOnError>; /** * Create a new tag for a VM * Creates a new tag for a VM. * */ export declare const vmCreateTag: <ThrowOnError extends boolean = false>(options?: Options<VmCreateTagData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").VmCreateTagResponse, unknown, ThrowOnError>; /** * Hibernate a VM * Suspends a running VM, saving a snapshot of its memory and running processes * * This endpoint may take an extended amount of time to return (30 seconds). If the VM is not * currently running, it will return an error (404). * * Unless later shut down by request or due to inactivity, a hibernated VM can be resumed with * minimal latency. * */ export declare const vmHibernate: <ThrowOnError extends boolean = false>(options: Options<VmHibernateData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").VmHibernateResponse, unknown, ThrowOnError>; /** * Update VM Hibernation Timeout * Updates the hibernation timeout of a running VM. * * This endpoint can only be used on VMs that belong to your team's workspace. * The new timeout must be greater than 0 and less than or equal to 86400 seconds (24 hours). * */ export declare const vmUpdateHibernationTimeout: <ThrowOnError extends boolean = false>(options: Options<VmUpdateHibernationTimeoutData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").VmUpdateHibernationTimeoutResponse, unknown, ThrowOnError>; /** * Create a new session on a VM * Creates a new session on a running VM. A session represents an isolated Linux user, with their own container. * A session has a single use token that the user can use to connect to the VM. This token has specific permissions (currently, read or write). * The session is identified by a unique session ID, and the Linux username is based on the session ID. * * The Git user name and email can be configured via parameters. * * This endpoint requires the VM to be running. If the VM is not running, it will return a 404 error. * */ export declare const vmCreateSession: <ThrowOnError extends boolean = false>(options: Options<VmCreateSessionData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").VmCreateSessionResponse, unknown, ThrowOnError>; /** * Shutdown a VM * Stops a running VM, ending all currently running processes * * This endpoint may take an extended amount of time to return (30 seconds). If the VM is not * currently running, it will return an error (404). * * Shutdown VMs require additional time to start up. * */ export declare const vmShutdown: <ThrowOnError extends boolean = false>(options: Options<VmShutdownData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").VmShutdownResponse, unknown, ThrowOnError>; /** * Update VM Specs * Updates the specifications (CPU, memory, storage) of a running VM. * * This endpoint can only be used on VMs that belong to your team's workspace. * The new tier must not exceed your team's maximum allowed tier. * */ export declare const vmUpdateSpecs: <ThrowOnError extends boolean = false>(options: Options<VmUpdateSpecsData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").VmUpdateSpecsResponse, unknown, ThrowOnError>; /** * Start a VM * Start a virtual machine for the sandbox (devbox) with the given ID * * While the `sandbox:read` scope is required for this endpoint, the resulting VM will have * permissions according to the `sandbox:edit_code` scope. If present, the returned token will * have write permissions to the contents of the VM. Otherwise, the returned token will grant * only read-only permissions. * * This endpoint is subject to special rate limits related to concurrent VM usage. * */ export declare const vmStart: <ThrowOnError extends boolean = false>(options: Options<VmStartData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").VmStartResponse, unknown, ThrowOnError>; /** * Update VM Specs * Updates the specifications (CPU, memory, storage) of a running VM. * * This endpoint can only be used on VMs that belong to your team's workspace. * The new tier must not exceed your team's maximum allowed tier. * */ export declare const vmUpdateSpecs2: <ThrowOnError extends boolean = false>(options: Options<VmUpdateSpecs2Data, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").VmUpdateSpecsResponse, unknown, ThrowOnError>; /** * List Preview Hosts * List all trusted preview hosts for the current team * */ export declare const previewHostList: <ThrowOnError extends boolean = false>(options?: Options<PreviewHostListData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").PreviewHostListResponse, unknown, ThrowOnError>; /** * Create Preview Hosts * Add one or more trusted domains that are allowed to access sandbox previews for this workspace. * */ export declare const previewHostCreate: <ThrowOnError extends boolean = false>(options?: Options<PreviewHostCreateData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").PreviewHostListResponse, unknown, ThrowOnError>; /** * Update Preview Hosts * Replace the list of trusted domains that are allowed to access sandbox previews for this workspace. * */ export declare const previewHostUpdate: <ThrowOnError extends boolean = false>(options?: Options<PreviewHostUpdateData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").PreviewHostListResponse, unknown, ThrowOnError>;