|
7 | 7 | import httpx |
8 | 8 |
|
9 | 9 | from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given |
10 | | -from ..._utils import maybe_transform, async_maybe_transform |
| 10 | +from ..._utils import path_template, maybe_transform, async_maybe_transform |
11 | 11 | from ..._compat import cached_property |
12 | 12 | from ..._resource import SyncAPIResource, AsyncAPIResource |
13 | 13 | from ..._response import ( |
@@ -81,7 +81,7 @@ def create( |
81 | 81 | if not workspace_id: |
82 | 82 | raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") |
83 | 83 | return self._post( |
84 | | - f"/v1/workspaces/{workspace_id}/executions", |
| 84 | + path_template("/v1/workspaces/{workspace_id}/executions", workspace_id=workspace_id), |
85 | 85 | body=maybe_transform( |
86 | 86 | { |
87 | 87 | "command": command, |
@@ -132,7 +132,11 @@ def retrieve( |
132 | 132 | if not execution_id: |
133 | 133 | raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}") |
134 | 134 | return self._get( |
135 | | - f"/v1/workspaces/{workspace_id}/executions/{execution_id}", |
| 135 | + path_template( |
| 136 | + "/v1/workspaces/{workspace_id}/executions/{execution_id}", |
| 137 | + workspace_id=workspace_id, |
| 138 | + execution_id=execution_id, |
| 139 | + ), |
136 | 140 | options=make_request_options( |
137 | 141 | extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
138 | 142 | ), |
@@ -167,7 +171,7 @@ def list( |
167 | 171 | if not workspace_id: |
168 | 172 | raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") |
169 | 173 | return self._get_api_list( |
170 | | - f"/v1/workspaces/{workspace_id}/executions", |
| 174 | + path_template("/v1/workspaces/{workspace_id}/executions", workspace_id=workspace_id), |
171 | 175 | page=SyncCursorPage[Execution], |
172 | 176 | options=make_request_options( |
173 | 177 | extra_headers=extra_headers, |
@@ -217,7 +221,11 @@ def delete( |
217 | 221 | if not execution_id: |
218 | 222 | raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}") |
219 | 223 | return self._delete( |
220 | | - f"/v1/workspaces/{workspace_id}/executions/{execution_id}", |
| 224 | + path_template( |
| 225 | + "/v1/workspaces/{workspace_id}/executions/{execution_id}", |
| 226 | + workspace_id=workspace_id, |
| 227 | + execution_id=execution_id, |
| 228 | + ), |
221 | 229 | options=make_request_options( |
222 | 230 | extra_headers=extra_headers, |
223 | 231 | extra_query=extra_query, |
@@ -259,7 +267,11 @@ def events( |
259 | 267 | if not execution_id: |
260 | 268 | raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}") |
261 | 269 | return self._get_api_list( |
262 | | - f"/v1/workspaces/{workspace_id}/executions/{execution_id}/events", |
| 270 | + path_template( |
| 271 | + "/v1/workspaces/{workspace_id}/executions/{execution_id}/events", |
| 272 | + workspace_id=workspace_id, |
| 273 | + execution_id=execution_id, |
| 274 | + ), |
263 | 275 | page=SyncCursorPage[ExecutionEvent], |
264 | 276 | options=make_request_options( |
265 | 277 | extra_headers=extra_headers, |
@@ -306,7 +318,11 @@ def output( |
306 | 318 | if not execution_id: |
307 | 319 | raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}") |
308 | 320 | return self._get( |
309 | | - f"/v1/workspaces/{workspace_id}/executions/{execution_id}/output", |
| 321 | + path_template( |
| 322 | + "/v1/workspaces/{workspace_id}/executions/{execution_id}/output", |
| 323 | + workspace_id=workspace_id, |
| 324 | + execution_id=execution_id, |
| 325 | + ), |
310 | 326 | options=make_request_options( |
311 | 327 | extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
312 | 328 | ), |
@@ -369,7 +385,7 @@ async def create( |
369 | 385 | if not workspace_id: |
370 | 386 | raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") |
371 | 387 | return await self._post( |
372 | | - f"/v1/workspaces/{workspace_id}/executions", |
| 388 | + path_template("/v1/workspaces/{workspace_id}/executions", workspace_id=workspace_id), |
373 | 389 | body=await async_maybe_transform( |
374 | 390 | { |
375 | 391 | "command": command, |
@@ -420,7 +436,11 @@ async def retrieve( |
420 | 436 | if not execution_id: |
421 | 437 | raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}") |
422 | 438 | return await self._get( |
423 | | - f"/v1/workspaces/{workspace_id}/executions/{execution_id}", |
| 439 | + path_template( |
| 440 | + "/v1/workspaces/{workspace_id}/executions/{execution_id}", |
| 441 | + workspace_id=workspace_id, |
| 442 | + execution_id=execution_id, |
| 443 | + ), |
424 | 444 | options=make_request_options( |
425 | 445 | extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
426 | 446 | ), |
@@ -455,7 +475,7 @@ def list( |
455 | 475 | if not workspace_id: |
456 | 476 | raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}") |
457 | 477 | return self._get_api_list( |
458 | | - f"/v1/workspaces/{workspace_id}/executions", |
| 478 | + path_template("/v1/workspaces/{workspace_id}/executions", workspace_id=workspace_id), |
459 | 479 | page=AsyncCursorPage[Execution], |
460 | 480 | options=make_request_options( |
461 | 481 | extra_headers=extra_headers, |
@@ -505,7 +525,11 @@ async def delete( |
505 | 525 | if not execution_id: |
506 | 526 | raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}") |
507 | 527 | return await self._delete( |
508 | | - f"/v1/workspaces/{workspace_id}/executions/{execution_id}", |
| 528 | + path_template( |
| 529 | + "/v1/workspaces/{workspace_id}/executions/{execution_id}", |
| 530 | + workspace_id=workspace_id, |
| 531 | + execution_id=execution_id, |
| 532 | + ), |
509 | 533 | options=make_request_options( |
510 | 534 | extra_headers=extra_headers, |
511 | 535 | extra_query=extra_query, |
@@ -547,7 +571,11 @@ def events( |
547 | 571 | if not execution_id: |
548 | 572 | raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}") |
549 | 573 | return self._get_api_list( |
550 | | - f"/v1/workspaces/{workspace_id}/executions/{execution_id}/events", |
| 574 | + path_template( |
| 575 | + "/v1/workspaces/{workspace_id}/executions/{execution_id}/events", |
| 576 | + workspace_id=workspace_id, |
| 577 | + execution_id=execution_id, |
| 578 | + ), |
551 | 579 | page=AsyncCursorPage[ExecutionEvent], |
552 | 580 | options=make_request_options( |
553 | 581 | extra_headers=extra_headers, |
@@ -594,7 +622,11 @@ async def output( |
594 | 622 | if not execution_id: |
595 | 623 | raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}") |
596 | 624 | return await self._get( |
597 | | - f"/v1/workspaces/{workspace_id}/executions/{execution_id}/output", |
| 625 | + path_template( |
| 626 | + "/v1/workspaces/{workspace_id}/executions/{execution_id}/output", |
| 627 | + workspace_id=workspace_id, |
| 628 | + execution_id=execution_id, |
| 629 | + ), |
598 | 630 | options=make_request_options( |
599 | 631 | extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
600 | 632 | ), |
|
0 commit comments