Started implementing the Replay Center.

Expanded and generalized the ApiClient.
This commit is contained in:
Marius Metzger
2015-01-29 22:58:22 +01:00
parent 4659abc98e
commit f67e681825
9 changed files with 247 additions and 31 deletions

View File

@@ -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;
}
}