Files
go-fulfillment/client/orders/get_orders_parameters.go
2018-08-13 17:30:21 -05:00

327 lines
7.9 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 (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/swag"
strfmt "github.com/go-openapi/strfmt"
)
// NewGetOrdersParams creates a new GetOrdersParams object
// with the default values initialized.
func NewGetOrdersParams() *GetOrdersParams {
var (
limitDefault = int64(80)
pageDefault = int64(1)
)
return &GetOrdersParams{
Limit: &limitDefault,
Page: &pageDefault,
timeout: cr.DefaultTimeout,
}
}
// NewGetOrdersParamsWithTimeout creates a new GetOrdersParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewGetOrdersParamsWithTimeout(timeout time.Duration) *GetOrdersParams {
var (
limitDefault = int64(80)
pageDefault = int64(1)
)
return &GetOrdersParams{
Limit: &limitDefault,
Page: &pageDefault,
timeout: timeout,
}
}
// NewGetOrdersParamsWithContext creates a new GetOrdersParams object
// with the default values initialized, and the ability to set a context for a request
func NewGetOrdersParamsWithContext(ctx context.Context) *GetOrdersParams {
var (
limitDefault = int64(80)
pageDefault = int64(1)
)
return &GetOrdersParams{
Limit: &limitDefault,
Page: &pageDefault,
Context: ctx,
}
}
// NewGetOrdersParamsWithHTTPClient creates a new GetOrdersParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewGetOrdersParamsWithHTTPClient(client *http.Client) *GetOrdersParams {
var (
limitDefault = int64(80)
pageDefault = int64(1)
)
return &GetOrdersParams{
Limit: &limitDefault,
Page: &pageDefault,
HTTPClient: client,
}
}
/*GetOrdersParams contains all the parameters to send to the API endpoint
for the get orders operation typically these are written to a http.Request
*/
type GetOrdersParams struct {
/*Authorization
OAuth 2.0 Bearer Access Token
*/
Authorization string
/*FromDate
Date-time in ISO 8601 format for selecting orders after, or at, the specified time
*/
FromDate string
/*Limit
The numbers of items to return
*/
Limit *int64
/*MerchantIds
A CSV of merchant id, '123' or '1,2,3'
*/
MerchantIds []int64
/*Page
A multiplier of the number of items (limit paramater) to skip before returning results
*/
Page *int64
/*ToDate
Date-time in ISO 8601 format for selecting orders before, or at, the specified time
*/
ToDate string
/*WarehouseIds
A CSV of warehouse id, '123' or '1,2,3'
*/
WarehouseIds []int64
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the get orders params
func (o *GetOrdersParams) WithTimeout(timeout time.Duration) *GetOrdersParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get orders params
func (o *GetOrdersParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get orders params
func (o *GetOrdersParams) WithContext(ctx context.Context) *GetOrdersParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get orders params
func (o *GetOrdersParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get orders params
func (o *GetOrdersParams) WithHTTPClient(client *http.Client) *GetOrdersParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get orders params
func (o *GetOrdersParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithAuthorization adds the authorization to the get orders params
func (o *GetOrdersParams) WithAuthorization(authorization string) *GetOrdersParams {
o.SetAuthorization(authorization)
return o
}
// SetAuthorization adds the authorization to the get orders params
func (o *GetOrdersParams) SetAuthorization(authorization string) {
o.Authorization = authorization
}
// WithFromDate adds the fromDate to the get orders params
func (o *GetOrdersParams) WithFromDate(fromDate string) *GetOrdersParams {
o.SetFromDate(fromDate)
return o
}
// SetFromDate adds the fromDate to the get orders params
func (o *GetOrdersParams) SetFromDate(fromDate string) {
o.FromDate = fromDate
}
// WithLimit adds the limit to the get orders params
func (o *GetOrdersParams) WithLimit(limit *int64) *GetOrdersParams {
o.SetLimit(limit)
return o
}
// SetLimit adds the limit to the get orders params
func (o *GetOrdersParams) SetLimit(limit *int64) {
o.Limit = limit
}
// WithMerchantIds adds the merchantIds to the get orders params
func (o *GetOrdersParams) WithMerchantIds(merchantIds []int64) *GetOrdersParams {
o.SetMerchantIds(merchantIds)
return o
}
// SetMerchantIds adds the merchantIds to the get orders params
func (o *GetOrdersParams) SetMerchantIds(merchantIds []int64) {
o.MerchantIds = merchantIds
}
// WithPage adds the page to the get orders params
func (o *GetOrdersParams) WithPage(page *int64) *GetOrdersParams {
o.SetPage(page)
return o
}
// SetPage adds the page to the get orders params
func (o *GetOrdersParams) SetPage(page *int64) {
o.Page = page
}
// WithToDate adds the toDate to the get orders params
func (o *GetOrdersParams) WithToDate(toDate string) *GetOrdersParams {
o.SetToDate(toDate)
return o
}
// SetToDate adds the toDate to the get orders params
func (o *GetOrdersParams) SetToDate(toDate string) {
o.ToDate = toDate
}
// WithWarehouseIds adds the warehouseIds to the get orders params
func (o *GetOrdersParams) WithWarehouseIds(warehouseIds []int64) *GetOrdersParams {
o.SetWarehouseIds(warehouseIds)
return o
}
// SetWarehouseIds adds the warehouseIds to the get orders params
func (o *GetOrdersParams) SetWarehouseIds(warehouseIds []int64) {
o.WarehouseIds = warehouseIds
}
// WriteToRequest writes these params to a swagger request
func (o *GetOrdersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// header param Authorization
if err := r.SetHeaderParam("Authorization", o.Authorization); err != nil {
return err
}
// query param fromDate
qrFromDate := o.FromDate
qFromDate := qrFromDate
if qFromDate != "" {
if err := r.SetQueryParam("fromDate", qFromDate); err != nil {
return err
}
}
if o.Limit != nil {
// query param limit
var qrLimit int64
if o.Limit != nil {
qrLimit = *o.Limit
}
qLimit := swag.FormatInt64(qrLimit)
if qLimit != "" {
if err := r.SetQueryParam("limit", qLimit); err != nil {
return err
}
}
}
var valuesMerchantIds []string
for _, v := range o.MerchantIds {
valuesMerchantIds = append(valuesMerchantIds, swag.FormatInt64(v))
}
joinedMerchantIds := swag.JoinByFormat(valuesMerchantIds, "csv")
// query array param merchantIds
if err := r.SetQueryParam("merchantIds", joinedMerchantIds...); err != nil {
return err
}
if o.Page != nil {
// query param page
var qrPage int64
if o.Page != nil {
qrPage = *o.Page
}
qPage := swag.FormatInt64(qrPage)
if qPage != "" {
if err := r.SetQueryParam("page", qPage); err != nil {
return err
}
}
}
// query param toDate
qrToDate := o.ToDate
qToDate := qrToDate
if qToDate != "" {
if err := r.SetQueryParam("toDate", qToDate); err != nil {
return err
}
}
var valuesWarehouseIds []string
for _, v := range o.WarehouseIds {
valuesWarehouseIds = append(valuesWarehouseIds, swag.FormatInt64(v))
}
joinedWarehouseIds := swag.JoinByFormat(valuesWarehouseIds, "csv")
// query array param warehouseIds
if err := r.SetQueryParam("warehouseIds", joinedWarehouseIds...); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}