259 lines
8.4 KiB
Go
259 lines
8.4 KiB
Go
// Code generated by go-swagger; DO NOT EDIT.
|
|
|
|
// All Code Copyright(c) 2018-2021 by Taxnexus, Inc.
|
|
// All rights reserved worldwide.
|
|
// Proprietary product; unlicensed use is not allowed
|
|
|
|
package product
|
|
|
|
// This file was generated by the swagger tool.
|
|
// Editing this file might prove futile when you re-run the swagger generate command
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/go-openapi/runtime"
|
|
"github.com/go-openapi/strfmt"
|
|
)
|
|
|
|
// New creates a new product API client.
|
|
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
|
return &Client{transport: transport, formats: formats}
|
|
}
|
|
|
|
/*
|
|
Client for product API
|
|
*/
|
|
type Client struct {
|
|
transport runtime.ClientTransport
|
|
formats strfmt.Registry
|
|
}
|
|
|
|
// ClientOption is the option for Client methods
|
|
type ClientOption func(*runtime.ClientOperation)
|
|
|
|
// ClientService is the interface for Client methods
|
|
type ClientService interface {
|
|
DeleteProduct(params *DeleteProductParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteProductOK, error)
|
|
|
|
GetProducts(params *GetProductsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetProductsOK, error)
|
|
|
|
GetProductsObservable(params *GetProductsObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetProductsObservableOK, error)
|
|
|
|
PostProducts(params *PostProductsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostProductsOK, error)
|
|
|
|
PutProducts(params *PutProductsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutProductsOK, error)
|
|
|
|
SetTransport(transport runtime.ClientTransport)
|
|
}
|
|
|
|
/*
|
|
DeleteProduct deletes a product
|
|
|
|
Delete Taxnexus Product record
|
|
*/
|
|
func (a *Client) DeleteProduct(params *DeleteProductParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteProductOK, error) {
|
|
// TODO: Validate the params before sending
|
|
if params == nil {
|
|
params = NewDeleteProductParams()
|
|
}
|
|
op := &runtime.ClientOperation{
|
|
ID: "deleteProduct",
|
|
Method: "DELETE",
|
|
PathPattern: "/products",
|
|
ProducesMediaTypes: []string{"application/json"},
|
|
ConsumesMediaTypes: []string{"application/json"},
|
|
Schemes: []string{"http"},
|
|
Params: params,
|
|
Reader: &DeleteProductReader{formats: a.formats},
|
|
AuthInfo: authInfo,
|
|
Context: params.Context,
|
|
Client: params.HTTPClient,
|
|
}
|
|
for _, opt := range opts {
|
|
opt(op)
|
|
}
|
|
|
|
result, err := a.transport.Submit(op)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
success, ok := result.(*DeleteProductOK)
|
|
if ok {
|
|
return success, nil
|
|
}
|
|
// unexpected success response
|
|
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
|
msg := fmt.Sprintf("unexpected success response for deleteProduct: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
|
panic(msg)
|
|
}
|
|
|
|
/*
|
|
GetProducts gets a list of products
|
|
|
|
Return a list of all available Products
|
|
*/
|
|
func (a *Client) GetProducts(params *GetProductsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetProductsOK, error) {
|
|
// TODO: Validate the params before sending
|
|
if params == nil {
|
|
params = NewGetProductsParams()
|
|
}
|
|
op := &runtime.ClientOperation{
|
|
ID: "getProducts",
|
|
Method: "GET",
|
|
PathPattern: "/products",
|
|
ProducesMediaTypes: []string{"application/json"},
|
|
ConsumesMediaTypes: []string{"application/json"},
|
|
Schemes: []string{"http"},
|
|
Params: params,
|
|
Reader: &GetProductsReader{formats: a.formats},
|
|
AuthInfo: authInfo,
|
|
Context: params.Context,
|
|
Client: params.HTTPClient,
|
|
}
|
|
for _, opt := range opts {
|
|
opt(op)
|
|
}
|
|
|
|
result, err := a.transport.Submit(op)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
success, ok := result.(*GetProductsOK)
|
|
if ok {
|
|
return success, nil
|
|
}
|
|
// unexpected success response
|
|
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
|
msg := fmt.Sprintf("unexpected success response for getProducts: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
|
panic(msg)
|
|
}
|
|
|
|
/*
|
|
GetProductsObservable gets a list of products
|
|
|
|
Return a simplified list of all available Products
|
|
*/
|
|
func (a *Client) GetProductsObservable(params *GetProductsObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetProductsObservableOK, error) {
|
|
// TODO: Validate the params before sending
|
|
if params == nil {
|
|
params = NewGetProductsObservableParams()
|
|
}
|
|
op := &runtime.ClientOperation{
|
|
ID: "getProductsObservable",
|
|
Method: "GET",
|
|
PathPattern: "/products/observable",
|
|
ProducesMediaTypes: []string{"application/json"},
|
|
ConsumesMediaTypes: []string{"application/json"},
|
|
Schemes: []string{"http"},
|
|
Params: params,
|
|
Reader: &GetProductsObservableReader{formats: a.formats},
|
|
AuthInfo: authInfo,
|
|
Context: params.Context,
|
|
Client: params.HTTPClient,
|
|
}
|
|
for _, opt := range opts {
|
|
opt(op)
|
|
}
|
|
|
|
result, err := a.transport.Submit(op)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
success, ok := result.(*GetProductsObservableOK)
|
|
if ok {
|
|
return success, nil
|
|
}
|
|
// unexpected success response
|
|
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
|
msg := fmt.Sprintf("unexpected success response for getProductsObservable: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
|
panic(msg)
|
|
}
|
|
|
|
/*
|
|
PostProducts adds new products
|
|
|
|
Product records to be added
|
|
*/
|
|
func (a *Client) PostProducts(params *PostProductsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostProductsOK, error) {
|
|
// TODO: Validate the params before sending
|
|
if params == nil {
|
|
params = NewPostProductsParams()
|
|
}
|
|
op := &runtime.ClientOperation{
|
|
ID: "postProducts",
|
|
Method: "POST",
|
|
PathPattern: "/products",
|
|
ProducesMediaTypes: []string{"application/json"},
|
|
ConsumesMediaTypes: []string{"application/json"},
|
|
Schemes: []string{"http"},
|
|
Params: params,
|
|
Reader: &PostProductsReader{formats: a.formats},
|
|
AuthInfo: authInfo,
|
|
Context: params.Context,
|
|
Client: params.HTTPClient,
|
|
}
|
|
for _, opt := range opts {
|
|
opt(op)
|
|
}
|
|
|
|
result, err := a.transport.Submit(op)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
success, ok := result.(*PostProductsOK)
|
|
if ok {
|
|
return success, nil
|
|
}
|
|
// unexpected success response
|
|
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
|
msg := fmt.Sprintf("unexpected success response for postProducts: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
|
panic(msg)
|
|
}
|
|
|
|
/*
|
|
PutProducts updates products
|
|
|
|
Update Product records
|
|
*/
|
|
func (a *Client) PutProducts(params *PutProductsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutProductsOK, error) {
|
|
// TODO: Validate the params before sending
|
|
if params == nil {
|
|
params = NewPutProductsParams()
|
|
}
|
|
op := &runtime.ClientOperation{
|
|
ID: "putProducts",
|
|
Method: "PUT",
|
|
PathPattern: "/products",
|
|
ProducesMediaTypes: []string{"application/json"},
|
|
ConsumesMediaTypes: []string{"application/json"},
|
|
Schemes: []string{"http"},
|
|
Params: params,
|
|
Reader: &PutProductsReader{formats: a.formats},
|
|
AuthInfo: authInfo,
|
|
Context: params.Context,
|
|
Client: params.HTTPClient,
|
|
}
|
|
for _, opt := range opts {
|
|
opt(op)
|
|
}
|
|
|
|
result, err := a.transport.Submit(op)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
success, ok := result.(*PutProductsOK)
|
|
if ok {
|
|
return success, nil
|
|
}
|
|
// unexpected success response
|
|
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
|
msg := fmt.Sprintf("unexpected success response for putProducts: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
|
panic(msg)
|
|
}
|
|
|
|
// SetTransport changes the transport on the client
|
|
func (a *Client) SetTransport(transport runtime.ClientTransport) {
|
|
a.transport = transport
|
|
}
|