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

Method UpdateUserPreferenceSettings

codersdk/users.go:683–694  ·  view source on GitHub ↗

UpdateUserPreferenceSettings updates the preference settings for a user.

(ctx context.Context, user string, req UpdateUserPreferenceSettingsRequest)

Source from the content-addressed store, hash-verified

681
682// UpdateUserPreferenceSettings updates the preference settings for a user.
683func (c *Client) UpdateUserPreferenceSettings(ctx context.Context, user string, req UpdateUserPreferenceSettingsRequest) (UserPreferenceSettings, error) {
684 res, err := c.Request(ctx, http.MethodPut, fmt.Sprintf("/api/v2/users/%s/preferences", user), req)
685 if err != nil {
686 return UserPreferenceSettings{}, err
687 }
688 defer res.Body.Close()
689 if res.StatusCode != http.StatusOK {
690 return UserPreferenceSettings{}, ReadBodyAsError(res)
691 }
692 var resp UserPreferenceSettings
693 return resp, json.NewDecoder(res.Body).Decode(&resp)
694}
695
696// UpdateUserPassword updates a user password.
697// It calls PUT /users/{user}/password

Calls 3

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65