package character // 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" ) // GetCharactersCharacterIDMedalsReader is a Reader for the GetCharactersCharacterIDMedals structure. type GetCharactersCharacterIDMedalsReader struct { formats strfmt.Registry } // ReadResponse reads a server response into the received o. func (o *GetCharactersCharacterIDMedalsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { case 200: result := NewGetCharactersCharacterIDMedalsOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil case 403: result := NewGetCharactersCharacterIDMedalsForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 500: result := NewGetCharactersCharacterIDMedalsInternalServerError() 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()) } } // NewGetCharactersCharacterIDMedalsOK creates a GetCharactersCharacterIDMedalsOK with default headers values func NewGetCharactersCharacterIDMedalsOK() *GetCharactersCharacterIDMedalsOK { return &GetCharactersCharacterIDMedalsOK{} } /*GetCharactersCharacterIDMedalsOK handles this case with default header values. A list of medals */ type GetCharactersCharacterIDMedalsOK struct { /*The caching mechanism used */ CacheControl string /*RFC7231 formatted datetime string */ Expires string /*RFC7231 formatted datetime string */ LastModified string Payload []*GetCharactersCharacterIDMedalsOKBodyItems0 } func (o *GetCharactersCharacterIDMedalsOK) Error() string { return fmt.Sprintf("[GET /characters/{character_id}/medals/][%d] getCharactersCharacterIdMedalsOK %+v", 200, o.Payload) } func (o *GetCharactersCharacterIDMedalsOK) 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 } // NewGetCharactersCharacterIDMedalsForbidden creates a GetCharactersCharacterIDMedalsForbidden with default headers values func NewGetCharactersCharacterIDMedalsForbidden() *GetCharactersCharacterIDMedalsForbidden { return &GetCharactersCharacterIDMedalsForbidden{} } /*GetCharactersCharacterIDMedalsForbidden handles this case with default header values. Forbidden */ type GetCharactersCharacterIDMedalsForbidden struct { Payload GetCharactersCharacterIDMedalsForbiddenBody } func (o *GetCharactersCharacterIDMedalsForbidden) Error() string { return fmt.Sprintf("[GET /characters/{character_id}/medals/][%d] getCharactersCharacterIdMedalsForbidden %+v", 403, o.Payload) } func (o *GetCharactersCharacterIDMedalsForbidden) 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 } // NewGetCharactersCharacterIDMedalsInternalServerError creates a GetCharactersCharacterIDMedalsInternalServerError with default headers values func NewGetCharactersCharacterIDMedalsInternalServerError() *GetCharactersCharacterIDMedalsInternalServerError { return &GetCharactersCharacterIDMedalsInternalServerError{} } /*GetCharactersCharacterIDMedalsInternalServerError handles this case with default header values. Internal server error */ type GetCharactersCharacterIDMedalsInternalServerError struct { Payload GetCharactersCharacterIDMedalsInternalServerErrorBody } func (o *GetCharactersCharacterIDMedalsInternalServerError) Error() string { return fmt.Sprintf("[GET /characters/{character_id}/medals/][%d] getCharactersCharacterIdMedalsInternalServerError %+v", 500, o.Payload) } func (o *GetCharactersCharacterIDMedalsInternalServerError) 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 } /*GetCharactersCharacterIDMedalsForbiddenBody get_characters_character_id_medals_forbidden // // Forbidden swagger:model GetCharactersCharacterIDMedalsForbiddenBody */ type GetCharactersCharacterIDMedalsForbiddenBody struct { // get_characters_character_id_medals_403_forbidden // // Forbidden message // Required: true Error *string `json:"error"` } // Validate validates this get characters character ID medals forbidden body func (o *GetCharactersCharacterIDMedalsForbiddenBody) 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 *GetCharactersCharacterIDMedalsForbiddenBody) validateError(formats strfmt.Registry) error { if err := validate.Required("getCharactersCharacterIdMedalsForbidden"+"."+"error", "body", o.Error); err != nil { return err } return nil } // MarshalBinary interface implementation func (o *GetCharactersCharacterIDMedalsForbiddenBody) MarshalBinary() ([]byte, error) { if o == nil { return nil, nil } return swag.WriteJSON(o) } // UnmarshalBinary interface implementation func (o *GetCharactersCharacterIDMedalsForbiddenBody) UnmarshalBinary(b []byte) error { var res GetCharactersCharacterIDMedalsForbiddenBody if err := swag.ReadJSON(b, &res); err != nil { return err } *o = res return nil } /*GetCharactersCharacterIDMedalsInternalServerErrorBody get_characters_character_id_medals_internal_server_error // // Internal server error swagger:model GetCharactersCharacterIDMedalsInternalServerErrorBody */ type GetCharactersCharacterIDMedalsInternalServerErrorBody struct { // get_characters_character_id_medals_500_internal_server_error // // Internal server error message // Required: true Error *string `json:"error"` } // Validate validates this get characters character ID medals internal server error body func (o *GetCharactersCharacterIDMedalsInternalServerErrorBody) 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 *GetCharactersCharacterIDMedalsInternalServerErrorBody) validateError(formats strfmt.Registry) error { if err := validate.Required("getCharactersCharacterIdMedalsInternalServerError"+"."+"error", "body", o.Error); err != nil { return err } return nil } // MarshalBinary interface implementation func (o *GetCharactersCharacterIDMedalsInternalServerErrorBody) MarshalBinary() ([]byte, error) { if o == nil { return nil, nil } return swag.WriteJSON(o) } // UnmarshalBinary interface implementation func (o *GetCharactersCharacterIDMedalsInternalServerErrorBody) UnmarshalBinary(b []byte) error { var res GetCharactersCharacterIDMedalsInternalServerErrorBody if err := swag.ReadJSON(b, &res); err != nil { return err } *o = res return nil } /*GetCharactersCharacterIDMedalsOKBodyItems0 get_characters_character_id_medals_200_ok // // 200 ok object swagger:model GetCharactersCharacterIDMedalsOKBodyItems0 */ type GetCharactersCharacterIDMedalsOKBodyItems0 struct { // get_characters_character_id_medals_corporation_id // // corporation_id integer // Required: true CorporationID *int32 `json:"corporation_id"` // get_characters_character_id_medals_date // // date string // Required: true Date *strfmt.DateTime `json:"date"` // get_characters_character_id_medals_description // // description string // Required: true Description *string `json:"description"` // get_characters_character_id_medals_graphics // // graphics array // Required: true // Max Items: 10 Graphics []*GetCharactersCharacterIDMedalsOKBodyItems0GraphicsItems0 `json:"graphics"` // get_characters_character_id_medals_issuer_id // // issuer_id integer // Required: true IssuerID *int32 `json:"issuer_id"` // get_characters_character_id_medals_medal_id // // medal_id integer // Required: true MedalID *int32 `json:"medal_id"` // get_characters_character_id_medals_reason // // reason string // Required: true Reason *string `json:"reason"` // get_characters_character_id_medals_status // // status string // Required: true Status *string `json:"status"` // get_characters_character_id_medals_title // // title string // Required: true Title *string `json:"title"` } // Validate validates this get characters character ID medals o k body items0 func (o *GetCharactersCharacterIDMedalsOKBodyItems0) Validate(formats strfmt.Registry) error { var res []error if err := o.validateCorporationID(formats); err != nil { // prop res = append(res, err) } if err := o.validateDate(formats); err != nil { // prop res = append(res, err) } if err := o.validateDescription(formats); err != nil { // prop res = append(res, err) } if err := o.validateGraphics(formats); err != nil { // prop res = append(res, err) } if err := o.validateIssuerID(formats); err != nil { // prop res = append(res, err) } if err := o.validateMedalID(formats); err != nil { // prop res = append(res, err) } if err := o.validateReason(formats); err != nil { // prop res = append(res, err) } if err := o.validateStatus(formats); err != nil { // prop res = append(res, err) } if err := o.validateTitle(formats); err != nil { // prop res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (o *GetCharactersCharacterIDMedalsOKBodyItems0) validateCorporationID(formats strfmt.Registry) error { if err := validate.Required("corporation_id", "body", o.CorporationID); err != nil { return err } return nil } func (o *GetCharactersCharacterIDMedalsOKBodyItems0) validateDate(formats strfmt.Registry) error { if err := validate.Required("date", "body", o.Date); err != nil { return err } return nil } func (o *GetCharactersCharacterIDMedalsOKBodyItems0) validateDescription(formats strfmt.Registry) error { if err := validate.Required("description", "body", o.Description); err != nil { return err } return nil } func (o *GetCharactersCharacterIDMedalsOKBodyItems0) validateGraphics(formats strfmt.Registry) error { if err := validate.Required("graphics", "body", o.Graphics); err != nil { return err } iGraphicsSize := int64(len(o.Graphics)) if err := validate.MaxItems("graphics", "body", iGraphicsSize, 10); err != nil { return err } for i := 0; i < len(o.Graphics); i++ { if swag.IsZero(o.Graphics[i]) { // not required continue } if o.Graphics[i] != nil { if err := o.Graphics[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("graphics" + "." + strconv.Itoa(i)) } return err } } } return nil } func (o *GetCharactersCharacterIDMedalsOKBodyItems0) validateIssuerID(formats strfmt.Registry) error { if err := validate.Required("issuer_id", "body", o.IssuerID); err != nil { return err } return nil } func (o *GetCharactersCharacterIDMedalsOKBodyItems0) validateMedalID(formats strfmt.Registry) error { if err := validate.Required("medal_id", "body", o.MedalID); err != nil { return err } return nil } func (o *GetCharactersCharacterIDMedalsOKBodyItems0) validateReason(formats strfmt.Registry) error { if err := validate.Required("reason", "body", o.Reason); err != nil { return err } return nil } var getCharactersCharacterIdMedalsOKBodyItems0TypeStatusPropEnum []interface{} func init() { var res []string if err := json.Unmarshal([]byte(`["public","private"]`), &res); err != nil { panic(err) } for _, v := range res { getCharactersCharacterIdMedalsOKBodyItems0TypeStatusPropEnum = append(getCharactersCharacterIdMedalsOKBodyItems0TypeStatusPropEnum, v) } } const ( // GetCharactersCharacterIDMedalsOKBodyItems0StatusPublic captures enum value "public" GetCharactersCharacterIDMedalsOKBodyItems0StatusPublic string = "public" // GetCharactersCharacterIDMedalsOKBodyItems0StatusPrivate captures enum value "private" GetCharactersCharacterIDMedalsOKBodyItems0StatusPrivate string = "private" ) // prop value enum func (o *GetCharactersCharacterIDMedalsOKBodyItems0) validateStatusEnum(path, location string, value string) error { if err := validate.Enum(path, location, value, getCharactersCharacterIdMedalsOKBodyItems0TypeStatusPropEnum); err != nil { return err } return nil } func (o *GetCharactersCharacterIDMedalsOKBodyItems0) validateStatus(formats strfmt.Registry) error { if err := validate.Required("status", "body", o.Status); err != nil { return err } // value enum if err := o.validateStatusEnum("status", "body", *o.Status); err != nil { return err } return nil } func (o *GetCharactersCharacterIDMedalsOKBodyItems0) validateTitle(formats strfmt.Registry) error { if err := validate.Required("title", "body", o.Title); err != nil { return err } return nil } // MarshalBinary interface implementation func (o *GetCharactersCharacterIDMedalsOKBodyItems0) MarshalBinary() ([]byte, error) { if o == nil { return nil, nil } return swag.WriteJSON(o) } // UnmarshalBinary interface implementation func (o *GetCharactersCharacterIDMedalsOKBodyItems0) UnmarshalBinary(b []byte) error { var res GetCharactersCharacterIDMedalsOKBodyItems0 if err := swag.ReadJSON(b, &res); err != nil { return err } *o = res return nil } /*GetCharactersCharacterIDMedalsOKBodyItems0GraphicsItems0 get_characters_character_id_medals_graphic // // graphic object swagger:model GetCharactersCharacterIDMedalsOKBodyItems0GraphicsItems0 */ type GetCharactersCharacterIDMedalsOKBodyItems0GraphicsItems0 struct { // get_characters_character_id_medals_color // // color integer Color int32 `json:"color,omitempty"` // get_characters_character_id_medals_graphic // // graphic string // Required: true Graphic *string `json:"graphic"` // get_characters_character_id_medals_layer // // layer integer // Required: true Layer *int32 `json:"layer"` // get_characters_character_id_medals_part // // part integer // Required: true Part *int32 `json:"part"` } // Validate validates this get characters character ID medals o k body items0 graphics items0 func (o *GetCharactersCharacterIDMedalsOKBodyItems0GraphicsItems0) Validate(formats strfmt.Registry) error { var res []error if err := o.validateGraphic(formats); err != nil { // prop res = append(res, err) } if err := o.validateLayer(formats); err != nil { // prop res = append(res, err) } if err := o.validatePart(formats); err != nil { // prop res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (o *GetCharactersCharacterIDMedalsOKBodyItems0GraphicsItems0) validateGraphic(formats strfmt.Registry) error { if err := validate.Required("graphic", "body", o.Graphic); err != nil { return err } return nil } func (o *GetCharactersCharacterIDMedalsOKBodyItems0GraphicsItems0) validateLayer(formats strfmt.Registry) error { if err := validate.Required("layer", "body", o.Layer); err != nil { return err } return nil } func (o *GetCharactersCharacterIDMedalsOKBodyItems0GraphicsItems0) validatePart(formats strfmt.Registry) error { if err := validate.Required("part", "body", o.Part); err != nil { return err } return nil } // MarshalBinary interface implementation func (o *GetCharactersCharacterIDMedalsOKBodyItems0GraphicsItems0) MarshalBinary() ([]byte, error) { if o == nil { return nil, nil } return swag.WriteJSON(o) } // UnmarshalBinary interface implementation func (o *GetCharactersCharacterIDMedalsOKBodyItems0GraphicsItems0) UnmarshalBinary(b []byte) error { var res GetCharactersCharacterIDMedalsOKBodyItems0GraphicsItems0 if err := swag.ReadJSON(b, &res); err != nil { return err } *o = res return nil }