Class GHRateLimit.Record

java.lang.Object
org.kohsuke.github.GHRateLimit.Record
Direct Known Subclasses:
GHRateLimit.UnknownLimitRecord
Enclosing class:
GHRateLimit

public static class GHRateLimit.Record extends Object
A rate limit record.
Since:
1.100
Author:
Liam Newman
  • Constructor Summary

    Constructors
    Constructor
    Description
    Record(int limit, int remaining, long resetEpochSeconds)
    Instantiates a new Record.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Equals.
    int
    Gets the total number of API calls per hour allotted for this connection.
    int
    Gets the remaining number of requests allowed before this connection will be throttled.
    The date at which the rate limit will reset, adjusted to local machine time if the local machine's clock not synchronized with to the same clock as the GitHub server.
    long
    Gets the time in epoch seconds when the rate limit will reset.
    int
    Hash code.
    boolean
    Whether the rate limit reset date indicated by this instance is expired If attempting to wait for the rate limit to reset, consider implementing a RateLimitChecker instead.
    To string.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Record

      public Record(int limit, int remaining, long resetEpochSeconds)
      Instantiates a new Record.
      Parameters:
      limit - the limit
      remaining - the remaining
      resetEpochSeconds - the reset epoch seconds
  • Method Details

    • getRemaining

      public int getRemaining()
      Gets the remaining number of requests allowed before this connection will be throttled.
      Returns:
      an integer
    • getLimit

      public int getLimit()
      Gets the total number of API calls per hour allotted for this connection.
      Returns:
      an integer
    • getResetEpochSeconds

      public long getResetEpochSeconds()
      Gets the time in epoch seconds when the rate limit will reset. This is the raw value returned by the server. This value is not adjusted if local machine time is not synchronized with server time. If attempting to check when the rate limit will reset, use getResetDate() or implement a RateLimitChecker instead.
      Returns:
      a long representing the time in epoch seconds when the rate limit will reset
      See Also:
    • isExpired

      public boolean isExpired()
      Whether the rate limit reset date indicated by this instance is expired If attempting to wait for the rate limit to reset, consider implementing a RateLimitChecker instead.
      Returns:
      true if the rate limit reset date has passed. Otherwise false.
    • getResetDate

      @Nonnull public Date getResetDate()
      The date at which the rate limit will reset, adjusted to local machine time if the local machine's clock not synchronized with to the same clock as the GitHub server. If attempting to wait for the rate limit to reset, consider implementing a RateLimitChecker instead.
      Returns:
      the calculated date at which the rate limit has or will reset.
    • toString

      public String toString()
      To string.
      Overrides:
      toString in class Object
      Returns:
      the string
    • equals

      public boolean equals(Object o)
      Equals.
      Overrides:
      equals in class Object
      Parameters:
      o - the o
      Returns:
      true, if successful
    • hashCode

      public int hashCode()
      Hash code.
      Overrides:
      hashCode in class Object
      Returns:
      the int