// 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 ( "encoding/json" "fmt" "io" "github.com/go-openapi/runtime" "github.com/go-openapi/strfmt" "github.com/fiskerinc/cloud-services/pkg/ota_api/models" ) // GetCarstateReader is a Reader for the GetCarstate structure. type GetCarstateReader struct { formats strfmt.Registry } // ReadResponse reads a server response into the received o. func (o *GetCarstateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { case 200: result := NewGetCarstateOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil case 400: result := NewGetCarstateBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 401: result := NewGetCarstateUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 503: result := NewGetCarstateServiceUnavailable() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result default: return nil, runtime.NewAPIError("[GET /carstate] GetCarstate", response, response.Code()) } } // NewGetCarstateOK creates a GetCarstateOK with default headers values func NewGetCarstateOK() *GetCarstateOK { return &GetCarstateOK{} } /* GetCarstateOK describes a response with status code 200, with default header values. OK */ type GetCarstateOK struct { Payload *models.HandlersJSONCarStateMessage } // IsSuccess returns true when this get carstate o k response has a 2xx status code func (o *GetCarstateOK) IsSuccess() bool { return true } // IsRedirect returns true when this get carstate o k response has a 3xx status code func (o *GetCarstateOK) IsRedirect() bool { return false } // IsClientError returns true when this get carstate o k response has a 4xx status code func (o *GetCarstateOK) IsClientError() bool { return false } // IsServerError returns true when this get carstate o k response has a 5xx status code func (o *GetCarstateOK) IsServerError() bool { return false } // IsCode returns true when this get carstate o k response a status code equal to that given func (o *GetCarstateOK) IsCode(code int) bool { return code == 200 } // Code gets the status code for the get carstate o k response func (o *GetCarstateOK) Code() int { return 200 } func (o *GetCarstateOK) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[GET /carstate][%d] getCarstateOK %s", 200, payload) } func (o *GetCarstateOK) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[GET /carstate][%d] getCarstateOK %s", 200, payload) } func (o *GetCarstateOK) GetPayload() *models.HandlersJSONCarStateMessage { return o.Payload } func (o *GetCarstateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { o.Payload = new(models.HandlersJSONCarStateMessage) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { return err } return nil } // NewGetCarstateBadRequest creates a GetCarstateBadRequest with default headers values func NewGetCarstateBadRequest() *GetCarstateBadRequest { return &GetCarstateBadRequest{} } /* GetCarstateBadRequest describes a response with status code 400, with default header values. Bad request */ type GetCarstateBadRequest struct { Payload *models.CommonJSONError } // IsSuccess returns true when this get carstate bad request response has a 2xx status code func (o *GetCarstateBadRequest) IsSuccess() bool { return false } // IsRedirect returns true when this get carstate bad request response has a 3xx status code func (o *GetCarstateBadRequest) IsRedirect() bool { return false } // IsClientError returns true when this get carstate bad request response has a 4xx status code func (o *GetCarstateBadRequest) IsClientError() bool { return true } // IsServerError returns true when this get carstate bad request response has a 5xx status code func (o *GetCarstateBadRequest) IsServerError() bool { return false } // IsCode returns true when this get carstate bad request response a status code equal to that given func (o *GetCarstateBadRequest) IsCode(code int) bool { return code == 400 } // Code gets the status code for the get carstate bad request response func (o *GetCarstateBadRequest) Code() int { return 400 } func (o *GetCarstateBadRequest) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[GET /carstate][%d] getCarstateBadRequest %s", 400, payload) } func (o *GetCarstateBadRequest) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[GET /carstate][%d] getCarstateBadRequest %s", 400, payload) } func (o *GetCarstateBadRequest) GetPayload() *models.CommonJSONError { return o.Payload } func (o *GetCarstateBadRequest) 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 } // NewGetCarstateUnauthorized creates a GetCarstateUnauthorized with default headers values func NewGetCarstateUnauthorized() *GetCarstateUnauthorized { return &GetCarstateUnauthorized{} } /* GetCarstateUnauthorized describes a response with status code 401, with default header values. Unauthorized */ type GetCarstateUnauthorized struct { Payload *models.CommonJSONError } // IsSuccess returns true when this get carstate unauthorized response has a 2xx status code func (o *GetCarstateUnauthorized) IsSuccess() bool { return false } // IsRedirect returns true when this get carstate unauthorized response has a 3xx status code func (o *GetCarstateUnauthorized) IsRedirect() bool { return false } // IsClientError returns true when this get carstate unauthorized response has a 4xx status code func (o *GetCarstateUnauthorized) IsClientError() bool { return true } // IsServerError returns true when this get carstate unauthorized response has a 5xx status code func (o *GetCarstateUnauthorized) IsServerError() bool { return false } // IsCode returns true when this get carstate unauthorized response a status code equal to that given func (o *GetCarstateUnauthorized) IsCode(code int) bool { return code == 401 } // Code gets the status code for the get carstate unauthorized response func (o *GetCarstateUnauthorized) Code() int { return 401 } func (o *GetCarstateUnauthorized) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[GET /carstate][%d] getCarstateUnauthorized %s", 401, payload) } func (o *GetCarstateUnauthorized) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[GET /carstate][%d] getCarstateUnauthorized %s", 401, payload) } func (o *GetCarstateUnauthorized) GetPayload() *models.CommonJSONError { return o.Payload } func (o *GetCarstateUnauthorized) 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 } // NewGetCarstateServiceUnavailable creates a GetCarstateServiceUnavailable with default headers values func NewGetCarstateServiceUnavailable() *GetCarstateServiceUnavailable { return &GetCarstateServiceUnavailable{} } /* GetCarstateServiceUnavailable describes a response with status code 503, with default header values. Service unavailable */ type GetCarstateServiceUnavailable struct { Payload *models.CommonJSONError } // IsSuccess returns true when this get carstate service unavailable response has a 2xx status code func (o *GetCarstateServiceUnavailable) IsSuccess() bool { return false } // IsRedirect returns true when this get carstate service unavailable response has a 3xx status code func (o *GetCarstateServiceUnavailable) IsRedirect() bool { return false } // IsClientError returns true when this get carstate service unavailable response has a 4xx status code func (o *GetCarstateServiceUnavailable) IsClientError() bool { return false } // IsServerError returns true when this get carstate service unavailable response has a 5xx status code func (o *GetCarstateServiceUnavailable) IsServerError() bool { return true } // IsCode returns true when this get carstate service unavailable response a status code equal to that given func (o *GetCarstateServiceUnavailable) IsCode(code int) bool { return code == 503 } // Code gets the status code for the get carstate service unavailable response func (o *GetCarstateServiceUnavailable) Code() int { return 503 } func (o *GetCarstateServiceUnavailable) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[GET /carstate][%d] getCarstateServiceUnavailable %s", 503, payload) } func (o *GetCarstateServiceUnavailable) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[GET /carstate][%d] getCarstateServiceUnavailable %s", 503, payload) } func (o *GetCarstateServiceUnavailable) GetPayload() *models.CommonJSONError { return o.Payload } func (o *GetCarstateServiceUnavailable) 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 }