diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
commit | a09983ae35713f5a2bbb100981116d31ce99826e (patch) | |
tree | 2ee2af7bd104d57086db360a7e6d8c9d5d43667a /lib/api/package_files.rb | |
parent | 18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff) |
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'lib/api/package_files.rb')
-rw-r--r-- | lib/api/package_files.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/api/package_files.rb b/lib/api/package_files.rb new file mode 100644 index 00000000000..17b92df629c --- /dev/null +++ b/lib/api/package_files.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +module API + class PackageFiles < Grape::API::Instance + include PaginationParams + + before do + authorize_packages_access!(user_project) + end + + helpers ::API::Helpers::PackagesHelpers + + params do + requires :id, type: String, desc: 'The ID of a project' + requires :package_id, type: Integer, desc: 'The ID of a package' + end + resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do + desc 'Get all package files' do + detail 'This feature was introduced in GitLab 11.8' + success ::API::Entities::PackageFile + end + params do + use :pagination + end + get ':id/packages/:package_id/package_files' do + package = ::Packages::PackageFinder + .new(user_project, params[:package_id]).execute + + present paginate(package.package_files), with: ::API::Entities::PackageFile + end + end + end +end |