Class TwitterRateLimit
java.lang.Object
com.northconcepts.datapipeline.twitter.TwitterRateLimit
A snapshot of a Twitter API rate limit: the calls allowed, the calls remaining and when the limit resets.
-
Constructor Summary
ConstructorsConstructorDescriptionTwitterRateLimit(RateLimitStatus rateLimit) Creates a snapshot of the given status; a null status yields 100 of 100 calls remaining. -
Method Summary
Modifier and TypeMethodDescriptionintgetLimit()intlongReturns when the limit resets, in milliseconds since the epoch.longReturns the milliseconds left until the limit resets, or 0 if the reset time has passed.intReturns the percentage of calls remaining, rounded down.Returns the remaining percentage as text, such as"75% API calls remaining".IntervalReturns the time left until the limit resets, truncated to whole seconds.Returns"Reset in "followed by thereset interval.toString()
-
Constructor Details
-
TwitterRateLimit
public TwitterRateLimit(RateLimitStatus rateLimit) Creates a snapshot of the given status; a null status yields 100 of 100 calls remaining.
-
-
Method Details
-
getResetInterval
public Interval getResetInterval()Returns the time left until the limit resets, truncated to whole seconds. -
getLimit
public int getLimit() -
getLimitRemaining
public int getLimitRemaining() -
getLimitResetTime
public long getLimitResetTime()Returns when the limit resets, in milliseconds since the epoch. -
getLimitResetTimeRemaining
public long getLimitResetTimeRemaining()Returns the milliseconds left until the limit resets, or 0 if the reset time has passed. -
getPercentage
public int getPercentage()Returns the percentage of calls remaining, rounded down. -
getRemainingCallString
Returns the remaining percentage as text, such as"75% API calls remaining". -
getResetTimeString
Returns"Reset in "followed by thereset interval. -
toString
-