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

cl.transbank.util.HttpUtil Maven / Gradle / Ivy

There is a newer version: 5.0.0
Show newest version
package cl.transbank.util;

import cl.transbank.webpay.exception.TransbankHttpApiException;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NonNull;

import java.io.IOException;
import java.net.URL;
import java.util.Map;

public interface HttpUtil {
     T request(@NonNull URL url, RequestMethod method, Object request, Map headers,
                  Class clazz) throws IOException, TransbankHttpApiException;
    String request(URL url, HttpUtilImpl.RequestMethod method, String query) throws IOException, TransbankHttpApiException;
    String request(URL url, HttpUtilImpl.RequestMethod method, String query, HttpUtil.ContentType contentType)
            throws IOException, TransbankHttpApiException;
    String request(@NonNull URL url, RequestMethod method, String query, Map headers)
            throws IOException, TransbankHttpApiException;
    String request(@NonNull URL url, RequestMethod method, String query, ContentType contentType, Map headers) throws IOException, TransbankHttpApiException;

    @AllArgsConstructor
    enum ContentType {
        JSON("application/json");

        @Getter
        private String contentType;
    }

    enum RequestMethod {
        GET,
        POST,
        DELETE,
        PUT
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy