feat(coderd): add tasks delete endpoint (#19638)

This change adds a DELETE endpoint for tasks (for now, alias of
workspace build delete transition).

Fixes coder/internal#903
This commit is contained in:
Mathias Fredriksson
2025-08-29 13:54:54 +00:00
committed by GitHub
parent 605dad8b1f
commit e5ac640e5e
5 changed files with 258 additions and 18 deletions
+15
View File
@@ -190,3 +190,18 @@ func (c *ExperimentalClient) TaskByID(ctx context.Context, id uuid.UUID) (Task,
return task, nil
}
// DeleteTask deletes a task by its ID.
//
// Experimental: This method is experimental and may change in the future.
func (c *ExperimentalClient) DeleteTask(ctx context.Context, user string, id uuid.UUID) error {
res, err := c.Request(ctx, http.MethodDelete, fmt.Sprintf("/api/experimental/tasks/%s/%s", user, id.String()), nil)
if err != nil {
return err
}
defer res.Body.Close()
if res.StatusCode != http.StatusAccepted {
return ReadBodyAsError(res)
}
return nil
}