aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/admin
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/admin
parent3a3782bb7fed768c1e832ff4c0a77f2f5281ed05 (diff)
downloadgitea-3917ed45de063b4e8868610c82d8172020d572fd.tar.gz
gitea-3917ed45de063b4e8868610c82d8172020d572fd.zip
golint fixed for routers (#208)
Diffstat (limited to 'routers/api/v1/admin')
-rw-r--r--routers/api/v1/admin/org.go3
-rw-r--r--routers/api/v1/admin/org_repo.go3
-rw-r--r--routers/api/v1/admin/org_team.go3
-rw-r--r--routers/api/v1/admin/repo.go3
-rw-r--r--routers/api/v1/admin/user.go10
5 files changed, 17 insertions, 5 deletions
diff --git a/routers/api/v1/admin/org.go b/routers/api/v1/admin/org.go
index 1162c96c5f..706e2cedeb 100644
--- a/routers/api/v1/admin/org.go
+++ b/routers/api/v1/admin/org.go
@@ -13,7 +13,8 @@ import (
"code.gitea.io/gitea/routers/api/v1/user"
)
-// https://github.com/gogits/go-gogs-client/wiki/Administration-Organizations#create-a-new-organization
+// CreateOrg api for create organization
+// see https://github.com/gogits/go-gogs-client/wiki/Administration-Organizations#create-a-new-organization
func CreateOrg(ctx *context.APIContext, form api.CreateOrgOption) {
u := user.GetUserByParams(ctx)
if ctx.Written() {
diff --git a/routers/api/v1/admin/org_repo.go b/routers/api/v1/admin/org_repo.go
index c7014dd7c0..8230c0acc4 100644
--- a/routers/api/v1/admin/org_repo.go
+++ b/routers/api/v1/admin/org_repo.go
@@ -9,6 +9,7 @@ import (
"code.gitea.io/gitea/modules/context"
)
+// GetRepositoryByParams api for getting repository by orgnizition ID and repo name
func GetRepositoryByParams(ctx *context.APIContext) *models.Repository {
repo, err := models.GetRepositoryByName(ctx.Org.Team.OrgID, ctx.Params(":reponame"))
if err != nil {
@@ -22,6 +23,7 @@ func GetRepositoryByParams(ctx *context.APIContext) *models.Repository {
return repo
}
+// AddTeamRepository api for adding a repository to a team
func AddTeamRepository(ctx *context.APIContext) {
repo := GetRepositoryByParams(ctx)
if ctx.Written() {
@@ -35,6 +37,7 @@ func AddTeamRepository(ctx *context.APIContext) {
ctx.Status(204)
}
+// RemoveTeamRepository api for removing a repository from a team
func RemoveTeamRepository(ctx *context.APIContext) {
repo := GetRepositoryByParams(ctx)
if ctx.Written() {
diff --git a/routers/api/v1/admin/org_team.go b/routers/api/v1/admin/org_team.go
index b1964ff728..93af1ec427 100644
--- a/routers/api/v1/admin/org_team.go
+++ b/routers/api/v1/admin/org_team.go
@@ -13,6 +13,7 @@ import (
"code.gitea.io/gitea/routers/api/v1/user"
)
+// CreateTeam api for create a team
func CreateTeam(ctx *context.APIContext, form api.CreateTeamOption) {
team := &models.Team{
OrgID: ctx.Org.Organization.ID,
@@ -32,6 +33,7 @@ func CreateTeam(ctx *context.APIContext, form api.CreateTeamOption) {
ctx.JSON(201, convert.ToTeam(team))
}
+// AddTeamMember api for add a member to a team
func AddTeamMember(ctx *context.APIContext) {
u := user.GetUserByParams(ctx)
if ctx.Written() {
@@ -45,6 +47,7 @@ func AddTeamMember(ctx *context.APIContext) {
ctx.Status(204)
}
+// RemoveTeamMember api for remove one member from a team
func RemoveTeamMember(ctx *context.APIContext) {
u := user.GetUserByParams(ctx)
if ctx.Written() {
diff --git a/routers/api/v1/admin/repo.go b/routers/api/v1/admin/repo.go
index 69187dc367..a52d462137 100644
--- a/routers/api/v1/admin/repo.go
+++ b/routers/api/v1/admin/repo.go
@@ -12,7 +12,8 @@ import (
"code.gitea.io/gitea/routers/api/v1/user"
)
-// https://github.com/gogits/go-gogs-client/wiki/Administration-Repositories#create-a-new-repository
+// CreateRepo api for creating a repository
+// see https://github.com/gogits/go-gogs-client/wiki/Administration-Repositories#create-a-new-repository
func CreateRepo(ctx *context.APIContext, form api.CreateRepoOption) {
owner := user.GetUserByParams(ctx)
if ctx.Written() {
diff --git a/routers/api/v1/admin/user.go b/routers/api/v1/admin/user.go
index c868c62104..0a6dc5d456 100644
--- a/routers/api/v1/admin/user.go
+++ b/routers/api/v1/admin/user.go
@@ -34,7 +34,8 @@ func parseLoginSource(ctx *context.APIContext, u *models.User, sourceID int64, l
u.LoginName = loginName
}
-// https://github.com/gogits/go-gogs-client/wiki/Administration-Users#create-a-new-user
+// CreateUser api for creating a user
+// see https://github.com/gogits/go-gogs-client/wiki/Administration-Users#create-a-new-user
func CreateUser(ctx *context.APIContext, form api.CreateUserOption) {
u := &models.User{
Name: form.Username,
@@ -71,7 +72,8 @@ func CreateUser(ctx *context.APIContext, form api.CreateUserOption) {
ctx.JSON(201, u.APIFormat())
}
-// https://github.com/gogits/go-gogs-client/wiki/Administration-Users#edit-an-existing-user
+// EditUser api for modifying a user's information
+// see https://github.com/gogits/go-gogs-client/wiki/Administration-Users#edit-an-existing-user
func EditUser(ctx *context.APIContext, form api.EditUserOption) {
u := user.GetUserByParams(ctx)
if ctx.Written() {
@@ -123,6 +125,7 @@ func EditUser(ctx *context.APIContext, form api.EditUserOption) {
ctx.JSON(200, u.APIFormat())
}
+// DeleteUser api for deleting a user
// https://github.com/gogits/go-gogs-client/wiki/Administration-Users#delete-a-user
func DeleteUser(ctx *context.APIContext) {
u := user.GetUserByParams(ctx)
@@ -144,7 +147,8 @@ func DeleteUser(ctx *context.APIContext) {
ctx.Status(204)
}
-// https://github.com/gogits/go-gogs-client/wiki/Administration-Users#create-a-public-key-for-user
+// CreatePublicKey api for creating a public key to a user
+// see https://github.com/gogits/go-gogs-client/wiki/Administration-Users#create-a-public-key-for-user
func CreatePublicKey(ctx *context.APIContext, form api.CreateKeyOption) {
u := user.GetUserByParams(ctx)
if ctx.Written() {