com.banxa.model.request.GetRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-sdk Show documentation
Show all versions of java-sdk Show documentation
The Java SDK for integration with Banxa's API
The newest version!
package com.banxa.model.request;
import java.util.Map;
public abstract class GetRequest implements Request {
@Override
public String getMethod() {
return "GET";
}
@Override
public String getPayload() {
return null;
}
protected void addUriParam(Map params, String key, String value) {
if (value != null) {
params.put(key, value);
}
}
protected void addUriParam(Map params, String key, Double value) {
if (value != null) {
params.put(key, value.toString());
}
}
protected void addUriParam(Map params, String key, Integer value) {
if (value != null) {
params.put(key, value.toString());
}
}
protected String appendUriParams(String uri, Map params) {
String appender = "?";
StringBuilder uriBuilder = new StringBuilder(uri);
for (Map.Entry param : params.entrySet()) {
uriBuilder.append(appender).append(param.getKey()).append("=").append(param.getValue());
appender = "&";
}
return uriBuilder.toString();
}
}