func (e *ErrorResponse) Error() string {
	return fmt.Sprintf("%v %v: %s %d %s",
		e.Response.Request.Method, e.Response.Request.URL,
		e.Code, e.ExtCode, e.Message,
	)
}
Error implements an error interface.
package velobike
import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"net/http"
	"net/url"
)
type Client struct {
	client *http.Client
	BaseURL *url.URL
	Parkings      *ParkingsService
	Authorization *AuthorizeService
	Profile       *ProfileService
	History       *HistoryService
	SessionID *string
}
func NewClient(opts ...ClientOption) *Client {
	o := &ClientOptions{}
	for _, opt := range opts {
		opt(o)
	}
	if o.client == nil {
		o.client = http.DefaultClient
	}
	if o.baseURL == "" {
		o.baseURL = defaultURL
	}
	baseURL, _ := url.Parse(o.baseURL)
	c := &Client{client: o.client, BaseURL: baseURL}
	c.Parkings = &ParkingsService{client: c}
	c.Authorization = &AuthorizeService{client: c}
	c.Profile = &ProfileService{client: c}
	c.History = &HistoryService{client: c}
	return c
}
func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error) {
	rel, err := url.Parse(urlStr)
	if err != nil {
		return nil, err
	}
	u := c.BaseURL.ResolveReference(rel)
	var buf io.ReadWriter
	if body != nil {
		buf = new(bytes.Buffer)
		err := json.NewEncoder(buf).Encode(body)
		if err != nil {
			return nil, err
		}
	}
	req, err := http.NewRequest(method, u.String(), buf)
	if err != nil {
		return nil, err
	}
	req.Header.Add("App-Version", "1.3")
	if c.SessionID != nil {
		req.Header.Add("SessionID", *c.SessionID)
	}
	return req, nil
}
type Response struct {
	*http.Response
}
func newResponse(r *http.Response) *Response {
	response := &Response{Response: r}
	return response
}
func (c *Client) Do(req *http.Request, v interface{}) (*Response, error) {
	resp, err := c.client.Do(req)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	response := newResponse(resp)
	var buf bytes.Buffer
	body := io.TeeReader(resp.Body, &buf)
	err = CheckResponse(resp, body)
	if err != nil {
		return response, err
	}
	if v != nil {
		if w, ok := v.(io.Writer); ok {
			_, err = io.Copy(w, &buf)
			if err != nil {
				return response, err
			}
		} else {
			err = json.NewDecoder(&buf).Decode(v)
			if err == io.EOF {
				err = nil  
			}
		}
	}
	return response, err
}
type BasicAuthTransport struct {
	Username string  
	Password string  
	Transport http.RoundTripper
}
func (t *BasicAuthTransport) Client() *http.Client {
	return &http.Client{Transport: t}
}
func (t *BasicAuthTransport) transport() http.RoundTripper {
	if t.Transport != nil {
		return t.Transport
	}
	return http.DefaultTransport
}
func (t *BasicAuthTransport) RoundTrip(req *http.Request) (*http.Response, error) {
	req = cloneRequest(req)  
	req.SetBasicAuth(t.Username, t.Password)
	return t.transport().RoundTrip(req)
}
func cloneRequest(r *http.Request) *http.Request {
	r2 := new(http.Request)
	*r2 = *r
	r2.Header = make(http.Header, len(r.Header))
	for k, s := range r.Header {
		r2.Header[k] = append([]string(nil), s...)
	}
	return r2
}
type ErrorResponse struct {
	Code             string `json:"code"`
	ExtCode          int    `json:"extCode"`
	LocalizedMessage string `json:"localizedMessage"`
	Message          string `json:"message"`
	Response         *http.Response
}