com.eligible.net.EligibleResponse Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of eligible-java Show documentation
Show all versions of eligible-java Show documentation
Java bindings for Eligible APIs (https://eligible.com).
package com.eligible.net;
import com.eligible.util.NetworkUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.io.UnsupportedEncodingException;
import java.util.List;
import java.util.Map;
/**
* Raw HTTP response fetched from Eligible API Calls.
*/
@Getter
@AllArgsConstructor
public class EligibleResponse {
private final int responseCode;
private final byte[] responseByteArray;
private final String responseBody;
private final Map> responseHeaders;
/**
* Create an {@link EligibleResponseGetter} with response code and body.
*
* @param responseCode HTTP response code
* @param responseByteArray HTTP response body
* @throws UnsupportedEncodingException when charset not supported
*/
public EligibleResponse(int responseCode, byte[] responseByteArray) throws UnsupportedEncodingException {
this(responseCode, responseByteArray, new String(responseByteArray, NetworkUtil.CHARSET), null);
}
/**
* Create an {@link EligibleResponseGetter} with response code and body.
*
* @param responseCode HTTP response code
* @param responseByteArray HTTP response body
* @param responseHeaders HTTP response headers
* @throws UnsupportedEncodingException when charset not supported
*/
public EligibleResponse(int responseCode, byte[] responseByteArray, Map> responseHeaders)
throws UnsupportedEncodingException {
this(responseCode, responseByteArray, new String(responseByteArray, NetworkUtil.CHARSET), responseHeaders);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy