コード例 #1
0
func (so *SobjectFsdb) LoadResponse(res *http.Response) error {
	body, err := httputil.ResponseBody(res)
	if err != nil {
		return err
	}
	msi := map[string]interface{}{}
	json.Unmarshal(body, &msi)
	so.Data = msi
	now := time.Now()
	so.Meta.EpochRetrievedSourceI64 = now.Unix()
	so.Meta.HttpStatusCodeI32 = int32(res.StatusCode)
	return nil
}
コード例 #2
0
func (cl *RestClient) LoadToken() error {
	resp, err := http.PostForm(cl.Config.ConfigToken.TokenUrl, cl.Config.ConfigToken.UrlValues)
	if err != nil {
		return err
	}
	body, err := httputil.ResponseBody(resp)
	if err != nil {
		return err
	}
	tokRes := SalesforceTokenResponse{}
	json.Unmarshal(body, &tokRes)
	cl.TokenResponse = tokRes
	return nil
}