schema

package
v1.4.0-RC1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnswerAcceptedFailed = 1
	AnswerAcceptedEnable = 2
)
View Source
const (
	CGDefault = 1
	CGDIY     = 2
)
View Source
const (
	DashboardCacheKey  = "answer:dashboard"
	DashboardCacheTime = 60 * time.Minute
)
View Source
const (
	ForbiddenReasonTypeInactive      = "inactive"
	ForbiddenReasonTypeURLExpired    = "url_expired"
	ForbiddenReasonTypeUserSuspended = "suspended"
)
View Source
const (
	NotificationTypeInbox        = 1
	NotificationTypeAchievement  = 2
	NotificationNotRead          = 1
	NotificationRead             = 2
	NotificationStatusNormal     = 1
	NotificationStatusDelete     = 10
	NotificationInboxTypeAll     = 0
	NotificationInboxTypePosts   = 1
	NotificationInboxTypeVotes   = 2
	NotificationInboxTypeInvites = 3
)
View Source
const (
	QuestionOperationPin   = "pin"
	QuestionOperationUnPin = "unpin"
	QuestionOperationHide  = "hide"
	QuestionOperationShow  = "show"
)
View Source
const (
	QuestionOrderCondNewest     = "newest"
	QuestionOrderCondActive     = "active"
	QuestionOrderCondHot        = "hot"
	QuestionOrderCondScore      = "score"
	QuestionOrderCondUnanswered = "unanswered"

	// HotInDays limit max days of the hottest question
	HotInDays = 90
)
View Source
const (
	QuestionPageRespOperationTypeAsked    = "asked"
	QuestionPageRespOperationTypeAnswered = "answered"
	QuestionPageRespOperationTypeModified = "modified"
)
View Source
const (
	NoticeStatusOn  = 1
	NoticeStatusOff = 2
)
View Source
const RevisionAuditApprove = "approve"
View Source
const RevisionAuditReject = "reject"

Variables

View Source
var (
	DefaultPrivilegeOptions      PrivilegeOptions
	DefaultCustomPrivilegeOption *PrivilegeOption
)
View Source
var AppStartTime time.Time
View Source
var ErrTypeAlert = ErrTypeData{ErrType: "alert"}
View Source
var ErrTypeModal = ErrTypeData{ErrType: "modal"}
View Source
var ErrTypeToast = ErrTypeData{ErrType: "toast"}
View Source
var GetThemeOptions = []*ThemeOption{
	{
		Label: "Default",
		Value: "default",
	},
}
View Source
var NotificationInboxType = map[string]int{
	"all":     NotificationInboxTypeAll,
	"posts":   NotificationInboxTypePosts,
	"invites": NotificationInboxTypeInvites,
	"votes":   NotificationInboxTypeVotes,
}
View Source
var NotificationType = map[string]int{
	"inbox":       NotificationTypeInbox,
	"achievement": NotificationTypeAchievement,
}
View Source
var UserStatusShowMsg = map[int]string{
	1:  "",
	9:  "<strong>This user was suspended forever.</strong> This user doesn't meet a community guideline.",
	10: "This user was deleted.",
	11: "This user is inactive.",
}

Functions

func ReplaceSearchContent added in v1.3.0

func ReplaceSearchContent(content string) (string, []string)

Types

type AcceptAnswerActivity

type AcceptAnswerActivity struct {
	ActivityType     int
	ActivityUserID   string
	TriggerUserID    string
	OriginalObjectID string
	Rank             int
}

AcceptAnswerActivity accept answer activity

func (*AcceptAnswerActivity) HasRank

func (v *AcceptAnswerActivity) HasRank() int

type AcceptAnswerOperationInfo

type AcceptAnswerOperationInfo struct {
	TriggerUserID    string
	QuestionObjectID string
	QuestionUserID   string
	AnswerObjectID   string
	AnswerUserID     string

	// vote activity info
	Activities []*AcceptAnswerActivity
}

AcceptAnswerOperationInfo accept answer operation info

func (*AcceptAnswerOperationInfo) GetUserIDs

func (a *AcceptAnswerOperationInfo) GetUserIDs() (userIDs []string)

type AcceptAnswerReq

type AcceptAnswerReq struct {
	QuestionID string `validate:"required,gt=0,lte=30" json:"question_id"`
	AnswerID   string `validate:"omitempty" json:"answer_id"`
	UserID     string `json:"-"`
}

func (*AcceptAnswerReq) Check

func (req *AcceptAnswerReq) Check() (errFields []*validator.FormErrorField, err error)

type AcceptedAnswerItem

type AcceptedAnswerItem struct {
	Type        string    `json:"@type"`
	Text        string    `json:"text"`
	DateCreated time.Time `json:"dateCreated"`
	UpvoteCount int       `json:"upvoteCount"`
	URL         string    `json:"url"`
	Author      struct {
		URL  string `json:"url"`
		Type string `json:"@type"`
		Name string `json:"name"`
	} `json:"author"`
}

type ActObjectInfo

type ActObjectInfo struct {
	Title           string `json:"title"`
	ObjectType      string `json:"object_type"`
	QuestionID      string `json:"question_id"`
	AnswerID        string `json:"answer_id"`
	Username        string `json:"username"`
	DisplayName     string `json:"display_name"`
	MainTagSlugName string `json:"main_tag_slug_name"`
}

ActObjectInfo act object info

type ActObjectTimeline

type ActObjectTimeline struct {
	ActivityID   string         `json:"activity_id"`
	RevisionID   string         `json:"revision_id"`
	CreatedAt    int64          `json:"created_at"`
	ActivityType string         `json:"activity_type"`
	Comment      string         `json:"comment"`
	ObjectID     string         `json:"object_id"`
	ObjectType   string         `json:"object_type"`
	Cancelled    bool           `json:"cancelled"`
	CancelledAt  int64          `json:"cancelled_at"`
	UserInfo     *UserBasicInfo `json:"user_info,omitempty"`
}

ActObjectTimeline act object timeline

type ActionRecordReq

type ActionRecordReq struct {
	Action string `` /* 141-byte string literal not displayed */
	IP     string `json:"-"`
	UserID string `json:"-"`
}

type ActionRecordResp

type ActionRecordResp struct {
	CaptchaID  string `json:"captcha_id"`
	CaptchaImg string `json:"captcha_img"`
	Verify     bool   `json:"verify"`
}

type ActivityMsg

type ActivityMsg struct {
	UserID           string
	TriggerUserID    int64
	ObjectID         string
	OriginalObjectID string
	ActivityTypeKey  constant.ActivityTypeKey
	RevisionID       string
	ExtraInfo        map[string]string
}

ActivityMsg activity message

type AddCollectionGroupReq

type AddCollectionGroupReq struct {
	//
	UserID int64 `validate:"required" comment:"" json:"user_id"`
	// the collection group name
	Name string `validate:"required,gt=0,lte=50" comment:"the collection group name" json:"name"`
	// mark this group is default, default 1
	DefaultGroup int `validate:"required" comment:"mark this group is default, default 1" json:"default_group"`
	//
	CreateTime time.Time `validate:"required" comment:"" json:"create_time"`
	//
	UpdateTime time.Time `validate:"required" comment:"" json:"update_time"`
}

AddCollectionGroupReq add collection group request

type AddCommentReq

type AddCommentReq struct {
	// object id
	ObjectID string `validate:"required" json:"object_id"`
	// reply comment id
	ReplyCommentID string `validate:"omitempty" json:"reply_comment_id"`
	// original comment content
	OriginalText string `validate:"required,notblank,gte=2,lte=600" json:"original_text"`
	// parsed comment content
	ParsedText string `json:"-"`
	// @ user id list
	MentionUsernameList []string `validate:"omitempty" json:"mention_username_list"`
	CaptchaID           string   `json:"captcha_id"`
	CaptchaCode         string   `json:"captcha_code"`

	// user id
	UserID string `json:"-"`
	// whether user can add it
	CanAdd bool `json:"-"`
	// whether user can edit it
	CanEdit bool `json:"-"`
	// whether user can delete it
	CanDelete bool `json:"-"`
}

AddCommentReq add comment request

func (*AddCommentReq) Check

func (req *AddCommentReq) Check() (errFields []*validator.FormErrorField, err error)

type AddConfigReq

type AddConfigReq struct {
	// the config key
	Key string `validate:"omitempty,gt=0,lte=32" comment:"the config key" json:"key"`
	// the config value, custom data structures and types
	Value string `validate:"omitempty,gt=0,lte=128" comment:"the config value, custom data structures and types" json:"value"`
}

AddConfigReq add config request

type AddReportReq

type AddReportReq struct {
	// object id
	ObjectID string `validate:"required,gt=0,lte=20" json:"object_id"`
	// report type
	ReportType int `validate:"required" json:"report_type"`
	// report content
	Content string `validate:"omitempty,gt=0,lte=500" json:"content"`
	// user id
	UserID      string `json:"-"`
	CaptchaID   string `json:"captcha_id"` // captcha_id
	CaptchaCode string `json:"captcha_code"`
}

AddReportReq add report request

type AddRevisionDTO

type AddRevisionDTO struct {
	// user id
	UserID string
	// object id
	ObjectID string
	// title
	Title string
	// content
	Content string
	// log
	Log string
	// status
	Status int
}

AddRevisionDTO add revision request

type AddTagListReq

type AddTagListReq struct {
	// tag_id
	TagID int64 `validate:"required" comment:"tag_id" json:"tag_id"`
	// object_id
	ObjectID int64 `validate:"required" comment:"object_id" json:"object_id"`
	// tag_list_status(available: 1; deleted: 10)
	Status int `validate:"required" comment:"tag_list_status(available: 1; deleted: 10)" json:"status"`
}

AddTagListReq add tag list request

type AddTagReq

type AddTagReq struct {
	// slug_name
	SlugName string `validate:"required,gt=0,lte=35" json:"slug_name"`
	// display_name
	DisplayName string `validate:"required,gt=0,lte=35" json:"display_name"`
	// original text
	OriginalText string `validate:"required,gt=0,lte=65536" json:"original_text"`
	// parsed text
	ParsedText string `json:"-"`
	// user id
	UserID string `json:"-"`
}

AddTagReq add tag request

func (*AddTagReq) Check

func (req *AddTagReq) Check() (errFields []*validator.FormErrorField, err error)

type AddTagResp

type AddTagResp struct {
	SlugName string `json:"slug_name"`
}

AddTagResp add tag response

type AddUserReq

type AddUserReq struct {
	DisplayName string `validate:"required,gte=4,lte=30" json:"display_name"`
	Email       string `validate:"required,email,gt=0,lte=500" json:"email"`
	Password    string `validate:"required,gte=8,lte=32" json:"password"`
	LoginUserID string `json:"-"`
}

AddUserReq add user request

type AddUsersErrorData

type AddUsersErrorData struct {
	// optional. error field name.
	Field string `json:"field"`
	// must. error line number.
	Line int `json:"line"`
	// must. error content.
	Content string `json:"content"`
	// optional. error message.
	ExtraMessage string `json:"extra_message"`
}

func (*AddUsersErrorData) GetErrField

func (e *AddUsersErrorData) GetErrField(ctx context.Context) (errFields []*validator.FormErrorField)

type AddUsersReq

type AddUsersReq struct {
	// users info line by line
	UsersStr string        `json:"users"`
	Users    []*AddUserReq `json:"-"`
}

AddUsersReq add users request

func (*AddUsersReq) ParseUsers

func (req *AddUsersReq) ParseUsers(ctx context.Context) (errFields []*validator.FormErrorField, err error)

type AdminAnswerInfo

type AdminAnswerInfo struct {
	ID           string         `json:"id"`
	QuestionID   string         `json:"question_id"`
	Description  string         `json:"description"`
	CreateTime   int64          `json:"create_time"`
	UpdateTime   int64          `json:"update_time"`
	Accepted     int            `json:"accepted"`
	UserID       string         `json:"-"`
	UpdateUserID string         `json:"-"`
	UserInfo     *UserBasicInfo `json:"user_info"`
	VoteCount    int            `json:"vote_count"`
	QuestionInfo struct {
		Title string `json:"title"`
	} `json:"question_info"`
}

type AdminAnswerPageReq

type AdminAnswerPageReq struct {
	Page          int    `validate:"omitempty,min=1" form:"page"`
	PageSize      int    `validate:"omitempty,min=1" form:"page_size"`
	StatusCond    string `validate:"omitempty,oneof=normal deleted pending" form:"status"`
	Query         string `validate:"omitempty,gt=0,lte=100" form:"query"`
	QuestionID    string `validate:"omitempty,gt=0,lte=24" form:"question_id"`
	QuestionTitle string `json:"-"`
	AnswerID      string `json:"-"`
	Status        int    `json:"-"`
	LoginUserID   string `json:"-"`
}

AdminAnswerPageReq admin answer page req

func (*AdminAnswerPageReq) Check

func (req *AdminAnswerPageReq) Check() (errField []*validator.FormErrorField, err error)

type AdminQuestionInfo

type AdminQuestionInfo struct {
	ID               string         `json:"id"`
	Title            string         `json:"title"`
	VoteCount        int            `json:"vote_count"`
	Show             int            `json:"show"`
	Pin              int            `json:"pin"`
	AnswerCount      int            `json:"answer_count"`
	AcceptedAnswerID string         `json:"accepted_answer_id"`
	CreateTime       int64          `json:"create_time"`
	UpdateTime       int64          `json:"update_time"`
	EditTime         int64          `json:"edit_time"`
	UserID           string         `json:"-" `
	UserInfo         *UserBasicInfo `json:"user_info"`
}

type AdminQuestionPageReq

type AdminQuestionPageReq struct {
	Page        int    `validate:"omitempty,min=1" form:"page"`
	PageSize    int    `validate:"omitempty,min=1" form:"page_size"`
	StatusCond  string `validate:"omitempty,oneof=normal closed deleted pending" form:"status"`
	Query       string `validate:"omitempty,gt=0,lte=100" json:"query" form:"query" `
	Status      int    `json:"-"`
	LoginUserID string `json:"-"`
}

func (*AdminQuestionPageReq) Check

func (req *AdminQuestionPageReq) Check() (errField []*validator.FormErrorField, err error)

type AdminUpdateAnswerStatusReq

type AdminUpdateAnswerStatusReq struct {
	AnswerID string `validate:"required" json:"answer_id"`
	Status   string `validate:"required,oneof=available deleted" json:"status"`
	UserID   string `json:"-"`
}

type AdminUpdateQuestionStatusReq

type AdminUpdateQuestionStatusReq struct {
	QuestionID string `validate:"required" json:"question_id"`
	Status     string `validate:"required,oneof=available closed deleted" json:"status"`
	UserID     string `json:"-"`
}

type AgentInfo

type AgentInfo struct {
	Name                      string           `json:"name"`
	DisplayName               string           `json:"display_name"`
	Icon                      string           `json:"icon"`
	Url                       string           `json:"url"`
	LoginRedirectURL          string           `json:"login_redirect_url"`
	SignUpRedirectURL         string           `json:"sign_up_redirect_url"`
	ControlCenterItems        []*ControlCenter `json:"control_center"`
	EnabledOriginalUserSystem bool             `json:"enabled_original_user_system"`
}

type AnswerAddReq

type AnswerAddReq struct {
	QuestionID  string `json:"question_id"`
	Content     string `validate:"required,notblank,gte=6,lte=65535" json:"content"`
	HTML        string `json:"-"`
	UserID      string `json:"-"`
	CanEdit     bool   `json:"-"`
	CanDelete   bool   `json:"-"`
	CanRecover  bool   `json:"-"`
	CaptchaID   string `json:"captcha_id"`
	CaptchaCode string `json:"captcha_code"`
	IP          string `json:"-"`
	UserAgent   string `json:"-"`
}

func (*AnswerAddReq) Check

func (req *AnswerAddReq) Check() (errFields []*validator.FormErrorField, err error)

type AnswerInfo

type AnswerInfo struct {
	ID             string            `json:"id"`
	QuestionID     string            `json:"question_id"`
	Content        string            `json:"content"`
	HTML           string            `json:"html"`
	CreateTime     int64             `json:"create_time"`
	UpdateTime     int64             `json:"update_time"`
	Accepted       int               `json:"accepted"`
	UserID         string            `json:"-"`
	UpdateUserID   string            `json:"-"`
	UserInfo       *UserBasicInfo    `json:"user_info,omitempty"`
	UpdateUserInfo *UserBasicInfo    `json:"update_user_info,omitempty"`
	Collected      bool              `json:"collected"`
	VoteStatus     string            `json:"vote_status"`
	VoteCount      int               `json:"vote_count"`
	QuestionInfo   *QuestionInfoResp `json:"question_info,omitempty"`
	Status         int               `json:"status"`

	// MemberActions
	MemberActions []*PermissionMemberAction `json:"member_actions"`
}

