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

Method GetUserPreferenceSettings

codersdk/users.go:669–680  ·  view source on GitHub ↗

GetUserPreferenceSettings fetches the preference settings for a user.

(ctx context.Context, user string)

Source from the content-addressed store, hash-verified

667
668// GetUserPreferenceSettings fetches the preference settings for a user.
669func (c *Client) GetUserPreferenceSettings(ctx context.Context, user string) (UserPreferenceSettings, error) {
670 res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/users/%s/preferences", user), nil)
671 if err != nil {
672 return UserPreferenceSettings{}, err
673 }
674 defer res.Body.Close()
675 if res.StatusCode != http.StatusOK {
676 return UserPreferenceSettings{}, ReadBodyAsError(res)
677 }
678 var resp UserPreferenceSettings
679 return resp, json.NewDecoder(res.Body).Decode(&resp)
680}
681
682// UpdateUserPreferenceSettings updates the preference settings for a user.
683func (c *Client) UpdateUserPreferenceSettings(ctx context.Context, user string, req UpdateUserPreferenceSettingsRequest) (UserPreferenceSettings, error) {

Calls 3

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65