diff options
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/entities.rb | 6 | ||||
-rw-r--r-- | lib/api/projects.rb | 14 |
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 8e815f2b25c..0d8cac5c8fd 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -120,5 +120,11 @@ module API expose :note expose :author, using: Entities::UserBasic end + + class Event < Grape::Entity + expose :title, :project_id, :action_name + expose :target_id, :target_type, :author_id + expose :data, :target_title + end end end diff --git a/lib/api/projects.rb b/lib/api/projects.rb index 7fcde3794f4..6dc051e4ba2 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -41,6 +41,20 @@ module API present user_project, with: Entities::Project end + # Get a single project events + # + # Parameters: + # id (required) - The ID of a project + # Example Request: + # GET /projects/:id + get ":id/events" do + limit = (params[:per_page] || 20).to_i + offset = (params[:page] || 0).to_i * limit + events = user_project.events.recent.limit(limit).offset(offset) + + present events, with: Entities::Event + end + # Create new project # # Parameters: |