Files
cloud-services/pkg/ota_api/client/operations/post_vehicle_paths_parameters.go

189 lines
5.2 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"
"fiskerinc.com/modules/ota_api/models"
)
// NewPostVehiclePathsParams creates a new PostVehiclePathsParams 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 NewPostVehiclePathsParams() *PostVehiclePathsParams {
return &PostVehiclePathsParams{
timeout: cr.DefaultTimeout,
}
}
// NewPostVehiclePathsParamsWithTimeout creates a new PostVehiclePathsParams object
// with the ability to set a timeout on a request.
func NewPostVehiclePathsParamsWithTimeout(timeout time.Duration) *PostVehiclePathsParams {
return &PostVehiclePathsParams{
timeout: timeout,
}
}
// NewPostVehiclePathsParamsWithContext creates a new PostVehiclePathsParams object
// with the ability to set a context for a request.
func NewPostVehiclePathsParamsWithContext(ctx context.Context) *PostVehiclePathsParams {
return &PostVehiclePathsParams{
Context: ctx,
}
}
// NewPostVehiclePathsParamsWithHTTPClient creates a new PostVehiclePathsParams object
// with the ability to set a custom HTTPClient for a request.
func NewPostVehiclePathsParamsWithHTTPClient(client *http.Client) *PostVehiclePathsParams {
return &PostVehiclePathsParams{
HTTPClient: client,
}
}
/*
PostVehiclePathsParams contains all the parameters to send to the API endpoint
for the post vehicle paths operation.
Typically these are written to a http.Request.
*/
type PostVehiclePathsParams struct {
/* LookbackHours.
Data lookback window in hours. Default is 24 if not set
*/
LookbackHours *int64
/* Vins.
List of VINs
*/
Vins *models.HandlersVehicleBodyParams
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the post vehicle paths params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PostVehiclePathsParams) WithDefaults() *PostVehiclePathsParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the post vehicle paths params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PostVehiclePathsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the post vehicle paths params
func (o *PostVehiclePathsParams) WithTimeout(timeout time.Duration) *PostVehiclePathsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the post vehicle paths params
func (o *PostVehiclePathsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the post vehicle paths params
func (o *PostVehiclePathsParams) WithContext(ctx context.Context) *PostVehiclePathsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the post vehicle paths params
func (o *PostVehiclePathsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the post vehicle paths params
func (o *PostVehiclePathsParams) WithHTTPClient(client *http.Client) *PostVehiclePathsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the post vehicle paths params
func (o *PostVehiclePathsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithLookbackHours adds the lookbackHours to the post vehicle paths params
func (o *PostVehiclePathsParams) WithLookbackHours(lookbackHours *int64) *PostVehiclePathsParams {
o.SetLookbackHours(lookbackHours)
return o
}
// SetLookbackHours adds the lookbackHours to the post vehicle paths params
func (o *PostVehiclePathsParams) SetLookbackHours(lookbackHours *int64) {
o.LookbackHours = lookbackHours
}
// WithVins adds the vins to the post vehicle paths params
func (o *PostVehiclePathsParams) WithVins(vins *models.HandlersVehicleBodyParams) *PostVehiclePathsParams {
o.SetVins(vins)
return o
}
// SetVins adds the vins to the post vehicle paths params
func (o *PostVehiclePathsParams) SetVins(vins *models.HandlersVehicleBodyParams) {
o.Vins = vins
}
// WriteToRequest writes these params to a swagger request
func (o *PostVehiclePathsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if o.LookbackHours != nil {
// query param lookback_hours
var qrLookbackHours int64
if o.LookbackHours != nil {
qrLookbackHours = *o.LookbackHours
}
qLookbackHours := swag.FormatInt64(qrLookbackHours)
if qLookbackHours != "" {
if err := r.SetQueryParam("lookback_hours", qLookbackHours); err != nil {
return err
}
}
}
if o.Vins != nil {
if err := r.SetBodyParam(o.Vins); err != nil {
return err
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}