 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
- Variables
- func ReplaceSearchContent(content string) (string, []string)
- type AcceptAnswerActivity
- type AcceptAnswerOperationInfo
- type AcceptAnswerReq
- type AcceptedAnswerItem
- type ActObjectInfo
- type ActObjectTimeline
- type ActionRecordReq
- type ActionRecordResp
- type ActivityMsg
- type AddCollectionGroupReq
- type AddCommentReq
- type AddConfigReq
- type AddReportReq
- type AddRevisionDTO
- type AddTagListReq
- type AddTagReq
- type AddTagResp
- type AddUserReq
- type AddUsersErrorData
- type AddUsersReq
- type AdminAnswerInfo
- type AdminAnswerPageReq
- type AdminQuestionInfo
- type AdminQuestionPageReq
- type AdminUpdateAnswerStatusReq
- type AdminUpdateQuestionStatusReq
- type AgentInfo
- type AnswerAddReq
- type AnswerInfo
- type AnswerListReq
- type AnswerUpdateReq
- type AnswerUpdateResp
- type AvatarInfo
- type BadgeListInfo
- type BadgeStatus
- type BadgeTplData
- type ChangeEmailTemplateData
- type CheckCanQuestionUpdate
- type CloseQuestionMeta
- type CloseQuestionReq
- type CollectionSwitchReq
- type CollectionSwitchResp
- type ConfigField
- type ConfigFieldOption
- type ConfigFieldUIOptions
- type ConnectorInfoResp
- type ConnectorUserInfoResp
- type ControlCenter
- type DashboardInfo
- type DashboardInfoVersion
- type DeletePermanentlyReq
- type EditUserProfileReq
- type EmailCodeContent
- type EmailSourceType
- type ErrTypeData
- type EventMsg
- func (e *EventMsg) AID(answerID, userID string) *EventMsg
- func (e *EventMsg) AddExtra(key, value string) *EventMsg
- func (e *EventMsg) CID(comment, userID string) *EventMsg
- func (e *EventMsg) GetExtra(key string) string
- func (e *EventMsg) GetObjectID() string
- func (e *EventMsg) QID(questionID, userID string) *EventMsg
- func (e *EventMsg) TID(triggerObjectID string) *EventMsg
 
