api

package
v0.2.51 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: MIT Imports: 69 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCategoryModerator added in v0.2.36

func AddGlobalModerator added in v0.2.38

func BadgeList added in v0.2.2

func BookmarkTopic added in v0.2.49

func ChangePassword

ChangePassword updates the current user's password.

func CreatePost added in v0.2.49

func DeleteBadge added in v0.2.2

func DeleteCategory

func DeleteCategory(req component.BetterRequest[struct {
	Id uint64 `json:"id"`
}]) component.Response

DeleteCategory 删除分类

func DeleteCategoryModerator added in v0.2.36

func DeleteCategoryModerator(req component.BetterRequest[struct {
	Id uint64 `json:"id" validate:"required"`
}]) component.Response

func DeleteGlobalModerator added in v0.2.38

func DeleteGlobalModerator(req component.BetterRequest[struct {
	Id uint64 `json:"id" validate:"required"`
}]) component.Response

func DeletePost added in v0.2.49

func DeleteTopic added in v0.2.49

func EditTopic added in v0.2.49

EditTopic updates topic moderation status.

func EditTopicCategories added in v0.2.49

EditTopicCategories updates topic categories.

func EditTopicPin added in v0.2.49

func EditUserEmail

EditUserEmail updates the current user's email and resets activation state.

func EditUserInfo

EditUserInfo updates the current user's profile fields.

func EditUserProfileCover added in v0.2.17

EditUserProfileCover updates the current user's profile cover.

func EditUsername

EditUsername updates the current user's username.

func FileResourcePage added in v0.2.46

func FollowUser added in v0.2.49

func ForgotPassword

ForgotPassword 忘记密码 - 发送重置邮件

func GetAnnouncement

GetAnnouncement 获取公告设置

func GetCategoryList

GetCategoryList 获取分类列表

func GetFileByFileName

func GetFileByFileName(c *gin.Context)

func GetGlobalModeratorList added in v0.2.38

func GetGlobalModeratorList(req component.BetterRequest[struct{}]) component.Response

func GetHttpNotifySettings added in v0.2.39

func GetHttpNotifySettings(req component.BetterRequest[component.Null]) component.Response

func GetMailSettings

GetMailSettings 获取邮件设置

func GetMessages added in v0.1.1

GetMessages 获取消息记录

func GetOAuthBindings added in v0.2.49

func GetOAuthBindings(req component.BetterRequest[component.Null]) component.Response

GetOAuthBindings 获取用户的OAuth绑定状态

func GetPostingSettings added in v0.1.1

func GetPostingSettings(req component.BetterRequest[component.Null]) component.Response

GetPostingSettings 获取发布内容设置

func GetSecuritySettings added in v0.1.1

func GetSecuritySettings(req component.BetterRequest[component.Null]) component.Response

GetSecuritySettings 获取安全与注册设置

func GetSiteChrome added in v0.2.45

func GetSiteSettings

GetSiteSettings 获取站点设置

func GetSiteStatistics added in v0.2.49

func GetSiteStatistics() component.Response

func GetSiteTheme added in v0.2.23

func GetSponsors

GetSponsors 获取赞助商配置

func GetTrafficOverview added in v0.1.1

func GetUnreadStatus added in v0.2.2

func GetUserCard added in v0.1.1

func LikeTopic added in v0.2.49

func Login added in v0.2.49

func Login(c *gin.Context)

Login 处理登录请求

func LoginPublicKey added in v0.2.49

func LoginPublicKey(c *gin.Context)

func Logout added in v0.2.49

func Logout(c *gin.Context)

func MarkAllAsRead

MarkAllAsRead 标记所有通知为已读

func MarkAsRead

MarkAsRead 标记通知为已读

func MarkChatRead added in v0.1.1

MarkChatRead 标记已读

func NotificationList added in v0.2.12

func ProviderCallback added in v0.2.49

func ProviderCallback(c *gin.Context)

ProviderCallback 处理OAuth登录/绑定回调(根据登录状态自动判断)

func ProviderLogin added in v0.2.49

func ProviderLogin(c *gin.Context)

ProviderLogin 开始OAuth登录/绑定流程(根据登录状态自动判断)

func PublishSiteTheme added in v0.2.23

func PublishSiteTheme(req component.BetterRequest[component.Null]) component.Response

func Register added in v0.2.49

func Register(c *gin.Context)

Register 注册

func ResendActivationEmail added in v0.2.14

func ResendActivationEmail(req component.BetterRequest[component.Null]) component.Response

func ResetPassword

ResetPassword 重置密码

func SaveAdminImgByGinContext added in v0.2.38

