vendor/bundle/ruby/2.7.0/gems/octokit-4.20.0/lib/octokit/connection.rb
# Make one or more HTTP GET requests, optionally fetching
# the next page of results from URL in Link response header based
# on value in {#auto_paginate}.
#
# @param url [String] The path, relative to {#api_endpoint}
# @param options [Hash] Query and header params for request
# @param block [Block] Block to perform the data concatination of the
#   multiple requests. The block is called with two parameters, the first
#   contains the contents of the requests so far and the second parameter
#   contains the latest response.
# @return [Sawyer::Resource]
Make one or more HTTP GET requests, optionally fetching
the next page of results from URL in Link response header based
on value in {#auto_paginate}.
Make one or more HTTP GET requests optionally fetching the next page of results from URL in Link response header based on value in { #auto_paginate } .
def paginate(url, options = {}, &block)
      opts = parse_query_and_convenience_headers(options)
      if @auto_paginate || @per_page
        opts[:query][:per_page] ||=  @per_page || (@auto_paginate ? 100 : nil)
      end
      data = request(:get, url, opts.dup)
      if @auto_paginate
        while @last_response.rels[:next] && rate_limit.remaining > 0
          @last_response = @last_response.rels[:next].get(:headers => opts[:headers])
          if block_given?
            yield(data, @last_response)
          else
            data.concat(@last_response.data) if @last_response.data.is_a?(Array)
          end
        end
      end
      data
    end
def paginate ( url , options = { } , & block ) opts = parse_query_and_convenience_headers ( options ) if @auto_paginate || @per_page opts [ :query ] [ :per_page ] ||= @per_page || ( @auto_paginate ? 100 : nil ) end data = request ( :get , url , opts . dup ) if @auto_paginate while @last_response . rels [ :next ] && rate_limit . remaining > 0 @last_response = @last_response . rels [ :next ] . get ( :headers => opts [ :headers ] ) if block_given? yield ( data , @last_response ) else data . concat ( @last_response . data ) if @last_response . data . is_a? ( Array ) end end end data end
Make one or more HTTP GET requests, optionally fetching
the next page of results from URL in Link response header based
on value in {#auto_paginate}.
Make one or more HTTP GET requests optionally fetching the next page of results from URL in Link response header based on value in { #auto_paginate } .
None
Sawyer::Resource
url
The path, relative to {#api_endpoint}
The path relative to { #api_endpoint }
options
Query and header params for request
Query and header params for request
block
Block to perform the data concatination of the multiple requests. The block is called with two parameters, the first contains the contents of the requests so far and the second parameter contains the latest response.
Block to perform the data concatination of the multiple requests . The block is called with two parameters the first contains the contents of the requests so far and the second parameter contains the latest response .