Evo files - Evo Python SDK

GitHub source

## evo.files.client.FileAPIClient

### __init__

    __init__(environment: Environment, connector: APIConnector) -> None

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`environment` | `Environment` | The environment object | required
`connector` | `APIConnector` | The connector object. | required

### get_service_health `async`

    get_service_health(check_type: HealthCheckType = HealthCheckType.FULL) -> ServiceHealth

Get the health of the file service.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`check_type` | `HealthCheckType` | The type of health check to perform. | `FULL`

Returns:

Type | Description
--- | ---
`ServiceHealth` | A ServiceHealth object.

Raises:

Type | Description
--- | ---
`EvoAPIException` | If the API returns an unexpected status code.
`ClientValueError` | If the response is not a valid service health check response.

### list_files `async`

    list_files(offset: int = 0, limit: int = 5000, name: str | None = None, deleted: bool = False) -> Page[FileMetadata]

List up to `limit` files in the workspace, starting at `offset`.

The files will be the latest version of the file. If there are no files starting at `offset`, the page will be empty.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`offset` | `int` | The number of files to skip before listing. | `0`
`limit` | `int` | Max number of files to list. | `5000`
`name` | `str | None` | Filter files by name. | `None`
`deleted` | `bool` | Only include deleted files in the listing. | `False`

Returns:

Type | Description
--- | ---
`Page[FileMetadata]` | A page of all files from the query.

### list_all_files `async`

    list_all_files(limit_per_request: int = 5000, name: str | None = None, deleted: bool = False) -> list[FileMetadata]

List all files in the workspace.

This method makes multiple calls to the `list_files` endpoint until all files have been listed.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`limit_per_request` | `int` | The maximum number of files to list in one request. | `5000`
`name` | `str | None` | Filter files by name. | `None`
`deleted` | `bool` | Only include deleted files in the listing. | `False`

Returns:

Type | Description
--- | ---
`list[FileMetadata]` | A list of all files in the workspace.

### get_file_by_path `async`

    get_file_by_path(path: str, version_id: str | None = None) -> FileMetadata

Get a file by its path.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`path` | `str` | The path to the file. | required
`version_id` | `str | None` | ID of the desired file version. By default, the response will return the latest version. | `None`

Returns:

Type | Description
--- | ---
`FileMetadata` | A FileMetadata representation of the file on the service.

### get_file_by_id `async`

    get_file_by_id(file_id: UUID, version_id: str | None = None, deleted: bool = False) -> FileMetadata

Get a file by its ID.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`file_id` | `UUID` | UUID of a file | required
`version_id` | `str | None` | ID of the desired file version. By default, the response will return the latest version. | `None`
`deleted` | `bool` | Optional flag to include deleted files. | `False`

Returns:

Type | Description
--- | ---
`FileMetadata` | A FileMetadata representation of the file on the service

### list_versions_by_path `async`

    list_versions_by_path(path: str) -> list[FileVersion]

List the versions of a file by path.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`path` | `str` | The path to the file. | required

Returns:

Type | Description
--- | ---
`list[FileVersion]` | A sorted list of file versions. The latest version is the first element of the list.

### list_versions_by_id `async`

    list_versions_by_id(file_id: UUID, deleted: bool = False) -> list[FileVersion]

List the versions of a file by ID

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`file_id` | `UUID` | UUID of the file. | required
`deleted` | `bool` | Optional flag to include deleted files. | `False`

Returns:

Type | Description
--- | ---
`list[FileVersion]` | A sorted list of file versions. The latest version is the first element of the list.

### prepare_download_by_path `async`

    prepare_download_by_path(path: str, version_id: str | None = None) -> FileAPIDownload

Prepares a file for download by path.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`path` | `str` | Path to the file. | required
`version_id` | `str | None` | Versions of the file. | `None`

Returns:

Type | Description
--- | ---
`FileAPIDownload` | A FileAPIDownload object.

### prepare_download_by_id `async`

    prepare_download_by_id(file_id: UUID, version_id: str | None = None, deleted: bool = False) -> FileAPIDownload

Prepares a file for download by ID.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`file_id` | `UUID` | UUID of the file. | required
`version_id` | `str | None` | Version of the file. | `None`
`deleted` | `bool` | Optional flag to include deleted files. | `False`

Returns:

Type | Description
--- | ---
`FileAPIDownload` | A FileAPIDownload object.

### prepare_upload_by_path `async`

    prepare_upload_by_path(path: str) -> FileAPIUpload

Prepares a file for upload by path. If the file already exists, a new version will be created.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`path` | `str` | Path the file is being uploaded to. | required

Returns:

Type | Description
--- | ---
`FileAPIUpload` | A FileAPIUpload object.

### prepare_upload_by_id `async`

    prepare_upload_by_id(file_id: UUID) -> FileAPIUpload

Prepares a file for upload by ID. The file_id must be the ID of an existing file, for which a new version will be created.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`file_id` | `UUID` | UUID of the file. | required

Returns:

Type | Description
--- | ---
`FileAPIUpload` | A FileAPIUpload object.

### restore_file_by_id `async`

    restore_file_by_id(file_id: UUID) -> FileMetadata | None

Restore a deleted file by ID.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`file_id` | `UUID` | UUID of the file. | required

Returns:

Type | Description
--- | ---
`FileMetadata | None` | FileMetadata if the file path changed during restore (HTTP 303), None if the file was restored without path change (HTTP 204).

### delete_file_by_path `async`

    delete_file_by_path(path: str) -> None

Deletes a file by path.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`path` | `str` | Path of the file to delete. | required

### delete_file_by_id `async`

    delete_file_by_id(file_id: UUID) -> None

Deletes a file by ID.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`file_id` | `UUID` | UUID of the file to delete. | required

#### Keyboard Shortcuts

Keys | Action
--- | ---
`?` | Open this help
`n` | Next page
`p` | Previous page
`s` | Search