code: func (r *Resource) do(method string) (*Resource, error) {
  	url := *r.Api.BaseUrl
  	if len(url.Path) > 0 {
  		url.Path += "/" + r.Url
  	} else {
  		url.Path = r.Url
  	}
  	if r.Api.PathSuffix != "" {
  		url.Path += r.Api.PathSuffix
  	}
  
  	url.RawQuery = r.QueryValues.Encode()
  	req, err := http.NewRequest(method, url.String(), r.Payload)
  	if err != nil {
  		return r, err
  	}
  
  	if r.Api.BasicAuth != nil {
  		req.SetBasicAuth(r.Api.BasicAuth.Username, r.Api.BasicAuth.Password)
  	}
  
  	if r.Headers != nil {
  		for k, _ := range r.Headers {
  			req.Header.Set(k, r.Headers.Get(k))
  		}
  	}
  
  	resp, err := r.Api.Client.Do(req)
  	if err != nil {
  		return r, err
  	}
  
  	r.Raw = resp
  
  	if resp.StatusCode >= 400 {
  		return r, nil
  	}
  
  	for k, _ := range r.Raw.Header {
  		r.SetHeader(k, r.Raw.Header.Get(k));
  	}
  
  	defer resp.Body.Close()
  
  	err = json.NewDecoder(resp.Body).Decode(r.Response)
  	if err != nil {
  		return r, err
  	}
  
  	return r, nil
  }
docs: // Main method, opens the connection, sets basic auth, applies headers,
  // parses response json.