// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../core/resource'; import { APIPromise } from '../../../core/api-promise'; import { RequestOptions } from '../../../internal/request-options'; import { path } from '../../../internal/utils/path'; export class Volumes extends APIResource { /** * Create a new volume to preload files in deployments */ create(body: VolumeCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/deployments/storage/volumes', { body, ...options }); } /** * Retrieve details of a specific volume by its ID or name */ retrieve(id: string, options?: RequestOptions): APIPromise { return this._client.get(path`/deployments/storage/volumes/${id}`, options); } /** * Update an existing volume's configuration or contents */ update(id: string, body: VolumeUpdateParams, options?: RequestOptions): APIPromise { return this._client.patch(path`/deployments/storage/volumes/${id}`, { body, ...options }); } /** * Retrieve all volumes in your project */ list(options?: RequestOptions): APIPromise { return this._client.get('/deployments/storage/volumes', options); } /** * Delete an existing volume */ delete(id: string, options?: RequestOptions): APIPromise { return this._client.delete(path`/deployments/storage/volumes/${id}`, options); } } export interface Volume { /** * ID is the unique identifier for this volume */ id?: string; content?: Volume.Content; /** * CreatedAt is the ISO8601 timestamp when this volume was created */ created_at?: string; /** * CurrentVersion is the current version number of this volume */ current_version?: number; /** * MountedBy is the list of deployment IDs currently mounting current volume * version */ mounted_by?: Array; /** * Name is the name of the volume */ name?: string; /** * Object is the type identifier for this response (always "volume") */ object?: string; type?: 'readOnly'; /** * UpdatedAt is the ISO8601 timestamp when this volume was last updated */ updated_at?: string; /** * VersionHistory contains previous versions of this volume, keyed by version * number */ version_history?: { [key: string]: Volume.VersionHistory }; } export namespace Volume { export interface Content { /** * Files is the list of files that will be preloaded into the volume, if the volume * content type is "files" */ files?: Array; /** * SourcePrefix is the file path prefix for the content to be preloaded into the * volume */ source_prefix?: string; /** * Type is the content type (currently only "files" is supported which allows * preloading files uploaded via Files API into the volume) */ type?: 'files'; } export namespace Content { export interface File { /** * LastModified is the timestamp when the file was last modified */ last_modified?: string; /** * Name is the filename including extension (e.g., "model_weights.bin") */ name?: string; /** * Size is the file size in bytes */ size?: number; } } export interface VersionHistory { /** * Content specifies the new content that will be preloaded to this volume */ content?: VersionHistory.Content; mounted_by?: Array; version?: number; } export namespace VersionHistory { /** * Content specifies the new content that will be preloaded to this volume */ export interface Content { /** * SourcePrefix is the file path prefix for the content to be preloaded into the * volume */ source_prefix?: string; /** * Type is the content type (currently only "files" is supported which allows * preloading files uploaded via Files API into the volume) */ type?: 'files'; } } } export interface VolumeListResponse { /** * Data is the array of volume items */ data?: Array; /** * The object type, which is always `list`. */ object?: 'list'; } export type VolumeDeleteResponse = unknown; export interface VolumeCreateParams { /** * Content specifies the new content that will be preloaded to this volume */ content: VolumeCreateParams.Content; /** * Name is the unique identifier for the volume within the project */ name: string; /** * Type is the volume type (currently only "readOnly" is supported) */ type: 'readOnly'; } export namespace VolumeCreateParams { /** * Content specifies the new content that will be preloaded to this volume */ export interface Content { /** * SourcePrefix is the file path prefix for the content to be preloaded into the * volume */ source_prefix?: string; /** * Type is the content type (currently only "files" is supported which allows * preloading files uploaded via Files API into the volume) */ type?: 'files'; } } export interface VolumeUpdateParams { /** * Content specifies the new content that will be preloaded to this volume */ content?: VolumeUpdateParams.Content; /** * Name is the new unique identifier for the volume within the project */ name?: string; /** * Type is the new volume type (currently only "readOnly" is supported) */ type?: 'readOnly'; } export namespace VolumeUpdateParams { /** * Content specifies the new content that will be preloaded to this volume */ export interface Content { /** * SourcePrefix is the file path prefix for the content to be preloaded into the * volume */ source_prefix?: string; /** * Type is the content type (currently only "files" is supported which allows * preloading files uploaded via Files API into the volume) */ type?: 'files'; } } export declare namespace Volumes { export { type Volume as Volume, type VolumeListResponse as VolumeListResponse, type VolumeDeleteResponse as VolumeDeleteResponse, type VolumeCreateParams as VolumeCreateParams, type VolumeUpdateParams as VolumeUpdateParams, }; }