func (r commonResult) Extract() (*User, error) {
	if r.Err != nil {
		return nil, r.Err
	}
	var response struct {
		User User `mapstructure:"user"`
	}
	err := mapstructure.Decode(r.Body, &response)
	return &response.User, err
}
Extract interprets any commonResult as a User, if possible.
package users
import (
	"github.com/mitchellh/mapstructure"
	"github.com/rackspace/gophercloud"
	"github.com/rackspace/gophercloud/pagination"
)
type User struct {
	ID string
	Name string
	Username string
	Enabled bool
	Email string
	TenantID string `mapstructure:"tenant_id"`
}
type Role struct {
	ID string
	Name string
}
type UserPage struct {
	pagination.SinglePageBase
}
type RolePage struct {
	pagination.SinglePageBase
}
func (page UserPage) IsEmpty() (bool, error) {
	users, err := ExtractUsers(page)
	if err != nil {
		return false, err
	}
	return len(users) == 0, nil
}
func ExtractUsers(page pagination.Page) ([]User, error) {
	casted := page.(UserPage).Body
	var response struct {
		Users []User `mapstructure:"users"`
	}
	err := mapstructure.Decode(casted, &response)
	return response.Users, err
}
func (page RolePage) IsEmpty() (bool, error) {
	users, err := ExtractRoles(page)
	if err != nil {
		return false, err
	}
	return len(users) == 0, nil
}
func ExtractRoles(page pagination.Page) ([]Role, error) {
	casted := page.(RolePage).Body
	var response struct {
		Roles []Role `mapstructure:"roles"`
	}
	err := mapstructure.Decode(casted, &response)
	return response.Roles, err
}
type commonResult struct {
	gophercloud.Result
}