- type ExternalLoginBindingUserReq
- type ExternalLoginBindingUserResp
- type ExternalLoginBindingUserSendEmailReq
- type ExternalLoginBindingUserSendEmailResp
- type ExternalLoginUnbindingReq
- type ExternalLoginUserInfoCache
- type ExternalNotificationMsg
- type FollowDTO
- type FollowReq
- type FollowResp
- type ForbiddenResp
- type GetAllPluginStatusResp
- type GetAnswerInfoResp
- type GetBadgeAwardWithPageReq
- type GetBadgeAwardWithPageResp
- type GetBadgeInfoResp
- type GetBadgeListPagedReq
- type GetBadgeListPagedResp
- type GetBadgeListResp
- type GetCloseTypeResp
- type GetCollectionGroupResp
- type GetCommentListReq
- type GetCommentPersonalWithPageReq
- type GetCommentPersonalWithPageResp
- type GetCommentReq
- type GetCommentResp
- type GetCommentWithPageReq
- type GetConfigListReq
- type GetConfigResp
- type GetConfigWithPageReq
- type GetCurrentLoginUserInfoResp
- type GetFollowingTagsResp
- type GetManifestJsonResp
- type GetObjectTimelineDetailReq
- type GetObjectTimelineDetailResp
- type GetObjectTimelineReq
- type GetObjectTimelineResp
- type GetOtherUserInfoByUsernameReq
- type GetOtherUserInfoByUsernameResp
- type GetOtherUserInfoResp
- type GetPermissionReq
- type GetPermissionResp
- type GetPluginConfigReq
- type GetPluginConfigResp
- type GetPluginListReq
- type GetPluginListResp
- type GetPrivilegesConfigResp
- type GetQuestionLinkReq
- type GetQuestionLinkResp
- type GetRankPersonalPageResp
- type GetRankPersonalWithPageReq
- type GetReactionByObjectIdResp
- type GetReactionReq
- type GetRedDot
- type GetReportListPageDTO
- type GetReportListPageResp
- type GetReportListReq
- type GetReportTypeResp
- type GetReviewingTypeReq
- type GetReviewingTypeResp
- type GetRevisionListReq
- type GetRevisionResp
- type GetRoleResp
- type GetSMTPConfigResp
- type GetSiteLegalInfoReq
- type GetSiteLegalInfoResp
- type GetTagBasicResp
- type GetTagInfoReq
- type GetTagListListReq
- type GetTagListResp
- type GetTagListWithPageReq
- type GetTagPageResp
- type GetTagResp
- type GetTagSynonymsReq
- type GetTagSynonymsResp
- type GetTagWithPageReq
- type GetTamplateTagInfoReq
- type GetUnreviewedPostPageReq
- type GetUnreviewedPostPageResp
- type GetUnreviewedReportPostPageReq
- type GetUnreviewedRevisionResp
- type GetUserActivationReq
- type GetUserActivationResp
- type GetUserBadgeAwardListReq
- type GetUserBadgeAwardListResp
- type GetUserInfoReq
- type GetUserInfoResp
- type GetUserNotificationConfigResp
- type GetUserPageReq
- type GetUserPageResp
- type GetUserPluginConfigReq
- type GetUserPluginConfigResp
- type GetUserPluginListResp
- type GetUserStaffReq
- type GetUserStaffResp
- type GetVoteWithPageReq
- type GetVoteWithPageResp
- type LoadingAction
- type ManifestJsonIcon
- type MergeTagReq
- type MergeTagResp
- type NewAnswerTemplateData
- type NewAnswerTemplateRawData
- type NewCommentTemplateData
- type NewCommentTemplateRawData
- type NewInviteAnswerTemplateData
- type NewInviteAnswerTemplateRawData
- type NewQuestionTemplateData
- type NewQuestionTemplateRawData
- type NotificationChannelConfig
- type NotificationChannels
- type NotificationClearIDRequest
- type NotificationClearRequest
- type NotificationConfig
- type NotificationContent
- type NotificationMsg
- type NotificationSearch
- type ObjectInfo
- type ObjectTimelineDetail
- type ObjectTimelineTag
- type OnCompleteAction
- type Operation
- type OperationLevel
- type OperationQuestionReq
- type Paginator
- type PassResetTemplateData
- type PassReviewActivity
- type PermissionMemberAction
- type PermissionTrTplData
- type PersonalAnswerPageReq
- type PersonalBranding
- type PersonalCollectionPageReq
- type PersonalQuestionPageReq
- type PluginStatus
- type PostRenderReq
- type PrivilegeLevel
- type PrivilegeOption
- type PrivilegeOptions
- type QAPageJsonLD
- type QuestionAdd
- type QuestionAddByAnswer
- type QuestionBaseInfo
- type QuestionInfoResp
- type QuestionPageReq
- type QuestionPageResp
- type QuestionPageRespOperator
- type QuestionPermission
- type QuestionRecoverReq
- type QuestionUpdate
- type QuestionUpdateInviteUser
- type ReactionRespItem
- type ReactionSummaryMeta
- type ReactionsSummaryMeta
- type ReasonItem
- type ReasonReq
- type RecoverAnswerReq
- type RecoverTagReq
- type RedDot
- type RedDotBadgeAward
- type RedDotBadgeAwardCache
- func (r *RedDotBadgeAwardCache) AddBadgeAward(badgeAward *RedDotBadgeAward)
- func (r *RedDotBadgeAwardCache) FromJSON(data string)
- func (r *RedDotBadgeAwardCache) GetBadgeAward() *RedDotBadgeAward
- func (r *RedDotBadgeAwardCache) RemoveBadgeAward(notificationID string)
- func (r *RedDotBadgeAwardCache) ToJSON() string
 