type AnswerListReq

type AnswerListReq struct {
	QuestionID string `json:"question_id" form:"question_id"`
	Order      string `json:"order" form:"order"`
	Page       int    `json:"page" form:"page"`
	PageSize   int    `json:"page_size" form:"page_size"`
	UserID     string `json:"-"`
	IsAdmin    bool   `json:"-"`
	CanEdit    bool   `json:"-"`
	CanDelete  bool   `json:"-"`
	CanRecover bool   `json:"-"`
}

type AnswerUpdateReq

type AnswerUpdateReq struct {
	ID           string `json:"id"`
	QuestionID   string `json:"question_id"`
	Title        string `json:"title"`
	Content      string `validate:"required,notblank,gte=6,lte=65535" json:"content"`
	EditSummary  string `validate:"omitempty" json:"edit_summary"`
	HTML         string `json:"-"`
	UserID       string `json:"-"`
	NoNeedReview bool   `json:"-"`
	CanEdit      bool   `json:"-"`
	CaptchaID    string `json:"captcha_id"`
	CaptchaCode  string `json:"captcha_code"`
}

func (*AnswerUpdateReq) Check

func (req *AnswerUpdateReq) Check() (errFields []*validator.FormErrorField, err error)

type AnswerUpdateResp

type AnswerUpdateResp struct {
	WaitForReview bool `json:"wait_for_review"`
}

AnswerUpdateResp answer update resp

type AvatarInfo

type AvatarInfo struct {
	Type     string `validate:"omitempty,gt=0,lte=100"  json:"type"`
	Gravatar string `validate:"omitempty,gt=0,lte=200"  json:"gravatar"`
	Custom   string `validate:"omitempty,gt=0,lte=200"  json:"custom"`
}

func CustomAvatar

func CustomAvatar(url string) *AvatarInfo

func (*AvatarInfo) GetURL

func (a *AvatarInfo) GetURL() string

func (*AvatarInfo) ToJsonString

func (a *AvatarInfo) ToJsonString() string

type BadgeListInfo added in v1.4.0

type BadgeListInfo struct {
	// badge id
	ID string `json:"id" `
	// badge name
	Name string `json:"name" `
	// badge icon
	Icon string `json:"icon" `
	// badge award count
	AwardCount int `json:"award_count" `
	// badge earned count
	EarnedCount int64 `json:"earned_count" `
	// badge level
	Level entity.BadgeLevel `json:"level" `
}

BadgeListInfo get badge list response

type BadgeStatus added in v1.4.0

type BadgeStatus string
const (
	BadgeStatusActive   BadgeStatus = "active"
	BadgeStatusInactive BadgeStatus = "inactive"
)

type BadgeTplData added in v1.4.0

type BadgeTplData struct {
	ProfileURL string
}

type ChangeEmailTemplateData

type ChangeEmailTemplateData struct {
	SiteName       string
	ChangeEmailUrl string
}

type CheckCanQuestionUpdate

type CheckCanQuestionUpdate struct {
	// question id
	ID string `validate:"required" form:"id"`
	// user id
	UserID  string `json:"-"`
	IsAdmin bool   `json:"-"`
}

type CloseQuestionMeta

type CloseQuestionMeta struct {
	CloseType int    `json:"close_type"`
	CloseMsg  string `json:"close_msg"`
}

type CloseQuestionReq

type CloseQuestionReq struct {
	ID        string `validate:"required" json:"id"`
	CloseType int    `json:"close_type"` // close_type
	CloseMsg  string `json:"close_msg"`  // close_type
	UserID    string `json:"-"`          // user_id
}

type CollectionSwitchReq

type CollectionSwitchReq struct {
	ObjectID string `validate:"required" json:"object_id"`
	GroupID  string `validate:"required" json:"group_id"`
	Bookmark bool   `validate:"omitempty" json:"bookmark"`
	UserID   string `json:"-"`
}

CollectionSwitchReq switch collection request

type CollectionSwitchResp

type CollectionSwitchResp struct {
	ObjectCollectionCount int64 `json:"object_collection_count"`
}

CollectionSwitchResp switch collection response

type ConfigField

type ConfigField struct {
	Name        string               `json:"name"`
	Type        string               `json:"type"`
	Title       string               `json:"title"`
	Description string               `json:"description"`
	Required    bool                 `json:"required"`
	Value       any                  `json:"value"`
	UIOptions   ConfigFieldUIOptions `json:"ui_options"`
	Options     []ConfigFieldOption  `json:"options,omitempty"`
}

type ConfigFieldOption

type ConfigFieldOption struct {
	Label string `json:"label"`
	Value string `json:"value"`
}

type ConfigFieldUIOptions

type ConfigFieldUIOptions struct {
	Placeholder    string          `json:"placeholder,omitempty"`
	Rows           string          `json:"rows,omitempty"`
	InputType      string          `json:"input_type,omitempty"`
	Label          string          `json:"label,omitempty"`
	Action         *UIOptionAction `json:"action,omitempty"`
	Variant        string          `json:"variant,omitempty"`
	Text           string          `json:"text,omitempty"`
	ClassName      string          `json:"class_name,omitempty"`
	FieldClassName string          `json:"field_class_name,omitempty"`
}

type ConnectorInfoResp

type ConnectorInfoResp struct {
	Name string `json:"name"`
	Icon string `json:"icon"`
	Link string `json:"link"`
}

type ConnectorUserInfoResp

type ConnectorUserInfoResp struct {
	Name       string `json:"name"`
	Icon       string `json:"icon"`
	Link       string `json:"link"`
	Binding    bool   `json:"binding"`
	ExternalID string `json:"external_id"`
}

type ControlCenter

type ControlCenter struct {
	Name  string `json:"name"`
	Label string `json:"label"`
	Url   string `json:"url"`
}

type DashboardInfo

type DashboardInfo struct {
	QuestionCount         int64                `json:"question_count"`
	AnswerCount           int64                `json:"answer_count"`
	CommentCount          int64                `json:"comment_count"`
	VoteCount             int64                `json:"vote_count"`
	UserCount             int64                `json:"user_count"`
	ReportCount           int64                `json:"report_count"`
	UploadingFiles        bool                 `json:"uploading_files"`
	SMTP                  string               `json:"smtp"`
	HTTPS                 bool                 `json:"https"`
	TimeZone              string               `json:"time_zone"`
	OccupyingStorageSpace string               `json:"occupying_storage_space"`
	AppStartTime          string               `json:"app_start_time"`
	VersionInfo           DashboardInfoVersion `json:"version_info"`
	LoginRequired         bool                 `json:"login_required"`
	GoVersion             string               `json:"go_version"`
	DatabaseVersion       string               `json:"database_version"`
	DatabaseSize          string               `json:"database_size"`
}

type DashboardInfoVersion

type DashboardInfoVersion struct {
	Version       string `json:"version"`
	Revision      string `json:"revision"`
	RemoteVersion string `json:"remote_version"`
}

type EditUserProfileReq added in v1.3.5

type EditUserProfileReq struct {
	UserID      string `validate:"required" json:"user_id"`
	DisplayName string `validate:"required,gte=4,lte=30" json:"display_name"`
	Username    string `validate:"omitempty,gt=3,lte=30" json:"username"`
	Email       string `validate:"required,email,gt=0,lte=500" json:"email"`
	LoginUserID string `json:"-"`
	IsAdmin     bool   `json:"-"`
}

EditUserProfileReq edit user profile request

type EmailCodeContent

type EmailCodeContent struct {
	SourceType EmailSourceType `json:"source_type"`
	Email      string          `json:"e_mail"`
	UserID     string          `json:"user_id"`
	// Used for unsubscribe notification
	NotificationSources []constant.NotificationSource `json:"notification_source,omitempty"`
	// Used for third-party login account binding
	BindingKey string `json:"binding_key,omitempty"`
	// Skip the validation of the latest code
	SkipValidationLatestCode bool `json:"skip_validation_latest_code"`
}

func (*EmailCodeContent) FromJSONString

func (r *EmailCodeContent) FromJSONString(data string) error

func (*EmailCodeContent) ToJSONString

func (r *EmailCodeContent) ToJSONString() string

type EmailSourceType

type EmailSourceType string
const (
	AccountActivationSourceType EmailSourceType = "account-activation"
	PasswordResetSourceType     EmailSourceType = "password-reset"
	ConfirmNewEmailSourceType   EmailSourceType = "password-reset"
	UnsubscribeSourceType       EmailSourceType = "unsubscribe"
	BindingSourceType           EmailSourceType = "binding"
)

type ErrTypeData

type ErrTypeData struct {
	ErrType string `json:"err_type"`
}

type EventMsg added in v1.4.0

type EventMsg struct {
	EventType constant.EventType
	UserID    string

	TriggerObjectID string

	QuestionID     string
	QuestionUserID string

	AnswerID     string
	AnswerUserID string

	CommentID     string
	CommentUserID string

	ExtraInfo map[string]string
}

EventMsg event message

func NewEvent added in v1.4.0

func NewEvent(e constant.EventType, userID string) *EventMsg

NewEvent create a new event

func (*EventMsg) AID added in v1.4.0

func (e *EventMsg) AID(answerID, userID string) *EventMsg

AID get answer id

func (*EventMsg) AddExtra added in v1.4.0

func (e *EventMsg) AddExtra(key, value string) *EventMsg

AddExtra add extra info

func (*EventMsg) CID added in v1.4.0

func (e *EventMsg) CID(comment, userID string) *EventMsg

CID get comment id

func (*EventMsg) GetExtra added in v1.4.0

func (e *EventMsg) GetExtra(key string) string

GetExtra get extra info

func (*EventMsg) GetObjectID added in v1.4.0

func (e *EventMsg) GetObjectID() string

GetObjectID get object id

func (*EventMsg) QID added in v1.4.0

func (e *EventMsg) QID(questionID, userID string) *EventMsg

QID get question id

func (*EventMsg) TID added in v1.4.0

func (e *EventMsg) TID(triggerObjectID string) *EventMsg

TID get trigger object id

type ExternalLoginBindingUserReq

type ExternalLoginBindingUserReq struct {
	Code    string `validate:"required,gt=0,lte=500" json:"code"`
	Content string `json:"-"`
}

ExternalLoginBindingUserReq external login binding user request

type ExternalLoginBindingUserResp

type ExternalLoginBindingUserResp struct {
	AccessToken string `json:"access_token"`
}

ExternalLoginBindingUserResp external login binding user response

type ExternalLoginBindingUserSendEmailReq

type ExternalLoginBindingUserSendEmailReq struct {
	BindingKey string `validate:"required,gt=1,lte=100" json:"binding_key"`
	Email      string `validate:"required,gt=1,lte=512,email" json:"email"`
	// If must is true, whatever email if exists, try to bind user.
	// If must is false, when email exist, will only be prompted with a warning.
	Must bool `json:"must"`
}

ExternalLoginBindingUserSendEmailReq external login binding user request

type ExternalLoginBindingUserSendEmailResp

type ExternalLoginBindingUserSendEmailResp struct {
	EmailExistAndMustBeConfirmed bool   `json:"email_exist_and_must_be_confirmed"`
	AccessToken                  string `json:"access_token"`
}

ExternalLoginBindingUserSendEmailResp external login binding user response

type ExternalLoginUnbindingReq

type ExternalLoginUnbindingReq struct {
	ExternalID string `validate:"required,gt=0,lte=128" json:"external_id"`
	UserID     string `json:"-"`
}

ExternalLoginUnbindingReq external login unbinding user

type ExternalLoginUserInfoCache

type ExternalLoginUserInfoCache struct {
	// Third party identification
	// e.g. facebook, twitter, instagram
	Provider string
	// required. The unique user ID provided by the third-party login
	ExternalID string
	// optional. This name is used preferentially during registration
	DisplayName string
	// optional. This username is used preferentially during registration
	Username string
	// optional. If email exist will bind the existing user
	Email string
	// optional. The avatar URL provided by the third-party login platform
	Avatar string
	// optional. The original user information provided by the third-party login platform
	MetaInfo string
	// optional. The bio provided by the third-party login platform
	Bio string
}

ExternalLoginUserInfoCache external login user info

type ExternalNotificationMsg

type ExternalNotificationMsg struct {
	ReceiverUserID string `json:"receiver_user_id"`
	ReceiverEmail  string `json:"receiver_email"`
	ReceiverLang   string `json:"receiver_lang"`

	NewAnswerTemplateRawData       *NewAnswerTemplateRawData       `json:"new_answer_template_raw_data,omitempty"`
	NewInviteAnswerTemplateRawData *NewInviteAnswerTemplateRawData `json:"new_invite_answer_template_raw_data,omitempty"`
	NewCommentTemplateRawData      *NewCommentTemplateRawData      `json:"new_comment_template_raw_data,omitempty"`
	NewQuestionTemplateRawData     *NewQuestionTemplateRawData     `json:"new_question_template_raw_data,omitempty"`
}

func CreateNewQuestionNotificationMsg

func CreateNewQuestionNotificationMsg(
	questionID, questionTitle, questionAuthorUserID string, tags []*entity.Tag) *ExternalNotificationMsg

type FollowDTO

type FollowDTO struct {
	// object TagID
	ObjectID string
	// is cancel
	IsCancel bool
	// user TagID
	UserID string
}

type FollowReq

type FollowReq struct {
	// object id
	ObjectID string `validate:"required" form:"object_id" json:"object_id"`
	// is cancel
	IsCancel bool `validate:"omitempty" form:"is_cancel" json:"is_cancel"`
}

FollowReq follow object request

type FollowResp

type FollowResp struct {
	// the followers of object
	Follows int `json:"follows"`
	// if user is followed object will be true,otherwise false
	IsFollowed bool `json:"is_followed"`
}

FollowResp response object's follows and current user follow status

type ForbiddenResp

type ForbiddenResp struct {
	// forbidden reason type
	Type string `json:"type" enums:"inactive,url_expired"`
}

ForbiddenResp forbidden response

type GetAllPluginStatusResp

type GetAllPluginStatusResp struct {
	SlugName string `json:"slug_name"`
	Enabled  bool   `json:"enabled"`
}

type GetBadgeAwardWithPageReq added in v1.4.0

type GetBadgeAwardWithPageReq struct {
	// page
	Page int `validate:"omitempty,min=1" form:"page"`
	// page size
	PageSize int `validate:"omitempty,min=1" form:"page_size"`
	// badge id
	BadgeID string `validate:"required" form:"badge_id"`
	// username
	Username string `validate:"omitempty,gt=0,lte=100" form:"username"`
	// user id
	UserID string `json:"-"`
}

type GetBadgeAwardWithPageResp added in v1.4.0

type GetBadgeAwardWithPageResp struct {
	// created time
	CreatedAt int64 `json:"created_at"`
	// object id
	ObjectID string `json:"object_id"`
	// question id
	QuestionID string `json:"question_id"`
	// answer id
	AnswerID string `json:"answer_id"`
	// comment id
	CommentID string `json:"comment_id"`
	// object type
	ObjectType string `json:"object_type" enums:"question,answer,comment"`
	// url title
	UrlTitle string `json:"url_title"`
	// author user info
	AuthorUserInfo UserBasicInfo `json:"author_user_info"`
}

type GetBadgeInfoResp added in v1.4.0

type GetBadgeInfoResp struct {
	// badge id
	ID string `json:"id" `
	// badge name
	Name string `json:"name" `
	// badge description
	Description string `json:"description" `
	// badge icon
	Icon string `json:"icon" `
	// badge award count
	AwardCount int `json:"award_count" `
	// badge earned count
	EarnedCount int64 `json:"earned_count" `
	// badge is single or multiple
	IsSingle bool `json:"is_single" `
	// badge level
	Level entity.BadgeLevel `json:"level" `
}

type GetBadgeListPagedReq added in v1.4.0

type GetBadgeListPagedReq struct {
	// page
	Page int `validate:"omitempty,min=1" form:"page"`
	// page size
	PageSize int `validate:"omitempty,min=1" form:"page_size"`
	// badge status
	Status BadgeStatus `validate:"omitempty" form:"status"`
	// query condition
	Query string `validate:"omitempty" form:"q"`
}

type GetBadgeListPagedResp added in v1.4.0

type GetBadgeListPagedResp struct {
	// badge id
	ID string `json:"id" `
	// badge name
	Name string `json:"name" `
	// badge description
	Description string `json:"description" `
	// badge icon
	Icon string `json:"icon" `
	// badge award count
	AwardCount int `json:"award_count" `
	// badge earned count
	Earned bool `json:"earned" `
	// badge level
	Level entity.BadgeLevel `json:"level" `
	// badge group name
	GroupName string `json:"group_name" `
	// badge status
	Status BadgeStatus `json:"status"`
}

