1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 10:18:38 +00:00

Convert all API handers to use *context.APIContext

This commit is contained in:
Unknwon
2016-03-13 18:49:16 -04:00
parent db4da7beec
commit dd6faf7f9b
20 changed files with 204 additions and 196 deletions

View File

@@ -14,7 +14,7 @@ import (
)
// https://github.com/gogits/go-gogs-client/wiki/Users#search-users
func Search(ctx *context.Context) {
func Search(ctx *context.APIContext) {
opts := &models.SearchUserOptions{
Keyword: ctx.Query("q"),
Type: models.USER_TYPE_INDIVIDUAL,
@@ -53,13 +53,13 @@ func Search(ctx *context.Context) {
}
// https://github.com/gogits/go-gogs-client/wiki/Users#get-a-single-user
func GetInfo(ctx *context.Context) {
func GetInfo(ctx *context.APIContext) {
u, err := models.GetUserByName(ctx.Params(":username"))
if err != nil {
if models.IsErrUserNotExist(err) {
ctx.Error(404)
ctx.Status(404)
} else {
ctx.APIError(500, "GetUserByName", err)
ctx.Error(500, "GetUserByName", err)
}
return
}