sift_client.resources.file_attachments
¶
| CLASS | DESCRIPTION |
|---|---|
FileAttachmentsAPIAsync |
High-level API for interacting with file attachments (remote files). |
FileAttachmentsAPIAsync
¶
FileAttachmentsAPIAsync(sift_client: SiftClient)
Bases: ResourceBase
High-level API for interacting with file attachments (remote files).
This class provides a Pythonic interface for managing file attachments on Sift entities like runs, assets, and test reports.
Initialize the FileAttachmentsAPIAsync.
| PARAMETER | DESCRIPTION |
|---|---|
sift_client
|
The Sift client to use.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
delete |
Batch delete multiple file attachments. |
download |
Download a file attachment to a local path. |
get |
Get a file attachment by ID. |
get_download_url |
Get a download URL for a file attachment. |
list_ |
List file attachments with optional filtering. |
update |
Update a file attachment. |
upload |
Upload a file attachment to a remote file. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
client |
TYPE:
|
grpc_client |
TYPE:
|
rest_client |
TYPE:
|
delete
async
¶
delete(
*,
file_attachments: list[FileAttachment | str]
| FileAttachment
| str,
) -> None
Batch delete multiple file attachments.
| PARAMETER | DESCRIPTION |
|---|---|
file_attachments
|
List of FileAttachments or the IDs of the file attachments to delete (up to 1000).
TYPE:
|
download
async
¶
download(
*,
file_attachment: FileAttachment | str,
output_path: str | Path,
) -> None
Download a file attachment to a local path.
| PARAMETER | DESCRIPTION |
|---|---|
file_attachment
|
The FileAttachment or the ID of the file attachment to download.
TYPE:
|
output_path
|
The path to download the file attachment to.
TYPE:
|
get
async
¶
get(*, file_attachment_id: str) -> FileAttachment
Get a file attachment by ID.
| PARAMETER | DESCRIPTION |
|---|---|
file_attachment_id
|
The ID of the file attachment to retrieve.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
FileAttachment
|
The FileAttachment. |
get_download_url
async
¶
get_download_url(
*, file_attachment: FileAttachment | str
) -> str
Get a download URL for a file attachment.
| PARAMETER | DESCRIPTION |
|---|---|
file_attachment
|
The FileAttachment or the ID of the file attachment.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The download URL for the file attachment. |
list_
async
¶
list_(
*,
name: str | None = None,
names: list[str] | None = None,
name_contains: str | None = None,
name_regex: str | Pattern | None = None,
remote_file_ids: list[str] | None = None,
entities: list[Run | Asset | TestReport] | None = None,
entity_type: RemoteFileEntityType | None = None,
entity_ids: list[str] | None = None,
description_contains: str | None = None,
filter_query: str | None = None,
order_by: str | None = None,
limit: int | None = None,
) -> list[FileAttachment]
List file attachments with optional filtering.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
Exact name of the file attachment.
TYPE:
|
names
|
List of file attachment names to filter by.
TYPE:
|
name_contains
|
Partial name of the file attachment.
TYPE:
|
name_regex
|
Regular expression to filter file attachments by name.
TYPE:
|
remote_file_ids
|
Filter to file attachments with any of these IDs.
TYPE:
|
entities
|
Filter to file attachments associated with these entities.
TYPE:
|
entity_type
|
Filter to file attachments associated with this entity type.
TYPE:
|
entity_ids
|
Filter to file attachments associated with these entity IDs.
TYPE:
|
description_contains
|
Partial description of the file attachment.
TYPE:
|
filter_query
|
Explicit CEL query to filter file attachments.
TYPE:
|
order_by
|
Field and direction to order results by. Note: Not supported by the backend, but it is here for API consistency.
TYPE:
|
limit
|
Maximum number of file attachments to return. If None, returns all matches.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[FileAttachment]
|
A list of FileAttachment objects that match the filter criteria. |
update
async
¶
update(
*, file_attachment: FileAttachmentUpdate | dict
) -> FileAttachment
Update a file attachment.
| PARAMETER | DESCRIPTION |
|---|---|
file_attachment
|
The FileAttachmentUpdate with fields to update.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
FileAttachment
|
The updated FileAttachment. |
upload
async
¶
upload(
*,
path: str | Path,
entity: Asset | Run | TestReport,
metadata: dict[str, Any] | None = None,
description: str | None = None,
organization_id: str | None = None,
) -> FileAttachment
Upload a file attachment to a remote file.
| PARAMETER | DESCRIPTION |
|---|---|
path
|
The path to the file to upload.
TYPE:
|
entity
|
The entity that the file is attached to.
TYPE:
|
metadata
|
Optional metadata for the file (e.g., video/image metadata).
TYPE:
|
description
|
Optional description of the file.
TYPE:
|
organization_id
|
Optional organization ID.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
FileAttachment
|
The uploaded FileAttachment. |