lib/api/geo/geo_client/geo_client.go

162 lines
4.7 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
// All Code Copyright(c) 2018-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package geo_client
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"github.com/go-openapi/runtime"
httptransport "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"code.tnxs.net/taxnexus/lib/api/geo/geo_client/coordinate"
"code.tnxs.net/taxnexus/lib/api/geo/geo_client/cors"
"code.tnxs.net/taxnexus/lib/api/geo/geo_client/country"
"code.tnxs.net/taxnexus/lib/api/geo/geo_client/county"
"code.tnxs.net/taxnexus/lib/api/geo/geo_client/domain"
"code.tnxs.net/taxnexus/lib/api/geo/geo_client/place"
"code.tnxs.net/taxnexus/lib/api/geo/geo_client/state"
"code.tnxs.net/taxnexus/lib/api/geo/geo_client/tax_rate"
"code.tnxs.net/taxnexus/lib/api/geo/geo_client/tax_type"
"code.tnxs.net/taxnexus/lib/api/geo/geo_client/taxnexus_code"
)
// Default geo HTTP client.
var Default = NewHTTPClient(nil)
const (
// DefaultHost is the default Host
// found in Meta (info) section of spec file
DefaultHost string = "geo.fabric.tnxs.net:8080"
// DefaultBasePath is the default BasePath
// found in Meta (info) section of spec file
DefaultBasePath string = "/v1"
)
// DefaultSchemes are the default schemes found in Meta (info) section of spec file
var DefaultSchemes = []string{"http"}
// NewHTTPClient creates a new geo HTTP client.
func NewHTTPClient(formats strfmt.Registry) *Geo {
return NewHTTPClientWithConfig(formats, nil)
}
// NewHTTPClientWithConfig creates a new geo HTTP client,
// using a customizable transport config.
func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *Geo {
// ensure nullable parameters have default
if cfg == nil {
cfg = DefaultTransportConfig()
}
// create transport and client
transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes)
return New(transport, formats)
}
// New creates a new geo client
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Geo {
// ensure nullable parameters have default
if formats == nil {
formats = strfmt.Default
}
cli := new(Geo)
cli.Transport = transport
cli.Coordinate = coordinate.New(transport, formats)
cli.Cors = cors.New(transport, formats)
cli.Country = country.New(transport, formats)
cli.County = county.New(transport, formats)
cli.Domain = domain.New(transport, formats)
cli.Place = place.New(transport, formats)
cli.State = state.New(transport, formats)
cli.TaxRate = tax_rate.New(transport, formats)
cli.TaxType = tax_type.New(transport, formats)
cli.TaxnexusCode = taxnexus_code.New(transport, formats)
return cli
}
// DefaultTransportConfig creates a TransportConfig with the
// default settings taken from the meta section of the spec file.
func DefaultTransportConfig() *TransportConfig {
return &TransportConfig{
Host: DefaultHost,
BasePath: DefaultBasePath,
Schemes: DefaultSchemes,
}
}
// TransportConfig contains the transport related info,
// found in the meta section of the spec file.
type TransportConfig struct {
Host string
BasePath string
Schemes []string
}
// WithHost overrides the default host,
// provided by the meta section of the spec file.
func (cfg *TransportConfig) WithHost(host string) *TransportConfig {
cfg.Host = host
return cfg
}
// WithBasePath overrides the default basePath,
// provided by the meta section of the spec file.
func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig {
cfg.BasePath = basePath
return cfg
}
// WithSchemes overrides the default schemes,
// provided by the meta section of the spec file.
func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig {
cfg.Schemes = schemes
return cfg
}
// Geo is a client for geo
type Geo struct {
Coordinate coordinate.ClientService
Cors cors.ClientService
Country country.ClientService
County county.ClientService
Domain domain.ClientService
Place place.ClientService
State state.ClientService
TaxRate tax_rate.ClientService
TaxType tax_type.ClientService
TaxnexusCode taxnexus_code.ClientService
Transport runtime.ClientTransport
}
// SetTransport changes the transport on the client and all its subresources
func (c *Geo) SetTransport(transport runtime.ClientTransport) {
c.Transport = transport
c.Coordinate.SetTransport(transport)
c.Cors.SetTransport(transport)
c.Country.SetTransport(transport)
c.County.SetTransport(transport)
c.Domain.SetTransport(transport)
c.Place.SetTransport(transport)
c.State.SetTransport(transport)
c.TaxRate.SetTransport(transport)
c.TaxType.SetTransport(transport)
c.TaxnexusCode.SetTransport(transport)
}