// NewClient initializes a new API client for the given host and API version.
NewClient initializes a new API client for the given host and API version.
// NewClient initializes a new API client for the given host and API version .
func NewClient(host string, version string, client *http.Client) (*Client, error) {
	hostURL, err := ParseHostURL(host)
	if err != nil {
		return nil, err
	}
	if client != nil {
		if _, ok := client.Transport.(http.RoundTripper); !ok {
			return nil, fmt.Errorf("unable to verify TLS configuration, invalid transport %v", client.Transport)
		}
	} else {
		transport := new(http.Transport)
		client = &http.Client{
			Transport: transport,
		}
	}
	scheme := "http"
	return &Client{
		scheme:   scheme,
		host:     host,
		proto:    hostURL.Scheme,
		addr:     hostURL.Host,
		basePath: hostURL.Path,
		client:   client,
		version:  version,
	}, nil
}
func NewClient ( host string , version string , client * http . Client ) ( * Client , error ) { hostURL , err := ParseHostURL ( host ) if err != nil { return nil , err } if client != nil { if _ , ok := client . Transport . ( http . RoundTripper ) ; ! ok { return nil , fmt . Errorf ( " " , client . Transport ) } } else { transport := new ( http . Transport ) client = & http . Client { Transport : transport , } } scheme := " " return & Client { scheme : scheme , host : host , proto : hostURL . Scheme , addr : hostURL . Host , basePath : hostURL . Path , client : client , version : version , } , nil }
NewClient initializes a new API client for the given host and API version.
NewClient initializes a new API client for the given host and API version .