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

com.twilio.base.Deleter Maven / Gradle / Ivy

There is a newer version: 10.1.5
Show newest version
package com.twilio.base;

import com.twilio.Twilio;
import com.twilio.http.TwilioRestClient;

import java.util.concurrent.CompletableFuture;

/**
 * Executor for deletes of a resource.
 *
 * @param  type of the resource
 */
public abstract class Deleter {

    /**
     * Execute an async request using default client.
     *
     * @return future that resolves to true if the object was deleted
     */
    public CompletableFuture deleteAsync() {
        return deleteAsync(Twilio.getRestClient());
    }

    /**
     * Execute an async request using specified client.
     *
     * @param client client used to make request
     * @return future that resolves to true if the object was deleted
     */
    public CompletableFuture deleteAsync(final TwilioRestClient client) {
        return CompletableFuture.supplyAsync(() -> delete(client), Twilio.getExecutorService());
    }

    /**
     * Execute a request using default client.
     *
     * @return true if the object was deleted
     */
    public boolean delete() {
        return delete(Twilio.getRestClient());
    }

    /**
     * Execute a request using specified client.
     *
     * @param client client used to make request
     * @return true if the object was deleted
     */
    public abstract boolean delete(final TwilioRestClient client);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy