@Immutable public final class CarefulWire extends Object implements com.jcabi.http.Wire
Github sets following headers in each response:
X-RateLimit-Limit
, X-RateLimit-Remaining
, and
X-RateLimit-Reset
. If X-RateLimit-Remaining
is
less than a given threshold, CarefulWire
will sleep until a time
specified in the X-RateLimit-Reset
header. For further information
about the Github rate limiting see
API
documentation.
You can use CarefulWire
with a Github
object:
Github github = new RtGithub(
new RtGithub().entry().through(CarefulWire.class, 50)
);
Constructor and Description |
---|
CarefulWire(com.jcabi.http.Wire wire,
int thrshld)
Public ctor.
|
Modifier and Type | Method and Description |
---|---|
com.jcabi.http.Response |
send(com.jcabi.http.Request req,
String home,
String method,
Collection<Map.Entry<String,String>> headers,
InputStream content) |
@NotNull(message="response can\'t be NULL") public com.jcabi.http.Response send(@NotNull(message="req can\'t be NULL") com.jcabi.http.Request req, @NotNull(message="home can\'t be NULL") String home, @NotNull(message="method can\'t be NULL") String method, @NotNull(message="headers can\'t be NULL") Collection<Map.Entry<String,String>> headers, @NotNull(message="content can\'t be NULL") InputStream content) throws IOException
send
in interface com.jcabi.http.Wire
IOException
Copyright © 2012–2014 jcabi.com. All rights reserved.