mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat(coderd): add experimental tasks send endpoint (#19941)
Fixes coder/internal#902
This commit is contained in:
@@ -206,3 +206,21 @@ func (c *ExperimentalClient) DeleteTask(ctx context.Context, user string, id uui
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// TaskSendRequest is used to send task input to the tasks sidebar app.
|
||||
type TaskSendRequest struct {
|
||||
Input string `json:"input"`
|
||||
}
|
||||
|
||||
// TaskSend submits task input to the tasks sidebar app.
|
||||
func (c *ExperimentalClient) TaskSend(ctx context.Context, user string, id uuid.UUID, req TaskSendRequest) error {
|
||||
res, err := c.Request(ctx, http.MethodPost, fmt.Sprintf("/api/experimental/tasks/%s/%s/send", user, id.String()), req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer res.Body.Close()
|
||||
if res.StatusCode != http.StatusNoContent {
|
||||
return ReadBodyAsError(res)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user