it.auties.whatsapp.api.AsyncCaptchaCodeSupplier Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of whatsappweb4j Show documentation
Show all versions of whatsappweb4j Show documentation
Standalone fully-featured Whatsapp Web API for Java and Kotlin
The newest version!
package it.auties.whatsapp.api;
import it.auties.whatsapp.model.mobile.VerificationCodeResponse;
import lombok.NonNull;
import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
import java.util.function.Supplier;
/**
* An interface to represent a supplier that returns a code wrapped in a CompletableFuture
*/
public interface AsyncCaptchaCodeSupplier extends Function> {
/**
* Creates an asynchronous supplier from a synchronous one
*
* @param supplier a non-null supplier
* @return a non-null async supplier
*/
static AsyncCaptchaCodeSupplier of(@NonNull Function supplier){
return (response) -> CompletableFuture.completedFuture(supplier.apply(response));
}
}