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

Method CreateUserWithOrgs

codersdk/users.go:559–570  ·  view source on GitHub ↗

CreateUserWithOrgs creates a new user.

(ctx context.Context, req CreateUserRequestWithOrgs)

Source from the content-addressed store, hash-verified

557
558// CreateUserWithOrgs creates a new user.
559func (c *Client) CreateUserWithOrgs(ctx context.Context, req CreateUserRequestWithOrgs) (User, error) {
560 res, err := c.Request(ctx, http.MethodPost, "/api/v2/users", req)
561 if err != nil {
562 return User{}, err
563 }
564 defer res.Body.Close()
565 if res.StatusCode != http.StatusCreated {
566 return User{}, ReadBodyAsError(res)
567 }
568 var user User
569 return user, json.NewDecoder(res.Body).Decode(&user)
570}
571
572// DeleteUser deletes a user.
573func (c *Client) DeleteUser(ctx context.Context, id uuid.UUID) error {

Callers 15

CreateUserMethod · 0.95
TestUserLogoutFunction · 0.80
TestPostLoginFunction · 0.80
TestDeleteUserFunction · 0.80
TestNotifyDeletedUserFunction · 0.80
TestPostUsersFunction · 0.80
TestNotifyCreatedUserFunction · 0.80
TestUpdateUserProfileFunction · 0.80
TestUpdateUserPasswordFunction · 0.80
TestActivateDormantUserFunction · 0.80
TestWorkspacesByUserFunction · 0.80

Calls 3

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65

Tested by 15

TestUserLogoutFunction · 0.64
TestPostLoginFunction · 0.64
TestDeleteUserFunction · 0.64
TestNotifyDeletedUserFunction · 0.64
TestPostUsersFunction · 0.64
TestNotifyCreatedUserFunction · 0.64
TestUpdateUserProfileFunction · 0.64
TestUpdateUserPasswordFunction · 0.64
TestActivateDormantUserFunction · 0.64
TestWorkspacesByUserFunction · 0.64
TestDormantUserFunction · 0.64