type GetBadgeListResp added in v1.4.0

type GetBadgeListResp struct {
	// badge list info
	Badges []*BadgeListInfo `json:"badges" `
	// badge group name
	GroupName string `json:"group_name" `
}

type GetCloseTypeResp

type GetCloseTypeResp struct {
	// report name
	Name string `json:"name"`
	// report description
	Description string `json:"description"`
	// report source
	Source string `json:"source"`
	// report type
	Type int `json:"type"`
	// is have content
	HaveContent bool `json:"have_content"`
	// content type
	ContentType string `json:"content_type"`
}

type GetCollectionGroupResp

type GetCollectionGroupResp struct {
	//
	ID int64 `json:"id"`
	//
	UserID int64 `json:"user_id"`
	// the collection group name
	Name string `json:"name"`
	// mark this group is default, default 1
	DefaultGroup int `json:"default_group"`
	//
	CreateTime time.Time `json:"create_time"`
	//
	UpdateTime time.Time `json:"update_time"`
}

GetCollectionGroupResp get collection group response

type GetCommentListReq

type GetCommentListReq struct {
	// user id
	UserID int64 `validate:"omitempty" comment:"user id" form:"user_id"`
	// reply user id
	ReplyUserID int64 `validate:"omitempty" comment:"reply user id" form:"reply_user_id"`
	// reply comment id
	ReplyCommentID int64 `validate:"omitempty" comment:"reply comment id" form:"reply_comment_id"`
	// object id
	ObjectID int64 `validate:"omitempty" comment:"object id" form:"object_id"`
	// user vote amount
	VoteCount int `validate:"omitempty" comment:"user vote amount" form:"vote_count"`
	// comment status(available: 0; deleted: 10)
	Status int `validate:"omitempty" comment:"comment status(available: 0; deleted: 10)" form:"status"`
	// original comment content
	OriginalText string `validate:"omitempty" comment:"original comment content" form:"original_text"`
	// parsed comment content
	ParsedText string `validate:"omitempty" comment:"parsed comment content" form:"parsed_text"`
}

GetCommentListReq get comment list all request

type GetCommentPersonalWithPageReq

type GetCommentPersonalWithPageReq struct {
	// page
	Page int `validate:"omitempty,min=1" form:"page"`
	// page size
	PageSize int `validate:"omitempty,min=1" form:"page_size"`
	// username
	Username string `validate:"omitempty,gt=0,lte=100" form:"username"`
	// user id
	UserID string `json:"-"`
}

GetCommentPersonalWithPageReq get comment list page request

type GetCommentPersonalWithPageResp

type GetCommentPersonalWithPageResp struct {
	// comment id
	CommentID string `json:"comment_id"`
	// create time
	CreatedAt int64 `json:"created_at"`
	// object id
	ObjectID string `json:"object_id"`
	// question id
	QuestionID string `json:"question_id"`
	// answer id
	AnswerID string `json:"answer_id"`
	// object type
	ObjectType string `json:"object_type" enums:"question,answer,tag,comment"`
	// title
	Title string `json:"title"`
	// url title
	UrlTitle string `json:"url_title"`
	// content
	Content string `json:"content"`
}

GetCommentPersonalWithPageResp comment response

type GetCommentReq

type GetCommentReq struct {
	// object id
	ID string `validate:"required" form:"id"`
	// user id
	UserID string `json:"-"`
	// whether user can edit it
	CanEdit bool `json:"-"`
	// whether user can delete it
	CanDelete bool `json:"-"`
}

GetCommentReq get comment list page request

type GetCommentResp

type GetCommentResp struct {
	// comment id
	CommentID string `json:"comment_id"`
	// create time
	CreatedAt int64 `json:"created_at"`

	// object id
	ObjectID string `json:"object_id"`
	// user vote amount
	VoteCount int `json:"vote_count"`
	// current user if already vote this comment
	IsVote bool `json:"is_vote"`
	// original comment content
	OriginalText string `json:"original_text"`
	// parsed comment content
	ParsedText string `json:"parsed_text"`

	// user id
	UserID string `json:"user_id"`
	// username
	Username string `json:"username"`
	// user display name
	UserDisplayName string `json:"user_display_name"`
	// user avatar
	UserAvatar string `json:"user_avatar"`
	// user status
	UserStatus string `json:"user_status"`

	// reply user id
	ReplyUserID string `json:"reply_user_id"`
	// reply user username
	ReplyUsername string `json:"reply_username"`
	// reply user display name
	ReplyUserDisplayName string `json:"reply_user_display_name"`
	// reply comment id
	ReplyCommentID string `json:"reply_comment_id"`
	// reply user status
	ReplyUserStatus string `json:"reply_user_status"`

	// MemberActions
	MemberActions []*PermissionMemberAction `json:"member_actions"`
}

GetCommentResp comment response

func (*GetCommentResp) SetFromComment

func (r *GetCommentResp) SetFromComment(comment *entity.Comment)

type GetCommentWithPageReq

type GetCommentWithPageReq struct {
	// page
	Page int `validate:"omitempty,min=1" form:"page"`
	// page size
	PageSize int `validate:"omitempty,min=1" form:"page_size"`
	// object id
	ObjectID string `validate:"required" form:"object_id"`
	// comment id
	CommentID string `validate:"omitempty" form:"comment_id"`
	// query condition
	QueryCond string `validate:"omitempty,oneof=vote created_at" form:"query_cond"`
	// user id
	UserID string `json:"-"`
	// whether user can edit it
	CanEdit bool `json:"-"`
	// whether user can delete it
	CanDelete bool `json:"-"`
}

GetCommentWithPageReq get comment list page request

type GetConfigListReq

type GetConfigListReq struct {
	// the config key
	Key string `validate:"omitempty,gt=0,lte=32" comment:"the config key" form:"key"`
	// the config value, custom data structures and types
	Value string `validate:"omitempty,gt=0,lte=128" comment:"the config value, custom data structures and types" form:"value"`
}

GetConfigListReq get config list all request

type GetConfigResp

type GetConfigResp struct {
	// config id
	ID int `json:"id"`
	// the config key
	Key string `json:"key"`
	// the config value, custom data structures and types
	Value string `json:"value"`
}

GetConfigResp get config response

type GetConfigWithPageReq

type GetConfigWithPageReq struct {
	// page
	Page int `validate:"omitempty,min=1" form:"page"`
	// page size
	PageSize int `validate:"omitempty,min=1" form:"page_size"`
	// the config key
	Key string `validate:"omitempty,gt=0,lte=32" comment:"the config key" form:"key"`
	// the config value, custom data structures and types
	Value string `validate:"omitempty,gt=0,lte=128" comment:"the config value, custom data structures and types" form:"value"`
}

GetConfigWithPageReq get config list page request

type GetCurrentLoginUserInfoResp

type GetCurrentLoginUserInfoResp struct {
	*UserLoginResp
	Avatar *AvatarInfo `json:"avatar"`
}

func (*GetCurrentLoginUserInfoResp) ConvertFromUserEntity

func (r *GetCurrentLoginUserInfoResp) ConvertFromUserEntity(userInfo *entity.User)

type GetFollowingTagsResp

type GetFollowingTagsResp struct {
	// tag id
	TagID string `json:"tag_id"`
	// slug name
	SlugName string `json:"slug_name"`
	// display name
	DisplayName string `json:"display_name"`
	// if main tag slug name is not empty, this tag is synonymous with the main tag
	MainTagSlugName string `json:"main_tag_slug_name"`
	Recommend       bool   `json:"recommend"`
	Reserved        bool   `json:"reserved"`
}

GetFollowingTagsResp get following tags response

type GetManifestJsonResp

type GetManifestJsonResp struct {
	ManifestVersion int               `json:"manifest_version"`
	Version         string            `json:"version"`
	Revision        string            `json:"revision"`
	ShortName       string            `json:"short_name"`
	Name            string            `json:"name"`
	Icons           map[string]string `json:"icons"`
	StartUrl        string            `json:"start_url"`
	Display         string            `json:"display"`
	ThemeColor      string            `json:"theme_color"`
	BackgroundColor string            `json:"background_color"`
}

GetManifestJsonResp get manifest json response

type GetObjectTimelineDetailReq

type GetObjectTimelineDetailReq struct {
	NewRevisionID string `validate:"required,gt=0,lte=100" form:"new_revision_id"`
	OldRevisionID string `validate:"required,gt=0,lte=100" form:"old_revision_id"`
	UserID        string `json:"-"`
}

GetObjectTimelineDetailReq get object timeline detail request

type GetObjectTimelineDetailResp

type GetObjectTimelineDetailResp struct {
	NewRevision *ObjectTimelineDetail `json:"new_revision"`
	OldRevision *ObjectTimelineDetail `json:"old_revision"`
}

GetObjectTimelineDetailResp get object timeline detail response

type GetObjectTimelineReq

type GetObjectTimelineReq struct {
	ObjectID string `validate:"omitempty,gt=0,lte=100" form:"object_id"`
	ShowVote bool   `validate:"omitempty" form:"show_vote"`
	UserID   string `json:"-"`
	IsAdmin  bool   `json:"-"`
}

GetObjectTimelineReq get object timeline request

type GetObjectTimelineResp

type GetObjectTimelineResp struct {
	ObjectInfo *ActObjectInfo       `json:"object_info"`
	Timeline   []*ActObjectTimeline `json:"timeline"`
}

GetObjectTimelineResp get object timeline response

type GetOtherUserInfoByUsernameReq

type GetOtherUserInfoByUsernameReq struct {
	Username string `validate:"required,gt=0,lte=500" form:"username"`
	UserID   string `json:"-"`
	IsAdmin  bool   `json:"-"`
}

type GetOtherUserInfoByUsernameResp

type GetOtherUserInfoByUsernameResp struct {
	// user id
	ID string `json:"id"`
	// create time
	CreatedAt int64 `json:"created_at"`
	// last login date
	LastLoginDate int64 `json:"last_login_date"`
	// username
	Username string `json:"username"`
	// email
	// follow count
	FollowCount int `json:"follow_count"`
	// answer count
	AnswerCount int `json:"answer_count"`
	// question count
	QuestionCount int `json:"question_count"`
	// rank
	Rank int `json:"rank"`
	// display name
	DisplayName string `json:"display_name"`
	// avatar
	Avatar string `json:"avatar"`
	// mobile
	Mobile string `json:"mobile"`
	// bio markdown
	Bio string `json:"bio"`
	// bio html
	BioHTML string `json:"bio_html"`
	// website
	Website string `json:"website"`
	// location
	Location  string `json:"location"`
	Status    string `json:"status"`
	StatusMsg string `json:"status_msg,omitempty"`
}

GetOtherUserInfoByUsernameResp get user response

func (*GetOtherUserInfoByUsernameResp) ConvertFromUserEntity

func (r *GetOtherUserInfoByUsernameResp) ConvertFromUserEntity(userInfo *entity.User)

type GetOtherUserInfoResp

type GetOtherUserInfoResp struct {
	Info *GetOtherUserInfoByUsernameResp `json:"info"`
}

type GetPermissionReq

type GetPermissionReq struct {
	Action  string   `form:"action"`
	Actions []string `validate:"omitempty" form:"actions"`
}

GetPermissionReq get permission request

func (*GetPermissionReq) Check

func (r *GetPermissionReq) Check() (errField []*validator.FormErrorField, err error)

type GetPermissionResp

type GetPermissionResp struct {
	HasPermission bool `json:"has_permission"`
	// only not allow, will return this tip
	NoPermissionTip string `json:"no_permission_tip"`
}

GetPermissionResp get permission response

func (*GetPermissionResp) TrTip

func (r *GetPermissionResp) TrTip(lang i18n.Language, requireRank int)

type GetPluginConfigReq

type GetPluginConfigReq struct {
	PluginSlugName string `validate:"required,gt=1,lte=100" form:"plugin_slug_name"`
}

type GetPluginConfigResp

type GetPluginConfigResp struct {
	Name         string        `json:"name"`
	SlugName     string        `json:"slug_name"`
	Description  string        `json:"description"`
	Version      string        `json:"version"`
	ConfigFields []ConfigField `json:"config_fields"`
}

func (*GetPluginConfigResp) SetConfigFields

func (g *GetPluginConfigResp) SetConfigFields(ctx *gin.Context, fields []plugin.ConfigField)

type GetPluginListReq

type GetPluginListReq struct {
	Status     PluginStatus `form:"status"`
	HaveConfig bool         `form:"have_config"`
}

type GetPluginListResp

type GetPluginListResp struct {
	Name        string `json:"name"`
	SlugName    string `json:"slug_name"`
	Description string `json:"description"`
	Version     string `json:"version"`
	Enabled     bool   `json:"enabled"`
	HaveConfig  bool   `json:"have_config"`
	Link        string `json:"link"`
}

type GetPrivilegesConfigResp

type GetPrivilegesConfigResp struct {
	Options       []*PrivilegeOption `json:"options"`
	SelectedLevel PrivilegeLevel     `json:"selected_level"`
}

GetPrivilegesConfigResp get privileges config response

type GetRankPersonalPageResp

type GetRankPersonalPageResp struct {
	// create time
	CreatedAt int64 `json:"created_at"`
	// object id
	ObjectID string `json:"object_id"`
	// question id
	QuestionID string `json:"question_id"`
	// answer id
	AnswerID string `json:"answer_id"`
	// object type
	ObjectType string `json:"object_type" enums:"question,answer,tag,comment"`
	// title
	Title string `json:"title"`
	// url title
	UrlTitle string `json:"url_title"`
	// content
	Content string `json:"content"`
	// reputation
	Reputation int `json:"reputation"`
	// rank type
	RankType string `json:"rank_type"`
}

GetRankPersonalPageResp rank response

type GetRankPersonalWithPageReq

type GetRankPersonalWithPageReq struct {
	// page
	Page int `validate:"omitempty,min=1" form:"page"`
	// page size
	PageSize int `validate:"omitempty,min=1" form:"page_size"`
	// username
	Username string `validate:"omitempty,gt=0,lte=100" form:"username"`
	// user id
	UserID string `json:"-"`
}

GetRankPersonalWithPageReq get rank list page request

type GetReactionByObjectIdResp added in v1.3.5

type GetReactionByObjectIdResp struct {
	ReactionSummary []*ReactionRespItem `json:"reaction_summary"`
}

GetReactionByObjectIdResp get reaction by object id response

type GetReactionReq added in v1.3.5

type GetReactionReq struct {
	ObjectID string `validate:"required" form:"object_id"`
	UserID   string `json:"-"`
}

type GetRedDot

type GetRedDot struct {
	CanReviewQuestion bool   `json:"-"`
	CanReviewAnswer   bool   `json:"-"`
	CanReviewTag      bool   `json:"-"`
	UserID            string `json:"-"`
	IsAdmin           bool   `json:"-"`
}

type GetReportListPageDTO

type GetReportListPageDTO struct {
	Page     int
	PageSize int
	Status   int
}

GetReportListPageDTO report list data transfer object

type GetReportListPageResp

type GetReportListPageResp struct {
	FlagID           string        `json:"flag_id"`
	CreatedAt        int64         `json:"created_at"`
	ObjectID         string        `json:"object_id"`
	QuestionID       string        `json:"question_id"`
	AnswerID         string        `json:"answer_id"`
	CommentID        string        `json:"comment_id"`
	ObjectType       string        `json:"object_type" enums:"question,answer,comment"`
	Title            string        `json:"title"`
	UrlTitle         string        `json:"url_title"`
	OriginalText     string        `json:"original_text"`
	ParsedText       string        `json:"parsed_text"`
	AnswerCount      int           `json:"answer_count"`
	AnswerAccepted   bool          `json:"answer_accepted"`
	Tags             []*TagResp    `json:"tags"`
	ObjectStatus     int           `json:"object_status"`
	ObjectShowStatus int           `json:"object_show_status"`
	AuthorUserInfo   UserBasicInfo `json:"author_user_info"`
	SubmitAt         int64         `json:"submit_at"`
	SubmitterUser    UserBasicInfo `json:"submitter_user"`
	Reason           *ReasonItem   `json:"reason"`
	ReasonContent    string        `json:"reason_content"`
}

GetReportListPageResp get report list

type GetReportListReq

type GetReportListReq struct {
	// report source
	Source string `validate:"required,oneof=question answer comment" form:"source"`
}

GetReportListReq get report list all request

type GetReportTypeResp