func SaveAdminImgByGinContext(c *gin.Context)

func SaveAnnouncement

SaveAnnouncement 保存公告设置

func SaveBadge added in v0.2.2

func SaveCategory

SaveCategory 保存分类

SaveFriendLinks 保存友情链接

func SaveHttpNotifySettings added in v0.2.39

func SaveImgByGinContext

func SaveImgByGinContext(c *gin.Context)

SaveImgByGinContext handles image uploads with size and content checks.

func SaveMailSettings

SaveMailSettings 保存邮件设置

func SavePostingSettings added in v0.1.1

SavePostingSettings 保存发布内容设置

func SaveSecuritySettings added in v0.1.1

SaveSecuritySettings 保存安全与注册设置

func SaveSiteChrome added in v0.2.45

func SaveSiteSettings

SaveSiteSettings 保存站点设置

func SaveSiteTheme added in v0.2.23

func SaveSponsors

SaveSponsors 保存赞助商配置

func SaveUserBadges added in v0.2.2

func SendMessage added in v0.1.1

SendMessage 发送私信

func ServerVersion added in v0.2.6

func SetPresetAvatar added in v0.2.35

SetPresetAvatar switches the current user to a built-in avatar.

func TestMailConnection

TestMailConnection 测试邮件连接

func TopicSource added in v0.2.49

func TopicsList added in v0.2.49

func UnbindOAuth added in v0.2.49

UnbindOAuth 解绑OAuth账户

func UpdatePost added in v0.2.49

func UpdateTopicStatus added in v0.2.49

func UploadAvatar

func UploadAvatar(c *gin.Context)

UploadAvatar stores a new avatar for the current user.

func UserBadgeOptions added in v0.2.2

func WatchTopic added in v0.2.49

func WearBadge added in v0.2.43

func WriteTopic added in v0.2.49

WriteTopic creates or updates a topic and its first post.

Types

type AddCategoryModeratorReq added in v0.2.36

type AddCategoryModeratorReq struct {
	CategoryId uint64 `json:"categoryId" validate:"required"`
	UserId     uint64 `json:"userId"`
	Username   string `json:"username"`
}

type BadgeDeleteReq added in v0.2.2

type BadgeDeleteReq struct {
	Code string `json:"code"`
}

type BadgeSaveReq added in v0.2.2

type BadgeSaveReq = badgeservice.Badge

type BookmarkTopicReq added in v0.2.49

type BookmarkTopicReq struct {
	TopicId uint64 `json:"topicId"`
	Action  int    `json:"action" validate:"min=1,max=2"` // 1 收藏,2 取消
}

type CategoryItem

type CategoryItem struct {
	Id         uint64                  `json:"id"`
	Category   string                  `json:"category"`
	Desc       string                  `json:"desc"`
	Icon       string                  `json:"icon"`
	Color      string                  `json:"color"`
	Slug       string                  `json:"slug"`
	Sort       int                     `json:"sort"`
	Moderators []CategoryModeratorItem `json:"moderators"`
}

type CategoryListReq

type CategoryListReq struct {
	Page     int `json:"page"`
	PageSize int `json:"pageSize"`
}

type CategoryModeratorItem added in v0.2.36

type CategoryModeratorItem struct {
	Id        uint64 `json:"id"`
	UserId    uint64 `json:"userId"`
	Username  string `json:"username"`
	AvatarUrl string `json:"avatarUrl"`
	Status    int    `json:"status"`
}

type CategorySaveReq

type CategorySaveReq struct {
	Id       uint64 `json:"id"`
	Category string `json:"category" validate:"required"`
	Desc     string `json:"desc"`
	Icon     string `json:"icon"`
	Color    string `json:"color"`
	Slug     string `json:"slug"`
	Sort     int    `json:"sort"`
}

type ChangePasswordReq

type ChangePasswordReq struct {
	OldPassword string `json:"oldPassword" validate:"required"`
	NewPassword string `json:"newPassword" validate:"required"`
}

ChangePasswordReq is the password change request.

type CreatePostReq added in v0.2.49

type CreatePostReq struct {
	TopicId       uint64 `json:"topicId"`
	Content       string `json:"content"`
	ReplyToPostId uint64 `json:"replyToPostId"`
}

type DailyTraffic added in v0.1.1

type DailyTraffic struct {
	Date       string `json:"date"`
	RegCount   int64  `json:"regCount"`
	TopicCount int64  `json:"topicCount"`
	ReplyCount int64  `json:"replyCount"`
}

type DeletePostReq added in v0.2.49

type DeletePostReq struct {
	PostId uint64 `json:"postId"`
}

