summaryrefslogtreecommitdiff
path: root/lib/api/users.rb
blob: ef3762f30fc360b2e504d9d821caa0ceecbf1ac4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
module Gitlab
  # Users API
  class Users < Grape::API
    before { authenticate! }

    resource :users do
      # Get a users list
      #
      # Example Request:
      #  GET /users
      get do
        @users = User.all
        present @users, :with => Entities::User
      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])
        present @user, :with => Entities::User
      end
    end

    # Get currently authenticated user
    #
    # Example Request:
    #   GET /user
    get "/user" do
      present @current_user, :with => Entities::User
    end
  end
end