type GetReportTypeResp struct {
	// report name
	Name string `json:"name"`
	// report description
	Description string `json:"description"`
	// report source
	Source string `json:"source"`
	// report type
	Type int `json:"type"`
	// is have content
	HaveContent bool `json:"have_content"`
	// content type
	ContentType string `json:"content_type"`
}

GetReportTypeResp get report response

type GetReviewingTypeReq added in v1.3.0

type GetReviewingTypeReq struct {
	CanReviewQuestion bool   `json:"-"`
	CanReviewAnswer   bool   `json:"-"`
	CanReviewTag      bool   `json:"-"`
	IsAdmin           bool   `json:"-"`
	UserID            string `json:"-"`
}

GetReviewingTypeReq get reviewing type request

func (*GetReviewingTypeReq) GetCanReviewObjectTypes added in v1.3.0

func (r *GetReviewingTypeReq) GetCanReviewObjectTypes() []int

type GetReviewingTypeResp added in v1.3.0

type GetReviewingTypeResp struct {
	Name       string `json:"name"`
	Label      string `json:"label"`
	TodoAmount int64  `json:"todo_amount"`
}

GetReviewingTypeResp get reviewing type response

type GetRevisionListReq

type GetRevisionListReq struct {
	// object id
	ObjectID string `validate:"required" comment:"object_id" form:"object_id"`
}

GetRevisionListReq get revision list all request

type GetRevisionResp

type GetRevisionResp struct {
	ID              string        `json:"id"`
	UserID          string        `json:"use_id"`
	ObjectID        string        `json:"object_id"`
	ObjectType      int           `json:"-"`
	Title           string        `json:"title"`
	UrlTitle        string        `json:"url_title"`
	Content         string        `json:"-"`
	ContentParsed   interface{}   `json:"content"`
	Status          int           `json:"status"`
	CreatedAt       time.Time     `json:"-"`
	CreatedAtParsed int64         `json:"create_at"`
	UserInfo        UserBasicInfo `json:"user_info"`
	Log             string        `json:"reason"`
}

GetRevisionResp get revision response

type GetRoleResp

type GetRoleResp struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

GetRoleResp get role response

type GetSMTPConfigResp

type GetSMTPConfigResp struct {
	FromEmail          string `json:"from_email"`
	FromName           string `json:"from_name"`
	SMTPHost           string `json:"smtp_host"`
	SMTPPort           int    `json:"smtp_port"`
	Encryption         string `json:"encryption"` // "" SSL TLS
	SMTPUsername       string `json:"smtp_username"`
	SMTPPassword       string `json:"smtp_password"`
	SMTPAuthentication bool   `json:"smtp_authentication"`
}

GetSMTPConfigResp get smtp config response

type GetSiteLegalInfoReq

type GetSiteLegalInfoReq struct {
	InfoType string `validate:"required,oneof=tos privacy" form:"info_type"`
}

GetSiteLegalInfoReq site site legal request

func (*GetSiteLegalInfoReq) IsPrivacy

func (r *GetSiteLegalInfoReq) IsPrivacy() bool

func (*GetSiteLegalInfoReq) IsTOS

func (r *GetSiteLegalInfoReq) IsTOS() bool

type GetSiteLegalInfoResp

type GetSiteLegalInfoResp struct {
	TermsOfServiceOriginalText string `json:"terms_of_service_original_text,omitempty"`
	TermsOfServiceParsedText   string `json:"terms_of_service_parsed_text,omitempty"`
	PrivacyPolicyOriginalText  string `json:"privacy_policy_original_text,omitempty"`
	PrivacyPolicyParsedText    string `json:"privacy_policy_parsed_text,omitempty"`
}

GetSiteLegalInfoResp get site legal info response

type GetTagBasicResp added in v1.3.6

type GetTagBasicResp struct {
	SlugName    string `json:"slug_name"`
	DisplayName string `json:"display_name"`
	Recommend   bool   `json:"recommend"`
	Reserved    bool   `json:"reserved"`
}

GetTagBasicResp get tag basic response

type GetTagInfoReq

type GetTagInfoReq struct {
	// tag id
	ID string `validate:"omitempty" form:"id"`
	// tag slug name
	Name       string `validate:"omitempty,gt=0,lte=35" form:"name"`
	UserID     string `json:"-"`
	CanEdit    bool   `json:"-"`
	CanDelete  bool   `json:"-"`
	CanRecover bool   `json:"-"`
}

GetTagInfoReq get tag info request

func (*GetTagInfoReq) Check

func (r *GetTagInfoReq) Check() (errFields []*validator.FormErrorField, err error)

type GetTagListListReq

type GetTagListListReq struct {
	// tag_id
	TagID int64 `validate:"omitempty" comment:"tag_id" form:"tag_id"`
	// object_id
	ObjectID int64 `validate:"omitempty" comment:"object_id" form:"object_id"`
	// tag_list_status(available: 1; deleted: 10)
	Status int `validate:"omitempty" comment:"tag_list_status(available: 1; deleted: 10)" form:"status"`
}

GetTagListListReq get tag list list all request

type GetTagListResp

type GetTagListResp struct {
	// tag_list_id
	ID int64 `json:"id"`
	// tag_id
	TagID int64 `json:"tag_id"`
	// object_id
	ObjectID int64 `json:"object_id"`
	// tag_list_status(available: 1; deleted: 10)
	Status int `json:"status"`
}

GetTagListResp get tag list response

type GetTagListWithPageReq

type GetTagListWithPageReq struct {
	// page
	Page int `validate:"omitempty,min=1" form:"page"`
	// page size
	PageSize int `validate:"omitempty,min=1" form:"page_size"`
	// tag_id
	TagID int64 `validate:"omitempty" comment:"tag_id" form:"tag_id"`
	// object_id
	ObjectID int64 `validate:"omitempty" comment:"object_id" form:"object_id"`
	// tag_list_status(available: 1; deleted: 10)
	Status int `validate:"omitempty" comment:"tag_list_status(available: 1; deleted: 10)" form:"status"`
}

GetTagListWithPageReq get tag list list page request

type GetTagPageResp

type GetTagPageResp struct {
	// tag_id
	TagID string `json:"tag_id"`
	// slug_name
	SlugName string `json:"slug_name"`
	// display_name
	DisplayName string `json:"display_name"`
	// excerpt
	Excerpt string `json:"excerpt"`
	//description
	Description string `json:"description"`
	// original text
	OriginalText string `json:"original_text"`
	// parsed_text
	ParsedText string `json:"parsed_text"`
	// follower amount
	FollowCount int `json:"follow_count"`
	// question amount
	QuestionCount int `json:"question_count"`
	// is follower
	IsFollower bool `json:"is_follower"`
	// created time
	CreatedAt int64 `json:"created_at"`
	// updated time
	UpdatedAt int64 `json:"updated_at"`
	Recommend bool  `json:"recommend"`
	Reserved  bool  `json:"reserved"`
}

GetTagPageResp get tag response

func (*GetTagPageResp) GetExcerpt

func (tr *GetTagPageResp) GetExcerpt()

type GetTagResp

type GetTagResp struct {
	TagID         string                    `json:"tag_id"`
	CreatedAt     int64                     `json:"created_at"`
	UpdatedAt     int64                     `json:"updated_at"`
	SlugName      string                    `json:"slug_name"`
	DisplayName   string                    `json:"display_name"`
	Excerpt       string                    `json:"excerpt"`
	OriginalText  string                    `json:"original_text"`
	ParsedText    string                    `json:"parsed_text"`
	Description   string                    `json:"description"`
	FollowCount   int                       `json:"follow_count"`
	QuestionCount int                       `json:"question_count"`
	IsFollower    bool                      `json:"is_follower"`
	Status        string                    `json:"status"`
	MemberActions []*PermissionMemberAction `json:"member_actions"`
	// if main tag slug name is not empty, this tag is synonymous with the main tag
	MainTagSlugName string `json:"main_tag_slug_name"`
	Recommend       bool   `json:"recommend"`
	Reserved        bool   `json:"reserved"`
}

GetTagResp get tag response

func (*GetTagResp) GetExcerpt

func (tr *GetTagResp) GetExcerpt()

type GetTagSynonymsReq

type GetTagSynonymsReq struct {
	// tag_id
	TagID string `validate:"required" form:"tag_id"`
	// user id
	UserID string `json:"-"`
	// whether user can edit it
	CanEdit bool `json:"-"`
}

GetTagSynonymsReq get tag synonyms request

type GetTagSynonymsResp

type GetTagSynonymsResp struct {
	// synonyms
	Synonyms []*TagSynonym `json:"synonyms"`
	// MemberActions
	MemberActions []*PermissionMemberAction `json:"member_actions"`
}

GetTagSynonymsResp get tag synonyms response

type GetTagWithPageReq

type GetTagWithPageReq struct {
	// page
	Page int `validate:"omitempty,min=1" form:"page"`
	// page size
	PageSize int `validate:"omitempty,min=1" form:"page_size"`
	// slug_name
	SlugName string `validate:"omitempty,gt=0,lte=35" form:"slug_name"`
	// display_name
	DisplayName string `validate:"omitempty,gt=0,lte=35" form:"display_name"`
	// query condition
	QueryCond string `validate:"omitempty,oneof=popular name newest" form:"query_cond"`
	// user id
	UserID string `json:"-"`
}

GetTagWithPageReq get tag list page request

type GetTamplateTagInfoReq

type GetTamplateTagInfoReq struct {
	// tag id
	ID string `validate:"omitempty" form:"id"`
	// tag slug name
	Name string `validate:"omitempty" form:"name"`
	// user id
	UserID   string `json:"-"`
	Page     int    `validate:"omitempty,min=1" form:"page"`
	PageSize int    `validate:"omitempty,min=1" form:"page_size"`
}

type GetUnreviewedPostPageReq added in v1.3.0

type GetUnreviewedPostPageReq struct {
	ObjectID        string            `validate:"omitempty" form:"object_id"`
	Page            int               `validate:"omitempty" form:"page"`
	ReviewerMapping map[string]string `json:"-"`
	UserID          string            `json:"-"`
	IsAdmin         bool              `json:"-"`
}

GetUnreviewedPostPageReq get review page request

func (*GetUnreviewedPostPageReq) Check added in v1.3.0

func (r *GetUnreviewedPostPageReq) Check() (errField []*validator.FormErrorField, err error)

type GetUnreviewedPostPageResp added in v1.3.0

type GetUnreviewedPostPageResp struct {
	ReviewID             int           `json:"review_id"`
	CreatedAt            int64         `json:"created_at"`
	ObjectID             string        `json:"object_id"`
	QuestionID           string        `json:"question_id"`
	AnswerID             string        `json:"answer_id"`
	CommentID            string        `json:"comment_id"`
	ObjectType           string        `json:"object_type" enums:"question,answer,comment"`
	Title                string        `json:"title"`
	UrlTitle             string        `json:"url_title"`
	OriginalText         string        `json:"original_text"`
	ParsedText           string        `json:"parsed_text"`
	Tags                 []*TagResp    `json:"tags"`
	ObjectStatus         int           `json:"object_status"`
	ObjectShowStatus     int           `json:"object_show_status"`
	AuthorUserInfo       UserBasicInfo `json:"author_user_info"`
	SubmitAt             int64         `json:"submit_at"`
	SubmitterDisplayName string        `json:"submitter_display_name"`
	Reason               string        `json:"reason"`
}

GetUnreviewedPostPageResp get review page response

type GetUnreviewedReportPostPageReq added in v1.3.0

type GetUnreviewedReportPostPageReq struct {
	Page    int    `json:"page" form:"page"`
	UserID  string `json:"-"`
	IsAdmin bool   `json:"-"`
}

GetUnreviewedReportPostPageReq get unreviewed report post page request

type GetUnreviewedRevisionResp

type GetUnreviewedRevisionResp struct {
	Type           string                      `json:"type"`
	Info           *UnreviewedRevisionInfoInfo `json:"info"`
	UnreviewedInfo *GetRevisionResp            `json:"unreviewed_info"`
}

type GetUserActivationReq

type GetUserActivationReq struct {
	UserID string `validate:"required" form:"user_id"`
}

GetUserActivationReq get user activation

type GetUserActivationResp

type GetUserActivationResp struct {
	ActivationURL string `json:"activation_url"`
}

GetUserActivationResp get user activation

type GetUserBadgeAwardListReq added in v1.4.0

type GetUserBadgeAwardListReq struct {
	// username
	Username string `validate:"required,gt=0,lte=100" form:"username"`
	// user id
	UserID string `json:"-"`
	Limit  int    `json:"-"`
}

type GetUserBadgeAwardListResp added in v1.4.0

type GetUserBadgeAwardListResp struct {
	// badge id
	ID string `json:"id" `
	// badge name
	Name string `json:"name" `
	// badge icon
	Icon string `json:"icon" `
	// badge award count
	EarnedCount int64 `json:"earned_count" `
	// badge level
	Level entity.BadgeLevel `json:"level" `
}

type GetUserInfoReq

type GetUserInfoReq struct {
	UserID string `validate:"required" json:"user_id"`
}

GetUserInfoReq get user request

type GetUserInfoResp

type GetUserInfoResp struct {
}

GetUserInfoResp get user response

type GetUserNotificationConfigResp

type GetUserNotificationConfigResp struct {
	NotificationConfig
}

GetUserNotificationConfigResp get user notification config response

type GetUserPageReq

type GetUserPageReq struct {
	// page
	Page int `validate:"omitempty,min=1" form:"page"`
	// page size
	PageSize int `validate:"omitempty,min=1" form:"page_size"`
	// email
	Query string `validate:"omitempty,gt=0,lte=100" form:"query"`
	// user status
	Status string `validate:"omitempty,oneof=normal suspended deleted inactive" form:"status"`
	// staff, if staff is true means query admin or moderator
	Staff bool `validate:"omitempty" form:"staff"`
}

GetUserPageReq get user list page request

func (*GetUserPageReq) IsDeleted

func (r *GetUserPageReq) IsDeleted() bool

func (*GetUserPageReq) IsInactive

func (r *GetUserPageReq) IsInactive() bool

func (*GetUserPageReq) IsSuspended

func (r *GetUserPageReq) IsSuspended() bool

type GetUserPageResp

type GetUserPageResp struct {
	// user id
	UserID string `json:"user_id"`
	// create time
	CreatedAt int64 `json:"created_at"`
	// delete time
	DeletedAt int64 `json:"deleted_at"`
	// suspended time
	SuspendedAt int64 `json:"suspended_at"`
	// username
	Username string `json:"username"`
	// email
	EMail string `json:"e_mail"`
	// rank
	Rank int `json:"rank"`
	// user status(normal,suspended,deleted,inactive)
	Status string `json:"status"`
	// display name
	DisplayName string `json:"display_name"`
	// avatar
	Avatar string `json:"avatar"`
	// role id
	RoleID int `json:"role_id"`
	// role name
	RoleName string `json:"role_name"`
}

GetUserPageResp get user response

type GetUserPluginConfigReq added in v1.2.5

type GetUserPluginConfigReq struct {
	PluginSlugName string `validate:"required,gt=1,lte=100" form:"plugin_slug_name"`
	UserID         string `json:"-"`
}

type GetUserPluginConfigResp added in v1.2.5

type GetUserPluginConfigResp struct {
	Name         string         `json:"name"`
	SlugName     string         `json:"slug_name"`
	ConfigFields []*ConfigField `json:"config_fields"`
}

func (*GetUserPluginConfigResp) SetConfigFields added in v1.2.5

func (g *GetUserPluginConfigResp) SetConfigFields(ctx *gin.Context, fields []plugin.ConfigField)

type GetUserPluginListResp added in v1.2.5

type GetUserPluginListResp struct {
	Name     string `json:"name"`
	SlugName string `json:"slug_name"`
}

type GetUserStaffReq added in v1.3.1

type GetUserStaffReq struct {
	Username string `validate:"omitempty,gt=0,lte=500" form:"username"`
	PageSize int    `validate:"omitempty,min=1" form:"page_size"`
}

GetUserStaffReq get user staff request

type GetUserStaffResp added in v1.3.1

type GetUserStaffResp struct {
	// username
	Username string `json:"username"`
	// display name
	DisplayName string `json:"display_name"`
	// avatar
	Avatar string `json:"avatar"`
}

GetUserStaffResp get user staff response

type GetVoteWithPageReq

type GetVoteWithPageReq struct {
	// page
	Page int `validate:"omitempty,min=1" form:"page"`
	// page size
	PageSize int `validate:"omitempty,min=1" form:"page_size"`
	// user id
	UserID string `json:"-"`
}

type GetVoteWithPageResp

