aboutsummaryrefslogtreecommitdiff
path: root/routers/api/v1/users.go
diff options
context:
space:
mode:
authorUnknwon <joe2010xtmf@163.com>2014-11-18 11:07:16 -0500
committerUnknwon <joe2010xtmf@163.com>2014-11-18 11:07:16 -0500
commit37d8d3afe9ec589574c0cc6380a36fa93b1be8f2 (patch)
tree30d7751228cdded099b1a0e2952d66dbe6d403b6 /routers/api/v1/users.go
parentdb0026c5070f8e6b82170a75b5f92a54b7b96ff2 (diff)
more APIs on #12
Diffstat (limited to 'routers/api/v1/users.go')
-rw-r--r--routers/api/v1/users.go46
1 files changed, 0 insertions, 46 deletions
diff --git a/routers/api/v1/users.go b/routers/api/v1/users.go
deleted file mode 100644
index e0f51ca8..00000000
--- a/routers/api/v1/users.go
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2014 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package v1
-
-import (
- "github.com/Unknwon/com"
-
- api "github.com/gogits/go-gogs-client"
-
- "github.com/gogits/gogs/models"
- "github.com/gogits/gogs/modules/middleware"
-)
-
-func SearchUsers(ctx *middleware.Context) {
- opt := models.SearchOption{
- Keyword: ctx.Query("q"),
- Limit: com.StrTo(ctx.Query("limit")).MustInt(),
- }
- if opt.Limit == 0 {
- opt.Limit = 10
- }
-
- us, err := models.SearchUserByName(opt)
- if err != nil {
- ctx.JSON(500, map[string]interface{}{
- "ok": false,
- "error": err.Error(),
- })
- return
- }
-
- results := make([]*api.User, len(us))
- for i := range us {
- results[i] = &api.User{
- UserName: us[i].Name,
- AvatarUrl: us[i].AvatarLink(),
- }
- }
-
- ctx.Render.JSON(200, map[string]interface{}{
- "ok": true,
- "data": results,
- })
-}