gitea-issue/controller/label.go

27 lines
653 B
Go
Raw Normal View History

2019-12-04 18:06:35 +00:00
package controller
import (
"code.gitea.io/sdk/gitea"
"gitea-issue/giteaClient"
"github.com/gin-gonic/gin"
"github.com/savaki/swag/endpoint"
"github.com/savaki/swag/swagger"
"net/http"
)
func GetLabels(c *gin.Context) {
labels, err := giteaClient.GetLabels()
if err != nil {
c.AbortWithStatus(http.StatusNotFound)
}
c.AsciiJSON(http.StatusOK, labels)
}
func GetLabelsSwagger() (*swagger.Endpoint){
return endpoint.New("get", "/labels", "List project labels",
endpoint.Handler(GetLabels),
endpoint.Description("Get all labels"),
endpoint.Tags("labels"),
endpoint.Response(http.StatusOK, []gitea.Label{}, "Gitea labels list"),
)
}