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

177 lines
5.5 KiB
Go
Raw Normal View History

2021-01-08 17:40:28 +00:00
// Code generated by go-swagger; DO NOT EDIT.
2021-01-19 16:58:40 +00:00
// All Code Copyright(c) 2018-2021 by Taxnexus, Inc.
2021-01-08 17:40:28 +00:00
// 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"
2021-01-10 17:03:26 +00:00
"code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_client/facilities"
"code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_client/harvests"
"code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_client/items"
"code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_client/lab_tests"
"code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_client/packages"
"code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_client/plant_batches"
"code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_client/plants"
"code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_client/rooms"
"code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_client/sales"
"code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_client/strains"
"code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_client/sys"
"code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_client/transfers"
"code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_client/units_of_measure"
2021-01-08 17:40:28 +00:00
)
// 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)
}