Esempio n. 1
0
// Create a new user and return a UserClient tied to the APIClient argument
func CreateUserClient(client *api.Client, email, firstName, lastName string) (*UserClient, error) {
	body, _, err := client.CreateUser(email, firstName, lastName)
	if err != nil {
		return nil, err
	}

	u := User{}
	err = json.Unmarshal(body, &u)
	if err != nil {
		return nil, errors.New("Unable to unmarshal new User")
	}

	return &UserClient{client, u}, nil
}