Class RatelimitedHttpClient
java.lang.Object
masecla.modrinth4j.client.HttpClient
masecla.modrinth4j.client.instances.RatelimitedHttpClient
This class is used to connect to the Modrinth API with rate limiting.
-
Constructor Summary
ConstructorsConstructorDescriptionRatelimitedHttpClient(UserAgent userAgent, String apiKey) Creates a new instance of the client.RatelimitedHttpClient(UserAgent userAgent, String baseUrl, String apiKey) Creates a new instance of the client.RatelimitedHttpClient(UserAgent userAgent, String baseUrl, String apiKey, long timeout) Creates a new instance of the client. -
Method Summary
Modifier and TypeMethodDescriptionvoidinterceptResponse(okhttp3.Response response) Intercepts the response.Returns the next request.Methods inherited from class masecla.modrinth4j.client.HttpClient
connect, connect, execute
-
Constructor Details
-
RatelimitedHttpClient
Creates a new instance of the client.- Parameters:
userAgent- The user agent to use.apiKey- The API key to use.
-
RatelimitedHttpClient
Creates a new instance of the client.- Parameters:
userAgent- The user agent to use.baseUrl- The base URL to use.apiKey- The API key to use.
-
RatelimitedHttpClient
Creates a new instance of the client.- Parameters:
userAgent- The user agent to use.baseUrl- The base URL to use.apiKey- The API key to use.timeout- The timeout to use in milliseconds.
-
-
Method Details
-
nextRequest
Returns the next request.- Specified by:
nextRequestin classHttpClient- Returns:
- A future that completes when the next request is allowed.
-
interceptResponse
public void interceptResponse(okhttp3.Response response) Intercepts the response.- Overrides:
interceptResponsein classHttpClient- Parameters:
response- - The response to intercept.
-