func (u *Users) Create(ctx context.Context, userObj Signup, signup apitypes.Signup) (*envelope.Unsigned, error) {
	v := &url.Values{}
	if signup.InviteCode != "" {
		v.Set("code", signup.InviteCode)
	}
	if signup.OrgInvite && signup.OrgName != "" {
		v.Set("org", signup.OrgName)
	}
	if signup.Email != "" {
		v.Set("email", signup.Email)
	}
	req, err := u.client.NewRequest("POST", "/users", v, userObj)
	if err != nil {
		log.Printf("Error making api request: %s", err)
		return nil, err
	}

	user := envelope.Unsigned{}
	_, err = u.client.Do(ctx, req, &user)
	if err != nil {
		log.Printf("Error making api request: %s", err)
		return nil, err
	}

	err = validateSelf(&user)
	if err != nil {
		log.Printf("Invalid user object: %s", err)
		return nil, err
	}

	return &user, nil
}
// Create attempts to register a new user
Create attempts to register a new user
// Create attempts to register a new user
func (u *Users) Create(ctx context.Context, userObj Signup, signup apitypes.Signup) (*envelope.Unsigned, error) {
	v := &url.Values{}
	if signup.InviteCode != "" {
		v.Set("code", signup.InviteCode)
	}
	if signup.OrgInvite && signup.OrgName != "" {
		v.Set("org", signup.OrgName)
	}
	if signup.Email != "" {
		v.Set("email", signup.Email)
	}
	req, err := u.client.NewRequest("POST", "/users", v, userObj)
	if err != nil {
		log.Printf("Error making api request: %s", err)
		return nil, err
	}
	user := envelope.Unsigned{}
	_, err = u.client.Do(ctx, req, &user)
	if err != nil {
		log.Printf("Error making api request: %s", err)
		return nil, err
	}
	err = validateSelf(&user)
	if err != nil {
		log.Printf("Invalid user object: %s", err)
		return nil, err
	}
	return &user, nil
}
func ( u * Users ) Create ( ctx context . Context , userObj Signup , signup apitypes . Signup ) ( * envelope . Unsigned , error ) { v := & url . Values { } if signup . InviteCode != " " { v . Set ( " " , signup . InviteCode ) } if signup . OrgInvite && signup . OrgName != " " { v . Set ( " " , signup . OrgName ) } if signup . Email != " " { v . Set ( " " , signup . Email ) } req , err := u . client . NewRequest ( " " , " " , v , userObj ) if err != nil { log . Printf ( " " , err ) return nil , err } user := envelope . Unsigned { } _ , err = u . client . Do ( ctx , req , & user ) if err != nil { log . Printf ( " " , err ) return nil , err } err = validateSelf ( & user ) if err != nil { log . Printf ( " " , err ) return nil , err } return & user , nil }
Create attempts to register a new user
Create attempts to register a new user