- type RegisterTemplateData
- type RemoteVersion
- type RemoveAnswerReq
- type RemoveCommentReq
- type RemoveConfigReq
- type RemoveQuestionReq
- type RemoveTagListReq
- type RemoveTagReq
- type ReopenQuestionReq
- type ReportHandleReq
- type ReviewReportReq
- type RevisionAuditReq
- type RevisionSearch
- type SearchCondition
- type SearchDTO
- type SearchDescResp
- type SearchObject
- type SearchObjectUser
- type SearchResp
- type SearchResult
- type SearchTagLikeReq
- type SearchTagsBySlugName
- type SendUserActivationReq
- type SimpleObjectInfo
- type SiteBrandingReq
- type SiteBrandingResp
- type SiteCustomCssHTMLReq
- type SiteCustomCssHTMLResp
- type SiteGeneralReq
- type SiteGeneralResp
- type SiteInfoResp
- type SiteInterfaceReq
- type SiteInterfaceResp
- type SiteLegalReq
- type SiteLegalResp
- type SiteLegalSimpleResp
- type SiteLoginReq
- type SiteLoginResp
- type SiteMapList
- type SiteMapPageList
- type SiteMapQuestionInfo
- type SiteSeoReq
- type SiteSeoResp
- type SiteThemeReq
- type SiteThemeResp
- type SiteUsersReq
- type SiteUsersResp
- type SiteWriteReq
- type SiteWriteResp
- type SiteWriteTag
- type SuggestedAnswerItem
- type TagChange
- type TagItem
- type TagResp
- type TagSynonym
- type TemplateSiteInfoResp
- type TestTemplateData
- type ThemeOption
- type UIOptionAction
- type UnreviewedRevisionInfoInfo
- type UpdateBadgeStatusReq
- type UpdateCollectionGroupReq
- type UpdateCommentReq
- type UpdateCommentResp
- type UpdateConfigReq
- type UpdateFollowTagsReq
- type UpdateInfoRequest
- type UpdatePluginConfigReq
- type UpdatePluginStatusReq
- type UpdatePrivilegesConfigReq
- type UpdateQuestionResp
- type UpdateReactionReq
- type UpdateReviewReq
- type UpdateSMTPConfigReq
- type UpdateTagListReq
- type UpdateTagReq
- type UpdateTagResp
- type UpdateTagSynonymReq
- type UpdateUserInterfaceRequest
- type UpdateUserNotificationConfigReq
- type UpdateUserPasswordReq
- type UpdateUserPluginConfigReq
- type UpdateUserPluginReq
- type UpdateUserRoleReq
- type UpdateUserStatusReq
- type UserAnswerInfo
- type UserBasicInfo
- type UserCenterAdminFunctionAgentResp
- type UserCenterAgentResp
- type UserCenterPersonalBranding
- type UserCenterUserSettingsResp
- type UserChangeEmailSendCodeReq
- type UserChangeEmailVerifyReq
- type UserEmailLoginReq
- type UserExternalLoginResp
- type UserLoginResp
- type UserModifyPasswordReq
- type UserQuestionInfo
- type UserRankingResp
- type UserRankingSimpleInfo
- type UserRePassWordRequest
- type UserRegisterReq
- type UserRetrievePassWordRequest
- type UserSettingAgent
- type UserUnsubscribeNotificationReq
- type UserVerifyEmailReq
- type UserVerifyEmailSendReq
- type VoteActivity
- type VoteOperationInfo
- type VoteReq
- type VoteResp
Constants ¶
const ( AnswerAcceptedFailed = 1 AnswerAcceptedEnable = 2 )
const ( CGDefault = 1 CGDIY = 2 )
const ( DashboardCacheKey = "answer:dashboard" DashboardCacheTime = 60 * time.Minute )
const ( ForbiddenReasonTypeInactive = "inactive" ForbiddenReasonTypeURLExpired = "url_expired" ForbiddenReasonTypeUserSuspended = "suspended" )
const ( NotificationTypeInbox = 1 NotificationTypeAchievement = 2 NotificationNotRead = 1 NotificationRead = 2 NotificationStatusNormal = 1 NotificationStatusDelete = 10 NotificationInboxTypeAll = 0 NotificationInboxTypePosts = 1 NotificationInboxTypeVotes = 2 NotificationInboxTypeInvites = 3 )
const ( QuestionOperationPin = "pin" QuestionOperationUnPin = "unpin" QuestionOperationHide = "hide" QuestionOperationShow = "show" )
const ( QuestionOrderCondNewest = "newest" QuestionOrderCondActive = "active" QuestionOrderCondHot = "hot" QuestionOrderCondScore = "score" QuestionOrderCondUnanswered = "unanswered" QuestionOrderCondRecommend = "recommend" QuestionOrderCondFrequent = "frequent" // HotInDays limit max days of the hottest question HotInDays = 90 )
const ( QuestionPageRespOperationTypeAsked = "asked" QuestionPageRespOperationTypeAnswered = "answered" QuestionPageRespOperationTypeModified = "modified" )
const RevisionAuditApprove = "approve"
    const RevisionAuditReject = "reject"
    Variables ¶
var ( DefaultPrivilegeOptions PrivilegeOptions DefaultCustomPrivilegeOption *PrivilegeOption )
var AppStartTime time.Time
    var BadgeStatusEMap = map[BadgeStatus]int8{ BadgeStatusActive: entity.BadgeStatusActive, BadgeStatusInactive: entity.BadgeStatusInactive, }
var BadgeStatusMap = map[int8]BadgeStatus{ entity.BadgeStatusActive: BadgeStatusActive, entity.BadgeStatusInactive: BadgeStatusInactive, }
var ErrTypeAlert = ErrTypeData{ErrType: "alert"}
    var ErrTypeModal = ErrTypeData{ErrType: "modal"}
    var ErrTypeToast = ErrTypeData{ErrType: "toast"}
    var GetThemeOptions = []*ThemeOption{
	{
		Label: "Default",
		Value: "default",
	},
}
    var NotificationInboxType = map[string]int{ "all": NotificationInboxTypeAll, "posts": NotificationInboxTypePosts, "invites": NotificationInboxTypeInvites, "votes": NotificationInboxTypeVotes, }
var NotificationType = map[string]int{ "inbox": NotificationTypeInbox, "achievement": NotificationTypeAchievement, }
Functions ¶
func ReplaceSearchContent ¶
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 ActionRecordResp ¶
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:"-"`
	IP        string `json:"-"`
	UserAgent string `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
type AddTagResp ¶
type AddTagResp struct {
	SlugName string `json:"slug_name"`
}
    AddTagResp add tag response
type AddUserReq ¶
type AddUserReq struct {
	DisplayName string `validate:"required,gte=2,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 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 ¶
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 ¶
type BadgeStatus string
const ( BadgeStatusActive BadgeStatus = "active" BadgeStatusInactive BadgeStatus = "inactive" )
type BadgeTplData ¶
type BadgeTplData struct {
	ProfileURL string
}
    type ChangeEmailTemplateData ¶
type CheckCanQuestionUpdate ¶
type CloseQuestionMeta ¶
type CloseQuestionReq ¶
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 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 ConnectorUserInfoResp ¶
type ControlCenter ¶
type DashboardInfo ¶
type DashboardInfo struct {
	QuestionCount         int64                `json:"question_count"`
	ResolvedCount         int64                `json:"resolved_count"`
	ResolvedRate          string               `json:"resolved_rate"`
	UnansweredCount       int64                `json:"unanswered_count"`
	UnansweredRate        string               `json:"unanswered_rate"`
	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 DeletePermanentlyReq ¶ added in v1.4.5
type DeletePermanentlyReq struct {
	Type string `validate:"required,oneof=users questions answers" json:"type"`
}
    DeletePermanentlyReq delete permanently request
type EditUserProfileReq ¶
type EditUserProfileReq struct {
	UserID      string `validate:"required" json:"user_id"`
	DisplayName string `validate:"required,gte=2,lte=30" json:"display_name"`
	Username    string `validate:"omitempty,gte=2,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 ¶
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
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 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 GetAnswerInfoResp ¶ added in v1.6.0
type GetAnswerInfoResp struct {
	Info     *AnswerInfo       `json:"info"`
	Question *QuestionInfoResp `json:"question"`
}
    type GetBadgeAwardWithPageReq ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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           []ManifestJsonIcon `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 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"`
	// suspended until timestamp
	SuspendedUntil int64 `json:"suspended_until"`
}
    GetOtherUserInfoByUsernameResp get user response
func (*GetOtherUserInfoByUsernameResp) ConvertFromUserEntity ¶
func (r *GetOtherUserInfoByUsernameResp) ConvertFromUserEntity(userInfo *entity.User)
func (*GetOtherUserInfoByUsernameResp) ConvertFromUserEntityWithLang ¶ added in v1.6.0
func (r *GetOtherUserInfoByUsernameResp) ConvertFromUserEntityWithLang(ctx context.Context, 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
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 GetPrivilegesConfigResp ¶
type GetPrivilegesConfigResp struct {
	Options       []*PrivilegeOption `json:"options"`
	SelectedLevel PrivilegeLevel     `json:"selected_level"`
}
    GetPrivilegesConfigResp get privileges config response
type GetQuestionLinkReq ¶
type GetQuestionLinkReq struct {
	Page       int    `validate:"omitempty,min=1" form:"page"`
	PageSize   int    `validate:"omitempty,min=1,max=100" form:"page_size"`
	QuestionID string `validate:"required" form:"question_id"`
	OrderCond  string `validate:"omitempty,oneof=newest active hot score unanswered recommend frequent" form:"order"`
	InDays     int    `validate:"omitempty,min=1" form:"in_days"`
	LoginUserID string `json:"-"`
}
    type GetQuestionLinkResp ¶
type GetQuestionLinkResp struct {
	QuestionPageResp
}
    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 ¶
type GetReactionByObjectIdResp struct {
	ReactionSummary []*ReactionRespItem `json:"reaction_summary"`
}
    GetReactionByObjectIdResp get reaction by object id response
type GetReactionReq ¶
type GetReportListPageDTO ¶
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 ¶
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 ¶
func (r *GetReviewingTypeReq) GetCanReviewObjectTypes() []int
type GetReviewingTypeResp ¶
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 ¶
type GetTagBasicResp struct {
	TagID       string `json:"tag_id"`
	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:"-"`
	CanMerge   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 GetUnreviewedPostPageReq ¶
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 ¶
func (r *GetUnreviewedPostPageReq) Check() (errField []*validator.FormErrorField, err error)
type GetUnreviewedPostPageResp ¶
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 ¶
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 GetUserInfoReq ¶
type GetUserInfoReq struct {
	UserID string `validate:"required" json:"user_id"`
}
    GetUserInfoReq get user request
type GetUserInfoResp ¶
type GetUserInfoResp struct {
	// suspended until
	SuspendedUntil time.Time `json:"suspended_until"`
}
    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"`
	// suspended until time
	SuspendedUntil int64 `json:"suspended_until"`
	// 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 ¶
type GetUserPluginConfigResp ¶
type GetUserPluginConfigResp struct {
	Name         string         `json:"name"`
	SlugName     string         `json:"slug_name"`
	ConfigFields []*ConfigField `json:"config_fields"`
}
    func (*GetUserPluginConfigResp) SetConfigFields ¶
func (g *GetUserPluginConfigResp) SetConfigFields(ctx *gin.Context, fields []plugin.ConfigField)
type GetUserPluginListResp ¶
type GetUserStaffReq ¶
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 ¶
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 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 ManifestJsonIcon ¶ added in v1.4.5
type ManifestJsonIcon struct {
	Src   string `json:"src"`
	Sizes string `json:"sizes"`
	Type  string `json:"type"`
}
    func CreateManifestJsonIcons ¶ added in v1.4.5
func CreateManifestJsonIcons(icon string) []ManifestJsonIcon
type MergeTagReq ¶ added in v1.5.0
type MergeTagReq struct {
	// source tag id
	SourceTagID string `validate:"required" json:"source_tag_id"`
	// target tag id
	TargetTagID string `validate:"required" json:"target_tag_id"`
	// user id
	UserID string `json:"-"`
}
    MergeTagReq merge tag request
type NewAnswerTemplateData ¶
type NewCommentTemplateData ¶
type NewQuestionTemplateData ¶
type NotificationChannelConfig ¶
type NotificationChannelConfig struct {
	Key    constant.NotificationChannelKey `json:"key"`
	Enable bool                            `json:"enable"`
}
    func NewNotificationChannelConfigFormJson ¶
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 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 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 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 PassResetTemplateData ¶
type PassReviewActivity ¶
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 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:"gte=0,lte=65535" json:"content"`
	// html
	HTML string `json:"-"`
	// tags
	Tags []*TagItem `validate:"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:"gte=0,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:"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 ¶
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 frequent" 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 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 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:"gte=0,lte=65535" json:"content"`
	// html
	HTML       string   `json:"-"`
	InviteUser []string `validate:"omitempty"  json:"invite_user"`
	// tags
	Tags []*TagItem `validate:"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 ReactionRespItem ¶
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 ¶
ReactionSummaryMeta reaction summary meta
type ReactionsSummaryMeta ¶
type ReactionsSummaryMeta struct {
	Reactions []*ReactionSummaryMeta `json:"reactions"`
}
    ReactionsSummaryMeta reactions summary meta
func (*ReactionsSummaryMeta) AddReactionSummary ¶
func (r *ReactionsSummaryMeta) AddReactionSummary(emoji, userID string)
AddReactionSummary add user operation to reaction summary
func (*ReactionsSummaryMeta) CheckUserInReactionSummary ¶
func (r *ReactionsSummaryMeta) CheckUserInReactionSummary(emoji, userID string) bool
CheckUserInReactionSummary check user's operation if in reaction summary
func (*ReactionsSummaryMeta) RemoveReactionSummary ¶
func (r *ReactionsSummaryMeta) RemoveReactionSummary(emoji, userID string)
RemoveReactionSummary remove user operation from reaction summary
type ReasonItem ¶
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 ¶
type RedDotBadgeAwardCache ¶
type RedDotBadgeAwardCache struct {
	BadgeAwardList map[string]*RedDotBadgeAward `json:"badge_award_list"`
}
    func NewRedDotBadgeAwardCache ¶
func NewRedDotBadgeAwardCache() *RedDotBadgeAwardCache
NewRedDotBadgeAwardCache new red dot badge award cache
func (*RedDotBadgeAwardCache) AddBadgeAward ¶
func (r *RedDotBadgeAwardCache) AddBadgeAward(badgeAward *RedDotBadgeAward)
AddBadgeAward add badge award
func (*RedDotBadgeAwardCache) FromJSON ¶
func (r *RedDotBadgeAwardCache) FromJSON(data string)
FromJSON from json
func (*RedDotBadgeAwardCache) GetBadgeAward ¶
func (r *RedDotBadgeAwardCache) GetBadgeAward() *RedDotBadgeAward
GetBadgeAward get badge award
func (*RedDotBadgeAwardCache) RemoveBadgeAward ¶
func (r *RedDotBadgeAwardCache) RemoveBadgeAward(notificationID string)
RemoveBadgeAward remove badge award
func (*RedDotBadgeAwardCache) ToJSON ¶
func (r *RedDotBadgeAwardCache) ToJSON() string
ToJSON to json
type RegisterTemplateData ¶
type RemoteVersion ¶
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 ¶
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 ¶
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:"-"`
}
    type SearchDescResp ¶
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 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 ¶
func (s *SimpleObjectInfo) IsDeleted() bool
IsDeleted is deleted
type SiteBrandingReq ¶
type SiteBrandingReq struct {
	Logo       string `validate:"omitempty,gt=0,lte=512" form:"logo" json:"logo"`
	MobileLogo string `validate:"omitempty,gt=0,lte=512" form:"mobile_logo" json:"mobile_logo"`
	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"`
	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 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"`
	Legal         *SiteLegalSimpleResp   `json:"site_legal"`
	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"`
	DefaultAvatar   string `validate:"required,oneof=system gravatar" json:"default_avatar"`
	GravatarBaseURL string `validate:"omitempty" json:"gravatar_base_url"`
}
    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"`
	ExternalContentDisplay     string `validate:"required,oneof=always_display ask_before_display" json:"external_content_display"`
}
    SiteLegalReq site branding request
type SiteLegalSimpleResp ¶ added in v1.4.5
type SiteLegalSimpleResp struct {
	ExternalContentDisplay string `validate:"required,oneof=always_display ask_before_display" json:"external_content_display"`
}
    SiteLegalSimpleResp 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 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 SiteSeoReq ¶
type SiteSeoResp ¶
type SiteSeoResp SiteSeoReq
SiteSeoResp site write response
func (*SiteSeoResp) IsShortLink ¶
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 SiteWriteReq ¶
type SiteWriteReq struct {
	MinimumContent                 int             `validate:"omitempty,gte=0,lte=65535" json:"min_content"`
	RestrictAnswer                 bool            `validate:"omitempty" json:"restrict_answer"`
	MinimumTags                    int             `validate:"omitempty,gte=0,lte=5" json:"min_tags"`
	RequiredTag                    bool            `validate:"omitempty" json:"required_tag"`
	RecommendTags                  []*SiteWriteTag `validate:"omitempty,dive" json:"recommend_tags"`
	ReservedTags                   []*SiteWriteTag `validate:"omitempty,dive" json:"reserved_tags"`
	MaxImageSize                   int             `validate:"omitempty,gt=0" json:"max_image_size"`
	MaxAttachmentSize              int             `validate:"omitempty,gt=0" json:"max_attachment_size"`
	MaxImageMegapixel              int             `validate:"omitempty,gt=0" json:"max_image_megapixel"`
	AuthorizedImageExtensions      []string        `validate:"omitempty" json:"authorized_image_extensions"`
	AuthorizedAttachmentExtensions []string        `validate:"omitempty" json:"authorized_attachment_extensions"`
	UserID                         string          `json:"-"`
}
    SiteWriteReq site write request
type SiteWriteResp ¶
type SiteWriteResp SiteWriteReq
SiteWriteResp site write response
func (*SiteWriteResp) GetMaxAttachmentSize ¶
func (s *SiteWriteResp) GetMaxAttachmentSize() int64
func (*SiteWriteResp) GetMaxImageMegapixel ¶
func (s *SiteWriteResp) GetMaxImageMegapixel() int
func (*SiteWriteResp) GetMaxImageSize ¶
func (s *SiteWriteResp) GetMaxImageSize() int64
type SiteWriteTag ¶
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 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 ¶
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 ¶
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 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,gte=2,lte=30" json:"display_name"`
	Username    string     `validate:"omitempty,gte=2,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 UpdatePluginStatusReq ¶
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 ¶
type UpdateReviewReq ¶
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 ¶
func (r *UpdateReviewReq) IsApprove() bool
func (*UpdateReviewReq) IsReject ¶
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 ¶
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 UpdateUserPluginReq ¶
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"`
	SuspendDuration  string `validate:"omitempty,oneof=24h 48h 72h 7d 14d 1m 2m 3m 6m 1y forever" json:"suspend_duration"`
	RemoveAllContent bool   `validate:"omitempty" json:"remove_all_content"`
	LoginUserID      string `json:"-"`
}
    UpdateUserStatusReq update user request