type GetVoteWithPageResp struct {
	// create time
	CreatedAt int64 `json:"created_at"`
	// object id
	ObjectID string `json:"object_id"`
	// question id
	QuestionID string `json:"question_id"`
	// answer id
	AnswerID string `json:"answer_id"`
	// object type
	ObjectType string `json:"object_type" enums:"question,answer,tag,comment"`
	// title
	Title string `json:"title"`
	// url title
	UrlTitle string `json:"url_title"`
	// content
	Content string `json:"content"`
	// vote type
	VoteType string `json:"vote_type"`
}

type LoadingAction

type LoadingAction struct {
	Text  string `json:"text"`
	State string `json:"state"`
}

type NewAnswerTemplateData

type NewAnswerTemplateData struct {
	SiteName       string
	DisplayName    string
	QuestionTitle  string
	AnswerUrl      string
	AnswerSummary  string
	UnsubscribeUrl string
}

type NewAnswerTemplateRawData

type NewAnswerTemplateRawData struct {
	AnswerUserDisplayName string
	QuestionTitle         string
	QuestionID            string
	AnswerID              string
	AnswerSummary         string
	UnsubscribeCode       string
}

type NewCommentTemplateData

type NewCommentTemplateData struct {
	SiteName       string
	DisplayName    string
	QuestionTitle  string
	CommentUrl     string
	CommentSummary string
	UnsubscribeUrl string
}

type NewCommentTemplateRawData

type NewCommentTemplateRawData struct {
	CommentUserDisplayName string
	QuestionTitle          string
	QuestionID             string
	AnswerID               string
	CommentID              string
	CommentSummary         string
	UnsubscribeCode        string
}

type NewInviteAnswerTemplateData

type NewInviteAnswerTemplateData struct {
	SiteName       string
	DisplayName    string
	QuestionTitle  string
	InviteUrl      string
	UnsubscribeUrl string
}

type NewInviteAnswerTemplateRawData

type NewInviteAnswerTemplateRawData struct {
	InviterDisplayName string
	QuestionTitle      string
	QuestionID         string
	UnsubscribeCode    string
}

type NewQuestionTemplateData

type NewQuestionTemplateData struct {
	SiteName       string
	QuestionTitle  string
	QuestionUrl    string
	Tags           string
	UnsubscribeUrl string
}

type NewQuestionTemplateRawData

type NewQuestionTemplateRawData struct {
	QuestionAuthorUserID string
	QuestionTitle        string
	QuestionID           string
	UnsubscribeCode      string
	Tags                 []string
	TagIDs               []string
}

type NotificationChannelConfig

type NotificationChannelConfig struct {
	Key    constant.NotificationChannelKey `json:"key"`
	Enable bool                            `json:"enable"`
}

func NewNotificationChannelConfigFormJson added in v1.2.5

func NewNotificationChannelConfigFormJson(jsonStr string) NotificationChannelConfig

type NotificationChannels

type NotificationChannels []*NotificationChannelConfig

func NewNotificationChannelsFormJson

func NewNotificationChannelsFormJson(jsonStr string) NotificationChannels

func (*NotificationChannels) ToJsonString

func (n *NotificationChannels) ToJsonString() string

type NotificationClearIDRequest

type NotificationClearIDRequest struct {
	UserID string `json:"-"`
	ID     string `json:"id" form:"id"`
}

type NotificationClearRequest

type NotificationClearRequest struct {
	NotificationType  string `validate:"required,oneof=inbox achievement" json:"type"`
	UserID            string `json:"-"`
	CanReviewQuestion bool   `json:"-"`
	CanReviewAnswer   bool   `json:"-"`
	CanReviewTag      bool   `json:"-"`
}

type NotificationConfig

type NotificationConfig struct {
	Inbox                          NotificationChannelConfig `json:"inbox"`
	AllNewQuestion                 NotificationChannelConfig `json:"all_new_question"`
	AllNewQuestionForFollowingTags NotificationChannelConfig `json:"all_new_question_for_following_tags"`
}

func NewNotificationConfig

func NewNotificationConfig(configs []*entity.UserNotificationConfig) NotificationConfig

func (*NotificationConfig) Format

func (n *NotificationConfig) Format()

type NotificationContent

type NotificationContent struct {
	ID                 string         `json:"id"`
	TriggerUserID      string         `json:"-"` //show userid
	ReceiverUserID     string         `json:"-"` // receiver userid
	UserInfo           *UserBasicInfo `json:"user_info,omitempty"`
	ObjectInfo         ObjectInfo     `json:"object_info"`
	Rank               int            `json:"rank"`
	NotificationAction string         `json:"notification_action,omitempty"`
	Type               int            `json:"-"` //	1 inbox 2 achievement
	IsRead             bool           `json:"is_read"`
	UpdateTime         int64          `json:"update_time"`
}

type NotificationMsg

type NotificationMsg struct {
	// trigger notification user id
	TriggerUserID string
	// receive notification user id
	ReceiverUserID string
	// type 1 inbox 2 achievement
	Type int
	// notification title
	Title string
	// notification object
	ObjectID string
	// notification object type
	ObjectType string
	// notification action
	NotificationAction string
	// if true no need to send notification to all followers
	NoNeedPushAllFollow bool
	// extra info
	ExtraInfo map[string]string
}

NotificationMsg notification message

type NotificationSearch

type NotificationSearch struct {
	Page         int    `json:"page" form:"page"`           //Query number of pages
	PageSize     int    `json:"page_size" form:"page_size"` //Search page size
	Type         int    `json:"-" form:"-"`
	TypeStr      string `json:"type" form:"type"`             // inbox achievement
	InboxTypeStr string `json:"inbox_type" form:"inbox_type"` // inbox achievement
	InboxType    int    `json:"-" form:"-"`                   // inbox achievement
	UserID       string `json:"-"`
}

type ObjectInfo

type ObjectInfo struct {
	Title      string            `json:"title"`
	ObjectID   string            `json:"object_id"`
	ObjectMap  map[string]string `json:"object_map"`
	ObjectType string            `json:"object_type"`
}

type ObjectTimelineDetail

type ObjectTimelineDetail struct {
	Title           string               `json:"title"`
	Tags            []*ObjectTimelineTag `json:"tags"`
	OriginalText    string               `json:"original_text"`
	SlugName        string               `json:"slug_name"`
	MainTagSlugName string               `json:"main_tag_slug_name"`
}

ObjectTimelineDetail object timeline detail

type ObjectTimelineTag

type ObjectTimelineTag struct {
	SlugName        string `json:"slug_name"`
	DisplayName     string `json:"display_name"`
	MainTagSlugName string `json:"main_tag_slug_name"`
	Recommend       bool   `json:"recommend"`
	Reserved        bool   `json:"reserved"`
}

ObjectTimelineTag object timeline tags

type OnCompleteAction

type OnCompleteAction struct {
	ToastReturnMessage bool `json:"toast_return_message"`
	RefreshFormConfig  bool `json:"refresh_form_config"`
}

type Operation

type Operation struct {
	Type        string         `json:"type"`
	Description string         `json:"description"`
	Msg         string         `json:"msg"`
	Time        int64          `json:"time"`
	Level       OperationLevel `json:"level"`
}

type OperationLevel

type OperationLevel string
const (
	OperationLevelInfo      OperationLevel = "info"
	OperationLevelDanger    OperationLevel = "danger"
	OperationLevelWarning   OperationLevel = "warning"
	OperationLevelSecondary OperationLevel = "secondary"
)

type OperationQuestionReq

type OperationQuestionReq struct {
	ID        string `validate:"required" json:"id"`
	Operation string `json:"operation"` // operation [pin unpin hide show]
	UserID    string `json:"-"`         // user_id
	CanPin    bool   `json:"-"`
	CanList   bool   `json:"-"`
}

type Paginator

type Paginator struct {
	Pages      []int
	Totalpages int
	Prevpage   int
	Nextpage   int
	Currpage   int
}

type PassResetTemplateData

type PassResetTemplateData struct {
	SiteName     string
	PassResetUrl string
}

type PassReviewActivity added in v1.3.0

type PassReviewActivity struct {
	UserID           string `json:"user_id"`
	TriggerUserID    string `json:"trigger_user_id"`
	ObjectID         string `json:"object_id"`
	OriginalObjectID string `json:"original_object_id"`
	RevisionID       string `json:"revision_id"`
}

PassReviewActivity pass review activity

type PermissionMemberAction

type PermissionMemberAction struct {
	Action string `json:"action"`
	Name   string `json:"name"`
	Type   string `json:"type"`
}

PermissionMemberAction permission member action

type PermissionTrTplData

type PermissionTrTplData struct {
	Rank int
}

PermissionTrTplData template data as for translate permission message

type PersonalAnswerPageReq

type PersonalAnswerPageReq struct {
	Page        int    `validate:"omitempty,min=1" form:"page"`
	PageSize    int    `validate:"omitempty,min=1" form:"page_size"`
	OrderCond   string `validate:"omitempty,oneof=newest active hot score unanswered" form:"order"`
	Username    string `validate:"omitempty,gt=0,lte=100" form:"username"`
	LoginUserID string `json:"-"`
	IsAdmin     bool   `json:"-"`
}

type PersonalBranding

type PersonalBranding struct {
	Icon  string `json:"icon"`
	Name  string `json:"name"`
	Label string `json:"label"`
	Url   string `json:"url"`
}

type PersonalCollectionPageReq

type PersonalCollectionPageReq struct {
	Page     int    `validate:"omitempty,min=1" form:"page"`
	PageSize int    `validate:"omitempty,min=1" form:"page_size"`
	UserID   string `json:"-"`
}

type PersonalQuestionPageReq

type PersonalQuestionPageReq struct {
	Page        int    `validate:"omitempty,min=1" form:"page"`
	PageSize    int    `validate:"omitempty,min=1" form:"page_size"`
	OrderCond   string `validate:"omitempty,oneof=newest active hot score unanswered" form:"order"`
	Username    string `validate:"omitempty,gt=0,lte=100" form:"username"`
	LoginUserID string `json:"-"`
	IsAdmin     bool   `json:"-"`
}

type PluginStatus

type PluginStatus string
const (
	PluginStatusActive   PluginStatus = "active"
	PluginStatusInactive PluginStatus = "inactive"
)

type PostRenderReq

type PostRenderReq struct {
	Content string `json:"content"`
}

PostRenderReq post render request

type PrivilegeLevel

type PrivilegeLevel int
const (
	// PrivilegeLevel1 low
	PrivilegeLevel1 PrivilegeLevel = 1
	// PrivilegeLevel2 medium
	PrivilegeLevel2 PrivilegeLevel = 2
	// PrivilegeLevel3 high
	PrivilegeLevel3 PrivilegeLevel = 3
	// PrivilegeLevelCustom custom
	PrivilegeLevelCustom PrivilegeLevel = 99
)

type PrivilegeOption

type PrivilegeOption struct {
	Level      PrivilegeLevel        `json:"level"`
	LevelDesc  string                `json:"level_desc"`
	Privileges []*constant.Privilege `validate:"dive" json:"privileges"`
}

PrivilegeOption privilege option

type PrivilegeOptions

type PrivilegeOptions []*PrivilegeOption

func (PrivilegeOptions) Choose

func (p PrivilegeOptions) Choose(level PrivilegeLevel) (option *PrivilegeOption)

type QAPageJsonLD

type QAPageJsonLD struct {
	Context    string `json:"@context"`
	Type       string `json:"@type"`
	MainEntity struct {
		Type        string    `json:"@type"`
		Name        string    `json:"name"`
		Text        string    `json:"text"`
		AnswerCount int       `json:"answerCount"`
		UpvoteCount int       `json:"upvoteCount"`
		DateCreated time.Time `json:"dateCreated"`
		Author      struct {
			URL  string `json:"url"`
			Type string `json:"@type"`
			Name string `json:"name"`
		} `json:"author"`
		AcceptedAnswer  *AcceptedAnswerItem    `json:"acceptedAnswer,omitempty"`
		SuggestedAnswer []*SuggestedAnswerItem `json:"suggestedAnswer"`
	} `json:"mainEntity"`
}

type QuestionAdd

type QuestionAdd struct {
	// question title
	Title string `validate:"required,notblank,gte=6,lte=150" json:"title"`
	// content
	Content string `validate:"required,notblank,gte=6,lte=65535" json:"content"`
	// html
	HTML string `json:"-"`
	// tags
	Tags []*TagItem `validate:"required,dive" json:"tags"`
	// user id
	UserID string `json:"-"`
	QuestionPermission
	CaptchaID   string `json:"captcha_id"` // captcha_id
	CaptchaCode string `json:"captcha_code"`
	IP          string `json:"-"`
	UserAgent   string `json:"-"`
}

func (*QuestionAdd) Check

func (req *QuestionAdd) Check() (errFields []*validator.FormErrorField, err error)

type QuestionAddByAnswer

type QuestionAddByAnswer struct {
	// question title
	Title string `validate:"required,notblank,gte=6,lte=150" json:"title"`
	// content
	Content string `validate:"required,notblank,gte=6,lte=65535" json:"content"`
	// html
	HTML          string `json:"-"`
	AnswerContent string `validate:"required,notblank,gte=6,lte=65535" json:"answer_content"`
	AnswerHTML    string `json:"-"`
	// tags
	Tags []*TagItem `validate:"required,dive" json:"tags"`
	// user id
	UserID              string   `json:"-"`
	MentionUsernameList []string `validate:"omitempty" json:"mention_username_list"`
	QuestionPermission
	CaptchaID   string `json:"captcha_id"` // captcha_id
	CaptchaCode string `json:"captcha_code"`
	IP          string `json:"-"`
	UserAgent   string `json:"-"`
}

func (*QuestionAddByAnswer) Check

func (req *QuestionAddByAnswer) Check() (errFields []*validator.FormErrorField, err error)

type QuestionBaseInfo

type QuestionBaseInfo struct {
	ID              string `json:"id" `
	Title           string `json:"title"`
	UrlTitle        string `json:"url_title"`
	ViewCount       int    `json:"view_count"`
	AnswerCount     int    `json:"answer_count"`
	CollectionCount int    `json:"collection_count"`
	FollowCount     int    `json:"follow_count"`
	Status          string `json:"status"`
	AcceptedAnswer  bool   `json:"accepted_answer"`
}

type QuestionInfoResp added in v1.3.0

type QuestionInfoResp struct {
	ID                   string         `json:"id" `
	Title                string         `json:"title"`
	UrlTitle             string         `json:"url_title"`
	Content              string         `json:"content"`
	HTML                 string         `json:"html"`
	Description          string         `json:"description"`
	Tags                 []*TagResp     `json:"tags"`
	ViewCount            int            `json:"view_count"`
	UniqueViewCount      int            `json:"unique_view_count"`
	VoteCount            int            `json:"vote_count"`
	AnswerCount          int            `json:"answer_count"`
	CollectionCount      int            `json:"collection_count"`
	FollowCount          int            `json:"follow_count"`
	AcceptedAnswerID     string         `json:"accepted_answer_id"`
	LastAnswerID         string         `json:"last_answer_id"`
	CreateTime           int64          `json:"create_time"`
	UpdateTime           int64          `json:"-"`
	PostUpdateTime       int64          `json:"update_time"`
	QuestionUpdateTime   int64          `json:"edit_time"`
	Pin                  int            `json:"pin"`
	Show                 int            `json:"show"`
	Status               int            `json:"status"`
	Operation            *Operation     `json:"operation,omitempty"`
	UserID               string         `json:"-"`
	LastEditUserID       string         `json:"-"`
	LastAnsweredUserID   string         `json:"-"`
	UserInfo             *UserBasicInfo `json:"user_info"`
	UpdateUserInfo       *UserBasicInfo `json:"update_user_info,omitempty"`
	LastAnsweredUserInfo *UserBasicInfo `json:"last_answered_user_info,omitempty"`
	Answered             bool           `json:"answered"`
	FirstAnswerId        string         `json:"first_answer_id"`
	Collected            bool           `json:"collected"`
	VoteStatus           string         `json:"vote_status"`
	IsFollowed           bool           `json:"is_followed"`

	// MemberActions
	MemberActions  []*PermissionMemberAction `json:"member_actions"`
	ExtendsActions []*PermissionMemberAction `json:"extends_actions"`
}

type QuestionPageReq

type QuestionPageReq struct {
	Page      int    `validate:"omitempty,min=1" form:"page"`
	PageSize  int    `validate:"omitempty,min=1" form:"page_size"`
	OrderCond string `validate:"omitempty,oneof=newest active hot score unanswered recommend" form:"order"`
	Tag       string `validate:"omitempty,gt=0,lte=100" form:"tag"`
	Username  string `validate:"omitempty,gt=0,lte=100" form:"username"`
	InDays    int    `validate:"omitempty,min=1" form:"in_days"`

	LoginUserID      string `json:"-"`
	UserIDBeSearched string `json:"-"`
	TagID            string `json:"-"`
	ShowPending      bool   `json:"-"`
}