type DeleteTopicReq added in v0.2.49

type DeleteTopicReq struct {
	TopicId uint64 `json:"topicId" validate:"required"`
}

type EditTopicCategoriesReq added in v0.2.49

type EditTopicCategoriesReq struct {
	TopicId    uint64   `json:"topicId" validate:"required"`
	CategoryId []uint64 `json:"categoryId" validate:"min=1,max=3"`
}

type EditTopicPinReq added in v0.2.49

type EditTopicPinReq struct {
	TopicId   uint64 `json:"topicId" validate:"required"`
	PinWeight int    `json:"pinWeight" validate:"min=0,max=1000000"`
}

type EditTopicReq added in v0.2.49

type EditTopicReq struct {
	TopicId       uint64 `json:"topicId" validate:"required"`
	ProcessStatus int8   `json:"processStatus" validate:"oneof=0 1"` // 0正常 1封禁
}

type EditUserEmailReq

type EditUserEmailReq struct {
	Email string `json:"email" validate:"required,email"`
}

type EditUserInfoReq

type EditUserInfoReq struct {
	Nickname            string                    `json:"nickname"`
	Bio                 string                    `json:"bio"`
	Signature           string                    `json:"signature"`
	Website             string                    `json:"website"`
	WebsiteName         string                    `json:"websiteName"`
	Locale              string                    `json:"locale,omitempty"`
	ExternalInformation users.ExternalInformation `json:"externalInformation"`
}

type EditUserProfileCoverReq added in v0.2.17

type EditUserProfileCoverReq struct {
	ProfileCoverUrl string `json:"profileCoverUrl"`
}

type EditUserReq

type EditUserReq struct {
	UserId   uint64 `json:"userId"`
	Status   int8   `json:"status"`
	Validate int8   `json:"validate"`
	RoleId   uint64 `json:"roleId"`
}

type EditUsernameReq

type EditUsernameReq struct {
	Username string `json:"username" validate:"required"`
}

type FileResourceItem added in v0.2.46

type FileResourceItem struct {
	filedata.FileResource
	UploaderUsername string `json:"uploaderUsername"`
}

type FileResourcePageReq added in v0.2.46

type FileResourcePageReq struct {
	Page     int `json:"page"`
	PageSize int `json:"pageSize"`
}

type FollowUserReq added in v0.2.49

type FollowUserReq struct {
	Id     uint64 `json:"id"`
	Action int    `json:"action" validate:"min=1,max=2"` // 1 关注,2 取消
}

type ForgotPasswordReq

type ForgotPasswordReq struct {
	Email       string `json:"email" validate:"required,email"`
	CaptchaId   string `json:"captchaId" validate:"required"`
	CaptchaCode string `json:"captchaCode" validate:"required"`
}

ForgotPasswordReq is the password reset email request.

type GetAllRoleItemReq

type GetAllRoleItemReq struct {
}

type GetMessagesReq added in v0.1.1

type GetMessagesReq struct {
	ConvId   uint64 `json:"convId" validate:"required"`
	BeforeId uint64 `json:"beforeId"`
	AfterId  uint64 `json:"afterId"`
	Limit    int    `json:"limit" validate:"omitempty,min=1,max=100"`
}

GetMessagesReq 获取消息记录请求

type GetUnreadCountReq

type GetUnreadCountReq struct{}

GetUnreadCountReq 获取未读数量请求

type GetUserCardReq added in v0.1.1

type GetUserCardReq struct {
	UserId uint64 `form:"userId" json:"userId" binding:"required"`
}

type LikeTopicReq added in v0.2.49

type LikeTopicReq struct {
	TopicId uint64 `json:"topicId"`
	Action  int    `json:"action" validate:"min=1,max=2"` // 1 点赞,2 取消
}

type LoginReq added in v0.2.49

type LoginReq struct {
	Username          string `json:"username" validate:"required"` // 可以是用户名或邮箱
	EncryptedPassword string `json:"encryptedPassword" validate:"required"`
	CaptchaId         string `json:"captchaId"`
	CaptchaCode       string `json:"captchaCode"`
}

type MarkAllAsReadReq

type MarkAllAsReadReq struct{}

MarkAllAsReadReq 标记所有通知已读请求

type MarkAsReadReq

type MarkAsReadReq struct {
	NotificationId uint64 `json:"notificationId" validate:"required"`
}

MarkAsReadReq 标记通知已读请求

type MarkReadReq added in v0.1.1

type MarkReadReq struct {
	ConvId uint64 `json:"convId" validate:"required"`
}

MarkReadReq 标记已读请求

type ModeratorUserReq added in v0.2.38

