lib/api/metrc-gw/metrc_gw_client/metrc_gw_client.go

177 lines
5.5 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 metrc_gw_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"
"github.com/taxnexus/go/lib/api/metrc-gw/metrc_gw_client/facilities"
"github.com/taxnexus/go/lib/api/metrc-gw/metrc_gw_client/harvests"
"github.com/taxnexus/go/lib/api/metrc-gw/metrc_gw_client/items"
"github.com/taxnexus/go/lib/api/metrc-gw/metrc_gw_client/lab_tests"
"github.com/taxnexus/go/lib/api/metrc-gw/metrc_gw_client/packages"
"github.com/taxnexus/go/lib/api/metrc-gw/metrc_gw_client/plant_batches"
"github.com/taxnexus/go/lib/api/metrc-gw/metrc_gw_client/plants"
"github.com/taxnexus/go/lib/api/metrc-gw/metrc_gw_client/rooms"
"github.com/taxnexus/go/lib/api/metrc-gw/metrc_gw_client/sales"
"github.com/taxnexus/go/lib/api/metrc-gw/metrc_gw_client/strains"
"github.com/taxnexus/go/lib/api/metrc-gw/metrc_gw_client/sys"
"github.com/taxnexus/go/lib/api/metrc-gw/metrc_gw_client/transfers"
"github.com/taxnexus/go/lib/api/metrc-gw/metrc_gw_client/units_of_measure"
)
// Default metrc gw HTTP client.
var Default = NewHTTPClient(nil)
const (
// DefaultHost is the default Host
// found in Meta (info) section of spec file
DefaultHost string = "metrc-gw.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 metrc gw HTTP client.
func NewHTTPClient(formats strfmt.Registry) *MetrcGw {
return NewHTTPClientWithConfig(formats, nil)
}
// NewHTTPClientWithConfig creates a new metrc gw HTTP client,
// using a customizable transport config.
func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *MetrcGw {
// 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 metrc gw client
func New(transport runtime.ClientTransport, formats strfmt.Registry) *MetrcGw {
// ensure nullable parameters have default
if formats == nil {
formats = strfmt.Default
}
cli := new(MetrcGw)
cli.Transport = transport
cli.Facilities = facilities.New(transport, formats)
cli.Harvests = harvests.New(transport, formats)
cli.Items = items.New(transport, formats)
cli.LabTests = lab_tests.New(transport, formats)
cli.Packages = packages.New(transport, formats)
cli.PlantBatches = plant_batches.New(transport, formats)
cli.Plants = plants.New(transport, formats)
cli.Rooms = rooms.New(transport, formats)
cli.Sales = sales.New(transport, formats)
cli.Strains = strains.New(transport, formats)
cli.Sys = sys.New(transport, formats)
cli.Transfers = transfers.New(transport, formats)
cli.UnitsOfMeasure = units_of_measure.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
}
// MetrcGw is a client for metrc gw
type MetrcGw struct {
Facilities facilities.ClientService
Harvests harvests.ClientService
Items items.ClientService
LabTests lab_tests.ClientService
Packages packages.ClientService
PlantBatches plant_batches.ClientService
Plants plants.ClientService
Rooms rooms.ClientService
Sales sales.ClientService
Strains strains.ClientService
Sys sys.ClientService
Transfers transfers.ClientService
UnitsOfMeasure units_of_measure.ClientService
Transport runtime.ClientTransport
}
// SetTransport changes the transport on the client and all its subresources
func (c *MetrcGw) SetTransport(transport runtime.ClientTransport) {
c.Transport = transport
c.Facilities.SetTransport(transport)
c.Harvests.SetTransport(transport)
c.Items.SetTransport(transport)
c.LabTests.SetTransport(transport)
c.Packages.SetTransport(transport)
c.PlantBatches.SetTransport(transport)
c.Plants.SetTransport(transport)
c.Rooms.SetTransport(transport)
c.Sales.SetTransport(transport)
c.Strains.SetTransport(transport)
c.Sys.SetTransport(transport)
c.Transfers.SetTransport(transport)
c.UnitsOfMeasure.SetTransport(transport)
}