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-Remaining
is less than a given threshold,CarefulWire
will sleep until a time specified in theX-RateLimit-Reset
header. For further information about the Github rate limiting see API documentation.You can use
CarefulWire
with aGithub
object: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.Response
send(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:
send
in interfacecom.jcabi.http.Wire
- Throws:
IOException
-
-