QuestionPageReq query questions page

type QuestionPageResp

type QuestionPageResp struct {
	ID          string     `json:"id" `
	CreatedAt   int64      `json:"created_at"`
	Title       string     `json:"title"`
	UrlTitle    string     `json:"url_title"`
	Description string     `json:"description"`
	Pin         int        `json:"pin"`  // 1: unpin, 2: pin
	Show        int        `json:"show"` // 0: show, 1: hide
	Status      int        `json:"status"`
	Tags        []*TagResp `json:"tags"`

	// question statistical information
	ViewCount       int `json:"view_count"`
	UniqueViewCount int `json:"unique_view_count"`
	VoteCount       int `json:"vote_count"`
	AnswerCount     int `json:"answer_count"`
	CollectionCount int `json:"collection_count"`
	FollowCount     int `json:"follow_count"`

	// answer information
	AcceptedAnswerID   string    `json:"accepted_answer_id"`
	LastAnswerID       string    `json:"last_answer_id"`
	LastAnsweredUserID string    `json:"-"`
	LastAnsweredAt     time.Time `json:"-"`

	// operator information
	OperatedAt    int64                     `json:"operated_at"`
	Operator      *QuestionPageRespOperator `json:"operator"`
	OperationType string                    `json:"operation_type"`
}

type QuestionPageRespOperator

type QuestionPageRespOperator struct {
	ID          string `json:"id"`
	Username    string `json:"username"`
	Rank        int    `json:"rank"`
	DisplayName string `json:"display_name"`
	Status      string `json:"status"`
}

type QuestionPermission

type QuestionPermission struct {
	// whether user can add it
	CanAdd bool `json:"-"`
	// whether user can edit it
	CanEdit bool `json:"-"`
	// whether user can delete it
	CanDelete bool `json:"-"`
	// whether user can close it
	CanClose bool `json:"-"`
	// whether user can reopen it
	CanReopen bool `json:"-"`
	// whether user can pin it
	CanPin   bool `json:"-"`
	CanUnPin bool `json:"-"`
	// whether user can hide it
	CanHide bool `json:"-"`
	CanShow bool `json:"-"`
	// whether user can use reserved it
	CanUseReservedTag bool `json:"-"`
	// whether user can invite other user to answer this question
	CanInviteOtherToAnswer bool `json:"-"`
	CanAddTag              bool `json:"-"`
	CanRecover             bool `json:"-"`
}

type QuestionRecoverReq

type QuestionRecoverReq struct {
	QuestionID string `validate:"required" json:"question_id"`
	UserID     string `json:"-"`
}

type QuestionUpdate

type QuestionUpdate struct {
	// question id
	ID string `validate:"required" json:"id"`
	// question title
	Title string `validate:"required,notblank,gte=6,lte=150" json:"title"`
	// content
	Content string `validate:"required,notblank,gte=6,lte=65535" json:"content"`
	// html
	HTML       string   `json:"-"`
	InviteUser []string `validate:"omitempty"  json:"invite_user"`
	// tags
	Tags []*TagItem `validate:"required,dive" json:"tags"`
	// edit summary
	EditSummary string `validate:"omitempty" json:"edit_summary"`
	// user id
	UserID       string `json:"-"`
	NoNeedReview bool   `json:"-"`
	QuestionPermission
	CaptchaID   string `json:"captcha_id"` // captcha_id
	CaptchaCode string `json:"captcha_code"`
}

func (*QuestionUpdate) Check

func (req *QuestionUpdate) Check() (errFields []*validator.FormErrorField, err error)

type QuestionUpdateInviteUser

type QuestionUpdateInviteUser struct {
	ID         string   `validate:"required" json:"id"`
	InviteUser []string `validate:"omitempty"  json:"invite_user"`
	UserID     string   `json:"-"`
	QuestionPermission
	CaptchaID   string `json:"captcha_id"` // captcha_id
	CaptchaCode string `json:"captcha_code"`
}

type ReactionRespItem added in v1.3.5

type ReactionRespItem struct {
	// Emoji is the reaction emoji
	Emoji string `json:"emoji"`
	// Count is the number of users who reacted
	Count int `json:"count"`
	// Tooltip is the user's name who reacted
	Tooltip string `json:"tooltip"`
	// IsActive is if current user has reacted
	IsActive bool `json:"is_active"`
}

ReactionRespItem reaction response item

type ReactionSummaryMeta added in v1.3.5

type ReactionSummaryMeta struct {
	Emoji   string   `json:"emoji"`
	UserIDs []string `json:"user_ids"`
}

ReactionSummaryMeta reaction summary meta

type ReactionsSummaryMeta added in v1.3.5

type ReactionsSummaryMeta struct {
	Reactions []*ReactionSummaryMeta `json:"reactions"`
}

ReactionsSummaryMeta reactions summary meta

func (*ReactionsSummaryMeta) AddReactionSummary added in v1.3.5

func (r *ReactionsSummaryMeta) AddReactionSummary(emoji, userID string)

AddReactionSummary add user operation to reaction summary

func (*ReactionsSummaryMeta) CheckUserInReactionSummary added in v1.3.5

func (r *ReactionsSummaryMeta) CheckUserInReactionSummary(emoji, userID string) bool

CheckUserInReactionSummary check user's operation if in reaction summary

func (*ReactionsSummaryMeta) RemoveReactionSummary added in v1.3.5

func (r *ReactionsSummaryMeta) RemoveReactionSummary(emoji, userID string)

RemoveReactionSummary remove user operation from reaction summary

type ReasonItem

type ReasonItem struct {
	ReasonKey   string `json:"reason_key"`
	ReasonType  int    `json:"reason_type"`
	Name        string `json:"name"`
	Description string `json:"description"`
	ContentType string `json:"content_type"`
	Placeholder string `json:"placeholder"`
}

func (*ReasonItem) Translate

func (r *ReasonItem) Translate(keyPrefix string, lang i18n.Language)

type ReasonReq

type ReasonReq struct {
	// ObjectType
	ObjectType string `validate:"required" form:"object_type" json:"object_type"`
	// Action
	Action string `validate:"required" form:"action" json:"action"`
}

type RecoverAnswerReq

type RecoverAnswerReq struct {
	AnswerID string `validate:"required" json:"answer_id"`
	UserID   string `json:"-"`
}

RecoverAnswerReq recover answer request

type RecoverTagReq

type RecoverTagReq struct {
	TagID  string `validate:"required" json:"tag_id"`
	UserID string `json:"-"`
}

RecoverTagReq update tag request

type RedDot

type RedDot struct {
	Inbox       int64             `json:"inbox"`
	Achievement int64             `json:"achievement"`
	Revision    int64             `json:"revision"`
	CanRevision bool              `json:"can_revision"`
	BadgeAward  *RedDotBadgeAward `json:"badge_award"`
}

type RedDotBadgeAward added in v1.4.0

type RedDotBadgeAward struct {
	NotificationID string            `json:"notification_id"`
	BadgeID        string            `json:"badge_id"`
	Name           string            `json:"name"`
	Icon           string            `json:"icon"`
	Level          entity.BadgeLevel `json:"level"`
}

type RedDotBadgeAwardCache added in v1.4.0

type RedDotBadgeAwardCache struct {
	BadgeAwardList map[string]*RedDotBadgeAward `json:"badge_award_list"`
}

func NewRedDotBadgeAwardCache added in v1.4.0

func NewRedDotBadgeAwardCache() *RedDotBadgeAwardCache

NewRedDotBadgeAwardCache new red dot badge award cache

func (*RedDotBadgeAwardCache) AddBadgeAward added in v1.4.0

func (r *RedDotBadgeAwardCache) AddBadgeAward(badgeAward *RedDotBadgeAward)

AddBadgeAward add badge award

func (*RedDotBadgeAwardCache) FromJSON added in v1.4.0

func (r *RedDotBadgeAwardCache) FromJSON(data string)

FromJSON from json

func (*RedDotBadgeAwardCache) GetBadgeAward added in v1.4.0

func (r *RedDotBadgeAwardCache) GetBadgeAward() *RedDotBadgeAward

GetBadgeAward get badge award

func (*RedDotBadgeAwardCache) RemoveBadgeAward added in v1.4.0

func (r *RedDotBadgeAwardCache) RemoveBadgeAward(notificationID string)

RemoveBadgeAward remove badge award

func (*RedDotBadgeAwardCache) ToJSON added in v1.4.0

func (r *RedDotBadgeAwardCache) ToJSON() string

ToJSON to json

type RegisterTemplateData

type RegisterTemplateData struct {
	SiteName    string
	RegisterUrl string
}

type RemoteVersion

type RemoteVersion struct {
	Release struct {
		Version string `json:"version"`
		URL     string `json:"url"`
	} `json:"release"`
}

type RemoveAnswerReq

type RemoveAnswerReq struct {
	ID          string `validate:"required" json:"id"`
	UserID      string `json:"-"`
	CanDelete   bool   `json:"-"`
	CaptchaID   string `json:"captcha_id"`
	CaptchaCode string `json:"captcha_code"`
}

RemoveAnswerReq delete answer request

type RemoveCommentReq

type RemoveCommentReq struct {
	// comment id
	CommentID string `validate:"required" json:"comment_id"`
	// user id
	UserID      string `json:"-"`
	CaptchaID   string `json:"captcha_id"`
	CaptchaCode string `json:"captcha_code"`
}

RemoveCommentReq remove comment

type RemoveConfigReq

type RemoveConfigReq struct {
	// config id
	ID int `validate:"required" comment:"config id" json:"id"`
}

RemoveConfigReq delete config request

type RemoveQuestionReq

type RemoveQuestionReq struct {
	// question id
	ID          string `validate:"required" json:"id"`
	UserID      string `json:"-" ` // user_id
	IsAdmin     bool   `json:"-"`
	CaptchaID   string `json:"captcha_id"` // captcha_id
	CaptchaCode string `json:"captcha_code"`
}

RemoveQuestionReq delete question request

type RemoveTagListReq

type RemoveTagListReq struct {
	// tag_list_id
	ID int64 `validate:"required" comment:"tag_list_id" json:"id"`
}

RemoveTagListReq delete tag list request

type RemoveTagReq

type RemoveTagReq struct {
	// tag_id
	TagID string `validate:"required" json:"tag_id"`
	// user id
	UserID string `json:"-"`
}

RemoveTagReq delete tag request

type ReopenQuestionReq

type ReopenQuestionReq struct {
	QuestionID string `json:"question_id"`
	UserID     string `json:"-"`
}

ReopenQuestionReq reopen question request

type ReportHandleReq

type ReportHandleReq struct {
	ID             string `validate:"required" comment:"report id" form:"id" json:"id"`
	FlaggedType    int    `validate:"required" comment:"flagged type" form:"flagged_type" json:"flagged_type"`
	FlaggedContent string `validate:"omitempty" comment:"flagged content" form:"flagged_content" json:"flagged_content"`
}

ReportHandleReq request handle request

type ReviewReportReq added in v1.3.0

type ReviewReportReq struct {
	FlagID        string     `validate:"required" json:"flag_id"`
	OperationType string     `validate:"required,oneof=edit_post close_post delete_post unlist_post ignore_report" json:"operation_type"`
	CloseType     int        `validate:"omitempty" json:"close_type"`
	CloseMsg      string     `validate:"omitempty" json:"close_msg"`
	Title         string     `validate:"omitempty,notblank,gte=6,lte=150" json:"title"`
	Content       string     `validate:"omitempty,notblank,gte=6,lte=65535" json:"content"`
	Tags          []*TagItem `validate:"omitempty,dive" json:"tags"`
	UserID        string     `json:"-"`
	IsAdmin       bool       `json:"-"`
}

ReviewReportReq review report request

type RevisionAuditReq

type RevisionAuditReq struct {
	// object id
	ID                string `validate:"required" comment:"id" form:"id"`
	Operation         string `validate:"required" comment:"operation" form:"operation"` //approve or reject
	UserID            string `json:"-"`
	CanReviewQuestion bool   `json:"-"`
	CanReviewAnswer   bool   `json:"-"`
	CanReviewTag      bool   `json:"-"`
}

type RevisionSearch

type RevisionSearch struct {
	Page              int    `json:"page" form:"page"` // Query number of pages
	CanReviewQuestion bool   `json:"-"`
	CanReviewAnswer   bool   `json:"-"`
	CanReviewTag      bool   `json:"-"`
	UserID            string `json:"-"`
}

func (RevisionSearch) GetCanReviewObjectTypes

func (r RevisionSearch) GetCanReviewObjectTypes() []int

type SearchCondition

type SearchCondition struct {
	// search target type: all/question/answer
	TargetType string
	// search query user id
	UserID string
	// vote amount
	VoteAmount int
	// only show not accepted answer's question
	NotAccepted bool
	// view amount
	Views int
	// answer count
	AnswerAmount int
	// only show accepted answer
	Accepted bool
	// only show this question's answer
	QuestionID string
	// search query tags
	Tags [][]string
	// search query keywords
	Words []string
}

func (*SearchCondition) Convert2PluginSearchCond

func (s *SearchCondition) Convert2PluginSearchCond(page, pageSize int, order string) *plugin.SearchBasicCond

Convert2PluginSearchCond convert to plugin search condition

func (*SearchCondition) SearchAll

func (s *SearchCondition) SearchAll() bool

SearchAll check if search all

func (*SearchCondition) SearchAnswer

func (s *SearchCondition) SearchAnswer() bool

SearchAnswer check if search only need answer

func (*SearchCondition) SearchQuestion

func (s *SearchCondition) SearchQuestion() bool

SearchQuestion check if search only need question

type SearchDTO

type SearchDTO struct {
	Query       string `validate:"required,gte=1,lte=60" form:"q"`
	Page        int    `validate:"omitempty,min=1" form:"page,default=1"`
	Size        int    `validate:"omitempty,min=1,max=50" form:"size,default=30"`
	Order       string `validate:"required,oneof=newest active score relevance" form:"order,default=relevance" enums:"newest,active,score,relevance"`
	CaptchaID   string `form:"captcha_id"`
	CaptchaCode string `form:"captcha_code"`
	UserID      string `json:"-"`
}

func (*SearchDTO) Check

func (s *SearchDTO) Check() (errField []*validator.FormErrorField, err error)

type SearchDescResp

type SearchDescResp struct {
	Name string `json:"name"`
	Icon string `json:"icon"`
	Link string `json:"link"`
}

type SearchObject

type SearchObject struct {
	ID              string `json:"id"`
	QuestionID      string `json:"question_id"`
	Title           string `json:"title"`
	UrlTitle        string `json:"url_title"`
	Excerpt         string `json:"excerpt"`
	CreatedAtParsed int64  `json:"created_at"`
	VoteCount       int    `json:"vote_count"`
	Accepted        bool   `json:"accepted"`
	AnswerCount     int    `json:"answer_count"`
	// user info
	UserInfo *SearchObjectUser `json:"user_info"`
	// tags
	Tags []*TagResp `json:"tags"`
	// Status
	StatusStr string `json:"status"`
}

type SearchObjectUser

type SearchObjectUser struct {
	ID          string `json:"id"`
	Username    string `json:"username"`
	DisplayName string `json:"display_name"`
	Rank        int    `json:"rank"`
	Status      string `json:"status"`
}

type SearchResp

type SearchResp struct {
	Total int64 `json:"count"`
	// search response
	SearchResults []*SearchResult `json:"list"`
}

type SearchResult

type SearchResult struct {
	// object_type
	ObjectType string `json:"object_type"`
	// this object
	Object *SearchObject `json:"object"`
}

type SearchTagLikeReq

type SearchTagLikeReq struct {
	// tag
	Tag     string `validate:"omitempty" form:"tag"`
	IsAdmin bool   `json:"-"`
}

SearchTagLikeReq get tag list all request

type SearchTagsBySlugName

type SearchTagsBySlugName struct {
	// slug name list split by ','
	Tags string `form:"tags"`
}

SearchTagsBySlugName search tags by slug name

type SendUserActivationReq

type SendUserActivationReq struct {
	UserID string `validate:"required" json:"user_id"`
}

SendUserActivationReq send user activation

type SimpleObjectInfo

