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

Method asRequestOption

codersdk/pagination.go:31–45  ·  view source on GitHub ↗

asRequestOption returns a function that can be used in (*Client).Request. It modifies the request query parameters.

()

Source from the content-addressed store, hash-verified

29// asRequestOption returns a function that can be used in (*Client).Request.
30// It modifies the request query parameters.
31func (p Pagination) asRequestOption() RequestOption {
32 return func(r *http.Request) {
33 q := r.URL.Query()
34 if p.AfterID != uuid.Nil {
35 q.Set("after_id", p.AfterID.String())
36 }
37 if p.Limit > 0 {
38 q.Set("limit", strconv.Itoa(p.Limit))
39 }
40 if p.Offset > 0 {
41 q.Set("offset", strconv.Itoa(p.Offset))
42 }
43 r.URL.RawQuery = q.Encode()
44 }
45}

Callers 2

WorkspacesMethod · 0.95

Calls 3

EncodeMethod · 0.80
SetMethod · 0.65
StringMethod · 0.45

Tested by 1