type ModeratorUserReq struct {
	UserId   uint64 `json:"userId"`
	Username string `json:"username"`
}

type NotificationListReq added in v0.2.12

type NotificationListReq struct {
	Filter string `form:"filter"`
	Cursor uint64 `form:"cursor"`
	Limit  int    `form:"limit"`
}

type NotificationListResp added in v0.2.12

type NotificationListResp struct {
	Items       []forumcontroller.NotificationPayload `json:"items"`
	NextCursor  uint64                                `json:"nextCursor"`
	HasNext     bool                                  `json:"hasNext"`
	UnreadCount int64                                 `json:"unreadCount"`
}

type OptRecordPageReq

type OptRecordPageReq struct {
	Page       int    `json:"page"`
	PageSize   int    `json:"pageSize"`
	OptUserId  uint64 `json:"optUserId"`
	OptType    int    `json:"optType"`
	TargetType int    `json:"targetType"`
	TargetId   int    `json:"targetId"`
}

type PermissionItem

type PermissionItem struct {
	Id   uint64 `json:"id"`
	Name string `json:"name"`
}

type PermissionListReq

type PermissionListReq struct {
}

type ResetPasswordReq

type ResetPasswordReq struct {
	Token       string `json:"token" validate:"required"`
	NewPassword string `json:"newPassword" validate:"required"`
}

ResetPasswordReq is the password reset confirmation request.

type RoleItem

type RoleItem struct {
	RoleId      uint64           `json:"roleId"`
	RoleName    string           `json:"roleName"`
	Effective   int              `json:"effective"`
	Permissions []PermissionItem `json:"permissions"`
	CreateTime  string           `json:"createTime"`
}

type RoleListReq

type RoleListReq struct {
}

type RoleSaveDel

type RoleSaveDel struct {
	Id uint `json:"id"`
}

type RoleSaveReq

type RoleSaveReq struct {
	Id          uint     `json:"id"`
	RoleName    string   `json:"roleName" validate:"required"`
	Permissions []uint64 `json:"permissions" validate:"required,min=1,max=100"`
}

type SaveAnnouncementReq

type SaveAnnouncementReq struct {
	Settings pageConfig.AnnouncementConfig `json:"settings" validate:"required"`
}

type SaveFriendLinksReq

type SaveFriendLinksReq struct {
	LinksInfo []pageConfig.FriendLinksGroup `json:"linksInfo"`
}

type SaveHttpNotifySettingsReq added in v0.2.39

type SaveHttpNotifySettingsReq struct {
	Settings pageConfig.HttpNotifyConfig `json:"settings" validate:"required"`
}

type SaveMailSettingsReq

type SaveMailSettingsReq struct {
	Settings pageConfig.MailSettingsConfig `json:"settings" validate:"required"`
}

type SavePostingSettingsReq added in v0.1.1

type SavePostingSettingsReq struct {
	Settings pageConfig.PostingContent `json:"settings" validate:"required"`
}

type SaveSecuritySettingsReq added in v0.1.1

type SaveSecuritySettingsReq struct {
	Settings pageConfig.SecurityAndRegistration `json:"settings" validate:"required"`
}

type SaveSiteChromeReq added in v0.2.45

type SaveSiteChromeReq struct {
	Settings pageConfig.SiteChromeConfig `json:"settings"`
}

type SaveSiteSettingsReq

type SaveSiteSettingsReq struct {
	Settings pageConfig.SiteSettingsConfig `json:"settings"`
}

type SaveSiteThemeReq added in v0.2.23

type SaveSiteThemeReq struct {
	Settings pageConfig.SiteThemeConfig `json:"settings" validate:"required"`
}

type SaveSponsorsReq

type SaveSponsorsReq struct {
	SponsorsInfo pageConfig.SponsorsConfig `json:"sponsorsInfo"`
}

type SaveUserBadgesReq added in v0.2.2

type SaveUserBadgesReq struct {
	UserId     uint64   `json:"userId"`
	BadgeCodes []string `json:"badgeCodes"`
}

type SendMessageReq added in v0.1.1

type SendMessageReq struct {
	PeerId  uint64 `json:"peerId" validate:"required"`
	Content string `json:"content" validate:"required"`
	MsgType int8   `json:"msgType" validate:"oneof=1 2 3"` // 1: Text, 2: Image, 3: Voice
}

SendMessageReq 发送私信请求

type SetPresetAvatarReq added in v0.2.35

type SetPresetAvatarReq struct {
	AvatarUrl string `json:"avatarUrl" validate:"required"`
}

type TestMailConnectionReq

