package clones // 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" "strconv" "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" ) // GetCharactersCharacterIDClonesReader is a Reader for the GetCharactersCharacterIDClones structure. type GetCharactersCharacterIDClonesReader struct { formats strfmt.Registry } // ReadResponse reads a server response into the received o. func (o *GetCharactersCharacterIDClonesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { case 200: result := NewGetCharactersCharacterIDClonesOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil case 403: result := NewGetCharactersCharacterIDClonesForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 500: result := NewGetCharactersCharacterIDClonesInternalServerError() 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()) } } // NewGetCharactersCharacterIDClonesOK creates a GetCharactersCharacterIDClonesOK with default headers values func NewGetCharactersCharacterIDClonesOK() *GetCharactersCharacterIDClonesOK { return &GetCharactersCharacterIDClonesOK{} } /*GetCharactersCharacterIDClonesOK handles this case with default header values. Clone information for the given character */ type GetCharactersCharacterIDClonesOK struct { /*The caching mechanism used */ CacheControl string /*RFC7231 formatted datetime string */ Expires string /*RFC7231 formatted datetime string */ LastModified string Payload GetCharactersCharacterIDClonesOKBody } func (o *GetCharactersCharacterIDClonesOK) Error() string { return fmt.Sprintf("[GET /characters/{character_id}/clones/][%d] getCharactersCharacterIdClonesOK %+v", 200, o.Payload) } func (o *GetCharactersCharacterIDClonesOK) 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 } // NewGetCharactersCharacterIDClonesForbidden creates a GetCharactersCharacterIDClonesForbidden with default headers values func NewGetCharactersCharacterIDClonesForbidden() *GetCharactersCharacterIDClonesForbidden { return &GetCharactersCharacterIDClonesForbidden{} } /*GetCharactersCharacterIDClonesForbidden handles this case with default header values. Forbidden */ type GetCharactersCharacterIDClonesForbidden struct { Payload GetCharactersCharacterIDClonesForbiddenBody } func (o *GetCharactersCharacterIDClonesForbidden) Error() string { return fmt.Sprintf("[GET /characters/{character_id}/clones/][%d] getCharactersCharacterIdClonesForbidden %+v", 403, o.Payload) } func (o *GetCharactersCharacterIDClonesForbidden) 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 } // NewGetCharactersCharacterIDClonesInternalServerError creates a GetCharactersCharacterIDClonesInternalServerError with default headers values func NewGetCharactersCharacterIDClonesInternalServerError() *GetCharactersCharacterIDClonesInternalServerError { return &GetCharactersCharacterIDClonesInternalServerError{} } /*GetCharactersCharacterIDClonesInternalServerError handles this case with default header values. Internal server error */ type GetCharactersCharacterIDClonesInternalServerError struct { Payload GetCharactersCharacterIDClonesInternalServerErrorBody } func (o *GetCharactersCharacterIDClonesInternalServerError) Error() string { return fmt.Sprintf("[GET /characters/{character_id}/clones/][%d] getCharactersCharacterIdClonesInternalServerError %+v", 500, o.Payload) } func (o *GetCharactersCharacterIDClonesInternalServerError) 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 } /*GetCharactersCharacterIDClonesForbiddenBody get_characters_character_id_clones_forbidden // // Forbidden swagger:model GetCharactersCharacterIDClonesForbiddenBody */ type GetCharactersCharacterIDClonesForbiddenBody struct { // get_characters_character_id_clones_403_forbidden // // Forbidden message // Required: true Error *string `json:"error"` } // Validate validates this get characters character ID clones forbidden body func (o *GetCharactersCharacterIDClonesForbiddenBody) 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 *GetCharactersCharacterIDClonesForbiddenBody) validateError(formats strfmt.Registry) error { if err := validate.Required("getCharactersCharacterIdClonesForbidden"+"."+"error", "body", o.Error); err != nil { return err } return nil } // MarshalBinary interface implementation func (o *GetCharactersCharacterIDClonesForbiddenBody) MarshalBinary() ([]byte, error) { if o == nil { return nil, nil } return swag.WriteJSON(o) } // UnmarshalBinary interface implementation func (o *GetCharactersCharacterIDClonesForbiddenBody) UnmarshalBinary(b []byte) error { var res GetCharactersCharacterIDClonesForbiddenBody if err := swag.ReadJSON(b, &res); err != nil { return err } *o = res return nil } /*GetCharactersCharacterIDClonesInternalServerErrorBody get_characters_character_id_clones_internal_server_error // // Internal server error swagger:model GetCharactersCharacterIDClonesInternalServerErrorBody */ type GetCharactersCharacterIDClonesInternalServerErrorBody struct { // get_characters_character_id_clones_500_internal_server_error // // Internal server error message // Required: true Error *string `json:"error"` } // Validate validates this get characters character ID clones internal server error body func (o *GetCharactersCharacterIDClonesInternalServerErrorBody) 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 *GetCharactersCharacterIDClonesInternalServerErrorBody) validateError(formats strfmt.Registry) error { if err := validate.Required("getCharactersCharacterIdClonesInternalServerError"+"."+"error", "body", o.Error); err != nil { return err } return nil } // MarshalBinary interface implementation func (o *GetCharactersCharacterIDClonesInternalServerErrorBody) MarshalBinary() ([]byte, error) { if o == nil { return nil, nil } return swag.WriteJSON(o) } // UnmarshalBinary interface implementation func (o *GetCharactersCharacterIDClonesInternalServerErrorBody) UnmarshalBinary(b []byte) error { var res GetCharactersCharacterIDClonesInternalServerErrorBody if err := swag.ReadJSON(b, &res); err != nil { return err } *o = res return nil } /*GetCharactersCharacterIDClonesOKBody get_characters_character_id_clones_ok // // 200 ok object swagger:model GetCharactersCharacterIDClonesOKBody */ type GetCharactersCharacterIDClonesOKBody struct { // home location // Required: true HomeLocation *GetCharactersCharacterIDClonesOKBodyHomeLocation `json:"home_location"` // get_characters_character_id_clones_jump_clones // // jump_clones array // Required: true // Max Items: 10 JumpClones []*JumpClonesItems0 `json:"jump_clones"` // get_characters_character_id_clones_last_jump_date // // last_jump_date string // Required: true LastJumpDate *strfmt.DateTime `json:"last_jump_date"` } // Validate validates this get characters character ID clones o k body func (o *GetCharactersCharacterIDClonesOKBody) Validate(formats strfmt.Registry) error { var res []error if err := o.validateHomeLocation(formats); err != nil { // prop res = append(res, err) } if err := o.validateJumpClones(formats); err != nil { // prop res = append(res, err) } if err := o.validateLastJumpDate(formats); err != nil { // prop res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (o *GetCharactersCharacterIDClonesOKBody) validateHomeLocation(formats strfmt.Registry) error { if err := validate.Required("getCharactersCharacterIdClonesOK"+"."+"home_location", "body", o.HomeLocation); err != nil { return err } if o.HomeLocation != nil { if err := o.HomeLocation.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("getCharactersCharacterIdClonesOK" + "." + "home_location") } return err } } return nil } func (o *GetCharactersCharacterIDClonesOKBody) validateJumpClones(formats strfmt.Registry) error { if err := validate.Required("getCharactersCharacterIdClonesOK"+"."+"jump_clones", "body", o.JumpClones); err != nil { return err } iJumpClonesSize := int64(len(o.JumpClones)) if err := validate.MaxItems("getCharactersCharacterIdClonesOK"+"."+"jump_clones", "body", iJumpClonesSize, 10); err != nil { return err } for i := 0; i < len(o.JumpClones); i++ { if swag.IsZero(o.JumpClones[i]) { // not required continue } if o.JumpClones[i] != nil { if err := o.JumpClones[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("getCharactersCharacterIdClonesOK" + "." + "jump_clones" + "." + strconv.Itoa(i)) } return err } } } return nil } func (o *GetCharactersCharacterIDClonesOKBody) validateLastJumpDate(formats strfmt.Registry) error { if err := validate.Required("getCharactersCharacterIdClonesOK"+"."+"last_jump_date", "body", o.LastJumpDate); err != nil { return err } return nil } // MarshalBinary interface implementation func (o *GetCharactersCharacterIDClonesOKBody) MarshalBinary() ([]byte, error) { if o == nil { return nil, nil } return swag.WriteJSON(o) } // UnmarshalBinary interface implementation func (o *GetCharactersCharacterIDClonesOKBody) UnmarshalBinary(b []byte) error { var res GetCharactersCharacterIDClonesOKBody if err := swag.ReadJSON(b, &res); err != nil { return err } *o = res return nil } /*GetCharactersCharacterIDClonesOKBodyHomeLocation get_characters_character_id_clones_home_location // // home_location object swagger:model GetCharactersCharacterIDClonesOKBodyHomeLocation */ type GetCharactersCharacterIDClonesOKBodyHomeLocation struct { // get_characters_character_id_clones_location_id // // location_id integer LocationID int64 `json:"location_id,omitempty"` // get_characters_character_id_clones_location_type // // location_type string LocationType string `json:"location_type,omitempty"` } // Validate validates this get characters character ID clones o k body home location func (o *GetCharactersCharacterIDClonesOKBodyHomeLocation) Validate(formats strfmt.Registry) error { var res []error if err := o.validateLocationType(formats); err != nil { // prop res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } var getCharactersCharacterIdClonesOKBodyHomeLocationTypeLocationTypePropEnum []interface{} func init() { var res []string if err := json.Unmarshal([]byte(`["station","structure"]`), &res); err != nil { panic(err) } for _, v := range res { getCharactersCharacterIdClonesOKBodyHomeLocationTypeLocationTypePropEnum = append(getCharactersCharacterIdClonesOKBodyHomeLocationTypeLocationTypePropEnum, v) } } const ( // GetCharactersCharacterIDClonesOKBodyHomeLocationLocationTypeStation captures enum value "station" GetCharactersCharacterIDClonesOKBodyHomeLocationLocationTypeStation string = "station" // GetCharactersCharacterIDClonesOKBodyHomeLocationLocationTypeStructure captures enum value "structure" GetCharactersCharacterIDClonesOKBodyHomeLocationLocationTypeStructure string = "structure" ) // prop value enum func (o *GetCharactersCharacterIDClonesOKBodyHomeLocation) validateLocationTypeEnum(path, location string, value string) error { if err := validate.Enum(path, location, value, getCharactersCharacterIdClonesOKBodyHomeLocationTypeLocationTypePropEnum); err != nil { return err } return nil } func (o *GetCharactersCharacterIDClonesOKBodyHomeLocation) validateLocationType(formats strfmt.Registry) error { if swag.IsZero(o.LocationType) { // not required return nil } // value enum if err := o.validateLocationTypeEnum("getCharactersCharacterIdClonesOK"+"."+"home_location"+"."+"location_type", "body", o.LocationType); err != nil { return err } return nil } // MarshalBinary interface implementation func (o *GetCharactersCharacterIDClonesOKBodyHomeLocation) MarshalBinary() ([]byte, error) { if o == nil { return nil, nil } return swag.WriteJSON(o) } // UnmarshalBinary interface implementation func (o *GetCharactersCharacterIDClonesOKBodyHomeLocation) UnmarshalBinary(b []byte) error { var res GetCharactersCharacterIDClonesOKBodyHomeLocation if err := swag.ReadJSON(b, &res); err != nil { return err } *o = res return nil } /*JumpClonesItems0 get_characters_character_id_clones_jump_clone // // jump_clone object swagger:model JumpClonesItems0 */ type JumpClonesItems0 struct { // get_characters_character_id_clones_implants // // implants array // Max Items: 11 Implants []int32 `json:"implants"` // get_characters_character_id_clones_location_id // // location_id integer LocationID int64 `json:"location_id,omitempty"` // get_characters_character_id_clones_location_type // // location_type string LocationType string `json:"location_type,omitempty"` } // Validate validates this jump clones items0 func (o *JumpClonesItems0) Validate(formats strfmt.Registry) error { var res []error if err := o.validateImplants(formats); err != nil { // prop res = append(res, err) } if err := o.validateLocationType(formats); err != nil { // prop res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (o *JumpClonesItems0) validateImplants(formats strfmt.Registry) error { if swag.IsZero(o.Implants) { // not required return nil } iImplantsSize := int64(len(o.Implants)) if err := validate.MaxItems("implants", "body", iImplantsSize, 11); err != nil { return err } return nil } var jumpClonesItems0TypeLocationTypePropEnum []interface{} func init() { var res []string if err := json.Unmarshal([]byte(`["station","structure"]`), &res); err != nil { panic(err) } for _, v := range res { jumpClonesItems0TypeLocationTypePropEnum = append(jumpClonesItems0TypeLocationTypePropEnum, v) } } const ( // JumpClonesItems0LocationTypeStation captures enum value "station" JumpClonesItems0LocationTypeStation string = "station" // JumpClonesItems0LocationTypeStructure captures enum value "structure" JumpClonesItems0LocationTypeStructure string = "structure" ) // prop value enum func (o *JumpClonesItems0) validateLocationTypeEnum(path, location string, value string) error { if err := validate.Enum(path, location, value, jumpClonesItems0TypeLocationTypePropEnum); err != nil { return err } return nil } func (o *JumpClonesItems0) validateLocationType(formats strfmt.Registry) error { if swag.IsZero(o.LocationType) { // not required return nil } // value enum if err := o.validateLocationTypeEnum("location_type", "body", o.LocationType); err != nil { return err } return nil } // MarshalBinary interface implementation func (o *JumpClonesItems0) MarshalBinary() ([]byte, error) { if o == nil { return nil, nil } return swag.WriteJSON(o) } // UnmarshalBinary interface implementation func (o *JumpClonesItems0) UnmarshalBinary(b []byte) error { var res JumpClonesItems0 if err := swag.ReadJSON(b, &res); err != nil { return err } *o = res return nil }