client.files
client.files — the files operations.
On AsyncKindgi every method is the same, awaited.
client.files.list()
Section titled “client.files.list()”list( *, limit: int | None = None, cursor: str | None = None, owner_run_id: str | UUID | None = None, project_id: str | UUID | None = None, content_type: str | None = None, timeout: float | None = None,) -> StoredFileCollectionPageList files. GET /v1/files
Cursor-paginated, newest change first. Each file with its Latest (no bytes). Deleted files aren't listed. Filters: ?ownerRunId=, ?projectId=, ?contentType= (Latest's, exactly). With authorization on, only files in projects the caller can read are listed; with ?ownerRunId= of a run of the caller's own (one that acts for them), run on the project is enough too. On a runtime that doesn't keep files, /v1/files isn't served (404 route-not-found).
client.files.create()
Section titled “client.files.create()”create( files: Mapping[str, Any], /, *, idempotency_key: str | None = None, data: Mapping[str, Any] | None = None, timeout: float | None = None,) -> FileVersionWriteCreate a file. POST /v1/files
Multipart upload of a new file's version 1. The file part carries the bytes; the other form fields are name, contentType, tags (JSON), ownerRunId, projectId and expectedHash. The file's id is the new bytes' blobId. It belongs to its owner run's project, else projectId, else the project the caller's API key is limited to, else the workspace's default project. Creating needs write there, and a key limited to a project creates in that project only; a person with run there and no write may create a file that names no ownerRunId: an input for a run they start. An upload over the runtime's cap (default 100 MiB) is 413 file-too-large. One that the workspace's storage limit has no room for is 403 storage-limit-reached, and nothing is stored.
client.files.get()
Section titled “client.files.get()”get(file_id: str | UUID, /, *, timeout: float | None = None) -> StoredFileGet a file. GET /v1/files/{fileId}
The file, with its Latest (no bytes). Needs read on the file's project, or run there for a file of the caller's own: one they made, or one a run that acts for them made.
client.files.delete()
Section titled “client.files.delete()”delete( file_id: str | UUID, /, *, idempotency_key: str | None = None, timeout: float | None = None,) -> DeleteFileResultDelete a file. DELETE /v1/files/{fileId}
Deletes the file and every version: a soft delete, kept until a retention policy for file_version purges it. Idempotent: { deleted: true } the first time, { deleted: false } after (already gone). Refused while any version is pinned. Needs write on its project.
client.files.pin_history()
Section titled “client.files.pin_history()”pin_history( file_id: str | UUID, /, *, limit: int | None = None, cursor: str | None = None, timeout: float | None = None,) -> FilePinChangeCollectionPageA file's pin history. GET /v1/files/{fileId}/pin-history
Every pin and unpin of its versions, newest first. Needs read on the file's project, or run there for a file of the caller's own: one they made, or one a run that acts for them made.