448 lines
9.3 KiB
Go
448 lines
9.3 KiB
Go
// Code generated by go-swagger; DO NOT EDIT.
|
|
|
|
package operations
|
|
|
|
// This file was generated by the swagger tool.
|
|
// Editing this file might prove futile when you re-run the swagger generate command
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
"time"
|
|
|
|
"github.com/go-openapi/errors"
|
|
"github.com/go-openapi/runtime"
|
|
cr "github.com/go-openapi/runtime/client"
|
|
"github.com/go-openapi/strfmt"
|
|
"github.com/go-openapi/swag"
|
|
)
|
|
|
|
// NewGetVehiclesParams creates a new GetVehiclesParams object,
|
|
// with the default timeout for this client.
|
|
//
|
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
|
//
|
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
|
func NewGetVehiclesParams() *GetVehiclesParams {
|
|
return &GetVehiclesParams{
|
|
timeout: cr.DefaultTimeout,
|
|
}
|
|
}
|
|
|
|
// NewGetVehiclesParamsWithTimeout creates a new GetVehiclesParams object
|
|
// with the ability to set a timeout on a request.
|
|
func NewGetVehiclesParamsWithTimeout(timeout time.Duration) *GetVehiclesParams {
|
|
return &GetVehiclesParams{
|
|
timeout: timeout,
|
|
}
|
|
}
|
|
|
|
// NewGetVehiclesParamsWithContext creates a new GetVehiclesParams object
|
|
// with the ability to set a context for a request.
|
|
func NewGetVehiclesParamsWithContext(ctx context.Context) *GetVehiclesParams {
|
|
return &GetVehiclesParams{
|
|
Context: ctx,
|
|
}
|
|
}
|
|
|
|
// NewGetVehiclesParamsWithHTTPClient creates a new GetVehiclesParams object
|
|
// with the ability to set a custom HTTPClient for a request.
|
|
func NewGetVehiclesParamsWithHTTPClient(client *http.Client) *GetVehiclesParams {
|
|
return &GetVehiclesParams{
|
|
HTTPClient: client,
|
|
}
|
|
}
|
|
|
|
/*
|
|
GetVehiclesParams contains all the parameters to send to the API endpoint
|
|
|
|
for the get vehicles operation.
|
|
|
|
Typically these are written to a http.Request.
|
|
*/
|
|
type GetVehiclesParams struct {
|
|
|
|
/* Limit.
|
|
|
|
Max number of records
|
|
*/
|
|
Limit *int64
|
|
|
|
/* Model.
|
|
|
|
Car model
|
|
*/
|
|
Model *int64
|
|
|
|
/* Offset.
|
|
|
|
Records offset
|
|
*/
|
|
Offset *int64
|
|
|
|
/* Online.
|
|
|
|
Car status
|
|
*/
|
|
Online *bool
|
|
|
|
/* OnlineHmi.
|
|
|
|
HMI status
|
|
*/
|
|
OnlineHmi *bool
|
|
|
|
/* Order.
|
|
|
|
Sort on column with asc or desc
|
|
*/
|
|
Order *string
|
|
|
|
/* Search.
|
|
|
|
Text search
|
|
*/
|
|
Search *string
|
|
|
|
/* Vins.
|
|
|
|
csv of Car vin
|
|
*/
|
|
Vins []string
|
|
|
|
/* Year.
|
|
|
|
Car year
|
|
*/
|
|
Year *string
|
|
|
|
timeout time.Duration
|
|
Context context.Context
|
|
HTTPClient *http.Client
|
|
}
|
|
|
|
// WithDefaults hydrates default values in the get vehicles params (not the query body).
|
|
//
|
|
// All values with no default are reset to their zero value.
|
|
func (o *GetVehiclesParams) WithDefaults() *GetVehiclesParams {
|
|
o.SetDefaults()
|
|
return o
|
|
}
|
|
|
|
// SetDefaults hydrates default values in the get vehicles params (not the query body).
|
|
//
|
|
// All values with no default are reset to their zero value.
|
|
func (o *GetVehiclesParams) SetDefaults() {
|
|
// no default values defined for this parameter
|
|
}
|
|
|
|
// WithTimeout adds the timeout to the get vehicles params
|
|
func (o *GetVehiclesParams) WithTimeout(timeout time.Duration) *GetVehiclesParams {
|
|
o.SetTimeout(timeout)
|
|
return o
|
|
}
|
|
|
|
// SetTimeout adds the timeout to the get vehicles params
|
|
func (o *GetVehiclesParams) SetTimeout(timeout time.Duration) {
|
|
o.timeout = timeout
|
|
}
|
|
|
|
// WithContext adds the context to the get vehicles params
|
|
func (o *GetVehiclesParams) WithContext(ctx context.Context) *GetVehiclesParams {
|
|
o.SetContext(ctx)
|
|
return o
|
|
}
|
|
|
|
// SetContext adds the context to the get vehicles params
|
|
func (o *GetVehiclesParams) SetContext(ctx context.Context) {
|
|
o.Context = ctx
|
|
}
|
|
|
|
// WithHTTPClient adds the HTTPClient to the get vehicles params
|
|
func (o *GetVehiclesParams) WithHTTPClient(client *http.Client) *GetVehiclesParams {
|
|
o.SetHTTPClient(client)
|
|
return o
|
|
}
|
|
|
|
// SetHTTPClient adds the HTTPClient to the get vehicles params
|
|
func (o *GetVehiclesParams) SetHTTPClient(client *http.Client) {
|
|
o.HTTPClient = client
|
|
}
|
|
|
|
// WithLimit adds the limit to the get vehicles params
|
|
func (o *GetVehiclesParams) WithLimit(limit *int64) *GetVehiclesParams {
|
|
o.SetLimit(limit)
|
|
return o
|
|
}
|
|
|
|
// SetLimit adds the limit to the get vehicles params
|
|
func (o *GetVehiclesParams) SetLimit(limit *int64) {
|
|
o.Limit = limit
|
|
}
|
|
|
|
// WithModel adds the model to the get vehicles params
|
|
func (o *GetVehiclesParams) WithModel(model *int64) *GetVehiclesParams {
|
|
o.SetModel(model)
|
|
return o
|
|
}
|
|
|
|
// SetModel adds the model to the get vehicles params
|
|
func (o *GetVehiclesParams) SetModel(model *int64) {
|
|
o.Model = model
|
|
}
|
|
|
|
// WithOffset adds the offset to the get vehicles params
|
|
func (o *GetVehiclesParams) WithOffset(offset *int64) *GetVehiclesParams {
|
|
o.SetOffset(offset)
|
|
return o
|
|
}
|
|
|
|
// SetOffset adds the offset to the get vehicles params
|
|
func (o *GetVehiclesParams) SetOffset(offset *int64) {
|
|
o.Offset = offset
|
|
}
|
|
|
|
// WithOnline adds the online to the get vehicles params
|
|
func (o *GetVehiclesParams) WithOnline(online *bool) *GetVehiclesParams {
|
|
o.SetOnline(online)
|
|
return o
|
|
}
|
|
|
|
// SetOnline adds the online to the get vehicles params
|
|
func (o *GetVehiclesParams) SetOnline(online *bool) {
|
|
o.Online = online
|
|
}
|
|
|
|
// WithOnlineHmi adds the onlineHmi to the get vehicles params
|
|
func (o *GetVehiclesParams) WithOnlineHmi(onlineHmi *bool) *GetVehiclesParams {
|
|
o.SetOnlineHmi(onlineHmi)
|
|
return o
|
|
}
|
|
|
|
// SetOnlineHmi adds the onlineHmi to the get vehicles params
|
|
func (o *GetVehiclesParams) SetOnlineHmi(onlineHmi *bool) {
|
|
o.OnlineHmi = onlineHmi
|
|
}
|
|
|
|
// WithOrder adds the order to the get vehicles params
|
|
func (o *GetVehiclesParams) WithOrder(order *string) *GetVehiclesParams {
|
|
o.SetOrder(order)
|
|
return o
|
|
}
|
|
|
|
// SetOrder adds the order to the get vehicles params
|
|
func (o *GetVehiclesParams) SetOrder(order *string) {
|
|
o.Order = order
|
|
}
|
|
|
|
// WithSearch adds the search to the get vehicles params
|
|
func (o *GetVehiclesParams) WithSearch(search *string) *GetVehiclesParams {
|
|
o.SetSearch(search)
|
|
return o
|
|
}
|
|
|
|
// SetSearch adds the search to the get vehicles params
|
|
func (o *GetVehiclesParams) SetSearch(search *string) {
|
|
o.Search = search
|
|
}
|
|
|
|
// WithVins adds the vins to the get vehicles params
|
|
func (o *GetVehiclesParams) WithVins(vins []string) *GetVehiclesParams {
|
|
o.SetVins(vins)
|
|
return o
|
|
}
|
|
|
|
// SetVins adds the vins to the get vehicles params
|
|
func (o *GetVehiclesParams) SetVins(vins []string) {
|
|
o.Vins = vins
|
|
}
|
|
|
|
// WithYear adds the year to the get vehicles params
|
|
func (o *GetVehiclesParams) WithYear(year *string) *GetVehiclesParams {
|
|
o.SetYear(year)
|
|
return o
|
|
}
|
|
|
|
// SetYear adds the year to the get vehicles params
|
|
func (o *GetVehiclesParams) SetYear(year *string) {
|
|
o.Year = year
|
|
}
|
|
|
|
// WriteToRequest writes these params to a swagger request
|
|
func (o *GetVehiclesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
|
|
|
if err := r.SetTimeout(o.timeout); err != nil {
|
|
return err
|
|
}
|
|
var res []error
|
|
|
|
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
|
|
}
|
|
}
|
|
}
|
|
|
|
if o.Model != nil {
|
|
|
|
// query param model
|
|
var qrModel int64
|
|
|
|
if o.Model != nil {
|
|
qrModel = *o.Model
|
|
}
|
|
qModel := swag.FormatInt64(qrModel)
|
|
if qModel != "" {
|
|
|
|
if err := r.SetQueryParam("model", qModel); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
|
|
if o.Offset != nil {
|
|
|
|
// query param offset
|
|
var qrOffset int64
|
|
|
|
if o.Offset != nil {
|
|
qrOffset = *o.Offset
|
|
}
|
|
qOffset := swag.FormatInt64(qrOffset)
|
|
if qOffset != "" {
|
|
|
|
if err := r.SetQueryParam("offset", qOffset); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
|
|
if o.Online != nil {
|
|
|
|
// query param online
|
|
var qrOnline bool
|
|
|
|
if o.Online != nil {
|
|
qrOnline = *o.Online
|
|
}
|
|
qOnline := swag.FormatBool(qrOnline)
|
|
if qOnline != "" {
|
|
|
|
if err := r.SetQueryParam("online", qOnline); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
|
|
if o.OnlineHmi != nil {
|
|
|
|
// query param online_hmi
|
|
var qrOnlineHmi bool
|
|
|
|
if o.OnlineHmi != nil {
|
|
qrOnlineHmi = *o.OnlineHmi
|
|
}
|
|
qOnlineHmi := swag.FormatBool(qrOnlineHmi)
|
|
if qOnlineHmi != "" {
|
|
|
|
if err := r.SetQueryParam("online_hmi", qOnlineHmi); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
|
|
if o.Order != nil {
|
|
|
|
// query param order
|
|
var qrOrder string
|
|
|
|
if o.Order != nil {
|
|
qrOrder = *o.Order
|
|
}
|
|
qOrder := qrOrder
|
|
if qOrder != "" {
|
|
|
|
if err := r.SetQueryParam("order", qOrder); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
|
|
if o.Search != nil {
|
|
|
|
// query param search
|
|
var qrSearch string
|
|
|
|
if o.Search != nil {
|
|
qrSearch = *o.Search
|
|
}
|
|
qSearch := qrSearch
|
|
if qSearch != "" {
|
|
|
|
if err := r.SetQueryParam("search", qSearch); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
|
|
if o.Vins != nil {
|
|
|
|
// binding items for vins
|
|
joinedVins := o.bindParamVins(reg)
|
|
|
|
// query array param vins
|
|
if err := r.SetQueryParam("vins", joinedVins...); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
if o.Year != nil {
|
|
|
|
// query param year
|
|
var qrYear string
|
|
|
|
if o.Year != nil {
|
|
qrYear = *o.Year
|
|
}
|
|
qYear := qrYear
|
|
if qYear != "" {
|
|
|
|
if err := r.SetQueryParam("year", qYear); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// bindParamGetVehicles binds the parameter vins
|
|
func (o *GetVehiclesParams) bindParamVins(formats strfmt.Registry) []string {
|
|
vinsIR := o.Vins
|
|
|
|
var vinsIC []string
|
|
for _, vinsIIR := range vinsIR { // explode []string
|
|
|
|
vinsIIV := vinsIIR // string as string
|
|
vinsIC = append(vinsIC, vinsIIV)
|
|
}
|
|
|
|
// items.CollectionFormat: ""
|
|
vinsIS := swag.JoinByFormat(vinsIC, "")
|
|
|
|
return vinsIS
|
|
}
|