summaryrefslogtreecommitdiff
path: root/lib/api/tags.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/tags.rb')
-rw-r--r--lib/api/tags.rb16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/api/tags.rb b/lib/api/tags.rb
index f018b421edd..1b37d38ef06 100644
--- a/lib/api/tags.rb
+++ b/lib/api/tags.rb
@@ -21,20 +21,28 @@ module API
optional :order_by, type: String, values: %w[name updated], default: 'updated',
desc: 'Return tags ordered by `name` or `updated` fields.'
optional :search, type: String, desc: 'Return list of tags matching the search criteria'
+ optional :page_token, type: String, desc: 'Name of tag to start the paginaition from'
use :pagination
end
- get ':id/repository/tags', feature_category: :source_code_management do
- tags, _ = ::TagsFinder.new(user_project.repository,
+ get ':id/repository/tags', feature_category: :source_code_management, urgency: :low do
+ tags_finder = ::TagsFinder.new(user_project.repository,
sort: "#{params[:order_by]}_#{params[:sort]}",
- search: params[:search]).execute
+ search: params[:search],
+ page_token: params[:page_token],
+ per_page: params[:per_page])
- paginated_tags = paginate(::Kaminari.paginate_array(tags))
+ paginated_tags = Gitlab::Pagination::GitalyKeysetPager.new(self, user_project).paginate(tags_finder)
if Feature.enabled?(:api_caching_tags, user_project, type: :development)
present_cached paginated_tags, with: Entities::Tag, project: user_project, cache_context: -> (_tag) { user_project.cache_key }
else
present paginated_tags, with: Entities::Tag, project: user_project
end
+
+ rescue Gitlab::Git::InvalidPageToken => e
+ unprocessable_entity!(e.message)
+ rescue Gitlab::Git::CommandError
+ service_unavailable!
end
desc 'Get a single repository tag' do