Documentation
¶
Index ¶
- func Create(c *gin.Context)
- func Delete(c *gin.Context)
- func GetAll(c *gin.Context)
- func GetOne(c *gin.Context)
- func Redirect(c *gin.Context)
- func Router(route *gin.RouterGroup)
- func Update(c *gin.Context)
- type CreatedLinkResponse
- type CreatedLinkSerializer
- type LinkCreateValidator
- type LinkResponse
- type LinkSerializer
- type LinkUpdateUriValidator
- type LinkUpdateValidator
- type LinksSerializer
- type RedirectUriValidator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
Create godoc
@Summary Create new link @Schemes @Tags Links @Accept json @Produce json @Security BearerAuth @Param request body LinkCreateValidator true "Request Body" @Success 200 {object} CreatedLinkResponse @Failure 422 {object} utils.CommonValidationError @Failure 400 {object} utils.CommonError @Router /links [post]
func Delete ¶ added in v0.7.2
Update godoc
@Summary Delete link @Schemes @Tags Links @Accept json @Produce json @Security BearerAuth @Param linkId path string true "Link ID" @Success 204 "Empty response" @Failure 404 {object} utils.CommonError @Router /links/{linkId} [delete]
func GetAll ¶
GetAll godoc
@Summary Get all links for user @Schemes @Tags Links @Accept json @Produce json @Security BearerAuth @Param take query int false "Limit links per page" @Param page query int false "Page number" @Success 200 {object} db_utils.GetAllResponse{data=[]LinkResponse} @Router /links [get]
func GetOne ¶ added in v0.7.2
Update godoc
@Summary Get one link @Schemes @Tags Links @Accept json @Produce json @Security BearerAuth @Param linkId path string true "Link ID" @Success 204 {object} LinkResponse @Failure 404 {object} utils.CommonError @Router /links/{linkId} [get]
func Redirect ¶
Redirect godoc
@Summary Redirect from alias to realLink @Schemes @Tags Links @Accept json @Produce json @Param alias path string true "Short URL Alias" @Success 302 "Redirect" @Failure 404 {object} utils.CommonError @BasePath / @Router /{alias} [get]
func Router ¶
func Router(route *gin.RouterGroup)
func Update ¶
Update godoc
@Summary Update link @Schemes @Tags Links @Accept json @Produce json @Security BearerAuth @Param linkId path string true "Link ID" @Param request body LinkUpdateValidator true "Request Body" @Success 204 "Empty response" @Failure 422 {object} utils.CommonValidationError @Failure 404 {object} utils.CommonError @Router /links/{linkId} [patch]
Types ¶
type CreatedLinkResponse ¶
type CreatedLinkSerializer ¶
func (*CreatedLinkSerializer) Response ¶
func (s *CreatedLinkSerializer) Response() CreatedLinkResponse
type LinkCreateValidator ¶
type LinkCreateValidator struct { Name string `json:"name" binding:"max=150"` RealUrl string `json:"realUrl" binding:"required,url,min=5,max=2000"` }
func NewLinkCreateValidator ¶
func NewLinkCreateValidator() LinkCreateValidator
type LinkResponse ¶
type LinkSerializer ¶
func (*LinkSerializer) Response ¶
func (s *LinkSerializer) Response() LinkResponse
type LinkUpdateUriValidator ¶
type LinkUpdateUriValidator struct {
ID uint `json:"id" uri:"linkId"`
}
type LinkUpdateValidator ¶
type LinkUpdateValidator struct {
Name string `json:"name" binding:"max=150"`
}
func NewLinkUpdateValidator ¶
func NewLinkUpdateValidator() LinkUpdateValidator
type LinksSerializer ¶
type LinksSerializer struct { C *gin.Context Links []models.LinkModel TotalCount int64 Took int CurrentPage int }
func (*LinksSerializer) Response ¶
func (s *LinksSerializer) Response() db_utils.GetAllResponse
type RedirectUriValidator ¶
type RedirectUriValidator struct {
Alias string `json:"alias" uri:"alias"`
}
Click to show internal directories.
Click to hide internal directories.