// The code in this file was automatically generated by running httprequest-generate-client.
// DO NOT EDIT

package idmclient

import (
	"github.com/juju/httprequest"
	"gopkg.in/macaroon.v1"

	"github.com/juju/idmclient/params"
)

type client struct {
	Client httprequest.Client
}

// QueryUsers serves the /u endpoint. See http://tinyurl.com/lu3mmr9 for
// details.
func (c *client) QueryUsers(p *params.QueryUsersRequest) ([]string, error) {
	var r []string
	err := c.Client.Call(p, &r)
	return r, err
}

func (c *client) SetUser(p *params.SetUserRequest) error {
	return c.Client.Call(p, nil)
}

// SetUserExtraInfo serves the /v1/u/:username/extra-info endpoint, see
// http://tinyurl.com/mqpynlw for details.
func (c *client) SetUserExtraInfo(p *params.SetUserExtraInfoRequest) error {
	return c.Client.Call(p, nil)
}

// ServeUserPutExtraInfoItem serves the /u/:username/extra-info/:item
// endpoint, see http://tinyurl.com/l5dc4r4 for details.
func (c *client) SetUserExtraInfoItem(p *params.SetUserExtraInfoItemRequest) error {
	return c.Client.Call(p, nil)
}

// User serves the /u/$username endpoint. See http://tinyurl.com/lrdjwmw
// for details.
func (c *client) User(p *params.UserRequest) (*params.User, error) {
	var r *params.User
	err := c.Client.Call(p, &r)
	return r, err
}

// UserExtraInfo serves the /v1/u/:username/extra-info endpoint, see
// http://tinyurl.com/mxo24yy for details.
func (c *client) UserExtraInfo(p *params.UserExtraInfoRequest) (map[string]interface{}, error) {
	var r map[string]interface{}
	err := c.Client.Call(p, &r)
	return r, err
}

// UserExtraInfoItem serves the /u/:username/extra-info/:item
// endpoint, see http://tinyurl.com/mjuu7dt for details.
func (c *client) UserExtraInfoItem(p *params.UserExtraInfoItemRequest) (interface{}, error) {
	var r interface{}
	err := c.Client.Call(p, &r)
	return r, err
}

// serveUserGroups serves the /u/$username/groups endpoint, and returns
// the list of groups associated with the user.
func (c *client) UserGroups(p *params.UserGroupsRequest) ([]string, error) {
	var r []string
	err := c.Client.Call(p, &r)
	return r, err
}

// UserIDPGroups serves the /u/$username/idpgroups endpoint, and returns
// the list of groups associated with the user. This endpoint should no longer be used
// and is maintained for backwards compatibility purposes only.
func (c *client) UserIDPGroups(p *params.UserIDPGroupsRequest) ([]string, error) {
	var r []string
	err := c.Client.Call(p, &r)
	return r, err
}

// UserToken serves a token, in the form of a macaroon, identifying
// the user. This token can only be generated by an administrator.
func (c *client) UserToken(p *params.UserTokenRequest) (*macaroon.Macaroon, error) {
	var r *macaroon.Macaroon
	err := c.Client.Call(p, &r)
	return r, err
}

func (c *client) VerifyToken(p *params.VerifyTokenRequest) (map[string]string, error) {
	var r map[string]string
	err := c.Client.Call(p, &r)
	return r, err
}
