aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo/label.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2016-11-24 15:04:31 +0800
committerGitHub <noreply@github.com>2016-11-24 15:04:31 +0800
commit3917ed45de063b4e8868610c82d8172020d572fd (patch)
tree052b7651cbb64ae30f92efe87441ad1d4fa2d922 /routers/api/v1/repo/label.go
parent3a3782bb7fed768c1e832ff4c0a77f2f5281ed05 (diff)
downloadgitea-3917ed45de063b4e8868610c82d8172020d572fd.tar.gz
gitea-3917ed45de063b4e8868610c82d8172020d572fd.zip
golint fixed for routers (#208)
Diffstat (limited to 'routers/api/v1/repo/label.go')
-rw-r--r--routers/api/v1/repo/label.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/routers/api/v1/repo/label.go b/routers/api/v1/repo/label.go
index 009e8d8a0b..383868beda 100644
--- a/routers/api/v1/repo/label.go
+++ b/routers/api/v1/repo/label.go
@@ -11,6 +11,7 @@ import (
"code.gitea.io/gitea/modules/context"
)
+// ListLabels list all the labels of a repository
func ListLabels(ctx *context.APIContext) {
labels, err := models.GetLabelsByRepoID(ctx.Repo.Repository.ID)
if err != nil {
@@ -25,6 +26,7 @@ func ListLabels(ctx *context.APIContext) {
ctx.JSON(200, &apiLabels)
}
+// GetLabel get label by repository and label id
func GetLabel(ctx *context.APIContext) {
label, err := models.GetLabelInRepoByID(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id"))
if err != nil {
@@ -39,6 +41,7 @@ func GetLabel(ctx *context.APIContext) {
ctx.JSON(200, label.APIFormat())
}
+// CreateLabel create a label for a repository
func CreateLabel(ctx *context.APIContext, form api.CreateLabelOption) {
if !ctx.Repo.IsWriter() {
ctx.Status(403)
@@ -57,6 +60,7 @@ func CreateLabel(ctx *context.APIContext, form api.CreateLabelOption) {
ctx.JSON(201, label.APIFormat())
}
+// EditLabel modify a label for a repository
func EditLabel(ctx *context.APIContext, form api.EditLabelOption) {
if !ctx.Repo.IsWriter() {
ctx.Status(403)
@@ -86,6 +90,7 @@ func EditLabel(ctx *context.APIContext, form api.EditLabelOption) {
ctx.JSON(200, label.APIFormat())
}
+// DeleteLabel delete a label for a repository
func DeleteLabel(ctx *context.APIContext) {
if !ctx.Repo.IsWriter() {
ctx.Status(403)