All Downloads are FREE. Search and download functionalities are using the official Maven repository.

it.auties.whatsapp.api.AsyncCaptchaCodeSupplier Maven / Gradle / Ivy

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));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy