func NewClient(opts ClientOpts) (*API, error) {
	var transport http.RoundTripper

	transport = &http.Transport{
		// Allow insecure and self-signed certificates if so configured
		TLSClientConfig: &tls.Config{
			InsecureSkipVerify: opts.AllowInsecure,
		},
	}

	if opts.Debug {
		// Wrap transport in debug logging
		transport = httplogger.NewLoggedTransport(transport, internal.NewHTTPLogger())
	}

	return &API{
		host: CanonicalHost(opts.Host),
		client: &http.Client{
			Transport: transport,
			Timeout:   15 * time.Second,
		},
		jwt:       opts.JWTToken,
		address:   opts.Address,
		key:       opts.Key,
		errorFunc: opts.ErrorFunc,
	}, nil
}
// NewClient creates a new client based on the given options
NewClient creates a new client based on the given options
// NewClient creates a new client based on the given options
func NewClient(opts ClientOpts) (*API, error) {
	var transport http.RoundTripper
	transport = &http.Transport{
		TLSClientConfig: &tls.Config{
			InsecureSkipVerify: opts.AllowInsecure,
		},
	}
	if opts.Debug {
		transport = httplogger.NewLoggedTransport(transport, internal.NewHTTPLogger())
	}
	return &API{
		host: CanonicalHost(opts.Host),
		client: &http.Client{
			Transport: transport,
			Timeout:   15 * time.Second,
		},
		jwt:       opts.JWTToken,
		address:   opts.Address,
		key:       opts.Key,
		errorFunc: opts.ErrorFunc,
	}, nil
}
func NewClient ( opts ClientOpts ) ( * API , error ) { var transport http . RoundTripper transport = & http . Transport { TLSClientConfig : & tls . Config { InsecureSkipVerify : opts . AllowInsecure , } , } if opts . Debug { transport = httplogger . NewLoggedTransport ( transport , internal . NewHTTPLogger ( ) ) } return & API { host : CanonicalHost ( opts . Host ) , client : & http . Client { Transport : transport , Timeout : 15 * time . Second , } , jwt : opts . JWTToken , address : opts . Address , key : opts . Key , errorFunc : opts . ErrorFunc , } , nil }
NewClient creates a new client based on the given options
NewClient creates a new client based on the given options
// Allow insecure and self-signed certificates if so configured // Wrap transport in debug logging