Started implementing the Replay Center.
Expanded and generalized the ApiClient.
This commit is contained in:
@@ -11,28 +11,28 @@ public class GsonApiClient {
|
||||
|
||||
private static final JsonParser parser = new JsonParser();
|
||||
|
||||
public static JsonObject invoke(QueryBuilder query) throws IOException, ApiException {
|
||||
public static JsonElement invoke(QueryBuilder query) throws IOException, ApiException {
|
||||
String apiResult = SimpleApiClient.invoke(query);
|
||||
return wrapWithJson(apiResult);
|
||||
}
|
||||
|
||||
public static JsonObject invokeJson(String url) throws IOException, ApiException {
|
||||
public static JsonElement invokeJson(String url) throws IOException, ApiException {
|
||||
String apiResult = SimpleApiClient.invokeUrl(url);
|
||||
return wrapWithJson(apiResult);
|
||||
}
|
||||
|
||||
public static JsonObject invokeJson(String apiKey, String method, Map<String,Object> paramMap) throws IOException, ApiException {
|
||||
public static JsonElement invokeJson(String apiKey, String method, Map<String,Object> paramMap) throws IOException, ApiException {
|
||||
String apiResult = SimpleApiClient.invoke(method, paramMap);
|
||||
return wrapWithJson(apiResult);
|
||||
}
|
||||
|
||||
public static JsonObject invokeJson(String apiKey, String method) throws IOException, ApiException {
|
||||
public static JsonElement invokeJson(String apiKey, String method) throws IOException, ApiException {
|
||||
String apiResult = SimpleApiClient.invoke(method, null);
|
||||
return wrapWithJson(apiResult);
|
||||
}
|
||||
|
||||
private static JsonObject wrapWithJson(String apiResult) {
|
||||
private static JsonElement wrapWithJson(String apiResult) {
|
||||
JsonElement element = parser.parse(apiResult);
|
||||
return element.getAsJsonObject();
|
||||
return element;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user