Skip to content

Models

models

TransferState

Bases: StrEnum

Enumeration of possible states for a file transfer.

TransferRecord

Bases: BaseModel

Data model for a file transfer record in the registry.

UploadResponse

Bases: BaseModel

Response model for a successful upload.

ErrorResponse

Bases: BaseModel

Body of the errors the routes raise via HTTPException.

FastAPI's own 422 validation errors use a list detail instead.

FileInfo

Bases: BaseModel

Metadata for a single stored file.

Subclass this to add provider-specific fields (e.g. checksum, URL, upload timestamp). Extra fields are preserved in the API response thanks to SerializeAsAny on FileListResponse.

ServedFile dataclass

ServedFile(path: Path, name: str)

A file to serve under a name other than its on-disk name.

Return this from FileProvider.get_file when the bytes are stored at a path whose name is not the one the client asked for (a content-addressed blob, a cache entry keyed by ID, a temp file).

Attributes:

Name Type Description
path Path

Where the bytes are stored. Range requests and the ETag and Last-Modified validators come from this file.

name str

The name to serve the file as. It is sent in Content-Disposition and its suffix picks the media type.

FileListResponse

Bases: BaseModel

Response model for the file listing endpoint.

HealthResponse

Bases: BaseModel

Response model for health check endpoint.