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

Method DeleteUser

codersdk/users.go:573–585  ·  view source on GitHub ↗

DeleteUser deletes a user.

(ctx context.Context, id uuid.UUID)

Source from the content-addressed store, hash-verified

571
572// DeleteUser deletes a user.
573func (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.
588func (c *Client) UpdateUserProfile(ctx context.Context, user string, req UpdateUserProfileRequest) (User, error) {

Callers 15

TestAPIKey_DeletedFunction · 0.80
TestUserLoginFunction · 0.80
TestUserOAuth2GithubFunction · 0.80
TestUpdateWorkspaceACLFunction · 0.80
TestWorkspaceBuildsFunction · 0.80
TestAuditLogsFunction · 0.80
TestDeleteUserFunction · 0.80
TestNotifyDeletedUserFunction · 0.80
userDeleteMethod · 0.80
RunMethod · 0.80
TestGroupFunction · 0.80

Calls 3

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65

Tested by 12

TestAPIKey_DeletedFunction · 0.64
TestUserLoginFunction · 0.64
TestUserOAuth2GithubFunction · 0.64
TestUpdateWorkspaceACLFunction · 0.64
TestWorkspaceBuildsFunction · 0.64
TestAuditLogsFunction · 0.64
TestDeleteUserFunction · 0.64
TestNotifyDeletedUserFunction · 0.64
TestGroupFunction · 0.64
TestTemplateACLFunction · 0.64
TestUpdateTemplateACLFunction · 0.64