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

Method ConnectionLogs

codersdk/connectionlog.go:102–127  ·  view source on GitHub ↗
(ctx context.Context, req ConnectionLogsRequest)

Source from the content-addressed store, hash-verified

100}
101
102func (c *Client) ConnectionLogs(ctx context.Context, req ConnectionLogsRequest) (ConnectionLogResponse, error) {
103 res, err := c.Request(ctx, http.MethodGet, "/api/v2/connectionlog", nil, req.Pagination.asRequestOption(), func(r *http.Request) {
104 q := r.URL.Query()
105 var params []string
106 if req.SearchQuery != "" {
107 params = append(params, req.SearchQuery)
108 }
109 q.Set("q", strings.Join(params, " "))
110 r.URL.RawQuery = q.Encode()
111 })
112 if err != nil {
113 return ConnectionLogResponse{}, err
114 }
115 defer res.Body.Close()
116
117 if res.StatusCode != http.StatusOK {
118 return ConnectionLogResponse{}, ReadBodyAsError(res)
119 }
120
121 var logRes ConnectionLogResponse
122 err = json.NewDecoder(res.Body).Decode(&logRes)
123 if err != nil {
124 return ConnectionLogResponse{}, err
125 }
126 return logRes, nil
127}

Callers 1

TestConnectionLogsFunction · 0.45

Calls 6

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
EncodeMethod · 0.80
SetMethod · 0.65
CloseMethod · 0.65
asRequestOptionMethod · 0.45

Tested by 1

TestConnectionLogsFunction · 0.36