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

Method asRequestOption

codersdk/aitasks.go:154–177  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

152}
153
154func (f TasksFilter) asRequestOption() RequestOption {
155 return func(r *http.Request) {
156 var params []string
157 // Make sure all user input is quoted to ensure it's parsed as a single
158 // string.
159 if f.Owner != "" {
160 params = append(params, fmt.Sprintf("owner:%q", f.Owner))
161 }
162 if f.Organization != "" {
163 params = append(params, fmt.Sprintf("organization:%q", f.Organization))
164 }
165 if f.Status != "" {
166 params = append(params, fmt.Sprintf("status:%q", string(f.Status)))
167 }
168 if f.FilterQuery != "" {
169 // If custom stuff is added, just add it on here.
170 params = append(params, f.FilterQuery)
171 }
172
173 q := r.URL.Query()
174 q.Set("q", strings.Join(params, " "))
175 r.URL.RawQuery = q.Encode()
176 }
177}
178
179// Tasks lists all tasks belonging to the user or specified owner.
180func (c *Client) Tasks(ctx context.Context, filter *TasksFilter) ([]Task, error) {

Callers 1

TasksMethod · 0.45

Calls 2

EncodeMethod · 0.80
SetMethod · 0.65

Tested by

no test coverage detected