Skip to content

feat: add folder support for job retrieve #394

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "uipath"
version = "2.0.61"
version = "2.0.62"
description = "Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools."
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.10"
Expand Down
66 changes: 62 additions & 4 deletions src/uipath/_services/jobs_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ async def resume_async(

async def main(): # noqa: D103
payload = await sdk.jobs.resume_async(job_id="38073051", payload="The response")
print(payload)


asyncio.run(main())
```
Expand Down Expand Up @@ -154,23 +152,78 @@ def custom_headers(self) -> Dict[str, str]:
def retrieve(
self,
job_key: str,
*,
folder_key: Optional[str] = None,
folder_path: Optional[str] = None,
) -> Job:
spec = self._retrieve_spec(job_key=job_key)
"""Retrieve a job identified by its key.

Args:
job_key (str): The job unique identifier.
folder_key (Optional[str]): The key of the folder in which the job was executed.
folder_path (Optional[str]): The path of the folder in which the job was executed.

Returns:
Job: The retrieved job.

Examples:
```python
from uipath import UiPath

sdk = UiPath()
job = sdk.jobs.retrieve(job_key="ee9327fd-237d-419e-86ef-9946b34461e3", folder_path="Shared")
```
"""
spec = self._retrieve_spec(
job_key=job_key, folder_key=folder_key, folder_path=folder_path
)
response = self.request(
spec.method,
url=spec.endpoint,
headers=spec.headers,
)

return Job.model_validate(response.json())

async def retrieve_async(
self,
job_key: str,
*,
folder_key: Optional[str] = None,
folder_path: Optional[str] = None,
) -> Job:
spec = self._retrieve_spec(job_key=job_key)
"""Asynchronously retrieve a job identified by its key.

Args:
job_key (str): The job unique identifier.
folder_key (Optional[str]): The key of the folder in which the job was executed.
folder_path (Optional[str]): The path of the folder in which the job was executed.

Returns:
Job: The retrieved job.

Examples:
```python
import asyncio

from uipath import UiPath

sdk = UiPath()


async def main(): # noqa: D103
job = await sdk.jobs.retrieve_async(job_key="ee9327fd-237d-419e-86ef-9946b34461e3", folder_path="Shared")

asyncio.run(main())
```
"""
spec = self._retrieve_spec(
job_key=job_key, folder_key=folder_key, folder_path=folder_path
)
response = await self.request_async(
spec.method,
url=spec.endpoint,
headers=spec.headers,
)

return Job.model_validate(response.json())
Expand Down Expand Up @@ -268,12 +321,17 @@ def _retrieve_spec(
self,
*,
job_key: str,
folder_key: Optional[str] = None,
folder_path: Optional[str] = None,
) -> RequestSpec:
return RequestSpec(
method="GET",
endpoint=Endpoint(
f"/orchestrator_/odata/Jobs/UiPath.Server.Configuration.OData.GetByKey(identifier={job_key})"
),
headers={
**header_folder(folder_key, folder_path),
},
)

@traced(name="jobs_list_attachments", run_type="uipath")
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.