func (server UbuntuSSOServer) GetAccounts(ssodata *SSOData) (string, error) {
	rp := RequestParameters{
		BaseURL:         server.AccountsURL() + ssodata.ConsumerKey,
		HTTPMethod:      "GET",
		SignatureMethod: HMACSHA1{}}

	request, err := http.NewRequest(rp.HTTPMethod, rp.BaseURL, nil)
	if err != nil {
		return "", err
	}
	err = SignRequest(ssodata, &rp, request)
	if err != nil {
		return "", err
	}
	client := &http.Client{}
	response, err := client.Do(request)
	if err != nil {
		return "", err
	}

	body, err := ioutil.ReadAll(response.Body)
	if err != nil {
		return "", err
	}
	if response.StatusCode == 200 {
		return string(body), nil
	} else {
		var jsonMap map[string]interface{}
		err = json.Unmarshal(body, &jsonMap)
		// In theory, this should never happen.
		if err != nil {
			return "", fmt.Errorf("NO_JSON_RESPONSE")
		}
		code, ok := jsonMap["code"]
		if !ok {
			return "", fmt.Errorf("NO_CODE")
		}
		return "", fmt.Errorf("%v", code)
	}
}
// Returns all the Ubuntu SSO information related to this account.
Returns all the Ubuntu SSO information related to this account.
// Returns all the Ubuntu SSO information related to this account .
func (server UbuntuSSOServer) GetAccounts(ssodata *SSOData) (string, error) {
	rp := RequestParameters{
		BaseURL:         server.AccountsURL() + ssodata.ConsumerKey,
		HTTPMethod:      "GET",
		SignatureMethod: HMACSHA1{}}
	request, err := http.NewRequest(rp.HTTPMethod, rp.BaseURL, nil)
	if err != nil {
		return "", err
	}
	err = SignRequest(ssodata, &rp, request)
	if err != nil {
		return "", err
	}
	client := &http.Client{}
	response, err := client.Do(request)
	if err != nil {
		return "", err
	}
	body, err := ioutil.ReadAll(response.Body)
	if err != nil {
		return "", err
	}
	if response.StatusCode == 200 {
		return string(body), nil
	} else {
		var jsonMap map[string]interface{}
		err = json.Unmarshal(body, &jsonMap)
		if err != nil {
			return "", fmt.Errorf("NO_JSON_RESPONSE")
		}
		code, ok := jsonMap["code"]
		if !ok {
			return "", fmt.Errorf("NO_CODE")
		}
		return "", fmt.Errorf("%v", code)
	}
}
func ( server UbuntuSSOServer ) GetAccounts ( ssodata * SSOData ) ( string , error ) { rp := RequestParameters { BaseURL : server . AccountsURL ( ) + ssodata . ConsumerKey , HTTPMethod : " " , SignatureMethod : HMACSHA1 { } } request , err := http . NewRequest ( rp . HTTPMethod , rp . BaseURL , nil ) if err != nil { return " " , err } err = SignRequest ( ssodata , & rp , request ) if err != nil { return " " , err } client := & http . Client { } response , err := client . Do ( request ) if err != nil { return " " , err } body , err := ioutil . ReadAll ( response . Body ) if err != nil { return " " , err } if response . StatusCode == 200 { return string ( body ) , nil } else { var jsonMap map [ string ] interface { } err = json . Unmarshal ( body , & jsonMap ) if err != nil { return " " , fmt . Errorf ( " " ) } code , ok := jsonMap [ " " ] if ! ok { return " " , fmt . Errorf ( " " ) } return " " , fmt . Errorf ( " " , code ) } }
Returns all the Ubuntu SSO information related to this account.
Returns all the Ubuntu SSO information related to this account .
// In theory, this should never happen.