MCPcopy Index your code
hub / github.com/coder/coder / Tasks

Method Tasks

codersdk/aitasks.go:180–200  ·  view source on GitHub ↗

Tasks lists all tasks belonging to the user or specified owner.

(ctx context.Context, filter *TasksFilter)

Source from the content-addressed store, hash-verified

178
179// Tasks lists all tasks belonging to the user or specified owner.
180func (c *Client) Tasks(ctx context.Context, filter *TasksFilter) ([]Task, error) {
181 if filter == nil {
182 filter = &TasksFilter{}
183 }
184
185 res, err := c.Request(ctx, http.MethodGet, "/api/v2/tasks", nil, filter.asRequestOption())
186 if err != nil {
187 return nil, err
188 }
189 defer res.Body.Close()
190 if res.StatusCode != http.StatusOK {
191 return nil, ReadBodyAsError(res)
192 }
193
194 var tres TasksListResponse
195 if err := json.NewDecoder(res.Body).Decode(&tres); err != nil {
196 return nil, err
197 }
198
199 return tres.Tasks, nil
200}
201
202// TaskByID fetches a single task by its ID.
203// Only tasks owned by codersdk.Me are supported.

Callers 5

TestTasksFunction · 0.80
toolsdk.goFile · 0.80
Test_TasksFunction · 0.80
taskListMethod · 0.80
runWithDeadlineFunction · 0.80

Calls 4

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65
asRequestOptionMethod · 0.45

Tested by 2

TestTasksFunction · 0.64
Test_TasksFunction · 0.64