GetUserPreferenceSettings fetches the preference settings for a user.
(ctx context.Context, user string)
| 667 | |
| 668 | // GetUserPreferenceSettings fetches the preference settings for a user. |
| 669 | func (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. |
| 683 | func (c *Client) UpdateUserPreferenceSettings(ctx context.Context, user string, req UpdateUserPreferenceSettingsRequest) (UserPreferenceSettings, error) { |