type SimpleObjectInfo struct {
	ObjectID            string `json:"object_id"`
	ObjectCreatorUserID string `json:"object_creator_user_id"`
	QuestionID          string `json:"question_id"`
	QuestionStatus      int    `json:"question_status"`
	AnswerID            string `json:"answer_id"`
	AnswerStatus        int    `json:"answer_status"`
	CommentID           string `json:"comment_id"`
	CommentStatus       int    `json:"comment_status"`
	TagID               string `json:"tag_id"`
	ObjectType          string `json:"object_type"`
	Title               string `json:"title"`
	Content             string `json:"content"`
}

SimpleObjectInfo simple object info

func (*SimpleObjectInfo) IsDeleted added in v1.3.5

func (s *SimpleObjectInfo) IsDeleted() bool

IsDeleted is deleted

type SiteBrandingReq

type SiteBrandingReq struct {
	SquareIcon string `validate:"omitempty,gt=0,lte=512" form:"square_icon" json:"square_icon"`
	Favicon    string `validate:"omitempty,gt=0,lte=512" form:"favicon" json:"favicon"`
}

SiteBrandingReq site branding request

type SiteBrandingResp

type SiteBrandingResp SiteBrandingReq

SiteBrandingResp site branding response

type SiteCustomCssHTMLReq

type SiteCustomCssHTMLReq struct {
	CustomHead    string `validate:"omitempty,gt=0,lte=65536" json:"custom_head"`
	CustomCss     string `validate:"omitempty,gt=0,lte=65536" json:"custom_css"`
	CustomHeader  string `validate:"omitempty,gt=0,lte=65536" json:"custom_header"`
	CustomFooter  string `validate:"omitempty,gt=0,lte=65536" json:"custom_footer"`
	CustomSideBar string `validate:"omitempty,gt=0,lte=65536" json:"custom_sidebar"`
}

SiteCustomCssHTMLReq site custom css html

type SiteCustomCssHTMLResp

type SiteCustomCssHTMLResp SiteCustomCssHTMLReq

SiteCustomCssHTMLResp site custom css html response

type SiteGeneralReq

type SiteGeneralReq struct {
	Name             string `validate:"required,sanitizer,gt=1,lte=128" form:"name" json:"name"`
	ShortDescription string `validate:"omitempty,sanitizer,gt=3,lte=255" form:"short_description" json:"short_description"`
	Description      string `validate:"omitempty,sanitizer,gt=3,lte=2000" form:"description" json:"description"`
	SiteUrl          string `validate:"required,sanitizer,gt=1,lte=512,url" form:"site_url" json:"site_url"`
	ContactEmail     string `validate:"required,sanitizer,gt=1,lte=512,email" form:"contact_email" json:"contact_email"`
	CheckUpdate      bool   `validate:"omitempty,sanitizer" form:"check_update" json:"check_update"`
}

SiteGeneralReq site general request

func (*SiteGeneralReq) FormatSiteUrl

func (r *SiteGeneralReq) FormatSiteUrl()

type SiteGeneralResp

type SiteGeneralResp SiteGeneralReq

SiteGeneralResp site general response

type SiteInfoResp

type SiteInfoResp struct {
	General       *SiteGeneralResp       `json:"general"`
	Interface     *SiteInterfaceResp     `json:"interface"`
	Branding      *SiteBrandingResp      `json:"branding"`
	Login         *SiteLoginResp         `json:"login"`
	Theme         *SiteThemeResp         `json:"theme"`
	CustomCssHtml *SiteCustomCssHTMLResp `json:"custom_css_html"`
	SiteSeo       *SiteSeoResp           `json:"site_seo"`
	SiteUsers     *SiteUsersResp         `json:"site_users"`
	Write         *SiteWriteResp         `json:"site_write"`
	Version       string                 `json:"version"`
	Revision      string                 `json:"revision"`
}

SiteInfoResp get site info response

type SiteInterfaceReq

type SiteInterfaceReq struct {
	Language string `validate:"required,gt=1,lte=128" form:"language" json:"language"`
	TimeZone string `validate:"required,gt=1,lte=128" form:"time_zone" json:"time_zone"`
}

SiteInterfaceReq site interface request

type SiteInterfaceResp

type SiteInterfaceResp SiteInterfaceReq

SiteInterfaceResp site interface response

type SiteLegalReq

type SiteLegalReq struct {
	TermsOfServiceOriginalText string `json:"terms_of_service_original_text"`
	TermsOfServiceParsedText   string `json:"terms_of_service_parsed_text"`
	PrivacyPolicyOriginalText  string `json:"privacy_policy_original_text"`
	PrivacyPolicyParsedText    string `json:"privacy_policy_parsed_text"`
}

SiteLegalReq site branding request

type SiteLegalResp

type SiteLegalResp SiteLegalReq

SiteLegalResp site write response

type SiteLoginReq

type SiteLoginReq struct {
	AllowNewRegistrations   bool     `json:"allow_new_registrations"`
	AllowEmailRegistrations bool     `json:"allow_email_registrations"`
	AllowPasswordLogin      bool     `json:"allow_password_login"`
	LoginRequired           bool     `json:"login_required"`
	AllowEmailDomains       []string `json:"allow_email_domains"`
}

SiteLoginReq site login request

type SiteLoginResp

type SiteLoginResp SiteLoginReq

SiteLoginResp site login response

type SiteMapList

type SiteMapList struct {
	QuestionIDs []*SiteMapQuestionInfo `json:"question_ids"`
	MaxPageNum  []int                  `json:"max_page_num"`
}

type SiteMapPageList

type SiteMapPageList struct {
	PageData []*SiteMapQuestionInfo `json:"page_data"`
}

type SiteMapQuestionInfo

type SiteMapQuestionInfo struct {
	ID         string `json:"id"`
	Title      string `json:"title"`
	UpdateTime string `json:"time"`
}

type SiteSeoReq

type SiteSeoReq struct {
	Permalink int    `validate:"required,lte=4,gte=0" form:"permalink" json:"permalink"`
	Robots    string `validate:"required" form:"robots" json:"robots"`
}

type SiteSeoResp

type SiteSeoResp SiteSeoReq

SiteSeoResp site write response

func (s *SiteSeoResp) IsShortLink() bool

type SiteThemeReq

type SiteThemeReq struct {
	Theme       string                 `validate:"required,gt=0,lte=255" json:"theme"`
	ThemeConfig map[string]interface{} `validate:"omitempty" json:"theme_config"`
	ColorScheme string                 `validate:"omitempty,gt=0,lte=100" json:"color_scheme"`
}

SiteThemeReq site theme config

type SiteThemeResp

type SiteThemeResp struct {
	ThemeOptions []*ThemeOption         `json:"theme_options"`
	Theme        string                 `json:"theme"`
	ThemeConfig  map[string]interface{} `json:"theme_config"`
	ColorScheme  string                 `json:"color_scheme"`
}

SiteThemeResp site theme response

func (*SiteThemeResp) TrTheme

func (s *SiteThemeResp) TrTheme(ctx context.Context)

type SiteUsersReq

type SiteUsersReq struct {
	DefaultAvatar          string `validate:"required,oneof=system gravatar" json:"default_avatar"`
	GravatarBaseURL        string `json:"gravatar_base_url"`
	AllowUpdateDisplayName bool   `json:"allow_update_display_name"`
	AllowUpdateUsername    bool   `json:"allow_update_username"`
	AllowUpdateAvatar      bool   `json:"allow_update_avatar"`
	AllowUpdateBio         bool   `json:"allow_update_bio"`
	AllowUpdateWebsite     bool   `json:"allow_update_website"`
	AllowUpdateLocation    bool   `json:"allow_update_location"`
}

SiteUsersReq site users config request

type SiteUsersResp

type SiteUsersResp SiteUsersReq

SiteUsersResp site users response

type SiteWriteReq

type SiteWriteReq struct {
	RestrictAnswer bool            `validate:"omitempty" json:"restrict_answer"`
	RequiredTag    bool            `validate:"omitempty" json:"required_tag"`
	RecommendTags  []*SiteWriteTag `validate:"omitempty,dive" json:"recommend_tags"`
	ReservedTags   []*SiteWriteTag `validate:"omitempty,dive" json:"reserved_tags"`
	UserID         string          `json:"-"`
}

SiteWriteReq site write request

type SiteWriteResp

type SiteWriteResp SiteWriteReq

SiteWriteResp site write response

type SiteWriteTag added in v1.3.6

type SiteWriteTag struct {
	SlugName    string `validate:"required" json:"slug_name"`
	DisplayName string `json:"display_name"`
}

SiteWriteTag site write response tag

type SuggestedAnswerItem

type SuggestedAnswerItem struct {
	Type        string    `json:"@type"`
	Text        string    `json:"text"`
	DateCreated time.Time `json:"dateCreated"`
	UpvoteCount int       `json:"upvoteCount"`
	URL         string    `json:"url"`
	Author      struct {
		URL  string `json:"url"`
		Type string `json:"@type"`
		Name string `json:"name"`
	} `json:"author"`
}

type TagChange

type TagChange struct {
	ObjectID string     `json:"object_id"` // object_id
	Tags     []*TagItem `json:"tags"`      // tags name
	// user id
	UserID string `json:"-"`
}

type TagItem

type TagItem struct {
	// slug_name
	SlugName string `validate:"omitempty,gt=0,lte=35" json:"slug_name"`
	// display_name
	DisplayName string `validate:"omitempty,gt=0,lte=35" json:"display_name"`
	// original text
	OriginalText string `validate:"omitempty" json:"original_text"`
	// parsed text
	ParsedText string `json:"-"`
}

type TagResp

type TagResp struct {
	ID          string `json:"-"`
	SlugName    string `json:"slug_name"`
	DisplayName string `json:"display_name"`
	// if main tag slug name is not empty, this tag is synonymous with the main tag
	MainTagSlugName string `json:"main_tag_slug_name"`
	Recommend       bool   `json:"recommend"`
	Reserved        bool   `json:"reserved"`
}

type TagSynonym

type TagSynonym struct {
	// tag id
	TagID string `json:"tag_id"`
	// slug name
	SlugName string `json:"slug_name"`
	// display name
	DisplayName string `json:"display_name"`
	// if main tag slug name is not empty, this tag is synonymous with the main tag
	MainTagSlugName string `json:"main_tag_slug_name"`
}

type TemplateSiteInfoResp

type TemplateSiteInfoResp struct {
	General       *SiteGeneralResp       `json:"general"`
	Interface     *SiteInterfaceResp     `json:"interface"`
	Branding      *SiteBrandingResp      `json:"branding"`
	SiteSeo       *SiteSeoResp           `json:"site_seo"`
	CustomCssHtml *SiteCustomCssHTMLResp `json:"custom_css_html"`
	Title         string
	Year          string
	Canonical     string
	JsonLD        string
	Keywords      string
	Description   string
}

type TestTemplateData

type TestTemplateData struct {
	SiteName string
}

type ThemeOption

type ThemeOption struct {
	Label string `json:"label"`
	Value string `json:"value"`
}

ThemeOption get label option

type UIOptionAction

type UIOptionAction struct {
	Url              string            `json:"url"`
	Method           string            `json:"method,omitempty"`
	Loading          *LoadingAction    `json:"loading,omitempty"`
	OnCompleteAction *OnCompleteAction `json:"on_complete,omitempty"`
}

type UnreviewedRevisionInfoInfo

type UnreviewedRevisionInfoInfo struct {
	CreatedAt           int64      `json:"created_at"`
	ObjectID            string     `json:"object_id"`
	QuestionID          string     `json:"question_id"`
	AnswerID            string     `json:"answer_id"`
	CommentID           string     `json:"comment_id"`
	ObjectType          string     `json:"object_type"`
	ObjectCreatorUserID string     `json:"object_creator_user_id"`
	Title               string     `json:"title"`
	UrlTitle            string     `json:"url_title"`
	Content             string     `json:"content"`
	Html                string     `json:"html"`
	AnswerCount         int        `json:"answer_count"`
	AnswerAccepted      bool       `json:"answer_accepted"`
	Tags                []*TagResp `json:"tags"`
	Status              int        `json:"status"`
	ShowStatus          int        `json:"show_status"`
}

type UpdateBadgeStatusReq added in v1.4.0

type UpdateBadgeStatusReq struct {
	// badge id
	ID string `validate:"required" json:"id"`
	// badge status
	Status BadgeStatus `validate:"required" json:"status"`
}

type UpdateCollectionGroupReq

type UpdateCollectionGroupReq struct {
	//
	ID int64 `validate:"required" comment:"" json:"id"`
	//
	UserID int64 `validate:"omitempty" comment:"" json:"user_id"`
	// the collection group name
	Name string `validate:"omitempty,gt=0,lte=50" comment:"the collection group name" json:"name"`
	// mark this group is default, default 1
	DefaultGroup int `validate:"omitempty" comment:"mark this group is default, default 1" json:"default_group"`
	//
	CreateTime time.Time `validate:"omitempty" comment:"" json:"create_time"`
	//
	UpdateTime time.Time `validate:"omitempty" comment:"" json:"update_time"`
}

UpdateCollectionGroupReq update collection group request

type UpdateCommentReq

type UpdateCommentReq struct {
	// comment id
	CommentID string `validate:"required" json:"comment_id"`
	// original comment content
	OriginalText string `validate:"required,notblank,gte=2,lte=600" json:"original_text"`
	// parsed comment content
	ParsedText string `json:"-"`
	// user id
	UserID  string `json:"-"`
	IsAdmin bool   `json:"-"`

	// whether user can edit it
	CanEdit bool `json:"-"`

	// whether user can delete it
	CaptchaID   string `json:"captcha_id"` // captcha_id
	CaptchaCode string `json:"captcha_code"`
}

UpdateCommentReq update comment request

func (*UpdateCommentReq) Check

func (req *UpdateCommentReq) Check() (errFields []*validator.FormErrorField, err error)

type UpdateCommentResp

type UpdateCommentResp struct {
	// comment id
	CommentID string `json:"comment_id"`
	// original comment content
	OriginalText string `json:"original_text"`
	// parsed comment content
	ParsedText string `json:"parsed_text"`
}

type UpdateConfigReq

type UpdateConfigReq struct {
	// config id
	ID int `validate:"required" comment:"config id" json:"id"`
	// the config key
	Key string `validate:"omitempty,gt=0,lte=32" comment:"the config key" json:"key"`
	// the config value, custom data structures and types
	Value string `validate:"omitempty,gt=0,lte=128" comment:"the config value, custom data structures and types" json:"value"`
}

UpdateConfigReq update config request

type UpdateFollowTagsReq

type UpdateFollowTagsReq struct {
	// tag slug name list
	SlugNameList []string `json:"slug_name_list"`
	// user id
	UserID string `json:"-"`
}

UpdateFollowTagsReq update user follow tags

type UpdateInfoRequest

type UpdateInfoRequest struct {
	DisplayName string     `validate:"omitempty,gt=0,lte=30" json:"display_name"`
	Username    string     `validate:"omitempty,gt=3,lte=30" json:"username"`
	Avatar      AvatarInfo `json:"avatar"`
	Bio         string     `validate:"omitempty,gt=0,lte=4096" json:"bio"`
	BioHTML     string     `json:"-"`
	Website     string     `validate:"omitempty,gt=0,lte=500" json:"website"`
	Location    string     `validate:"omitempty,gt=0,lte=100" json:"location"`
	UserID      string     `json:"-"`
	IsAdmin     bool       `json:"-"`
}

func (*UpdateInfoRequest) Check

func (req *UpdateInfoRequest) Check() (errFields []*validator.FormErrorField, err error)

type UpdatePluginConfigReq

type UpdatePluginConfigReq struct {
	PluginSlugName string         `validate:"required,gt=1,lte=100" json:"plugin_slug_name"`
	ConfigFields   map[string]any `json:"config_fields"`
}

type UpdatePluginStatusReq

type UpdatePluginStatusReq struct {
	PluginSlugName string `validate:"required,gt=1,lte=100" json:"plugin_slug_name"`
	Enabled        bool   `json:"enabled"`
}

type UpdatePrivilegesConfigReq

type UpdatePrivilegesConfigReq struct {
	Level            PrivilegeLevel        `validate:"required,min=1,max=3|eq=99" json:"level"`
	CustomPrivileges []*constant.Privilege `validate:"dive" json:"custom_privileges"`
}

UpdatePrivilegesConfigReq update privileges config request

type UpdateQuestionResp

type UpdateQuestionResp struct {
	UrlTitle      string `json:"url_title"`
	WaitForReview bool   `json:"wait_for_review"`
}

UpdateQuestionResp update question resp

type UpdateReactionReq added in v1.3.5

type UpdateReactionReq struct {
	ObjectID string `validate:"required" json:"object_id"`
	Emoji    string `validate:"required,oneof=heart smile frown" json:"emoji"`
	Reaction string `validate:"required,oneof=activate deactivate" json:"reaction"`
	UserID   string `json:"-"`
}

