Class AuditableRestAction.EmptyRestAction<T>

  • Type Parameters:
    T - The generic response type for this RestAction
    Enclosing class:
    AuditableRestAction<T>

    public static class AuditableRestAction.EmptyRestAction<T>
    extends AuditableRestAction<T>
    Specialized form of AuditableRestAction that is used to provide information that has already been retrieved or generated so that another request does not need to be made to Discord.
    Basically: Allows you to provide a value directly to the success returns.
    • Constructor Detail

      • EmptyRestAction

        public EmptyRestAction​(JDA api)
      • EmptyRestAction

        public EmptyRestAction​(JDA api,
                               T content)
    • Method Detail

      • queue

        public void queue​(java.util.function.Consumer<? super T> success,
                          java.util.function.Consumer<? super java.lang.Throwable> failure)
        Description copied from class: RestAction
        Submits a Request for execution.

        This method is asynchronous

        Overrides:
        queue in class RestAction<T>
        Parameters:
        success - The success callback that will be called at a convenient time for the API. (can be null)
        failure - The failure callback that will be called if the Request encounters an exception at its execution point.
      • submit

        public RequestFuture<T> submit​(boolean shouldQueue)
        Description copied from class: RestAction
        Submits a Request for execution and provides a RequestFuture representing its completion task.
        Cancelling the returned Future will result in the cancellation of the Request!

        Note: The usage of CompletionStage.toCompletableFuture() is not supported.

        Overrides:
        submit in class RestAction<T>
        Parameters:
        shouldQueue - Whether the Request should automatically handle rate limitations. (default true)
        Returns:
        Never-null RequestFuture task representing the completion promise