Initial cloud-services repo - gateway service + pkg modules
This commit is contained in:
502
pkg/ota_api/client/operations/get_vehicles_responses.go
Normal file
502
pkg/ota_api/client/operations/get_vehicles_responses.go
Normal file
@@ -0,0 +1,502 @@
|
||||
// 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"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"fiskerinc.com/modules/ota_api/models"
|
||||
)
|
||||
|
||||
// GetVehiclesReader is a Reader for the GetVehicles structure.
|
||||
type GetVehiclesReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *GetVehiclesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewGetVehiclesOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 400:
|
||||
result := NewGetVehiclesBadRequest()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 401:
|
||||
result := NewGetVehiclesUnauthorized()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 503:
|
||||
result := NewGetVehiclesServiceUnavailable()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[GET /vehicles] GetVehicles", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetVehiclesOK creates a GetVehiclesOK with default headers values
|
||||
func NewGetVehiclesOK() *GetVehiclesOK {
|
||||
return &GetVehiclesOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
GetVehiclesOK describes a response with status code 200, with default header values.
|
||||
|
||||
OK
|
||||
*/
|
||||
type GetVehiclesOK struct {
|
||||
Payload *GetVehiclesOKBody
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get vehicles o k response has a 2xx status code
|
||||
func (o *GetVehiclesOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get vehicles o k response has a 3xx status code
|
||||
func (o *GetVehiclesOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get vehicles o k response has a 4xx status code
|
||||
func (o *GetVehiclesOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get vehicles o k response has a 5xx status code
|
||||
func (o *GetVehiclesOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get vehicles o k response a status code equal to that given
|
||||
func (o *GetVehiclesOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the get vehicles o k response
|
||||
func (o *GetVehiclesOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *GetVehiclesOK) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /vehicles][%d] getVehiclesOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *GetVehiclesOK) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /vehicles][%d] getVehiclesOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *GetVehiclesOK) GetPayload() *GetVehiclesOKBody {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetVehiclesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(GetVehiclesOKBody)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewGetVehiclesBadRequest creates a GetVehiclesBadRequest with default headers values
|
||||
func NewGetVehiclesBadRequest() *GetVehiclesBadRequest {
|
||||
return &GetVehiclesBadRequest{}
|
||||
}
|
||||
|
||||
/*
|
||||
GetVehiclesBadRequest describes a response with status code 400, with default header values.
|
||||
|
||||
Bad request
|
||||
*/
|
||||
type GetVehiclesBadRequest struct {
|
||||
Payload *models.CommonJSONError
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get vehicles bad request response has a 2xx status code
|
||||
func (o *GetVehiclesBadRequest) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get vehicles bad request response has a 3xx status code
|
||||
func (o *GetVehiclesBadRequest) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get vehicles bad request response has a 4xx status code
|
||||
func (o *GetVehiclesBadRequest) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get vehicles bad request response has a 5xx status code
|
||||
func (o *GetVehiclesBadRequest) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get vehicles bad request response a status code equal to that given
|
||||
func (o *GetVehiclesBadRequest) IsCode(code int) bool {
|
||||
return code == 400
|
||||
}
|
||||
|
||||
// Code gets the status code for the get vehicles bad request response
|
||||
func (o *GetVehiclesBadRequest) Code() int {
|
||||
return 400
|
||||
}
|
||||
|
||||
func (o *GetVehiclesBadRequest) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /vehicles][%d] getVehiclesBadRequest %s", 400, payload)
|
||||
}
|
||||
|
||||
func (o *GetVehiclesBadRequest) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /vehicles][%d] getVehiclesBadRequest %s", 400, payload)
|
||||
}
|
||||
|
||||
func (o *GetVehiclesBadRequest) GetPayload() *models.CommonJSONError {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetVehiclesBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.CommonJSONError)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewGetVehiclesUnauthorized creates a GetVehiclesUnauthorized with default headers values
|
||||
func NewGetVehiclesUnauthorized() *GetVehiclesUnauthorized {
|
||||
return &GetVehiclesUnauthorized{}
|
||||
}
|
||||
|
||||
/*
|
||||
GetVehiclesUnauthorized describes a response with status code 401, with default header values.
|
||||
|
||||
Unauthorized
|
||||
*/
|
||||
type GetVehiclesUnauthorized struct {
|
||||
Payload *models.CommonJSONError
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get vehicles unauthorized response has a 2xx status code
|
||||
func (o *GetVehiclesUnauthorized) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get vehicles unauthorized response has a 3xx status code
|
||||
func (o *GetVehiclesUnauthorized) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get vehicles unauthorized response has a 4xx status code
|
||||
func (o *GetVehiclesUnauthorized) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get vehicles unauthorized response has a 5xx status code
|
||||
func (o *GetVehiclesUnauthorized) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get vehicles unauthorized response a status code equal to that given
|
||||
func (o *GetVehiclesUnauthorized) IsCode(code int) bool {
|
||||
return code == 401
|
||||
}
|
||||
|
||||
// Code gets the status code for the get vehicles unauthorized response
|
||||
func (o *GetVehiclesUnauthorized) Code() int {
|
||||
return 401
|
||||
}
|
||||
|
||||
func (o *GetVehiclesUnauthorized) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /vehicles][%d] getVehiclesUnauthorized %s", 401, payload)
|
||||
}
|
||||
|
||||
func (o *GetVehiclesUnauthorized) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /vehicles][%d] getVehiclesUnauthorized %s", 401, payload)
|
||||
}
|
||||
|
||||
func (o *GetVehiclesUnauthorized) GetPayload() *models.CommonJSONError {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetVehiclesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.CommonJSONError)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewGetVehiclesServiceUnavailable creates a GetVehiclesServiceUnavailable with default headers values
|
||||
func NewGetVehiclesServiceUnavailable() *GetVehiclesServiceUnavailable {
|
||||
return &GetVehiclesServiceUnavailable{}
|
||||
}
|
||||
|
||||
/*
|
||||
GetVehiclesServiceUnavailable describes a response with status code 503, with default header values.
|
||||
|
||||
Service unavailable
|
||||
*/
|
||||
type GetVehiclesServiceUnavailable struct {
|
||||
Payload *models.CommonJSONError
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get vehicles service unavailable response has a 2xx status code
|
||||
func (o *GetVehiclesServiceUnavailable) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get vehicles service unavailable response has a 3xx status code
|
||||
func (o *GetVehiclesServiceUnavailable) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get vehicles service unavailable response has a 4xx status code
|
||||
func (o *GetVehiclesServiceUnavailable) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get vehicles service unavailable response has a 5xx status code
|
||||
func (o *GetVehiclesServiceUnavailable) IsServerError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsCode returns true when this get vehicles service unavailable response a status code equal to that given
|
||||
func (o *GetVehiclesServiceUnavailable) IsCode(code int) bool {
|
||||
return code == 503
|
||||
}
|
||||
|
||||
// Code gets the status code for the get vehicles service unavailable response
|
||||
func (o *GetVehiclesServiceUnavailable) Code() int {
|
||||
return 503
|
||||
}
|
||||
|
||||
func (o *GetVehiclesServiceUnavailable) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /vehicles][%d] getVehiclesServiceUnavailable %s", 503, payload)
|
||||
}
|
||||
|
||||
func (o *GetVehiclesServiceUnavailable) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /vehicles][%d] getVehiclesServiceUnavailable %s", 503, payload)
|
||||
}
|
||||
|
||||
func (o *GetVehiclesServiceUnavailable) GetPayload() *models.CommonJSONError {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetVehiclesServiceUnavailable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.CommonJSONError)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
GetVehiclesOKBody get vehicles o k body
|
||||
swagger:model GetVehiclesOKBody
|
||||
*/
|
||||
type GetVehiclesOKBody struct {
|
||||
models.CommonJSONDBQueryResult
|
||||
|
||||
// data
|
||||
Data []*models.CommonCar `json:"data"`
|
||||
}
|
||||
|
||||
// UnmarshalJSON unmarshals this object from a JSON structure
|
||||
func (o *GetVehiclesOKBody) UnmarshalJSON(raw []byte) error {
|
||||
// GetVehiclesOKBodyAO0
|
||||
var getVehiclesOKBodyAO0 models.CommonJSONDBQueryResult
|
||||
if err := swag.ReadJSON(raw, &getVehiclesOKBodyAO0); err != nil {
|
||||
return err
|
||||
}
|
||||
o.CommonJSONDBQueryResult = getVehiclesOKBodyAO0
|
||||
|
||||
// GetVehiclesOKBodyAO1
|
||||
var dataGetVehiclesOKBodyAO1 struct {
|
||||
Data []*models.CommonCar `json:"data"`
|
||||
}
|
||||
if err := swag.ReadJSON(raw, &dataGetVehiclesOKBodyAO1); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
o.Data = dataGetVehiclesOKBodyAO1.Data
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON marshals this object to a JSON structure
|
||||
func (o GetVehiclesOKBody) MarshalJSON() ([]byte, error) {
|
||||
_parts := make([][]byte, 0, 2)
|
||||
|
||||
getVehiclesOKBodyAO0, err := swag.WriteJSON(o.CommonJSONDBQueryResult)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_parts = append(_parts, getVehiclesOKBodyAO0)
|
||||
var dataGetVehiclesOKBodyAO1 struct {
|
||||
Data []*models.CommonCar `json:"data"`
|
||||
}
|
||||
|
||||
dataGetVehiclesOKBodyAO1.Data = o.Data
|
||||
|
||||
jsonDataGetVehiclesOKBodyAO1, errGetVehiclesOKBodyAO1 := swag.WriteJSON(dataGetVehiclesOKBodyAO1)
|
||||
if errGetVehiclesOKBodyAO1 != nil {
|
||||
return nil, errGetVehiclesOKBodyAO1
|
||||
}
|
||||
_parts = append(_parts, jsonDataGetVehiclesOKBodyAO1)
|
||||
return swag.ConcatJSON(_parts...), nil
|
||||
}
|
||||
|
||||
// Validate validates this get vehicles o k body
|
||||
func (o *GetVehiclesOKBody) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
// validation for a type composition with models.CommonJSONDBQueryResult
|
||||
if err := o.CommonJSONDBQueryResult.Validate(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := o.validateData(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *GetVehiclesOKBody) validateData(formats strfmt.Registry) error {
|
||||
|
||||
if swag.IsZero(o.Data) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(o.Data); i++ {
|
||||
if swag.IsZero(o.Data[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if o.Data[i] != nil {
|
||||
if err := o.Data[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("getVehiclesOK" + "." + "data" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("getVehiclesOK" + "." + "data" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this get vehicles o k body based on the context it is used
|
||||
func (o *GetVehiclesOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
// validation for a type composition with models.CommonJSONDBQueryResult
|
||||
if err := o.CommonJSONDBQueryResult.ContextValidate(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := o.contextValidateData(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *GetVehiclesOKBody) contextValidateData(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(o.Data); i++ {
|
||||
|
||||
if o.Data[i] != nil {
|
||||
|
||||
if swag.IsZero(o.Data[i]) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := o.Data[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("getVehiclesOK" + "." + "data" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("getVehiclesOK" + "." + "data" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *GetVehiclesOKBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *GetVehiclesOKBody) UnmarshalBinary(b []byte) error {
|
||||
var res GetVehiclesOKBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user