package alipayapi

import "git.rosy.net.cn/baseapi/utils"

type UserInfo struct {
	Code               string `json:"code"`
	Msg                string `json:"msg"`
	Avatar             string `json:"avatar"`
	City               string `json:"city"`
	Gender             string `json:"gender"`
	IsCertified        string `json:"is_certified"`
	IsStudentCertified string `json:"is_student_certified"`
	NickName           string `json:"nick_name"`
	Province           string `json:"province"`
	UserID             string `json:"user_id"`
	UserStatus         string `json:"user_status"`
	UserType           string `json:"user_type"`
}

func (a *API) UserInfoShare(accessToken string) (userInfo *UserInfo, err error) {
	params := map[string]interface{}{
		"auth_token": accessToken,
	}
	retVal, err := a.AccessAPI("alipay.user.info.share", params, nil, false)
	if err == nil {
		err = utils.Map2StructByJson(retVal, &userInfo, false)
	}
	return userInfo, err
}
