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

160 lines
4.1 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"
)
// NewCancelOrderParams creates a new CancelOrderParams object
// with the default values initialized.
func NewCancelOrderParams() *CancelOrderParams {
var ()
return &CancelOrderParams{
timeout: cr.DefaultTimeout,
}
}
// NewCancelOrderParamsWithTimeout creates a new CancelOrderParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewCancelOrderParamsWithTimeout(timeout time.Duration) *CancelOrderParams {
var ()
return &CancelOrderParams{
timeout: timeout,
}
}
// NewCancelOrderParamsWithContext creates a new CancelOrderParams object
// with the default values initialized, and the ability to set a context for a request
func NewCancelOrderParamsWithContext(ctx context.Context) *CancelOrderParams {
var ()
return &CancelOrderParams{
Context: ctx,
}
}
// NewCancelOrderParamsWithHTTPClient creates a new CancelOrderParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewCancelOrderParamsWithHTTPClient(client *http.Client) *CancelOrderParams {
var ()
return &CancelOrderParams{
HTTPClient: client,
}
}
/*CancelOrderParams contains all the parameters to send to the API endpoint
for the cancel order operation typically these are written to a http.Request
*/
type CancelOrderParams struct {
/*Authorization
OAuth 2.0 Bearer Access Token
*/
Authorization string
/*ID
ID of order that needs to be canceled
*/
ID int32
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the cancel order params
func (o *CancelOrderParams) WithTimeout(timeout time.Duration) *CancelOrderParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the cancel order params
func (o *CancelOrderParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the cancel order params
func (o *CancelOrderParams) WithContext(ctx context.Context) *CancelOrderParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the cancel order params
func (o *CancelOrderParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the cancel order params
func (o *CancelOrderParams) WithHTTPClient(client *http.Client) *CancelOrderParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the cancel order params
func (o *CancelOrderParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithAuthorization adds the authorization to the cancel order params
func (o *CancelOrderParams) WithAuthorization(authorization string) *CancelOrderParams {
o.SetAuthorization(authorization)
return o
}
// SetAuthorization adds the authorization to the cancel order params
func (o *CancelOrderParams) SetAuthorization(authorization string) {
o.Authorization = authorization
}
// WithID adds the id to the cancel order params
func (o *CancelOrderParams) WithID(id int32) *CancelOrderParams {
o.SetID(id)
return o
}
// SetID adds the id to the cancel order params
func (o *CancelOrderParams) SetID(id int32) {
o.ID = id
}
// WriteToRequest writes these params to a swagger request
func (o *CancelOrderParams) 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
}
// path param id
if err := r.SetPathParam("id", swag.FormatInt32(o.ID)); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}