dwyl / stars

:star: "No more counting dollars, we'll be counting stars" :chart_with_upwards_trend:
https://youtu.be/hT_nvWreIhg?t=14s
GNU General Public License v2.0
15 stars 3 forks source link

What to do when org has more than 30 repos (one page of data) #7

Open nelsonic opened 7 years ago

nelsonic commented 7 years ago

How do we know when the GitHub API returns more than 30 results for the /org/repos query?

nelsonic commented 7 years ago

This looks like what we need:

     '<https://api.github.com/organizations/11708465/repos?page=2>; rel="next", <https://api.github.com/organizations/11708465/repos?page=7>; rel="last"',
nelsonic commented 7 years ago

This was contained in the response.rawHeaders:

[ 'Server',
  'GitHub.com',
  'Date',
  'Mon, 16 Jan 2017 23:09:48 GMT',
  'Content-Type',
  'application/json; charset=utf-8',
  'Content-Length',
  '140366',
  'Connection',
  'close',
  'Status',
  '200 OK',
  'X-RateLimit-Limit',
  '60',
  'X-RateLimit-Remaining',
  '51',
  'X-RateLimit-Reset',
  '1484610743',
  'Cache-Control',
  'public, max-age=60, s-maxage=60',
  'Vary',
  'Accept',
  'ETag',
  '"18d391dee23fdb73fa2d37d649132011"',
  'X-GitHub-Media-Type',
  'github.v3; format=json',
  'Link',
  '<https://api.github.com/organizations/11708465/repos?page=2>; rel="next", <https://api.github.com/organizations/11708465/repos?page=7>; rel="last"',
  'Access-Control-Expose-Headers',
  'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval',
  'Access-Control-Allow-Origin',
  '*',
  'Content-Security-Policy',
  'default-src \'none\'',
  'Strict-Transport-Security',
  'max-age=31536000; includeSubdomains; preload',
  'X-Content-Type-Options',
  'nosniff',
  'X-Frame-Options',
  'deny',
  'X-XSS-Protection',
  '1; mode=block',
  'Vary',
  'Accept-Encoding',
  'X-Served-By',
  'b0ef53392caa42315c6206737946d931',
  'X-GitHub-Request-Id',
  'BCAC993D:1F31:353521D:587D52BC' ]
nelsonic commented 7 years ago

so we need to extract the rawHeaders and .filter them for api.github.com ... I feel some regex foo coming on... 🕺