263 lines
7.4 KiB
Go
263 lines
7.4 KiB
Go
package routes
|
|
|
|
// This file was generated by the swagger tool.
|
|
// Editing this file might prove futile when you re-run the swagger generate command
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
|
|
"github.com/go-openapi/errors"
|
|
"github.com/go-openapi/runtime"
|
|
"github.com/go-openapi/swag"
|
|
"github.com/go-openapi/validate"
|
|
|
|
strfmt "github.com/go-openapi/strfmt"
|
|
)
|
|
|
|
// GetRouteOriginDestinationReader is a Reader for the GetRouteOriginDestination structure.
|
|
type GetRouteOriginDestinationReader struct {
|
|
formats strfmt.Registry
|
|
}
|
|
|
|
// ReadResponse reads a server response into the received o.
|
|
func (o *GetRouteOriginDestinationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
|
switch response.Code() {
|
|
|
|
case 200:
|
|
result := NewGetRouteOriginDestinationOK()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return result, nil
|
|
|
|
case 404:
|
|
result := NewGetRouteOriginDestinationNotFound()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return nil, result
|
|
|
|
case 500:
|
|
result := NewGetRouteOriginDestinationInternalServerError()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return nil, result
|
|
|
|
default:
|
|
return nil, runtime.NewAPIError("unknown error", response, response.Code())
|
|
}
|
|
}
|
|
|
|
// NewGetRouteOriginDestinationOK creates a GetRouteOriginDestinationOK with default headers values
|
|
func NewGetRouteOriginDestinationOK() *GetRouteOriginDestinationOK {
|
|
return &GetRouteOriginDestinationOK{}
|
|
}
|
|
|
|
/*GetRouteOriginDestinationOK handles this case with default header values.
|
|
|
|
Solar systems in route from origin to destination
|
|
*/
|
|
type GetRouteOriginDestinationOK struct {
|
|
/*The caching mechanism used
|
|
*/
|
|
CacheControl string
|
|
/*RFC7231 formatted datetime string
|
|
*/
|
|
Expires string
|
|
/*RFC7231 formatted datetime string
|
|
*/
|
|
LastModified string
|
|
|
|
Payload []int32
|
|
}
|
|
|
|
func (o *GetRouteOriginDestinationOK) Error() string {
|
|
return fmt.Sprintf("[GET /route/{origin}/{destination}/][%d] getRouteOriginDestinationOK %+v", 200, o.Payload)
|
|
}
|
|
|
|
func (o *GetRouteOriginDestinationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
|
|
|
// response header Cache-Control
|
|
o.CacheControl = response.GetHeader("Cache-Control")
|
|
|
|
// response header Expires
|
|
o.Expires = response.GetHeader("Expires")
|
|
|
|
// response header Last-Modified
|
|
o.LastModified = response.GetHeader("Last-Modified")
|
|
|
|
// response payload
|
|
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// NewGetRouteOriginDestinationNotFound creates a GetRouteOriginDestinationNotFound with default headers values
|
|
func NewGetRouteOriginDestinationNotFound() *GetRouteOriginDestinationNotFound {
|
|
return &GetRouteOriginDestinationNotFound{}
|
|
}
|
|
|
|
/*GetRouteOriginDestinationNotFound handles this case with default header values.
|
|
|
|
No route found
|
|
*/
|
|
type GetRouteOriginDestinationNotFound struct {
|
|
Payload GetRouteOriginDestinationNotFoundBody
|
|
}
|
|
|
|
func (o *GetRouteOriginDestinationNotFound) Error() string {
|
|
return fmt.Sprintf("[GET /route/{origin}/{destination}/][%d] getRouteOriginDestinationNotFound %+v", 404, o.Payload)
|
|
}
|
|
|
|
func (o *GetRouteOriginDestinationNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
|
|
|
// response payload
|
|
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// NewGetRouteOriginDestinationInternalServerError creates a GetRouteOriginDestinationInternalServerError with default headers values
|
|
func NewGetRouteOriginDestinationInternalServerError() *GetRouteOriginDestinationInternalServerError {
|
|
return &GetRouteOriginDestinationInternalServerError{}
|
|
}
|
|
|
|
/*GetRouteOriginDestinationInternalServerError handles this case with default header values.
|
|
|
|
Internal server error
|
|
*/
|
|
type GetRouteOriginDestinationInternalServerError struct {
|
|
Payload GetRouteOriginDestinationInternalServerErrorBody
|
|
}
|
|
|
|
func (o *GetRouteOriginDestinationInternalServerError) Error() string {
|
|
return fmt.Sprintf("[GET /route/{origin}/{destination}/][%d] getRouteOriginDestinationInternalServerError %+v", 500, o.Payload)
|
|
}
|
|
|
|
func (o *GetRouteOriginDestinationInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
|
|
|
// response payload
|
|
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
/*GetRouteOriginDestinationInternalServerErrorBody get_route_origin_destination_internal_server_error
|
|
//
|
|
// Internal server error
|
|
swagger:model GetRouteOriginDestinationInternalServerErrorBody
|
|
*/
|
|
type GetRouteOriginDestinationInternalServerErrorBody struct {
|
|
|
|
// get_route_origin_destination_500_internal_server_error
|
|
//
|
|
// Internal server error message
|
|
// Required: true
|
|
Error *string `json:"error"`
|
|
}
|
|
|
|
// Validate validates this get route origin destination internal server error body
|
|
func (o *GetRouteOriginDestinationInternalServerErrorBody) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := o.validateError(formats); err != nil {
|
|
// prop
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (o *GetRouteOriginDestinationInternalServerErrorBody) validateError(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("getRouteOriginDestinationInternalServerError"+"."+"error", "body", o.Error); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (o *GetRouteOriginDestinationInternalServerErrorBody) MarshalBinary() ([]byte, error) {
|
|
if o == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(o)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (o *GetRouteOriginDestinationInternalServerErrorBody) UnmarshalBinary(b []byte) error {
|
|
var res GetRouteOriginDestinationInternalServerErrorBody
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*o = res
|
|
return nil
|
|
}
|
|
|
|
/*GetRouteOriginDestinationNotFoundBody get_route_origin_destination_not_found
|
|
//
|
|
// Not found
|
|
swagger:model GetRouteOriginDestinationNotFoundBody
|
|
*/
|
|
type GetRouteOriginDestinationNotFoundBody struct {
|
|
|
|
// get_route_origin_destination_404_not_found
|
|
//
|
|
// Not found message
|
|
// Required: true
|
|
Error *string `json:"error"`
|
|
}
|
|
|
|
// Validate validates this get route origin destination not found body
|
|
func (o *GetRouteOriginDestinationNotFoundBody) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := o.validateError(formats); err != nil {
|
|
// prop
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (o *GetRouteOriginDestinationNotFoundBody) validateError(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("getRouteOriginDestinationNotFound"+"."+"error", "body", o.Error); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (o *GetRouteOriginDestinationNotFoundBody) MarshalBinary() ([]byte, error) {
|
|
if o == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(o)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (o *GetRouteOriginDestinationNotFoundBody) UnmarshalBinary(b []byte) error {
|
|
var res GetRouteOriginDestinationNotFoundBody
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*o = res
|
|
return nil
|
|
}
|