debian-mirror-gitlab/lib/api/pagination_params.rb

27 lines
594 B
Ruby
Raw Permalink Normal View History

2018-12-05 23:21:45 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
module API
# Concern for declare pagination params.
#
# @example
2020-07-28 23:09:34 +05:30
# class CustomApiResource < Grape::API::Instance
2017-08-17 22:00:37 +05:30
# include PaginationParams
#
# params do
# use :pagination
# end
# end
module PaginationParams
extend ActiveSupport::Concern
included do
helpers do
params :pagination do
optional :page, type: Integer, default: 1, desc: 'Current page number'
optional :per_page, type: Integer, default: 20, desc: 'Number of items per page'
end
end
end
end
end