Class DiscordWebResponse

java.lang.Object
discord4j.rest.request.DiscordWebResponse

public class DiscordWebResponse extends Object
Contract to handle a Mono of ClientResponse after a network exchange is done.
  • Constructor Details

  • Method Details

    • bodyToMono

      public <T> Mono<T> bodyToMono(Class<T> responseClass)
      Read the response body and extract it to a single object according to the responseType given. If the response has an HTTP error (status codes 4xx and 5xx) the produced object will be a ClientException.
      Type Parameters:
      T - the response type
      Parameters:
      responseClass - the target type this response body should be converted into
      Returns:
      a Mono containing the response body extracted into the given T type. If a network or read error had occurred, it will be emitted through the Mono.
    • skipBody

      public Mono<Void> skipBody()
      Consume and release the response body then return and empty Mono.
      Returns:
      an empty Mono indicating response body consumption and release
    • mono

      public Mono<ClientResponse> mono()
      Return the underlying Mono of ClientResponse.
      Returns:
      the original Mono this response wrapper accesses