Commit e0fdb4262aa8b5351fe55044b942f4ce595be25c

Authored by Dmitriy Zaporozhets
2 parents 6d65afb3 61e68634

Merge pull request #6823 from milgner/api_expose_project_archived_status

Expose archive status of projects in API
Showing 2 changed files with 7 additions and 3 deletions   Show diff stats
doc/api/projects.md
@@ -43,7 +43,8 @@ GET /projects @@ -43,7 +43,8 @@ GET /projects
43 "owner_id": 1, 43 "owner_id": 1,
44 "path": "diaspora", 44 "path": "diaspora",
45 "updated_at": "2013-09-30T13: 46: 02Z" 45 "updated_at": "2013-09-30T13: 46: 02Z"
46 - } 46 + },
  47 + "archived": false
47 }, 48 },
48 { 49 {
49 "id": 6, 50 "id": 6,
@@ -78,7 +79,8 @@ GET /projects @@ -78,7 +79,8 @@ GET /projects
78 "owner_id": 1, 79 "owner_id": 1,
79 "path": "brightbox", 80 "path": "brightbox",
80 "updated_at": "2013-09-30T13:46:02Z" 81 "updated_at": "2013-09-30T13:46:02Z"
81 - } 82 + },
  83 + "archived": false
82 } 84 }
83 ] 85 ]
84 ``` 86 ```
@@ -157,7 +159,8 @@ Parameters: @@ -157,7 +159,8 @@ Parameters:
157 "access_level": 50, 159 "access_level": 50,
158 "notification_level": 3 160 "notification_level": 3
159 } 161 }
160 - } 162 + },
  163 + "archived": false
161 } 164 }
162 ``` 165 ```
163 166
lib/api/entities.rb
@@ -43,6 +43,7 @@ module API @@ -43,6 +43,7 @@ module API
43 class Project < Grape::Entity 43 class Project < Grape::Entity
44 expose :id, :description, :default_branch 44 expose :id, :description, :default_branch
45 expose :public?, as: :public 45 expose :public?, as: :public
  46 + expose :archived?, as: :archived
46 expose :visibility_level, :ssh_url_to_repo, :http_url_to_repo, :web_url 47 expose :visibility_level, :ssh_url_to_repo, :http_url_to_repo, :web_url
47 expose :owner, using: Entities::UserBasic, unless: ->(project, options) { project.group } 48 expose :owner, using: Entities::UserBasic, unless: ->(project, options) { project.group }
48 expose :name, :name_with_namespace 49 expose :name, :name_with_namespace