diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 17:22:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 17:22:11 +0300 |
commit | 0c872e02b2c822e3397515ec324051ff540f0cd5 (patch) | |
tree | ce2fb6ce7030e4dad0f4118d21ab6453e5938cdd /lib/api/project_packages.rb | |
parent | f7e05a6853b12f02911494c4b3fe53d9540d74fc (diff) |
Add latest changes from gitlab-org/gitlab@15-7-stable-eev15.7.0-rc42
Diffstat (limited to 'lib/api/project_packages.rb')
-rw-r--r-- | lib/api/project_packages.rb | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/lib/api/project_packages.rb b/lib/api/project_packages.rb index d09c481403f..158ba7465f4 100644 --- a/lib/api/project_packages.rb +++ b/lib/api/project_packages.rb @@ -17,9 +17,15 @@ module API requires :id, types: [String, Integer], desc: 'The ID or URL-encoded path of the project' end resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do - desc 'Get all project packages' do + desc 'Get a list of project packages' do detail 'This feature was introduced in GitLab 11.8' - success ::API::Entities::Package + success code: 200, model: ::API::Entities::Package + failure [ + { code: 403, message: 'Forbidden' }, + { code: 404, message: 'Project Not Found' } + ] + is_array true + tags %w[project_packages] end params do use :pagination @@ -48,7 +54,12 @@ module API desc 'Get a single project package' do detail 'This feature was introduced in GitLab 11.9' - success ::API::Entities::Package + success code: 200, model: ::API::Entities::Package + failure [ + { code: 403, message: 'Forbidden' }, + { code: 404, message: 'Not Found' } + ] + tags %w[project_packages] end params do requires :package_id, type: Integer, desc: 'The ID of a package' @@ -58,11 +69,19 @@ module API package = ::Packages::PackageFinder .new(user_project, params[:package_id]).execute + render_api_error!('Package not found', 404) unless package.default? + present package, with: ::API::Entities::Package, user: current_user, namespace: user_project.namespace end - desc 'Remove a package' do + desc 'Delete a project package' do detail 'This feature was introduced in GitLab 11.9' + success code: 204 + failure [ + { code: 403, message: 'Forbidden' }, + { code: 404, message: 'Not Found' } + ] + tags %w[project_packages] end params do requires :package_id, type: Integer, desc: 'The ID of a package' |