// 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" "encoding/json" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Feedback feedback // // swagger:model Feedback type Feedback struct { // created at // Format: date-time CreatedAt strfmt.DateTime `json:"created_at,omitempty"` // feedback uuid FeedbackUUID string `json:"feedback_uuid,omitempty"` // to have more context about the project ProjectID string `json:"project_id,omitempty"` // session uuid SessionUUID string `json:"session_uuid,omitempty"` // text Text string `json:"text,omitempty"` // type // Enum: [feature feedback support] Type string `json:"type,omitempty"` // upvoted Upvoted bool `json:"upvoted,omitempty"` // upvotes Upvotes int64 `json:"upvotes,omitempty"` // to have more context about the user UserID string `json:"user_id,omitempty"` } // Validate validates this feedback func (m *Feedback) Validate(formats strfmt.Registry) error { var res []error if err := m.validateCreatedAt(formats); err != nil { res = append(res, err) } if err := m.validateType(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *Feedback) validateCreatedAt(formats strfmt.Registry) error { if swag.IsZero(m.CreatedAt) { // not required return nil } if err := validate.FormatOf("created_at", "body", "date-time", m.CreatedAt.String(), formats); err != nil { return err } return nil } var feedbackTypeTypePropEnum []interface{} func init() { var res []string if err := json.Unmarshal([]byte(`["feature","feedback","support"]`), &res); err != nil { panic(err) } for _, v := range res { feedbackTypeTypePropEnum = append(feedbackTypeTypePropEnum, v) } } const ( // FeedbackTypeFeature captures enum value "feature" FeedbackTypeFeature string = "feature" // FeedbackTypeFeedback captures enum value "feedback" FeedbackTypeFeedback string = "feedback" // FeedbackTypeSupport captures enum value "support" FeedbackTypeSupport string = "support" ) // prop value enum func (m *Feedback) validateTypeEnum(path, location string, value string) error { if err := validate.EnumCase(path, location, value, feedbackTypeTypePropEnum, true); err != nil { return err } return nil } func (m *Feedback) validateType(formats strfmt.Registry) error { if swag.IsZero(m.Type) { // not required return nil } // value enum if err := m.validateTypeEnum("type", "body", m.Type); err != nil { return err } return nil } // ContextValidate validates this feedback based on context it is used func (m *Feedback) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *Feedback) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *Feedback) UnmarshalBinary(b []byte) error { var res Feedback if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil }