handlers

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllowedHostsMiddleware added in v1.2.0

func AllowedHostsMiddleware() gin.HandlerFunc

检查当前请求的 Host 是否属于我们所设定的 Host 列表中的其中一个 如果不在设定列表中,则返回 HTTP Code 400 并中断后续逻辑的处理

func Authenticator

func Authenticator(f AuthAPIFunc) gin.HandlerFunc

func ChangePasswordAPI

func ChangePasswordAPI() gin.HandlerFunc

ChangePasswordAPI godoc @Security ApiKeyAuth @Summary 修改账号密码 @Description 修改账号密码 @Tags 账号 @Accept json @Produce json @Param body body models.ChangePasswordAPIRequest true "修改密码请求" @Success 200 {object} models.Response @Failure 401 @Router /user/change-password [post]

func CreateShortLinkAPI

func CreateShortLinkAPI() gin.HandlerFunc

CreateShortLinkAPI godoc @Security ApiKeyAuth @Summary 创建短链接 @Description 创建短链接 @Tags 短链接 @Accept json @Produce json @Param body body models.CreateShortLinkAPIRequest true "创建短链接请求" @Success 200 {object} models.Response{data=models.CreateShortLinkAPIResponseData} @Failure 401 @Router /short-link/ [post]

func DeleteShortLinkAPI

func DeleteShortLinkAPI() gin.HandlerFunc

DeleteShortLinkAPI godoc @Security ApiKeyAuth @Summary 删除短链接 @Description 删除短链接 @Tags 短链接 @Accept json @Produce json @Param id path string true "短链接 ID" @Success 200 {object} models.Response @Failure 401 @Router /short-link/{id} [delete]

func GetConfigAPI added in v1.4.1

func GetConfigAPI(c *gin.Context)

GetConfigAPI godoc @Security ApiKeyAuth @Summary 获取系统配置信息 @Description 获取系统配置信息 @Tags 系统配置 @Accept json @Produce json @Success 200 {object} models.Response{data=models.GetConfigAPIResponseData} @Failure 401 @Router /config [get]

func GetShortLinkAPI

func GetShortLinkAPI() gin.HandlerFunc

GetShortLinkAPI godoc @Security ApiKeyAuth @Summary 获取指定 ID 短链接 @Description 获取系统配置信息 @Tags 短链接 @Accept json @Produce json @Param id path string true "短链接 ID" @Success 200 {object} models.Response{data=models.GetShortLinkAPIResponseData} @Failure 401 @Router /short-link/{id} [get]

func GetUserInfoAPI

func GetUserInfoAPI() gin.HandlerFunc

GetUserInfoAPI godoc @Security ApiKeyAuth @Summary 获取账号信息 @Description 获取账号信息 @Tags 账号 @Accept json @Produce json @Success 200 {object} models.Response{data=models.GetUserInfoAPIResponseData} @Failure 401 @Router /user/info [get]

func JWTAuthenticatorMiddleware

func JWTAuthenticatorMiddleware() gin.HandlerFunc

func LandingHome added in v1.2.0

func LandingHome(c *gin.Context)

func ListShortLinksAPI

func ListShortLinksAPI() gin.HandlerFunc

ListShortLinksAPI godoc @Security ApiKeyAuth @Summary 短链接列表 @Description 短链接列表 @Tags 短链接 @Accept json @Produce json @Param page query int false "页码" @Param pageSize query int false "每页条数" @Success 200 {object} models.Response{data=models.ListShortLinksAPIResponseData} @Failure 401 @Router /short-link/ [get]

func LoginAPI added in v1.4.1

func LoginAPI(c *gin.Context)

LoginAPI godoc @Summary 账号登入 @Description 账号密码登入 @Tags 账号 @Accept json @Produce json @Param body body models.LoginAPIRequest true "登入请求" @Success 200 {object} models.Response{data=models.LoginAPIResponseData} @Router /user/login [post]

func LogoutAPI

func LogoutAPI() gin.HandlerFunc

LogoutAPI godoc @Security ApiKeyAuth @Summary 登出 @Description 登出 @Tags 账号 @Accept json @Produce json @Success 200 {object} models.Response @Failure 401 @Router /user/logout [post]

func Redirect

func Redirect(c *gin.Context)

func ShortLinkActionAPI

func ShortLinkActionAPI() gin.HandlerFunc

ShortLinkDataAPI godoc @Security ApiKeyAuth @Summary 短链接访问数据 @Description 可查询短链接某个日期范围内的访问数据 @Tags 短链接 @Accept json @Produce json @Param id path string true "短链接 ID" @Param startDate query string true "开始日期 YYYY-mm-dd" @Param endDate query string true "结束日期 YYYY-mm-dd" @Success 200 {object} models.Response{data=models.ShortLinkDataAPIResponseData} @Failure 401 @Router /short-link/{id}/data [get]

func UpdateIdLengthConfigAPI added in v1.2.0

func UpdateIdLengthConfigAPI() gin.HandlerFunc

UpdateIdLengthConfigAPI godoc @Security ApiKeyAuth @Summary 更新短链接 ID 设置 @Description 更新短链接 ID 设置 @Tags 系统配置 @Accept json @Produce json @Param body body config.IdConfig true "更新短链接 ID 设置请求" @Success 200 {object} models.Response{data=models.GetConfigAPIResponseData} @Failure 401 @Router /config/id-length [patch]

func UpdateLandingHostsAPI

func UpdateLandingHostsAPI() gin.HandlerFunc

UpdateLandingHostsAPI godoc @Security ApiKeyAuth @Summary 更新落地页 Hosts @Description 更新落地页 Hosts @Tags 系统配置 @Accept json @Produce json @Param body body models.UpdateLandingHostsAPIRequest true "更新落地页 Hosts 请求" @Success 200 {object} models.Response{data=models.GetConfigAPIResponseData} @Failure 401 @Router /config/landing-hosts [patch]

func UpdateShortLinkAPI

func UpdateShortLinkAPI() gin.HandlerFunc

UpdateShortLinkAPI godoc @Security ApiKeyAuth @Summary 更新短链接 @Description 更新短链接 @Tags 短链接 @Accept json @Produce json @Param id path string true "短链接 ID" @Param body body models.UpdateShortLinkAPIRequest true "更新短链接请求" @Success 200 {object} models.Response{data=models.UpdateShortLinkAPIResponseData} @Failure 401 @Router /short-link/{id} [patch]

func UpdateShortLinkNotFoundConfigAPI added in v1.2.0

func UpdateShortLinkNotFoundConfigAPI() gin.HandlerFunc

UpdateShortLinkNotFoundConfigAPI godoc @Security ApiKeyAuth @Summary 更新短链接 404 设置 @Description 更新短链接 404 设置 @Tags 系统配置 @Accept json @Produce json @Param body body config.ShortLinkNotFoundConfig true "更新短链接 404 设置请求" @Success 200 {object} models.Response{data=models.GetConfigAPIResponseData} @Failure 401 @Router /config/short-link-404-handling [patch]

Types

type AuthAPIFunc

type AuthAPIFunc func(c *gin.Context, user *models.User)

Jump to

Keyboard shortcuts

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