type UpdateReviewReq added in v1.3.0

type UpdateReviewReq struct {
	ReviewID int    `validate:"required" json:"review_id"`
	Status   string `validate:"required,oneof=approve reject" json:"status"`
	UserID   string `json:"-"`
	IsAdmin  bool   `json:"-"`
}

UpdateReviewReq update review request

func (*UpdateReviewReq) IsApprove added in v1.3.0

func (r *UpdateReviewReq) IsApprove() bool

func (*UpdateReviewReq) IsReject added in v1.3.0

func (r *UpdateReviewReq) IsReject() bool

type UpdateSMTPConfigReq

type UpdateSMTPConfigReq struct {
	FromEmail          string `validate:"omitempty,gt=0,lte=256" json:"from_email"`
	FromName           string `validate:"omitempty,gt=0,lte=256" json:"from_name"`
	SMTPHost           string `validate:"omitempty,gt=0,lte=256" json:"smtp_host"`
	SMTPPort           int    `validate:"omitempty,min=1,max=65535" json:"smtp_port"`
	Encryption         string `validate:"omitempty,oneof=SSL TLS" json:"encryption"` // "" SSL TLS
	SMTPUsername       string `validate:"omitempty,gt=0,lte=256" json:"smtp_username"`
	SMTPPassword       string `validate:"omitempty,gt=0,lte=256" json:"smtp_password"`
	SMTPAuthentication bool   `validate:"omitempty" json:"smtp_authentication"`
	TestEmailRecipient string `validate:"omitempty,email" json:"test_email_recipient"`
}

UpdateSMTPConfigReq get smtp config request

func (*UpdateSMTPConfigReq) Check

func (r *UpdateSMTPConfigReq) Check() (errField []*validator.FormErrorField, err error)

type UpdateTagListReq

type UpdateTagListReq struct {
	// tag_list_id
	ID int64 `validate:"required" comment:"tag_list_id" json:"id"`
	// tag_id
	TagID int64 `validate:"omitempty" comment:"tag_id" json:"tag_id"`
	// object_id
	ObjectID int64 `validate:"omitempty" comment:"object_id" json:"object_id"`
	// tag_list_status(available: 1; deleted: 10)
	Status int `validate:"omitempty" comment:"tag_list_status(available: 1; deleted: 10)" json:"status"`
}

UpdateTagListReq update tag list request

type UpdateTagReq

type UpdateTagReq struct {
	// tag_id
	TagID string `validate:"required" json:"tag_id"`
	// slug_name
	SlugName string `validate:"omitempty,gt=0,lte=35" json:"slug_name"`
	// display_name
	DisplayName string `validate:"omitempty,gt=0,lte=35" json:"display_name"`
	// original text
	OriginalText string `validate:"omitempty" json:"original_text"`
	// parsed text
	ParsedText string `json:"-"`
	// edit summary
	EditSummary string `validate:"omitempty" json:"edit_summary"`
	// user id
	UserID       string `json:"-"`
	NoNeedReview bool   `json:"-"`
}

UpdateTagReq update tag request

func (*UpdateTagReq) Check

func (r *UpdateTagReq) Check() (errFields []*validator.FormErrorField, err error)

type UpdateTagResp

type UpdateTagResp struct {
	WaitForReview bool `json:"wait_for_review"`
}

UpdateTagResp update tag response

type UpdateTagSynonymReq

type UpdateTagSynonymReq struct {
	// tag_id
	TagID string `validate:"required" json:"tag_id"`
	// synonym tag list
	SynonymTagList []*TagItem `validate:"required,dive" json:"synonym_tag_list"`
	// user id
	UserID string `json:"-"`
}

UpdateTagSynonymReq update tag request

func (*UpdateTagSynonymReq) Format

func (req *UpdateTagSynonymReq) Format()

type UpdateUserInterfaceRequest

type UpdateUserInterfaceRequest struct {
	// language
	Language string `validate:"required,gt=1,lte=100" json:"language"`
	// Color scheme
	ColorScheme string `validate:"required,gt=1,lte=100" json:"color_scheme"`
	// user id
	UserId string `json:"-"`
}

UpdateUserInterfaceRequest update user interface request

func (*UpdateUserInterfaceRequest) Check added in v1.2.5

func (req *UpdateUserInterfaceRequest) Check() (errFields []*validator.FormErrorField, err error)

type UpdateUserNotificationConfigReq

type UpdateUserNotificationConfigReq struct {
	NotificationConfig
	UserID string `json:"-"`
}

UpdateUserNotificationConfigReq update user notification config request

type UpdateUserPasswordReq

type UpdateUserPasswordReq struct {
	UserID      string `validate:"required" json:"user_id"`
	Password    string `validate:"required,gte=8,lte=32" json:"password"`
	LoginUserID string `json:"-"`
}

UpdateUserPasswordReq update user password request

type UpdateUserPluginConfigReq added in v1.2.5

type UpdateUserPluginConfigReq struct {
	PluginSlugName string         `validate:"required,gt=1,lte=100" json:"plugin_slug_name"`
	ConfigFields   map[string]any `json:"config_fields"`
	UserID         string         `json:"-"`
}

type UpdateUserPluginReq added in v1.2.5

type UpdateUserPluginReq struct {
	PluginSlugName string `validate:"required,gt=1,lte=100" json:"plugin_slug_name"`
	UserID         string `json:"-"`
}

type UpdateUserRoleReq

type UpdateUserRoleReq struct {
	// user id
	UserID string `validate:"required" json:"user_id"`
	// role id
	RoleID int `validate:"required" json:"role_id"`
	// login user id
	LoginUserID string `json:"-"`
}

UpdateUserRoleReq update user role request

type UpdateUserStatusReq

type UpdateUserStatusReq struct {
	UserID           string `validate:"required" json:"user_id"`
	Status           string `validate:"required,oneof=normal suspended deleted inactive" json:"status" enums:"normal,suspended,deleted,inactive"`
	RemoveAllContent bool   `validate:"omitempty" json:"remove_all_content"`
	LoginUserID      string `json:"-"`
}

UpdateUserStatusReq update user request

func (*UpdateUserStatusReq) IsDeleted

func (r *UpdateUserStatusReq) IsDeleted() bool

func (*UpdateUserStatusReq) IsInactive

func (r *UpdateUserStatusReq) IsInactive() bool

func (*UpdateUserStatusReq) IsNormal

func (r *UpdateUserStatusReq) IsNormal() bool

func (*UpdateUserStatusReq) IsSuspended

func (r *UpdateUserStatusReq) IsSuspended() bool

type UserAnswerInfo

type UserAnswerInfo struct {
	AnswerID     string `json:"answer_id"`
	QuestionID   string `json:"question_id"`
	Accepted     int    `json:"accepted"`
	VoteCount    int    `json:"vote_count"`
	CreateTime   int    `json:"create_time"`
	UpdateTime   int    `json:"update_time"`
	QuestionInfo struct {
		Title    string        `json:"title"`
		UrlTitle string        `json:"url_title"`
		Tags     []interface{} `json:"tags"`
	} `json:"question_info"`
}

type UserBasicInfo

type UserBasicInfo struct {
	ID          string `json:"id"`
	Username    string `json:"username"`
	Rank        int    `json:"rank"`
	DisplayName string `json:"display_name"`
	Avatar      string `json:"avatar"`
	Website     string `json:"website"`
	Location    string `json:"location"`
	Language    string `json:"language"`
	Status      string `json:"status"`
}

type UserCenterAdminFunctionAgentResp

type UserCenterAdminFunctionAgentResp struct {
	AllowCreateUser         bool `json:"allow_create_user"`
	AllowUpdateUserStatus   bool `json:"allow_update_user_status"`
	AllowUpdateUserPassword bool `json:"allow_update_user_password"`
	AllowUpdateUserRole     bool `json:"allow_update_user_role"`
}

type UserCenterAgentResp

type UserCenterAgentResp struct {
	Enabled   bool       `json:"enabled"`
	AgentInfo *AgentInfo `json:"agent_info"`
}

type UserCenterPersonalBranding

type UserCenterPersonalBranding struct {
	Enabled          bool                `json:"enabled"`
	PersonalBranding []*PersonalBranding `json:"personal_branding"`
}

type UserCenterUserSettingsResp

type UserCenterUserSettingsResp struct {
	ProfileSettingAgent UserSettingAgent `json:"profile_setting_agent"`
	AccountSettingAgent UserSettingAgent `json:"account_setting_agent"`
}

UserCenterUserSettingsResp user center user info response

type UserChangeEmailSendCodeReq

type UserChangeEmailSendCodeReq struct {
	UserVerifyEmailSendReq
	Email  string `validate:"required,email,gt=0,lte=500" json:"e_mail"`
	Pass   string `validate:"omitempty,gte=8,lte=32" json:"pass"`
	UserID string `json:"-"`
}

type UserChangeEmailVerifyReq

type UserChangeEmailVerifyReq struct {
	Code    string `validate:"required,gt=0,lte=500" json:"code"`
	Content string `json:"-"`
}

type UserEmailLoginReq

type UserEmailLoginReq struct {
	Email       string `validate:"required,email,gt=0,lte=500" json:"e_mail"`
	Pass        string `validate:"required,gte=8,lte=32" json:"pass"`
	CaptchaID   string `json:"captcha_id"`
	CaptchaCode string `json:"captcha_code"`
}

UserEmailLoginReq user email login request

type UserExternalLoginResp

type UserExternalLoginResp struct {
	BindingKey  string `json:"binding_key"`
	AccessToken string `json:"access_token"`
	// ErrMsg error message, if not empty, means login failed and this message should be displayed.
	ErrMsg   string `json:"-"`
	ErrTitle string `json:"-"`
}

UserExternalLoginResp user external login resp

type UserLoginResp

type UserLoginResp struct {
	// user id
	ID string `json:"id"`
	// create time
	CreatedAt int64 `json:"created_at"`
	// last login date
	LastLoginDate int64 `json:"last_login_date"`
	// username
	Username string `json:"username"`
	// email
	EMail string `json:"e_mail"`
	// mail status(1 pass 2 to be verified)
	MailStatus int `json:"mail_status"`
	// notice status(1 on 2off)
	NoticeStatus int `json:"notice_status"`
	// follow count
	FollowCount int `json:"follow_count"`
	// answer count
	AnswerCount int `json:"answer_count"`
	// question count
	QuestionCount int `json:"question_count"`
	// rank
	Rank int `json:"rank"`
	// authority group
	AuthorityGroup int `json:"authority_group"`
	// display name
	DisplayName string `json:"display_name"`
	// avatar
	Avatar string `json:"avatar"`
	// mobile
	Mobile string `json:"mobile"`
	// bio markdown
	Bio string `json:"bio"`
	// bio html
	BioHTML string `json:"bio_html"`
	// website
	Website string `json:"website"`
	// location
	Location string `json:"location"`
	// language
	Language string `json:"language"`
	// Color scheme
	ColorScheme string `json:"color_scheme"`
	// access token
	AccessToken string `json:"access_token"`
	// role id
	RoleID int `json:"role_id"`
	// user status
	Status string `json:"status"`
	// user have password
	HavePassword bool `json:"have_password"`
	// visit token
	VisitToken string `json:"visit_token"`
}

UserLoginResp get user response

func (*UserLoginResp) ConvertFromUserEntity

func (r *UserLoginResp) ConvertFromUserEntity(userInfo *entity.User)

type UserModifyPasswordReq

type UserModifyPasswordReq struct {
	OldPass     string `validate:"omitempty,gte=8,lte=32" json:"old_pass"`
	Pass        string `validate:"required,gte=8,lte=32" json:"pass"`
	CaptchaID   string `json:"captcha_id"`
	CaptchaCode string `json:"captcha_code"`
	UserID      string `json:"-"`
	AccessToken string `json:"-"`
}

func (*UserModifyPasswordReq) Check

func (u *UserModifyPasswordReq) Check() (errFields []*validator.FormErrorField, err error)

type UserQuestionInfo

type UserQuestionInfo struct {
	ID               string        `json:"question_id"`
	Title            string        `json:"title"`
	UrlTitle         string        `json:"url_title"`
	VoteCount        int           `json:"vote_count"`
	Tags             []interface{} `json:"tags"`
	ViewCount        int           `json:"view_count"`
	AnswerCount      int           `json:"answer_count"`
	CollectionCount  int           `json:"collection_count"`
	CreatedAt        int64         `json:"created_at"`
	AcceptedAnswerID string        `json:"accepted_answer_id"`
	Status           string        `json:"status"`
}

type UserRankingResp

type UserRankingResp struct {
	UsersWithTheMostReputation []*UserRankingSimpleInfo `json:"users_with_the_most_reputation"`
	UsersWithTheMostVote       []*UserRankingSimpleInfo `json:"users_with_the_most_vote"`
	Staffs                     []*UserRankingSimpleInfo `json:"staffs"`
}

UserRankingResp user ranking response

type UserRankingSimpleInfo

type UserRankingSimpleInfo struct {
	// username
	Username string `json:"username"`
	// rank
	Rank int `json:"rank"`
	// vote
	VoteCount int `json:"vote_count"`
	// display name
	DisplayName string `json:"display_name"`
	// avatar
	Avatar string `json:"avatar"`
}

UserRankingSimpleInfo user ranking simple info

type UserRePassWordRequest

type UserRePassWordRequest struct {
	Code    string `validate:"required,gt=0,lte=100" json:"code"`
	Pass    string `validate:"required,gt=0,lte=32" json:"pass"`
	Content string `json:"-"`
}

func (*UserRePassWordRequest) Check

func (u *UserRePassWordRequest) Check() (errFields []*validator.FormErrorField, err error)

type UserRegisterReq

type UserRegisterReq struct {
	Name        string `validate:"required,gt=3,lte=30" json:"name"`
	Email       string `validate:"required,email,gt=0,lte=500" json:"e_mail" `
	Pass        string `validate:"required,gte=8,lte=32" json:"pass"`
	CaptchaID   string `json:"captcha_id"`
	CaptchaCode string `json:"captcha_code"`
	IP          string `json:"-" `
}

UserRegisterReq user register request

func (*UserRegisterReq) Check

func (u *UserRegisterReq) Check() (errFields []*validator.FormErrorField, err error)

type UserRetrievePassWordRequest

type UserRetrievePassWordRequest struct {
	Email       string `validate:"required,email,gt=0,lte=500" json:"e_mail"`
	CaptchaID   string `json:"captcha_id"`
	CaptchaCode string `json:"captcha_code"`
}

type UserSettingAgent

type UserSettingAgent struct {
	Enabled     bool   `json:"enabled"`
	RedirectURL string `json:"redirect_url"`
}

type UserUnsubscribeNotificationReq

type UserUnsubscribeNotificationReq struct {
	Code    string `validate:"required,gt=0,lte=500" json:"code"`
	Content string `json:"-"`
}

UserUnsubscribeNotificationReq user unsubscribe email notification request

type UserVerifyEmailReq

type UserVerifyEmailReq struct {
	// code
	Code string `validate:"required,gt=0,lte=500" form:"code"`
	// content
	Content string `json:"-"`
}

UserVerifyEmailReq user verify email request

type UserVerifyEmailSendReq

type UserVerifyEmailSendReq struct {
	CaptchaID   string `json:"captcha_id"`
	CaptchaCode string `json:"captcha_code"`
}

type VoteActivity

type VoteActivity struct {
	ActivityType   int
	ActivityUserID string
	TriggerUserID  string
	Rank           int
}

VoteActivity vote activity

func (*VoteActivity) HasRank

func (v *VoteActivity) HasRank() int

type VoteOperationInfo

type VoteOperationInfo struct {
	// operation object id
	ObjectID string
	// question answer comment
	ObjectType string
	// object owner user id
	ObjectCreatorUserID string
	// operation user id
	OperatingUserID string
	// vote up
	VoteUp bool
	// vote down
	VoteDown bool
	// vote activity info
	Activities []*VoteActivity
}

VoteOperationInfo vote operation info

type VoteReq

type VoteReq struct {
	ObjectID    string `validate:"required" json:"object_id"`
	IsCancel    bool   `validate:"omitempty" json:"is_cancel"`
	CaptchaID   string `json:"captcha_id"`
	CaptchaCode string `json:"captcha_code"`
	UserID      string `json:"-"`
}

type VoteResp

type VoteResp struct {
	UpVotes    int64  `json:"up_votes"`
	DownVotes  int64  `json:"down_votes"`
	Votes      int64  `json:"votes"`
	VoteStatus string `json:"vote_status"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL