@@ -113,8 +113,6 @@ async def resume_async(
113
113
114
114
async def main(): # noqa: D103
115
115
payload = await sdk.jobs.resume_async(job_id="38073051", payload="The response")
116
- print(payload)
117
-
118
116
119
117
asyncio.run(main())
120
118
```
@@ -154,23 +152,80 @@ def custom_headers(self) -> Dict[str, str]:
154
152
def retrieve (
155
153
self ,
156
154
job_key : str ,
155
+ * ,
156
+ folder_key : Optional [str ] = None ,
157
+ folder_path : Optional [str ] = None ,
157
158
) -> Job :
158
- spec = self ._retrieve_spec (job_key = job_key )
159
+ """Retrieve a job identified by its key.
160
+
161
+ Args:
162
+ job_key (str): The job unique identifier.
163
+ folder_key (Optional[str]): The key of the folder in which the job was executed.
164
+ folder_path (Optional[str]): The path of the folder in which the job was executed.
165
+
166
+ Returns:
167
+ Job: The retrieved job.
168
+
169
+ Examples:
170
+ ```python
171
+ from uipath import UiPath
172
+
173
+ sdk = UiPath()
174
+ payload = sdk.jobs.retrieve(job_key="ee9327fd-237d-419e-86ef-9946b34461e3", folder_path="Shared")
175
+ ```
176
+ """
177
+ spec = self ._retrieve_spec (
178
+ job_key = job_key , folder_key = folder_key , folder_path = folder_path
179
+ )
159
180
response = self .request (
160
181
spec .method ,
161
182
url = spec .endpoint ,
183
+ headers = spec .headers ,
162
184
)
163
185
164
186
return Job .model_validate (response .json ())
165
187
166
188
async def retrieve_async (
167
189
self ,
168
190
job_key : str ,
191
+ * ,
192
+ folder_key : Optional [str ] = None ,
193
+ folder_path : Optional [str ] = None ,
169
194
) -> Job :
170
- spec = self ._retrieve_spec (job_key = job_key )
195
+ """Asynchronously retrieve a job identified by its key.
196
+
197
+ Args:
198
+ job_key (str): The job unique identifier.
199
+ folder_key (Optional[str]): The key of the folder in which the job was executed.
200
+ folder_path (Optional[str]): The path of the folder in which the job was executed.
201
+
202
+ Returns:
203
+ Job: The retrieved job.
204
+
205
+ Examples:
206
+ ```python
207
+ import asyncio
208
+
209
+ from uipath import UiPath
210
+
211
+ sdk = UiPath()
212
+
213
+
214
+ async def main(): # noqa: D103
215
+ payload = await sdk.jobs.retrieve_async(job_key="ee9327fd-237d-419e-86ef-9946b34461e3", folder_path="Shared")
216
+ print(payload)
217
+
218
+
219
+ asyncio.run(main())
220
+ ```
221
+ """
222
+ spec = self ._retrieve_spec (
223
+ job_key = job_key , folder_key = folder_key , folder_path = folder_path
224
+ )
171
225
response = await self .request_async (
172
226
spec .method ,
173
227
url = spec .endpoint ,
228
+ headers = spec .headers ,
174
229
)
175
230
176
231
return Job .model_validate (response .json ())
@@ -268,12 +323,17 @@ def _retrieve_spec(
268
323
self ,
269
324
* ,
270
325
job_key : str ,
326
+ folder_key : Optional [str ] = None ,
327
+ folder_path : Optional [str ] = None ,
271
328
) -> RequestSpec :
272
329
return RequestSpec (
273
330
method = "GET" ,
274
331
endpoint = Endpoint (
275
332
f"/orchestrator_/odata/Jobs/UiPath.Server.Configuration.OData.GetByKey(identifier={ job_key } )"
276
333
),
334
+ headers = {
335
+ ** header_folder (folder_key , folder_path ),
336
+ },
277
337
)
278
338
279
339
@traced (name = "jobs_list_attachments" , run_type = "uipath" )
0 commit comments