Skip to content

sift_py.file_attachment.service

CLASS DESCRIPTION
FileAttachmentService

Service used to retrieve, upload, download, and delete file attachments. Seee sift_py.file_attachment

FileAttachmentService

FileAttachmentService(
    channel: SiftChannel, restconf: SiftRestConfig
)

Service used to retrieve, upload, download, and delete file attachments. Seee sift_py.file_attachment for more information and examples on how to use this service.

METHOD DESCRIPTION
delete_file_attachments

Deletes remote files given a set of arguments that could either be instances of RemoteFile or the ID

download_attachment

Downloads a file attachment and saves it locally.

retrieve_attachments

Retrieves all file attachments for the provided entity.

upload_attachment

Uploads a file pointed to by path and attaches it to the provided entity.

delete_file_attachments

delete_file_attachments(*to_delete: Union[str, RemoteFile])

Deletes remote files given a set of arguments that could either be instances of RemoteFile or the ID of remote files to delete

download_attachment

download_attachment(
    file: Union[RemoteFile, str],
    out: Optional[Union[str, Path]] = None,
) -> Path

Downloads a file attachment and saves it locally.

  • remote_file: Could either be an instance of RemoteFile or the ID of the remote file to download.
  • out: If unspecified, then the file will be downloaded to the current working directory with the original name.

retrieve_attachments

retrieve_attachments(entity: Entity) -> List[RemoteFile]

Retrieves all file attachments for the provided entity.

upload_attachment

upload_attachment(
    path: Union[str, Path],
    entity: Entity,
    metadata: Optional[Metadata],
    description: Optional[str] = None,
    organization_id: Optional[str] = None,
) -> RemoteFile

Uploads a file pointed to by path and attaches it to the provided entity.

  • path: A path to the file to upload to Sift as a file attachment.
  • entity: The entity to attach the file to.
  • metadata: Optional metadata to include with the specific file.
  • description: An optional description to provide for the file attachment.
  • organization_id: Only required if your user belongs to multiple organizations.