// Path: allegro-nice-domain/src/main/java/com/apwglobal/nice/exception/RestApiException.java
// public class RestApiException extends AllegroException {
// 
//     public RestApiException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public RestApiException(String message) {
//         super(message);
//     }
// 
// }


import com.apwglobal.nice.exception.RestApiException;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
package com.apwglobal.nice.util;


public class ClientExecuteUtil {

    private final static Logger logger = LoggerFactory.getLogger(ClientExecuteUtil.class);

    @NotNull
    public static String execute(@NotNull HttpRequestBase httpRequest) {
        CloseableHttpClient client = HttpClients.createDefault();

        try (CloseableHttpResponse res = client.execute(httpRequest)) {
            HttpEntity entity = res.getEntity();
            return EntityUtils.toString(entity, "UTF-8");
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
// Path: allegro-nice-domain/src/main/java/com/apwglobal/nice/exception/RestApiException.java
// public class RestApiException extends AllegroException {
// 
//     public RestApiException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public RestApiException(String message) {
//         super(message);
//     }
// 
// }


// Path: allegro-nice-api/src/main/java/com/apwglobal/nice/util/ClientExecuteUtil.java
import com.apwglobal.nice.exception.RestApiException;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

package com.apwglobal.nice.util;


public class ClientExecuteUtil {

    private final static Logger logger = LoggerFactory.getLogger(ClientExecuteUtil.class);

    @NotNull
    public static String execute(@NotNull HttpRequestBase httpRequest) {
        CloseableHttpClient client = HttpClients.createDefault();

        try (CloseableHttpResponse res = client.execute(httpRequest)) {
            HttpEntity entity = res.getEntity();
            return EntityUtils.toString(entity, "UTF-8");
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            throw new RestApiException(e.getMessage(), e);