DeleteUser deletes a user.
(ctx context.Context, id uuid.UUID)
| 571 | |
| 572 | // DeleteUser deletes a user. |
| 573 | func (c *Client) DeleteUser(ctx context.Context, id uuid.UUID) error { |
| 574 | res, err := c.Request(ctx, http.MethodDelete, fmt.Sprintf("/api/v2/users/%s", id), nil) |
| 575 | if err != nil { |
| 576 | return err |
| 577 | } |
| 578 | defer res.Body.Close() |
| 579 | // Check for a 200 or a 204 response. 2.14.0 accidentally included a 204 response, |
| 580 | // which was a breaking change, and reverted in 2.14.1. |
| 581 | if res.StatusCode != http.StatusOK && res.StatusCode != http.StatusNoContent { |
| 582 | return ReadBodyAsError(res) |
| 583 | } |
| 584 | return nil |
| 585 | } |
| 586 | |
| 587 | // UpdateUserProfile updates the username of a user. |
| 588 | func (c *Client) UpdateUserProfile(ctx context.Context, user string, req UpdateUserProfileRequest) (User, error) { |