Welcome to mirror list, hosted at ThFree Co, Russian Federation.

project_events.rb « api « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d90ce32c354d5726ca9e4ccf4195ad4f7a01e717 (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
37
38
39
# frozen_string_literal: true

module API
  class ProjectEvents < ::API::Base
    include PaginationParams
    include APIGuard
    helpers ::API::Helpers::EventsHelpers

    feature_category :users

    # TODO: Set higher urgency after resolving https://gitlab.com/gitlab-org/gitlab/-/issues/357839
    urgency :low

    params do
      requires :id, types: [String, Integer], desc: 'The ID or URL-encoded path of the project'
      optional :action, type: String, desc: 'Include only events of a particular action type'
      optional :target_type, type: String, desc: 'Include only events of a particular target type'
      optional :before, type: DateTime, desc: 'Include only events created before a particular date'
      optional :after, type: DateTime, desc: 'Include only events created after a particular date'
      optional :sort, type: String, desc: 'Sort events in asc or desc order by created_at. Default is desc'
    end
    resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
      desc "List a project's visible events" do
        success Entities::Event
      end
      params do
        use :pagination
        use :event_filter_params
        use :sort_params
      end

      get ":id/events" do
        events = find_events(user_project)

        present_events(events)
      end
    end
  end
end