public CompletableFuture<T> execute(Function<RestRequestResult, T> function) {
        api.getRatelimitManager().queueRequest(this);
        CompletableFuture<T> future = new CompletableFuture<>();
        result.whenComplete((result, throwable) -> {
            if (throwable != null) {
                future.completeExceptionally(throwable);
                return;
            }
            try {
                future.complete(function.apply(result));
            } catch (Throwable t) {
                future.completeExceptionally(t);
            }
        });
        return future;
    }
public CompletableFuture < T > execute ( Function < RestRequestResult , T > function ) { api . getRatelimitManager ( ) . queueRequest ( this ) ; CompletableFuture < T > future = new CompletableFuture < > ( ) ; result . whenComplete ( ( result , throwable ) -> { if ( throwable != null ) { future . completeExceptionally ( throwable ) ; return ; } try { future . complete ( function . apply ( result ) ) ; } catch ( Throwable t ) { future . completeExceptionally ( t ) ; } } ) ; return future ; }
Executes the request. This will automatically retry if we hit a ratelimit.

@param function A function which processes the rest response to the requested object.
@return A future which will contain the output of the function.