503 lines
15 KiB
Go
503 lines
15 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"
|
|
"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"
|
|
)
|
|
|
|
// GetCansignalsVinReader is a Reader for the GetCansignalsVin structure.
|
|
type GetCansignalsVinReader struct {
|
|
formats strfmt.Registry
|
|
}
|
|
|
|
// ReadResponse reads a server response into the received o.
|
|
func (o *GetCansignalsVinReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
|
switch response.Code() {
|
|
case 200:
|
|
result := NewGetCansignalsVinOK()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return result, nil
|
|
case 400:
|
|
result := NewGetCansignalsVinBadRequest()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return nil, result
|
|
case 401:
|
|
result := NewGetCansignalsVinUnauthorized()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return nil, result
|
|
case 503:
|
|
result := NewGetCansignalsVinServiceUnavailable()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return nil, result
|
|
default:
|
|
return nil, runtime.NewAPIError("[GET /cansignals/{vin}] GetCansignalsVin", response, response.Code())
|
|
}
|
|
}
|
|
|
|
// NewGetCansignalsVinOK creates a GetCansignalsVinOK with default headers values
|
|
func NewGetCansignalsVinOK() *GetCansignalsVinOK {
|
|
return &GetCansignalsVinOK{}
|
|
}
|
|
|
|
/*
|
|
GetCansignalsVinOK describes a response with status code 200, with default header values.
|
|
|
|
OK
|
|
*/
|
|
type GetCansignalsVinOK struct {
|
|
Payload *GetCansignalsVinOKBody
|
|
}
|
|
|
|
// IsSuccess returns true when this get cansignals vin o k response has a 2xx status code
|
|
func (o *GetCansignalsVinOK) IsSuccess() bool {
|
|
return true
|
|
}
|
|
|
|
// IsRedirect returns true when this get cansignals vin o k response has a 3xx status code
|
|
func (o *GetCansignalsVinOK) IsRedirect() bool {
|
|
return false
|
|
}
|
|
|
|
// IsClientError returns true when this get cansignals vin o k response has a 4xx status code
|
|
func (o *GetCansignalsVinOK) IsClientError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsServerError returns true when this get cansignals vin o k response has a 5xx status code
|
|
func (o *GetCansignalsVinOK) IsServerError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsCode returns true when this get cansignals vin o k response a status code equal to that given
|
|
func (o *GetCansignalsVinOK) IsCode(code int) bool {
|
|
return code == 200
|
|
}
|
|
|
|
// Code gets the status code for the get cansignals vin o k response
|
|
func (o *GetCansignalsVinOK) Code() int {
|
|
return 200
|
|
}
|
|
|
|
func (o *GetCansignalsVinOK) Error() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[GET /cansignals/{vin}][%d] getCansignalsVinOK %s", 200, payload)
|
|
}
|
|
|
|
func (o *GetCansignalsVinOK) String() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[GET /cansignals/{vin}][%d] getCansignalsVinOK %s", 200, payload)
|
|
}
|
|
|
|
func (o *GetCansignalsVinOK) GetPayload() *GetCansignalsVinOKBody {
|
|
return o.Payload
|
|
}
|
|
|
|
func (o *GetCansignalsVinOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
|
|
|
o.Payload = new(GetCansignalsVinOKBody)
|
|
|
|
// response payload
|
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// NewGetCansignalsVinBadRequest creates a GetCansignalsVinBadRequest with default headers values
|
|
func NewGetCansignalsVinBadRequest() *GetCansignalsVinBadRequest {
|
|
return &GetCansignalsVinBadRequest{}
|
|
}
|
|
|
|
/*
|
|
GetCansignalsVinBadRequest describes a response with status code 400, with default header values.
|
|
|
|
Bad request
|
|
*/
|
|
type GetCansignalsVinBadRequest struct {
|
|
Payload *models.CommonJSONError
|
|
}
|
|
|
|
// IsSuccess returns true when this get cansignals vin bad request response has a 2xx status code
|
|
func (o *GetCansignalsVinBadRequest) IsSuccess() bool {
|
|
return false
|
|
}
|
|
|
|
// IsRedirect returns true when this get cansignals vin bad request response has a 3xx status code
|
|
func (o *GetCansignalsVinBadRequest) IsRedirect() bool {
|
|
return false
|
|
}
|
|
|
|
// IsClientError returns true when this get cansignals vin bad request response has a 4xx status code
|
|
func (o *GetCansignalsVinBadRequest) IsClientError() bool {
|
|
return true
|
|
}
|
|
|
|
// IsServerError returns true when this get cansignals vin bad request response has a 5xx status code
|
|
func (o *GetCansignalsVinBadRequest) IsServerError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsCode returns true when this get cansignals vin bad request response a status code equal to that given
|
|
func (o *GetCansignalsVinBadRequest) IsCode(code int) bool {
|
|
return code == 400
|
|
}
|
|
|
|
// Code gets the status code for the get cansignals vin bad request response
|
|
func (o *GetCansignalsVinBadRequest) Code() int {
|
|
return 400
|
|
}
|
|
|
|
func (o *GetCansignalsVinBadRequest) Error() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[GET /cansignals/{vin}][%d] getCansignalsVinBadRequest %s", 400, payload)
|
|
}
|
|
|
|
func (o *GetCansignalsVinBadRequest) String() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[GET /cansignals/{vin}][%d] getCansignalsVinBadRequest %s", 400, payload)
|
|
}
|
|
|
|
func (o *GetCansignalsVinBadRequest) GetPayload() *models.CommonJSONError {
|
|
return o.Payload
|
|
}
|
|
|
|
func (o *GetCansignalsVinBadRequest) 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
|
|
}
|
|
|
|
// NewGetCansignalsVinUnauthorized creates a GetCansignalsVinUnauthorized with default headers values
|
|
func NewGetCansignalsVinUnauthorized() *GetCansignalsVinUnauthorized {
|
|
return &GetCansignalsVinUnauthorized{}
|
|
}
|
|
|
|
/*
|
|
GetCansignalsVinUnauthorized describes a response with status code 401, with default header values.
|
|
|
|
Unauthorized
|
|
*/
|
|
type GetCansignalsVinUnauthorized struct {
|
|
Payload *models.CommonJSONError
|
|
}
|
|
|
|
// IsSuccess returns true when this get cansignals vin unauthorized response has a 2xx status code
|
|
func (o *GetCansignalsVinUnauthorized) IsSuccess() bool {
|
|
return false
|
|
}
|
|
|
|
// IsRedirect returns true when this get cansignals vin unauthorized response has a 3xx status code
|
|
func (o *GetCansignalsVinUnauthorized) IsRedirect() bool {
|
|
return false
|
|
}
|
|
|
|
// IsClientError returns true when this get cansignals vin unauthorized response has a 4xx status code
|
|
func (o *GetCansignalsVinUnauthorized) IsClientError() bool {
|
|
return true
|
|
}
|
|
|
|
// IsServerError returns true when this get cansignals vin unauthorized response has a 5xx status code
|
|
func (o *GetCansignalsVinUnauthorized) IsServerError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsCode returns true when this get cansignals vin unauthorized response a status code equal to that given
|
|
func (o *GetCansignalsVinUnauthorized) IsCode(code int) bool {
|
|
return code == 401
|
|
}
|
|
|
|
// Code gets the status code for the get cansignals vin unauthorized response
|
|
func (o *GetCansignalsVinUnauthorized) Code() int {
|
|
return 401
|
|
}
|
|
|
|
func (o *GetCansignalsVinUnauthorized) Error() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[GET /cansignals/{vin}][%d] getCansignalsVinUnauthorized %s", 401, payload)
|
|
}
|
|
|
|
func (o *GetCansignalsVinUnauthorized) String() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[GET /cansignals/{vin}][%d] getCansignalsVinUnauthorized %s", 401, payload)
|
|
}
|
|
|
|
func (o *GetCansignalsVinUnauthorized) GetPayload() *models.CommonJSONError {
|
|
return o.Payload
|
|
}
|
|
|
|
func (o *GetCansignalsVinUnauthorized) 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
|
|
}
|
|
|
|
// NewGetCansignalsVinServiceUnavailable creates a GetCansignalsVinServiceUnavailable with default headers values
|
|
func NewGetCansignalsVinServiceUnavailable() *GetCansignalsVinServiceUnavailable {
|
|
return &GetCansignalsVinServiceUnavailable{}
|
|
}
|
|
|
|
/*
|
|
GetCansignalsVinServiceUnavailable describes a response with status code 503, with default header values.
|
|
|
|
Service unavailable
|
|
*/
|
|
type GetCansignalsVinServiceUnavailable struct {
|
|
Payload *models.CommonJSONError
|
|
}
|
|
|
|
// IsSuccess returns true when this get cansignals vin service unavailable response has a 2xx status code
|
|
func (o *GetCansignalsVinServiceUnavailable) IsSuccess() bool {
|
|
return false
|
|
}
|
|
|
|
// IsRedirect returns true when this get cansignals vin service unavailable response has a 3xx status code
|
|
func (o *GetCansignalsVinServiceUnavailable) IsRedirect() bool {
|
|
return false
|
|
}
|
|
|
|
// IsClientError returns true when this get cansignals vin service unavailable response has a 4xx status code
|
|
func (o *GetCansignalsVinServiceUnavailable) IsClientError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsServerError returns true when this get cansignals vin service unavailable response has a 5xx status code
|
|
func (o *GetCansignalsVinServiceUnavailable) IsServerError() bool {
|
|
return true
|
|
}
|
|
|
|
// IsCode returns true when this get cansignals vin service unavailable response a status code equal to that given
|
|
func (o *GetCansignalsVinServiceUnavailable) IsCode(code int) bool {
|
|
return code == 503
|
|
}
|
|
|
|
// Code gets the status code for the get cansignals vin service unavailable response
|
|
func (o *GetCansignalsVinServiceUnavailable) Code() int {
|
|
return 503
|
|
}
|
|
|
|
func (o *GetCansignalsVinServiceUnavailable) Error() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[GET /cansignals/{vin}][%d] getCansignalsVinServiceUnavailable %s", 503, payload)
|
|
}
|
|
|
|
func (o *GetCansignalsVinServiceUnavailable) String() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[GET /cansignals/{vin}][%d] getCansignalsVinServiceUnavailable %s", 503, payload)
|
|
}
|
|
|
|
func (o *GetCansignalsVinServiceUnavailable) GetPayload() *models.CommonJSONError {
|
|
return o.Payload
|
|
}
|
|
|
|
func (o *GetCansignalsVinServiceUnavailable) 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
|
|
}
|
|
|
|
/*
|
|
GetCansignalsVinOKBody get cansignals vin o k body
|
|
swagger:model GetCansignalsVinOKBody
|
|
*/
|
|
type GetCansignalsVinOKBody struct {
|
|
models.CommonJSONDBQueryResult
|
|
|
|
// data
|
|
Data []*models.CommonClickHouseSignal `json:"data"`
|
|
}
|
|
|
|
// UnmarshalJSON unmarshals this object from a JSON structure
|
|
func (o *GetCansignalsVinOKBody) UnmarshalJSON(raw []byte) error {
|
|
// GetCansignalsVinOKBodyAO0
|
|
var getCansignalsVinOKBodyAO0 models.CommonJSONDBQueryResult
|
|
if err := swag.ReadJSON(raw, &getCansignalsVinOKBodyAO0); err != nil {
|
|
return err
|
|
}
|
|
o.CommonJSONDBQueryResult = getCansignalsVinOKBodyAO0
|
|
|
|
// GetCansignalsVinOKBodyAO1
|
|
var dataGetCansignalsVinOKBodyAO1 struct {
|
|
Data []*models.CommonClickHouseSignal `json:"data"`
|
|
}
|
|
if err := swag.ReadJSON(raw, &dataGetCansignalsVinOKBodyAO1); err != nil {
|
|
return err
|
|
}
|
|
|
|
o.Data = dataGetCansignalsVinOKBodyAO1.Data
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON marshals this object to a JSON structure
|
|
func (o GetCansignalsVinOKBody) MarshalJSON() ([]byte, error) {
|
|
_parts := make([][]byte, 0, 2)
|
|
|
|
getCansignalsVinOKBodyAO0, err := swag.WriteJSON(o.CommonJSONDBQueryResult)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
_parts = append(_parts, getCansignalsVinOKBodyAO0)
|
|
var dataGetCansignalsVinOKBodyAO1 struct {
|
|
Data []*models.CommonClickHouseSignal `json:"data"`
|
|
}
|
|
|
|
dataGetCansignalsVinOKBodyAO1.Data = o.Data
|
|
|
|
jsonDataGetCansignalsVinOKBodyAO1, errGetCansignalsVinOKBodyAO1 := swag.WriteJSON(dataGetCansignalsVinOKBodyAO1)
|
|
if errGetCansignalsVinOKBodyAO1 != nil {
|
|
return nil, errGetCansignalsVinOKBodyAO1
|
|
}
|
|
_parts = append(_parts, jsonDataGetCansignalsVinOKBodyAO1)
|
|
return swag.ConcatJSON(_parts...), nil
|
|
}
|
|
|
|
// Validate validates this get cansignals vin o k body
|
|
func (o *GetCansignalsVinOKBody) 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 *GetCansignalsVinOKBody) 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("getCansignalsVinOK" + "." + "data" + "." + strconv.Itoa(i))
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("getCansignalsVinOK" + "." + "data" + "." + strconv.Itoa(i))
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validate this get cansignals vin o k body based on the context it is used
|
|
func (o *GetCansignalsVinOKBody) 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 *GetCansignalsVinOKBody) 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("getCansignalsVinOK" + "." + "data" + "." + strconv.Itoa(i))
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("getCansignalsVinOK" + "." + "data" + "." + strconv.Itoa(i))
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (o *GetCansignalsVinOKBody) MarshalBinary() ([]byte, error) {
|
|
if o == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(o)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (o *GetCansignalsVinOKBody) UnmarshalBinary(b []byte) error {
|
|
var res GetCansignalsVinOKBody
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*o = res
|
|
return nil
|
|
}
|