Skip to content

Commit

Permalink
Provide reset date info for rate limit
Browse files Browse the repository at this point in the history
  • Loading branch information
KostyaSha authored and kohsuke committed Mar 17, 2015
1 parent 0bf81f4 commit a4c1c8d
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/main/java/org/kohsuke/github/GHRateLimit.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.kohsuke.github;

import java.util.Date;

/**
* Rate limit.
* @author Kohsuke Kawaguchi
Expand All @@ -10,12 +12,28 @@ public class GHRateLimit {
*/
public int remaining;
/**
* Alotted API call per hour.
* Allotted API call per hour.
*/
public int limit;

/**
* The time at which the current rate limit window resets in UTC epoch seconds.
*/
public Date reset;

/**
* Non-epoch date
*/
public Date getResetDate() {
return new Date(reset.getTime() * 1000);
}

@Override
public String toString() {
return remaining+"/"+limit;
return "GHRateLimit{" +
"remaining=" + remaining +
", limit=" + limit +
", resetDate=" + getResetDate() +
'}';
}
}

0 comments on commit a4c1c8d

Please sign in to comment.