gitlab-org--gitlab-foss/lib/api/namespaces.rb
2015-02-02 21:22:57 -08:00

23 lines
513 B
Ruby

module API
# namespaces API
class Namespaces < Grape::API
before do
authenticate!
authenticated_as_admin!
end
resource :namespaces do
# Get a namespaces list
#
# Example Request:
# GET /namespaces
get do
@namespaces = Namespace.all
@namespaces = @namespaces.search(params[:search]) if params[:search].present?
@namespaces = paginate @namespaces
present @namespaces, with: Entities::Namespace
end
end
end
end