Skip to content

Commit ea0476c

Browse files
committed
feat(sdk): add attachments service
1 parent b2d347b commit ea0476c

File tree

9 files changed

+1692
-1
lines changed

9 files changed

+1692
-1
lines changed

docs/core/attachments.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Attachments Service
2+
3+
The `AttachmentsService` provides methods to upload, download, and delete attachments in UiPath Orchestrator. Attachments are files that can be associated with jobs, processes, or other entities, and are managed via the Orchestrator API.
4+
5+
> **Reference:** [UiPath Orchestrator Attachments API](https://docs.uipath.com/orchestrator/reference/api-attachments)
6+
7+
## Features
8+
- Upload files or in-memory content as attachments
9+
- Download attachments to local files
10+
- Delete attachments
11+
- Both synchronous and asynchronous methods
12+
13+
## Usage
14+
15+
### Instantiating the Service
16+
17+
The `AttachmentsService` is available as a property on the main `UiPath` client:
18+
19+
```python
20+
from uipath import UiPath
21+
22+
client = UiPath()
23+
attachments = client.attachments
24+
```
25+
26+
### Uploading an Attachment
27+
28+
You can upload a file from disk or from memory:
29+
30+
```python
31+
# Upload from file
32+
attachment_key = client.attachments.upload(
33+
name="document.pdf",
34+
source_path="/path/to/document.pdf",
35+
)
36+
37+
# Upload from memory
38+
attachment_key = client.attachments.upload(
39+
name="notes.txt",
40+
content="Some text content",
41+
)
42+
```
43+
44+
#### Async Example
45+
```python
46+
attachment_key = await client.attachments.upload_async(
47+
name="notes.txt",
48+
content="Some text content",
49+
)
50+
```
51+
52+
### Downloading an Attachment
53+
54+
```python
55+
attachment_name = client.attachments.download(
56+
key=attachment_key,
57+
destination_path="/path/to/save/document.pdf",
58+
)
59+
```
60+
61+
#### Async Example
62+
```python
63+
attachment_name = await client.attachments.download_async(
64+
key=attachment_key,
65+
destination_path="/path/to/save/document.pdf",
66+
)
67+
```
68+
69+
### Deleting an Attachment
70+
71+
```python
72+
client.attachments.delete(key=attachment_key)
73+
```
74+
75+
#### Async Example
76+
```python
77+
await client.attachments.delete_async(key=attachment_key)
78+
```
79+
80+
## Error Handling
81+
82+
All methods raise exceptions on failure. See the SDK error handling documentation for details.
83+
84+
## See Also
85+
- [UiPath Orchestrator Attachments API](https://docs.uipath.com/orchestrator/reference/api-attachments)
86+
- [Jobs Service](./jobs.md) for listing attachments associated with jobs.

src/uipath/_services/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from .actions_service import ActionsService
22
from .api_client import ApiClient
33
from .assets_service import AssetsService
4+
from .attachments_service import AttachmentsService
45
from .buckets_service import BucketsService
56
from .connections_service import ConnectionsService
67
from .context_grounding_service import ContextGroundingService
@@ -13,6 +14,7 @@
1314
__all__ = [
1415
"ActionsService",
1516
"AssetsService",
17+
"AttachmentsService",
1618
"BucketsService",
1719
"ConnectionsService",
1820
"ContextGroundingService",

0 commit comments

Comments
 (0)