client_deprecated.go 948 B

1234567891011121314151617181920212223
  1. package client
  2. import "net/http"
  3. // NewClient initializes a new API client for the given host and API version.
  4. // It uses the given http client as transport.
  5. // It also initializes the custom http headers to add to each request.
  6. //
  7. // It won't send any version information if the version number is empty. It is
  8. // highly recommended that you set a version or your client may break if the
  9. // server is upgraded.
  10. // Deprecated: use NewClientWithOpts
  11. func NewClient(host string, version string, client *http.Client, httpHeaders map[string]string) (*Client, error) {
  12. return NewClientWithOpts(WithHost(host), WithVersion(version), WithHTTPClient(client), WithHTTPHeaders(httpHeaders))
  13. }
  14. // NewEnvClient initializes a new API client based on environment variables.
  15. // See FromEnv for a list of support environment variables.
  16. //
  17. // Deprecated: use NewClientWithOpts(FromEnv)
  18. func NewEnvClient() (*Client, error) {
  19. return NewClientWithOpts(FromEnv)
  20. }