Add statistics API.

Fixes issue #330
This commit is contained in:
Martin van Zijl
2018-11-15 11:36:05 +13:00
parent fad203a66d
commit 9d955d252a
2 changed files with 333 additions and 0 deletions

View File

@@ -622,6 +622,13 @@ class Requester {
return type.cast(Array.newInstance(type.getComponentType(),0));
}
// Response code 202 means the statistics are still being cached.
// See https://developer.github.com/v3/repos/statistics/#a-word-about-caching
if (responseCode == 202) {
LOGGER.log(INFO, "The statistics are still being generated. Please try again in 5 seconds.");
return null;
}
r = new InputStreamReader(wrapStream(uc.getInputStream()), "UTF-8");
String data = IOUtils.toString(r);
if (type!=null)