2012-06-29 12:46:01 +02:00
|
|
|
module Gitlab
|
|
|
|
# Users API
|
|
|
|
class Users < Grape::API
|
|
|
|
before { authenticate! }
|
|
|
|
|
|
|
|
resource :users do
|
|
|
|
# Get a users list
|
|
|
|
#
|
|
|
|
# Example Request:
|
|
|
|
# GET /users
|
|
|
|
get do
|
2012-09-03 13:46:29 +02:00
|
|
|
@users = paginate User
|
2012-08-11 00:07:50 +02:00
|
|
|
present @users, with: Entities::User
|
2012-06-29 12:46:01 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
# Get a single user
|
|
|
|
#
|
|
|
|
# Parameters:
|
|
|
|
# id (required) - The ID of a user
|
|
|
|
# Example Request:
|
|
|
|
# GET /users/:id
|
|
|
|
get ":id" do
|
|
|
|
@user = User.find(params[:id])
|
2012-08-11 00:07:50 +02:00
|
|
|
present @user, with: Entities::User
|
2012-06-29 12:46:01 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# Get currently authenticated user
|
|
|
|
#
|
|
|
|
# Example Request:
|
|
|
|
# GET /user
|
|
|
|
get "/user" do
|
2012-08-11 00:07:50 +02:00
|
|
|
present @current_user, with: Entities::User
|
2012-06-29 12:46:01 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|