mirror of
https://github.com/hanzoai/go-fulfillment.git
synced 2026-10-30 18:36:06 +00:00
151 lines
3.8 KiB
Go
151 lines
3.8 KiB
Go
// Code generated by go-swagger; DO NOT EDIT.
|
|
|
|
package orders
|
|
|
|
// 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"
|
|
|
|
strfmt "github.com/go-openapi/strfmt"
|
|
)
|
|
|
|
// New creates a new orders API client.
|
|
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
|
|
return &Client{transport: transport, formats: formats}
|
|
}
|
|
|
|
/*
|
|
Client for orders API
|
|
*/
|
|
type Client struct {
|
|
transport runtime.ClientTransport
|
|
formats strfmt.Registry
|
|
}
|
|
|
|
/*
|
|
CancelOrder cancels an order
|
|
*/
|
|
func (a *Client) CancelOrder(params *CancelOrderParams) (*CancelOrderOK, error) {
|
|
// TODO: Validate the params before sending
|
|
if params == nil {
|
|
params = NewCancelOrderParams()
|
|
}
|
|
|
|
result, err := a.transport.Submit(&runtime.ClientOperation{
|
|
ID: "cancelOrder",
|
|
Method: "DELETE",
|
|
PathPattern: "/orders/{id}",
|
|
ProducesMediaTypes: []string{""},
|
|
ConsumesMediaTypes: []string{""},
|
|
Schemes: []string{"http"},
|
|
Params: params,
|
|
Reader: &CancelOrderReader{formats: a.formats},
|
|
Context: params.Context,
|
|
Client: params.HTTPClient,
|
|
})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return result.(*CancelOrderOK), nil
|
|
|
|
}
|
|
|
|
/*
|
|
CreateOrder news order
|
|
|
|
Error Notes:
|
|
* When `409 Conflict` is a 'Duplicate Order' the `context` will include the FDC `id`, see samples.
|
|
|
|
*/
|
|
func (a *Client) CreateOrder(params *CreateOrderParams) (*CreateOrderCreated, error) {
|
|
// TODO: Validate the params before sending
|
|
if params == nil {
|
|
params = NewCreateOrderParams()
|
|
}
|
|
|
|
result, err := a.transport.Submit(&runtime.ClientOperation{
|
|
ID: "createOrder",
|
|
Method: "POST",
|
|
PathPattern: "/orders",
|
|
ProducesMediaTypes: []string{""},
|
|
ConsumesMediaTypes: []string{""},
|
|
Schemes: []string{"http"},
|
|
Params: params,
|
|
Reader: &CreateOrderReader{formats: a.formats},
|
|
Context: params.Context,
|
|
Client: params.HTTPClient,
|
|
})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return result.(*CreateOrderCreated), nil
|
|
|
|
}
|
|
|
|
/*
|
|
GetOrder orders details
|
|
|
|
For the fastest results use the FDC provided `id` however you can use your `merchantOrderId` as the `id`.
|
|
*/
|
|
func (a *Client) GetOrder(params *GetOrderParams) (*GetOrderOK, error) {
|
|
// TODO: Validate the params before sending
|
|
if params == nil {
|
|
params = NewGetOrderParams()
|
|
}
|
|
|
|
result, err := a.transport.Submit(&runtime.ClientOperation{
|
|
ID: "getOrder",
|
|
Method: "GET",
|
|
PathPattern: "/orders/{id}",
|
|
ProducesMediaTypes: []string{""},
|
|
ConsumesMediaTypes: []string{""},
|
|
Schemes: []string{"http"},
|
|
Params: params,
|
|
Reader: &GetOrderReader{formats: a.formats},
|
|
Context: params.Context,
|
|
Client: params.HTTPClient,
|
|
})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return result.(*GetOrderOK), nil
|
|
|
|
}
|
|
|
|
/*
|
|
GetOrders lists of orders
|
|
|
|
Retrieve many orders at once
|
|
*/
|
|
func (a *Client) GetOrders(params *GetOrdersParams) (*GetOrdersOK, error) {
|
|
// TODO: Validate the params before sending
|
|
if params == nil {
|
|
params = NewGetOrdersParams()
|
|
}
|
|
|
|
result, err := a.transport.Submit(&runtime.ClientOperation{
|
|
ID: "getOrders",
|
|
Method: "GET",
|
|
PathPattern: "/orders",
|
|
ProducesMediaTypes: []string{""},
|
|
ConsumesMediaTypes: []string{""},
|
|
Schemes: []string{"http"},
|
|
Params: params,
|
|
Reader: &GetOrdersReader{formats: a.formats},
|
|
Context: params.Context,
|
|
Client: params.HTTPClient,
|
|
})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return result.(*GetOrdersOK), nil
|
|
|
|
}
|
|
|
|
// SetTransport changes the transport on the client
|
|
func (a *Client) SetTransport(transport runtime.ClientTransport) {
|
|
a.transport = transport
|
|
}
|