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

mn.foreman.api.WebUtil Maven / Gradle / Ivy

There is a newer version: 1.78.0
Show newest version
package mn.foreman.api;

import java.util.Map;
import java.util.Optional;

/**
 * {@link WebUtil} provides utility functions for performing HTTP operations
 * against the Foreman API.
 */
public interface WebUtil {

    /**
     * Performs a GET operation against the provided URI.
     *
     * @param uri The URI.
     *
     * @return The response content.
     */
    Optional get(String uri);

    /**
     * Performs a GET operation against the provided URI.
     *
     * @param uri  The URI.
     * @param auth Whether or not to auth.
     *
     * @return The response content.
     */
    Optional get(
            String uri,
            boolean auth);

    /**
     * Performs a GET operation against the provided URI.
     *
     * @param uri    The URI.
     * @param params The parameters.
     *
     * @return The response content.
     */
    Optional get(
            String uri,
            Map params);

    /**
     * Performs a POST operation against the provided URI.
     *
     * @param uri The URI.
     *
     * @return The response content.
     */
    Optional post(String uri);

    /**
     * Performs a POST operation against the provided URI with
     * content.
     *
     * @param uri  The URI.
     * @param body The content.
     *
     * @return The response content.
     */
    Optional post(
            String uri,
            String body);

    /**
     * Performs a PUT operation against the provided URI.
     *
     * @param uri  The URI.
     * @param body The body.
     *
     * @return The response content.
     */
    Optional put(
            String uri,
            String body);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy