func (k *Kongo) NewRequest(ctx context.Context, method string, res *url.URL, body interface{}) (*http.Request, error) {
	url := k.BaseURL.ResolveReference(res)
	buf := new(bytes.Buffer)
	if body != nil {
		err := json.NewEncoder(buf).Encode(body)
		if err != nil {
			return nil, err
		}
	}
	req, err := http.NewRequest(method, url.String(), buf)
	if err != nil {
		return nil, err
	}
	req = req.WithContext(ctx)
	req.Header.Add("Content-Type", mediaType)
	req.Header.Add("Accept", mediaType)
	req.Header.Add("User-Agent", userAgent)
	return req, nil
}
NewRequest creates an API requrest. A relative URL can be provided in res URL instance. If specified, the
value pointed to by body JSON encoded and included in as the request body.
package kongo
import (
	"bytes"
	"context"
	"encoding/json"
	"errors"
	"fmt"
	"io/ioutil"
	"net/http"
	"net/url"
	"strconv"
	"strings"
	"time"
)
const (
	version   = "v0"
	userAgent = "kongo/" + version
	mediaType = "application/json"
)
type (
	Kongo struct {
		client *http.Client
		BaseURL *url.URL
		UserAgent string
		Node Node
		Services Services
		Routes Routes
		Customers Customers
	}
	ErrorResponse struct {
		Response *http.Response
		Message string `json:"message, omitempty"`
	}
	Time struct {
		time.Time
	}
)
func NewClient(client *http.Client, baseURL *url.URL) (*Kongo, error) {
	if client == nil {
		client = http.DefaultClient
	}
	if baseURL == nil {
		return nil, errors.New("Empty URL is not allowed")
	}
	k := &Kongo{client: client, BaseURL: baseURL, UserAgent: userAgent}
	k.Node = &NodeService{k}
	k.Services = &ServicesService{k}
	k.Routes = &RoutesService{k}
	k.Customers = &CustomersService{k}
	return k, nil
}
func New(client *http.Client, baseURL string) (*Kongo, error) {
	if baseURL == "" {
		return nil, errors.New("Empty URL is not allowed")
	}
	parsedURL, err := url.Parse(baseURL)
	if err != nil {
		return nil, err
	}
	return NewClient(client, parsedURL)
}