public class ResponseConditions
extends java.lang.Object
| Constructor and Description |
|---|
ResponseConditions() |
| Modifier and Type | Method and Description |
|---|---|
static void |
checkRateLimit(okhttp3.Response response)
Analyzes a web response to determine if it represents exceeding GitHub's rate limits
|
static <T> void |
checkRateLimit(T response,
java.util.function.Function<T,java.lang.Integer> codeLookup,
java.util.function.BiFunction<T,java.lang.String,java.util.Collection<java.lang.String>> headerLookup)
Analyzes a web response to determine if it represents exceeding GitHub's rate limits
|
public static void checkRateLimit(okhttp3.Response response)
throws RequestLimitExceededException
If the response does represent exceeded rate limiting, throws a RequestLimitExceededException
To use this check with other web libraries, see checkRateLimit(Object, Function, BiFunction)
response - OkHttp3 representation of a web responseRequestLimitExceededExceptionpublic static <T> void checkRateLimit(T response,
java.util.function.Function<T,java.lang.Integer> codeLookup,
java.util.function.BiFunction<T,java.lang.String,java.util.Collection<java.lang.String>> headerLookup)
throws RequestLimitExceededException
If the response does represent exceeded rate limiting, throws a RequestLimitExceededException
T - Java type representing a web responseresponse - Representation of a web responsecodeLookup - Function which reads the HTTP status code from the provided responseheaderLookup - Function which takes a response and header value as input, and produces all instances of that header
from the responseRequestLimitExceededException - If the provided response represents exceeding GitHub's rate limiting