public class DiscordWebClient extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
REQUEST_TIMESTAMP_KEY |
| Constructor and Description |
|---|
DiscordWebClient(HttpClient httpClient,
ExchangeStrategies exchangeStrategies,
String token)
Create a new
DiscordWebClient wrapping HTTP, Discord and encoding/decoding resources. |
| Modifier and Type | Method and Description |
|---|---|
<R,T> Mono<T> |
exchange(ClientRequest request,
R body,
Class<T> responseType,
Consumer<HttpClientResponse> responseConsumer)
Exchange a request for a
Mono response of the specified type. |
HttpHeaders |
getDefaultHeaders()
Return the default headers used in every request.
|
ExchangeStrategies |
getExchangeStrategies()
Return the strategy used for request and response conversion
|
HttpClient |
getHttpClient()
Return the underlying Reactor Netty HTTP client.
|
public static final String REQUEST_TIMESTAMP_KEY
public DiscordWebClient(HttpClient httpClient, ExchangeStrategies exchangeStrategies, String token)
DiscordWebClient wrapping HTTP, Discord and encoding/decoding resources.httpClient - a Reactor Netty HTTP clientexchangeStrategies - a strategy to transform requests and responsestoken - a Discord token for API authorizationpublic HttpClient getHttpClient()
DiscordWebClientpublic HttpHeaders getDefaultHeaders()
HttpHeaders used by this DiscordWebClient in every requestpublic ExchangeStrategies getExchangeStrategies()
ExchangeStrategies used by this DiscordWebClient in every requestpublic <R,T> Mono<T> exchange(ClientRequest request, @Nullable R body, Class<T> responseType, Consumer<HttpClientResponse> responseConsumer)
Mono response of the specified type.
The request will be processed according to the writer strategies and its response according to the reader strategies available.
R - the type of the request body, can be nullT - the type of the response body, can be Voidrequest - the method, headers and URI of the client HTTP requestbody - an object representing the body of the requestresponseType - the desired response typeresponseConsumer - the consumer to use while processing the responseMono of T with the response