func (a *APIv2) NewAPIRequest(method, urlStr string, body io.Reader) (*http.Request, error) {
	req, err := http.NewRequest(method, urlStr, body)
	if err != nil {
		return nil, err
	}
	req.SetBasicAuth("x", a.key)
	req.Header.Add("Content-Type", "application/json")
	req.Header.Add("X-Gms-Client-Version", config.VERSION)
	req.Header.Add("X-Gms-Revision", utils.GetCurrentRevision())
	req.Header.Add("X-Gms-Branch", utils.GetCurrentBranch())
	return req, nil
}
Create a new API request, with needed headers for auth and content-type
package api
import (
	"encoding/json"
	"net/http"
	"bytes"
	"fmt"
	"os"
	"io"
	"io/ioutil"
	"github.com/gemnasium/toolbelt/config"
	"github.com/gemnasium/toolbelt/utils"
)
type APIv2 struct {
	endpoint string
	key string
	jwt string
	host string
}
func NewAPIv2(endpoint string, key string) (api *APIv2) {
	newAPIv2 := new(APIv2)
	h, err := getHost(endpoint)
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
	newAPIv2.endpoint = endpoint
	newAPIv2.key = key
	newAPIv2.host = h
	return newAPIv2
}
func (a *APIv2) Endpoint() string {
	return a.endpoint
}
func (a *APIv2) Host() string {
	h, err := getHost(a.endpoint)
	if err != nil {
		return ""
	}
	return h
}
func (a *APIv2) Key() string {
	return a.key
}
func (a *APIv2) SetKey(key string) {
	a.key = key
}