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

Method User

codersdk/users.go:985–996  ·  view source on GitHub ↗

User returns a user for the ID/username provided.

(ctx context.Context, userIdent string)

Source from the content-addressed store, hash-verified

983
984// User returns a user for the ID/username provided.
985func (c *Client) User(ctx context.Context, userIdent string) (User, error) {
986 res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/users/%s", userIdent), nil)
987 if err != nil {
988 return User{}, err
989 }
990 defer res.Body.Close()
991 if res.StatusCode != http.StatusOK {
992 return User{}, ReadBodyAsError(res)
993 }
994 var user User
995 return user, json.NewDecoder(res.Body).Decode(&user)
996}
997
998// UserQuietHoursSchedule returns the quiet hours settings for the user. This
999// endpoint only exists in enterprise editions.

Callers 1

TestSSHFunction · 0.95

Calls 3

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65

Tested by 1

TestSSHFunction · 0.76