diff options
author | Mark Fletcher <mark@gitlab.com> | 2017-09-19 15:48:22 +1000 |
---|---|---|
committer | Mark Fletcher <mark@gitlab.com> | 2017-09-20 08:27:16 +1000 |
commit | 63e0a42317cad084b982d1deff8737bd2a1bf2d1 (patch) | |
tree | 259993080deba01244a6fd17bc0db1c260cffd80 /lib/api/projects.rb | |
parent | 5f331ab7008ae6d5931873fb674daf9bc8aa06be (diff) | |
download | gitlab-ce-63e0a42317cad084b982d1deff8737bd2a1bf2d1.tar.gz |
Add an API endpoint to determine the forks of a project
Diffstat (limited to 'lib/api/projects.rb')
-rw-r--r-- | lib/api/projects.rb | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb index 7dc19788462..aab7a6c3f93 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -70,8 +70,11 @@ module API optional :import_url, type: String, desc: 'URL from which the project is imported' end - def present_projects(options = {}) - projects = ProjectsFinder.new(current_user: current_user, params: project_finder_params).execute + def load_projects + ProjectsFinder.new(current_user: current_user, params: project_finder_params).execute + end + + def present_projects(projects, options = {}) projects = reorder_projects(projects) projects = projects.with_statistics if params[:statistics] projects = projects.with_issues_enabled if params[:with_issues_enabled] @@ -111,7 +114,7 @@ module API params[:user] = user - present_projects + present_projects load_projects end end @@ -124,7 +127,7 @@ module API use :statistics_params end get do - present_projects + present_projects load_projects end desc 'Create new project' do @@ -229,6 +232,18 @@ module API end end + desc 'List forks of this project' do + success Entities::Project + end + params do + use :collection_params + end + get ':id/forks' do + forks = ForkProjectsFinder.new(user_project, params: project_finder_params, current_user: current_user).execute + + present_projects forks + end + desc 'Update an existing project' do success Entities::Project end |