Add public SDK cancel endpoint and CloudClient method
- POST /v1/tasks/{task_id}/cancel: tasks:submit scoped, 200 for
immediate/idempotent cancellation, 202 for newly recorded pending
cancellation, 404 for unknown task, 409 for terminal task.
- TaskCancellationResponse{task_id, status} model.
- Widen list_tasks status_filter Literal to include "cancelled".
- CloudClient.cancel_task(task_id).
- SDK-level tests covering queued/assigned/idempotent/404/409/scope
cases for both the router and CloudClient.
Task 5/9 of task-cancellation change.
This commit is contained in:
@@ -115,6 +115,10 @@ class CloudClient:
|
||||
resp = self._request("GET", f"/tasks/{task_id}/attempts")
|
||||
return resp.json()
|
||||
|
||||
def cancel_task(self, task_id: str) -> dict[str, Any]:
|
||||
resp = self._request("POST", f"/tasks/{task_id}/cancel")
|
||||
return resp.json()
|
||||
|
||||
# ----------------------------------------------------------------- devices
|
||||
|
||||
def list_devices(self) -> list[dict[str, Any]]:
|
||||
|
||||
Reference in New Issue
Block a user