type TestMailConnectionReq struct {
	Settings  pageConfig.MailSettingsConfig `json:"settings" validate:"required"`
	TestEmail string                        `json:"testEmail" validate:"required,email"`
}

type TestMailConnectionResp

type TestMailConnectionResp struct {
	Success     bool                    `json:"success"`
	MessageCode component.MessageCode   `json:"messageCode"`
	Params      component.MessageParams `json:"params,omitempty"`
}

type TopicAdminBaseVo added in v0.2.49

type TopicAdminBaseVo struct {
	Id            uint64   `json:"id"`
	Title         string   `json:"title"`
	Description   string   `json:"description"`
	CategoryId    []uint64 `json:"categoryId"`
	UserId        uint64   `json:"userId"`
	TopicStatus   int8     `json:"topicStatus"`
	ProcessStatus int8     `json:"processStatus"`
	CreatedAt     string   `json:"createdAt"`
	UpdatedAt     string   `json:"updatedAt"`
}

type TopicInfoAdminVo added in v0.2.49

type TopicInfoAdminVo struct {
	TopicAdminBaseVo
	Username      string `json:"username"`
	UserAvatarUrl string `json:"userAvatarUrl"`
	ViewCount     uint64 `json:"viewCount"`
	ReplyCount    uint64 `json:"replyCount"`
	LikeCount     uint64 `json:"likeCount"`
	PinWeight     int    `json:"pinWeight"`
}

type TopicSourceReq added in v0.2.49

type TopicSourceReq struct {
	TopicId uint64 `json:"topicId" validate:"required"`
}

type TopicSourceVo added in v0.2.49

type TopicSourceVo struct {
	TopicAdminBaseVo
	Content string `json:"content"`
}

type TopicStatusReq added in v0.2.49

type TopicStatusReq struct {
	TopicId     uint64 `json:"topicId" validate:"required"`
	TopicStatus int8   `json:"topicStatus" validate:"oneof=0 1"`
}

type TopicsListReq added in v0.2.49

type TopicsListReq struct {
	Page     int    `form:"page"`
	PageSize int    `form:"pageSize"`
	Search   string `form:"search"`
	UserId   uint64 `form:"userId"`
}

type TrafficOverviewReq added in v0.1.1

type TrafficOverviewReq struct {
	StartDate string `json:"startDate"` // YYYY-MM-DD
	EndDate   string `json:"endDate"`   // YYYY-MM-DD
}

type UpdatePostReq added in v0.2.49

type UpdatePostReq struct {
	PostId  uint64 `json:"postId"`
	Content string `json:"content"`
}

type UserBadgeOptionsReq added in v0.2.2

type UserBadgeOptionsReq struct {
	UserId uint64 `json:"userId"`
}

type UserBadgeOptionsResp added in v0.2.2

type UserBadgeOptionsResp struct {
	Options []badgeservice.Badge     `json:"options"`
	Active  []badgeservice.UserBadge `json:"active"`
}

type UserItem

type UserItem struct {
	UserId         uint64                              `json:"userId"`
	Username       string                              `json:"username"`
	AvatarUrl      string                              `json:"avatarUrl"`
	Email          string                              `json:"email"`
	Status         int8                                `json:"status"`
	Validate       int8                                `json:"validate"`
	Prestige       int64                               `json:"prestige"`
	RoleList       []datastruct.Option[string, uint64] `json:"roleList"`
	RoleId         uint64                              `json:"roleId,omitempty"`
	CreateTime     string                              `json:"createTime"`
	LastActiveTime string                              `json:"lastActiveTime"`
	Badges         []badgeservice.UserBadge            `json:"badges"`
}

type UserListReq

type UserListReq struct {
	Username string `json:"username"`
	UserId   uint64 `json:"userId"`
	Email    string `json:"email"`
	Page     int    `json:"page"`
	PageSize int    `json:"pageSize"`
}

type WatchTopicReq added in v0.2.49

type WatchTopicReq struct {
	TopicId uint64 `json:"topicId"`
	Action  int    `json:"action" validate:"min=1,max=2"` // 1 关注,2 取消
}

type WearBadgeReq added in v0.2.43

type WearBadgeReq struct {
	BadgeCode string `json:"badgeCode"`
}

type WriteTopicReq added in v0.2.49

type WriteTopicReq struct {
	TopicId     uint64   `json:"topicId"`
	Content     string   `json:"content" validate:"required"`
	Title       string   `json:"title" validate:"required"`
	CategoryId  []uint64 `json:"categoryId" validate:"min=1,max=3"`
	TopicStatus int8     `json:"topicStatus" validate:"oneof=0 1"`
}

Jump to

Keyboard shortcuts

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