27 lines
653 B
Go
27 lines
653 B
Go
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"),
|
|
)
|
|
} |