package mail // 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" ) // PostCharactersCharacterIDMailReader is a Reader for the PostCharactersCharacterIDMail structure. type PostCharactersCharacterIDMailReader struct { formats strfmt.Registry } // ReadResponse reads a server response into the received o. func (o *PostCharactersCharacterIDMailReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { case 201: result := NewPostCharactersCharacterIDMailCreated() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil case 400: result := NewPostCharactersCharacterIDMailBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 403: result := NewPostCharactersCharacterIDMailForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 500: result := NewPostCharactersCharacterIDMailInternalServerError() 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()) } } // NewPostCharactersCharacterIDMailCreated creates a PostCharactersCharacterIDMailCreated with default headers values func NewPostCharactersCharacterIDMailCreated() *PostCharactersCharacterIDMailCreated { return &PostCharactersCharacterIDMailCreated{} } /*PostCharactersCharacterIDMailCreated handles this case with default header values. Mail created */ type PostCharactersCharacterIDMailCreated struct { Payload int32 } func (o *PostCharactersCharacterIDMailCreated) Error() string { return fmt.Sprintf("[POST /characters/{character_id}/mail/][%d] postCharactersCharacterIdMailCreated %+v", 201, o.Payload) } func (o *PostCharactersCharacterIDMailCreated) 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 } // NewPostCharactersCharacterIDMailBadRequest creates a PostCharactersCharacterIDMailBadRequest with default headers values func NewPostCharactersCharacterIDMailBadRequest() *PostCharactersCharacterIDMailBadRequest { return &PostCharactersCharacterIDMailBadRequest{} } /*PostCharactersCharacterIDMailBadRequest handles this case with default header values. Only one corporation, alliance, or mailing list can be the recipient of a mail */ type PostCharactersCharacterIDMailBadRequest struct { Payload PostCharactersCharacterIDMailBadRequestBody } func (o *PostCharactersCharacterIDMailBadRequest) Error() string { return fmt.Sprintf("[POST /characters/{character_id}/mail/][%d] postCharactersCharacterIdMailBadRequest %+v", 400, o.Payload) } func (o *PostCharactersCharacterIDMailBadRequest) 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 } // NewPostCharactersCharacterIDMailForbidden creates a PostCharactersCharacterIDMailForbidden with default headers values func NewPostCharactersCharacterIDMailForbidden() *PostCharactersCharacterIDMailForbidden { return &PostCharactersCharacterIDMailForbidden{} } /*PostCharactersCharacterIDMailForbidden handles this case with default header values. Forbidden */ type PostCharactersCharacterIDMailForbidden struct { Payload PostCharactersCharacterIDMailForbiddenBody } func (o *PostCharactersCharacterIDMailForbidden) Error() string { return fmt.Sprintf("[POST /characters/{character_id}/mail/][%d] postCharactersCharacterIdMailForbidden %+v", 403, o.Payload) } func (o *PostCharactersCharacterIDMailForbidden) 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 } // NewPostCharactersCharacterIDMailInternalServerError creates a PostCharactersCharacterIDMailInternalServerError with default headers values func NewPostCharactersCharacterIDMailInternalServerError() *PostCharactersCharacterIDMailInternalServerError { return &PostCharactersCharacterIDMailInternalServerError{} } /*PostCharactersCharacterIDMailInternalServerError handles this case with default header values. Internal server error */ type PostCharactersCharacterIDMailInternalServerError struct { Payload PostCharactersCharacterIDMailInternalServerErrorBody } func (o *PostCharactersCharacterIDMailInternalServerError) Error() string { return fmt.Sprintf("[POST /characters/{character_id}/mail/][%d] postCharactersCharacterIdMailInternalServerError %+v", 500, o.Payload) } func (o *PostCharactersCharacterIDMailInternalServerError) 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 } /*PostCharactersCharacterIDMailBadRequestBody post_characters_character_id_mail_bad_request // // Bad request swagger:model PostCharactersCharacterIDMailBadRequestBody */ type PostCharactersCharacterIDMailBadRequestBody struct { // post_characters_character_id_mail_400_bad_request // // Bad request message // Required: true Error *string `json:"error"` } // Validate validates this post characters character ID mail bad request body func (o *PostCharactersCharacterIDMailBadRequestBody) 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 *PostCharactersCharacterIDMailBadRequestBody) validateError(formats strfmt.Registry) error { if err := validate.Required("postCharactersCharacterIdMailBadRequest"+"."+"error", "body", o.Error); err != nil { return err } return nil } // MarshalBinary interface implementation func (o *PostCharactersCharacterIDMailBadRequestBody) MarshalBinary() ([]byte, error) { if o == nil { return nil, nil } return swag.WriteJSON(o) } // UnmarshalBinary interface implementation func (o *PostCharactersCharacterIDMailBadRequestBody) UnmarshalBinary(b []byte) error { var res PostCharactersCharacterIDMailBadRequestBody if err := swag.ReadJSON(b, &res); err != nil { return err } *o = res return nil } /*PostCharactersCharacterIDMailBody post_characters_character_id_mail_mail // // mail schema swagger:model PostCharactersCharacterIDMailBody */ type PostCharactersCharacterIDMailBody struct { // post_characters_character_id_mail_approved_cost // // approved_cost integer // Required: true ApprovedCost *int64 `json:"approved_cost"` // post_characters_character_id_mail_body // // body string // Required: true // Max Length: 10000 Body *string `json:"body"` // post_characters_character_id_mail_recipients // // recipients array // Required: true // Max Items: 50 // Min Items: 1 Recipients []*RecipientsItems0 `json:"recipients"` // post_characters_character_id_mail_subject // // subject string // Required: true // Max Length: 1000 Subject *string `json:"subject"` } // MarshalBinary interface implementation func (o *PostCharactersCharacterIDMailBody) MarshalBinary() ([]byte, error) { if o == nil { return nil, nil } return swag.WriteJSON(o) } // UnmarshalBinary interface implementation func (o *PostCharactersCharacterIDMailBody) UnmarshalBinary(b []byte) error { var res PostCharactersCharacterIDMailBody if err := swag.ReadJSON(b, &res); err != nil { return err } *o = res return nil } /*PostCharactersCharacterIDMailForbiddenBody post_characters_character_id_mail_forbidden // // Forbidden swagger:model PostCharactersCharacterIDMailForbiddenBody */ type PostCharactersCharacterIDMailForbiddenBody struct { // post_characters_character_id_mail_403_forbidden // // Forbidden message // Required: true Error *string `json:"error"` } // Validate validates this post characters character ID mail forbidden body func (o *PostCharactersCharacterIDMailForbiddenBody) 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 *PostCharactersCharacterIDMailForbiddenBody) validateError(formats strfmt.Registry) error { if err := validate.Required("postCharactersCharacterIdMailForbidden"+"."+"error", "body", o.Error); err != nil { return err } return nil } // MarshalBinary interface implementation func (o *PostCharactersCharacterIDMailForbiddenBody) MarshalBinary() ([]byte, error) { if o == nil { return nil, nil } return swag.WriteJSON(o) } // UnmarshalBinary interface implementation func (o *PostCharactersCharacterIDMailForbiddenBody) UnmarshalBinary(b []byte) error { var res PostCharactersCharacterIDMailForbiddenBody if err := swag.ReadJSON(b, &res); err != nil { return err } *o = res return nil } /*PostCharactersCharacterIDMailInternalServerErrorBody post_characters_character_id_mail_internal_server_error // // Internal server error swagger:model PostCharactersCharacterIDMailInternalServerErrorBody */ type PostCharactersCharacterIDMailInternalServerErrorBody struct { // post_characters_character_id_mail_500_internal_server_error // // Internal server error message // Required: true Error *string `json:"error"` } // Validate validates this post characters character ID mail internal server error body func (o *PostCharactersCharacterIDMailInternalServerErrorBody) 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 *PostCharactersCharacterIDMailInternalServerErrorBody) validateError(formats strfmt.Registry) error { if err := validate.Required("postCharactersCharacterIdMailInternalServerError"+"."+"error", "body", o.Error); err != nil { return err } return nil } // MarshalBinary interface implementation func (o *PostCharactersCharacterIDMailInternalServerErrorBody) MarshalBinary() ([]byte, error) { if o == nil { return nil, nil } return swag.WriteJSON(o) } // UnmarshalBinary interface implementation func (o *PostCharactersCharacterIDMailInternalServerErrorBody) UnmarshalBinary(b []byte) error { var res PostCharactersCharacterIDMailInternalServerErrorBody if err := swag.ReadJSON(b, &res); err != nil { return err } *o = res return nil }