diff options
author | BaldinoF <baldinof@gmail.com> | 2016-04-17 18:17:27 +0200 |
---|---|---|
committer | BaldinoF <baldinof@gmail.com> | 2016-04-17 18:17:27 +0200 |
commit | b04140a1e497c75a721bc4e5458907bf35a0a8b9 (patch) | |
tree | 8005646150e1c6979061e56a30f661b18ec331c7 /lib/api/projects.rb | |
parent | 3918fce5bd073e18addb7d1d4aaf3c81ce8150b0 (diff) | |
parent | 5048064dc5e7ca30f65209c7ccd9fb90f9ac49db (diff) | |
download | gitlab-ce-b04140a1e497c75a721bc4e5458907bf35a0a8b9.tar.gz |
Merge branch 'master' into number_sign_for_external_issue_ref
Diffstat (limited to 'lib/api/projects.rb')
-rw-r--r-- | lib/api/projects.rb | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb index 6fcb5261e40..cc2c7a0c503 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -244,6 +244,68 @@ module API end end + # Archive project + # + # Parameters: + # id (required) - The ID of a project + # Example Request: + # PUT /projects/:id/archive + post ':id/archive' do + authorize!(:archive_project, user_project) + + user_project.archive! + + present user_project, with: Entities::Project + end + + # Unarchive project + # + # Parameters: + # id (required) - The ID of a project + # Example Request: + # PUT /projects/:id/unarchive + post ':id/unarchive' do + authorize!(:archive_project, user_project) + + user_project.unarchive! + + present user_project, with: Entities::Project + end + + # Star project + # + # Parameters: + # id (required) - The ID of a project + # Example Request: + # POST /projects/:id/star + post ':id/star' do + if current_user.starred?(user_project) + not_modified! + else + current_user.toggle_star(user_project) + user_project.reload + + present user_project, with: Entities::Project + end + end + + # Unstar project + # + # Parameters: + # id (required) - The ID of a project + # Example Request: + # DELETE /projects/:id/star + delete ':id/star' do + if current_user.starred?(user_project) + current_user.toggle_star(user_project) + user_project.reload + + present user_project, with: Entities::Project + else + not_modified! + end + end + # Remove project # # Parameters: |