attachments
Bases: BaseAttachments
Source code in airia/client/attachments/async_attachments.py
get_file_url(file_id, correlation_id=None)
async
Get a refreshed signed URL for an existing attachment.
This method retrieves a new time-limited signed URL for accessing an attachment that was previously uploaded. Useful when the original signed URL has expired or is about to expire.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_id
|
str
|
The unique identifier of the attachment |
required |
correlation_id
|
Optional[str]
|
Optional correlation ID for request tracing. If not provided, one will be generated automatically. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
GetFileUrlResponse |
GetFileUrlResponse
|
Response containing the attachment ID and refreshed signed URL. |
Raises:
| Type | Description |
|---|---|
AiriaAPIError
|
If the API request fails with details about the error. |
ClientError
|
For other request-related errors. |
Example
async_client = AiriaAsyncClient(api_key="your_api_key")
# First, upload a file
upload_response = await async_client.attachments.upload_file(
file_path="example.jpg"
)
file_id = upload_response.id
# Later, get a refreshed URL for the same file
url_response = await async_client.attachments.get_file_url(
file_id=file_id
)
print(f"Attachment ID: {url_response.id}")
print(f"Refreshed URL: {url_response.signed_url}")
Source code in airia/client/attachments/async_attachments.py
upload_file(file_path, correlation_id=None)
async
Upload a file and get attachment information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Path to the file on disk |
required |
correlation_id
|
Optional[str]
|
Optional correlation ID for request tracing. If not provided, one will be generated automatically. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
AttachmentResponse |
AttachmentResponse
|
Response containing the attachment ID and URL. |
Raises:
| Type | Description |
|---|---|
AiriaAPIError
|
If the API request fails with details about the error. |
ClientError
|
For other request-related errors. |