package calendar // 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/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/swag" "github.com/go-openapi/validate" strfmt "github.com/go-openapi/strfmt" ) // GetCharactersCharacterIDCalendarReader is a Reader for the GetCharactersCharacterIDCalendar structure. type GetCharactersCharacterIDCalendarReader struct { formats strfmt.Registry } // ReadResponse reads a server response into the received o. func (o *GetCharactersCharacterIDCalendarReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { case 200: result := NewGetCharactersCharacterIDCalendarOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil case 403: result := NewGetCharactersCharacterIDCalendarForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 500: result := NewGetCharactersCharacterIDCalendarInternalServerError() 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()) } } // NewGetCharactersCharacterIDCalendarOK creates a GetCharactersCharacterIDCalendarOK with default headers values func NewGetCharactersCharacterIDCalendarOK() *GetCharactersCharacterIDCalendarOK { return &GetCharactersCharacterIDCalendarOK{} } /*GetCharactersCharacterIDCalendarOK handles this case with default header values. A collection of event summaries */ type GetCharactersCharacterIDCalendarOK struct { /*The caching mechanism used */ CacheControl string /*RFC7231 formatted datetime string */ Expires string /*RFC7231 formatted datetime string */ LastModified string Payload []*GetCharactersCharacterIDCalendarOKBodyItems0 } func (o *GetCharactersCharacterIDCalendarOK) Error() string { return fmt.Sprintf("[GET /characters/{character_id}/calendar/][%d] getCharactersCharacterIdCalendarOK %+v", 200, o.Payload) } func (o *GetCharactersCharacterIDCalendarOK) 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 } // NewGetCharactersCharacterIDCalendarForbidden creates a GetCharactersCharacterIDCalendarForbidden with default headers values func NewGetCharactersCharacterIDCalendarForbidden() *GetCharactersCharacterIDCalendarForbidden { return &GetCharactersCharacterIDCalendarForbidden{} } /*GetCharactersCharacterIDCalendarForbidden handles this case with default header values. Forbidden */ type GetCharactersCharacterIDCalendarForbidden struct { Payload GetCharactersCharacterIDCalendarForbiddenBody } func (o *GetCharactersCharacterIDCalendarForbidden) Error() string { return fmt.Sprintf("[GET /characters/{character_id}/calendar/][%d] getCharactersCharacterIdCalendarForbidden %+v", 403, o.Payload) } func (o *GetCharactersCharacterIDCalendarForbidden) 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 } // NewGetCharactersCharacterIDCalendarInternalServerError creates a GetCharactersCharacterIDCalendarInternalServerError with default headers values func NewGetCharactersCharacterIDCalendarInternalServerError() *GetCharactersCharacterIDCalendarInternalServerError { return &GetCharactersCharacterIDCalendarInternalServerError{} } /*GetCharactersCharacterIDCalendarInternalServerError handles this case with default header values. Internal server error */ type GetCharactersCharacterIDCalendarInternalServerError struct { Payload GetCharactersCharacterIDCalendarInternalServerErrorBody } func (o *GetCharactersCharacterIDCalendarInternalServerError) Error() string { return fmt.Sprintf("[GET /characters/{character_id}/calendar/][%d] getCharactersCharacterIdCalendarInternalServerError %+v", 500, o.Payload) } func (o *GetCharactersCharacterIDCalendarInternalServerError) 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 } /*GetCharactersCharacterIDCalendarForbiddenBody get_characters_character_id_calendar_forbidden // // Forbidden swagger:model GetCharactersCharacterIDCalendarForbiddenBody */ type GetCharactersCharacterIDCalendarForbiddenBody struct { // get_characters_character_id_calendar_403_forbidden // // Forbidden message // Required: true Error *string `json:"error"` } // Validate validates this get characters character ID calendar forbidden body func (o *GetCharactersCharacterIDCalendarForbiddenBody) 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 *GetCharactersCharacterIDCalendarForbiddenBody) validateError(formats strfmt.Registry) error { if err := validate.Required("getCharactersCharacterIdCalendarForbidden"+"."+"error", "body", o.Error); err != nil { return err } return nil } // MarshalBinary interface implementation func (o *GetCharactersCharacterIDCalendarForbiddenBody) MarshalBinary() ([]byte, error) { if o == nil { return nil, nil } return swag.WriteJSON(o) } // UnmarshalBinary interface implementation func (o *GetCharactersCharacterIDCalendarForbiddenBody) UnmarshalBinary(b []byte) error { var res GetCharactersCharacterIDCalendarForbiddenBody if err := swag.ReadJSON(b, &res); err != nil { return err } *o = res return nil } /*GetCharactersCharacterIDCalendarInternalServerErrorBody get_characters_character_id_calendar_internal_server_error // // Internal server error swagger:model GetCharactersCharacterIDCalendarInternalServerErrorBody */ type GetCharactersCharacterIDCalendarInternalServerErrorBody struct { // get_characters_character_id_calendar_500_internal_server_error // // Internal server error message // Required: true Error *string `json:"error"` } // Validate validates this get characters character ID calendar internal server error body func (o *GetCharactersCharacterIDCalendarInternalServerErrorBody) 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 *GetCharactersCharacterIDCalendarInternalServerErrorBody) validateError(formats strfmt.Registry) error { if err := validate.Required("getCharactersCharacterIdCalendarInternalServerError"+"."+"error", "body", o.Error); err != nil { return err } return nil } // MarshalBinary interface implementation func (o *GetCharactersCharacterIDCalendarInternalServerErrorBody) MarshalBinary() ([]byte, error) { if o == nil { return nil, nil } return swag.WriteJSON(o) } // UnmarshalBinary interface implementation func (o *GetCharactersCharacterIDCalendarInternalServerErrorBody) UnmarshalBinary(b []byte) error { var res GetCharactersCharacterIDCalendarInternalServerErrorBody if err := swag.ReadJSON(b, &res); err != nil { return err } *o = res return nil } /*GetCharactersCharacterIDCalendarOKBodyItems0 get_characters_character_id_calendar_200_ok // // event swagger:model GetCharactersCharacterIDCalendarOKBodyItems0 */ type GetCharactersCharacterIDCalendarOKBodyItems0 struct { // get_characters_character_id_calendar_event_date // // event_date string EventDate strfmt.DateTime `json:"event_date,omitempty"` // get_characters_character_id_calendar_event_id // // event_id integer EventID int32 `json:"event_id,omitempty"` // get_characters_character_id_calendar_event_response // // event_response string EventResponse string `json:"event_response,omitempty"` // get_characters_character_id_calendar_importance // // importance integer Importance int32 `json:"importance,omitempty"` // get_characters_character_id_calendar_title // // title string Title string `json:"title,omitempty"` } // Validate validates this get characters character ID calendar o k body items0 func (o *GetCharactersCharacterIDCalendarOKBodyItems0) Validate(formats strfmt.Registry) error { var res []error if err := o.validateEventResponse(formats); err != nil { // prop res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } var getCharactersCharacterIdCalendarOKBodyItems0TypeEventResponsePropEnum []interface{} func init() { var res []string if err := json.Unmarshal([]byte(`["declined","not_responded","accepted","tentative"]`), &res); err != nil { panic(err) } for _, v := range res { getCharactersCharacterIdCalendarOKBodyItems0TypeEventResponsePropEnum = append(getCharactersCharacterIdCalendarOKBodyItems0TypeEventResponsePropEnum, v) } } const ( // GetCharactersCharacterIDCalendarOKBodyItems0EventResponseDeclined captures enum value "declined" GetCharactersCharacterIDCalendarOKBodyItems0EventResponseDeclined string = "declined" // GetCharactersCharacterIDCalendarOKBodyItems0EventResponseNotResponded captures enum value "not_responded" GetCharactersCharacterIDCalendarOKBodyItems0EventResponseNotResponded string = "not_responded" // GetCharactersCharacterIDCalendarOKBodyItems0EventResponseAccepted captures enum value "accepted" GetCharactersCharacterIDCalendarOKBodyItems0EventResponseAccepted string = "accepted" // GetCharactersCharacterIDCalendarOKBodyItems0EventResponseTentative captures enum value "tentative" GetCharactersCharacterIDCalendarOKBodyItems0EventResponseTentative string = "tentative" ) // prop value enum func (o *GetCharactersCharacterIDCalendarOKBodyItems0) validateEventResponseEnum(path, location string, value string) error { if err := validate.Enum(path, location, value, getCharactersCharacterIdCalendarOKBodyItems0TypeEventResponsePropEnum); err != nil { return err } return nil } func (o *GetCharactersCharacterIDCalendarOKBodyItems0) validateEventResponse(formats strfmt.Registry) error { if swag.IsZero(o.EventResponse) { // not required return nil } // value enum if err := o.validateEventResponseEnum("event_response", "body", o.EventResponse); err != nil { return err } return nil } // MarshalBinary interface implementation func (o *GetCharactersCharacterIDCalendarOKBodyItems0) MarshalBinary() ([]byte, error) { if o == nil { return nil, nil } return swag.WriteJSON(o) } // UnmarshalBinary interface implementation func (o *GetCharactersCharacterIDCalendarOKBodyItems0) UnmarshalBinary(b []byte) error { var res GetCharactersCharacterIDCalendarOKBodyItems0 if err := swag.ReadJSON(b, &res); err != nil { return err } *o = res return nil }