// Code generated by go-swagger; DO NOT EDIT. package models // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command import ( "context" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PullReview PullReview represents a pull request review // // swagger:model PullReview type PullReview struct { // body Body string `json:"body,omitempty"` // code comments count CodeCommentsCount int64 `json:"comments_count,omitempty"` // commit ID CommitID string `json:"commit_id,omitempty"` // dismissed Dismissed bool `json:"dismissed,omitempty"` // HTML pull URL HTMLPullURL string `json:"pull_request_url,omitempty"` // HTML URL HTMLURL string `json:"html_url,omitempty"` // ID ID int64 `json:"id,omitempty"` // official Official bool `json:"official,omitempty"` // stale Stale bool `json:"stale,omitempty"` // submitted // Format: date-time Submitted strfmt.DateTime `json:"submitted_at,omitempty"` // updated // Format: date-time Updated strfmt.DateTime `json:"updated_at,omitempty"` // state State ReviewStateType `json:"state,omitempty"` // team Team *Team `json:"team,omitempty"` // user User *User `json:"user,omitempty"` } // Validate validates this pull review func (m *PullReview) Validate(formats strfmt.Registry) error { var res []error if err := m.validateSubmitted(formats); err != nil { res = append(res, err) } if err := m.validateUpdated(formats); err != nil { res = append(res, err) } if err := m.validateState(formats); err != nil { res = append(res, err) } if err := m.validateTeam(formats); err != nil { res = append(res, err) } if err := m.validateUser(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *PullReview) validateSubmitted(formats strfmt.Registry) error { if swag.IsZero(m.Submitted) { // not required return nil } if err := validate.FormatOf("submitted_at", "body", "date-time", m.Submitted.String(), formats); err != nil { return err } return nil } func (m *PullReview) validateUpdated(formats strfmt.Registry) error { if swag.IsZero(m.Updated) { // not required return nil } if err := validate.FormatOf("updated_at", "body", "date-time", m.Updated.String(), formats); err != nil { return err } return nil } func (m *PullReview) validateState(formats strfmt.Registry) error { if swag.IsZero(m.State) { // not required return nil } if err := m.State.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("state") } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("state") } return err } return nil } func (m *PullReview) validateTeam(formats strfmt.Registry) error { if swag.IsZero(m.Team) { // not required return nil } if m.Team != nil { if err := m.Team.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("team") } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("team") } return err } } return nil } func (m *PullReview) validateUser(formats strfmt.Registry) error { if swag.IsZero(m.User) { // not required return nil } if m.User != nil { if err := m.User.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("user") } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("user") } return err } } return nil } // ContextValidate validate this pull review based on the context it is used func (m *PullReview) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateState(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateTeam(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateUser(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *PullReview) contextValidateState(ctx context.Context, formats strfmt.Registry) error { if swag.IsZero(m.State) { // not required return nil } if err := m.State.ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("state") } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("state") } return err } return nil } func (m *PullReview) contextValidateTeam(ctx context.Context, formats strfmt.Registry) error { if m.Team != nil { if swag.IsZero(m.Team) { // not required return nil } if err := m.Team.ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("team") } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("team") } return err } } return nil } func (m *PullReview) contextValidateUser(ctx context.Context, formats strfmt.Registry) error { if m.User != nil { if swag.IsZero(m.User) { // not required return nil } if err := m.User.ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("user") } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("user") } return err } } return nil } // MarshalBinary interface implementation func (m *PullReview) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *PullReview) UnmarshalBinary(b []byte) error { var res PullReview if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil }