debian-mirror-gitlab/lib/api/events.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

59 lines
1.3 KiB
Ruby
Raw Normal View History

2018-12-05 23:21:45 +05:30
# frozen_string_literal: true
2017-09-10 17:25:29 +05:30
module API
2021-01-03 14:25:43 +05:30
class Events < ::API::Base
2017-09-10 17:25:29 +05:30
include PaginationParams
2018-11-20 20:47:30 +05:30
include APIGuard
2019-05-18 00:54:41 +05:30
helpers ::API::Helpers::EventsHelpers
2017-09-10 17:25:29 +05:30
2021-03-11 19:13:27 +05:30
allow_access_with_scope :read_user, if: -> (request) { request.get? || request.head? }
2017-09-10 17:25:29 +05:30
2021-01-29 00:20:46 +05:30
feature_category :users
2022-07-16 23:28:13 +05:30
urgency :low
2021-01-29 00:20:46 +05:30
2017-09-10 17:25:29 +05:30
resource :events do
desc "List currently authenticated user's events" do
detail 'This feature was introduced in GitLab 9.3.'
success Entities::Event
end
params do
use :pagination
use :event_filter_params
use :sort_params
end
2019-02-15 15:39:39 +05:30
2017-09-10 17:25:29 +05:30
get do
authenticate!
2019-02-15 15:39:39 +05:30
events = find_events(current_user)
2017-09-10 17:25:29 +05:30
2019-02-15 15:39:39 +05:30
present_events(events)
2017-09-10 17:25:29 +05:30
end
end
params do
requires :id, type: String, desc: 'The ID or Username of the user'
end
resource :users do
desc 'Get the contribution events of a specified user' do
detail 'This feature was introduced in GitLab 8.13.'
success Entities::Event
end
params do
use :pagination
use :event_filter_params
use :sort_params
end
2019-02-15 15:39:39 +05:30
2017-09-10 17:25:29 +05:30
get ':id/events' do
user = find_user(params[:id])
not_found!('User') unless user
2019-02-15 15:39:39 +05:30
events = find_events(user)
2017-09-10 17:25:29 +05:30
present_events(events)
end
end
end
end