AuthMethods returns types of authentication available to the user.
(ctx context.Context)
| 1074 | |
| 1075 | // AuthMethods returns types of authentication available to the user. |
| 1076 | func (c *Client) AuthMethods(ctx context.Context) (AuthMethods, error) { |
| 1077 | res, err := c.Request(ctx, http.MethodGet, "/api/v2/users/authmethods", nil) |
| 1078 | if err != nil { |
| 1079 | return AuthMethods{}, err |
| 1080 | } |
| 1081 | defer res.Body.Close() |
| 1082 | |
| 1083 | if res.StatusCode != http.StatusOK { |
| 1084 | return AuthMethods{}, ReadBodyAsError(res) |
| 1085 | } |
| 1086 | |
| 1087 | var userAuth AuthMethods |
| 1088 | return userAuth, json.NewDecoder(res.Body).Decode(&userAuth) |
| 1089 | } |