func (*UpdateUserStatusReq) GetSuspendedUntil ¶ added in v1.6.0
func (r *UpdateUserStatusReq) GetSuspendedUntil() time.Time
GetSuspendedUntil calculates the suspended until time based on duration
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"`
	SuspendedUntil int64  `json:"suspended_until"`
}
    type UserCenterAgentResp ¶
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 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"`
	// suspended until timestamp
	SuspendedUntil int64 `json:"suspended_until"`
}
    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,gte=2,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 UserSettingAgent ¶
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 VoteActivity ¶
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
       Source Files
      ¶
      Source Files
      ¶
    
- activity.go
- answer_activity_schema.go
- answer_schema.go
- backyard_user_schema.go
- badge_schema.go
- collection_group_schema.go
- comment_schema.go
- config_schema.go
- connector_schema.go
- dashboard_schema.go
- email_template.go
- err_schema.go
- event_schema.go
- follow_schema.go
- forbidden_schema.go
- meta_schema.go
- new_question_queue_schema.go
- notification_schema.go
- permission.go
- plugin_admin_schema.go
- plugin_user_center.go
- plugin_user_schema.go
- question_schema.go
- rank_schema.go
- reason_schema.go
- render_schema.go
- report_schema.go
- review_schema.go
- revision_schema.go
- role_schema.go
- search_schema.go
- simple_obj_info_schema.go
- siteinfo_schema.go
- sitemap_schema.go
- tag_list_schema.go
- tag_schema.go
- template_schema.go
- theme_schema.go
- user_external_login_schema.go
- user_notification_schema.go
- user_schema.go
- vote_schema.go