Package com.jcabi.github.wire
Class CarefulWire
- java.lang.Object
-
- com.jcabi.github.wire.CarefulWire
-
- All Implemented Interfaces:
com.jcabi.http.Wire
@Immutable public final class CarefulWire extends Object implements com.jcabi.http.Wire
Wire that waits if number of remaining request per hour is less than a given threshold.Github sets following headers in each response:
X-RateLimit-Limit,X-RateLimit-Remaining, andX-RateLimit-Reset. IfX-RateLimit-Remainingis less than a given threshold,CarefulWirewill sleep until a time specified in theX-RateLimit-Resetheader. For further information about the Github rate limiting see API documentation.You can use
CarefulWirewith aGithubobject:Github github = new RtGithub( new RtGithub().entry().through(CarefulWire.class, 50) );- Version:
- $Id: d6b6ca2c903c7afce79f93053598c30f6786463d $
- Author:
- Alexander Sinyagin (sinyagin.alexander@gmail.com)
-
-
Constructor Summary
Constructors Constructor Description CarefulWire(com.jcabi.http.Wire wire, int thrshld)Public ctor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.jcabi.http.Responsesend(com.jcabi.http.Request req, String home, String method, Collection<Map.Entry<String,String>> headers, InputStream content, int connect, int read)
-
-
-
Method Detail
-
send
public com.jcabi.http.Response send(com.jcabi.http.Request req, String home, String method, Collection<Map.Entry<String,String>> headers, InputStream content, int connect, int read) throws IOException- Specified by:
sendin interfacecom.jcabi.http.Wire- Throws:
IOException
-
-