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

Method Users

codersdk/users.go:1030–1046  ·  view source on GitHub ↗

Users returns all users according to the request parameters. If no parameters are set, the default behavior is to return all users in a single page.

(ctx context.Context, req UsersRequest)

Source from the content-addressed store, hash-verified

1028// Users returns all users according to the request parameters. If no parameters are set,
1029// the default behavior is to return all users in a single page.
1030func (c *Client) Users(ctx context.Context, req UsersRequest) (GetUsersResponse, error) {
1031 res, err := c.Request(ctx, http.MethodGet, "/api/v2/users", nil,
1032 req.Pagination.asRequestOption(),
1033 req.asRequestOption(),
1034 )
1035 if err != nil {
1036 return GetUsersResponse{}, err
1037 }
1038 defer res.Body.Close()
1039
1040 if res.StatusCode != http.StatusOK {
1041 return GetUsersResponse{}, ReadBodyAsError(res)
1042 }
1043
1044 var usersRes GetUsersResponse
1045 return usersRes, json.NewDecoder(res.Body).Decode(&usersRes)
1046}
1047
1048// OrganizationsByUser returns all organizations the user is a member of.
1049func (c *Client) OrganizationsByUser(ctx context.Context, user string) ([]Organization, error) {

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected