Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion src/main/java/com/facebook/ads/sdk/APIConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ public class APIConfig {
public static final String DEFAULT_API_BASE = "https://graph.facebook.com";
public static final String DEFAULT_VIDEO_API_BASE = "https://graph-video.facebook.com";
public static final String USER_AGENT = "fbbizsdk-java-v6.0";
};
}
6 changes: 3 additions & 3 deletions src/main/java/com/facebook/ads/sdk/APINode.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public String getId() {
} catch (Exception e) {
return null;
}
};
}

public String getRawValue() {
return rawValue;
Expand Down Expand Up @@ -112,7 +112,7 @@ public static APINodeList<APINode> parseResponse(String json, APIContext context
arr = result.getAsJsonArray();
for (int i = 0; i < arr.size(); i++) {
nodes.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header));
};
}
return nodes;
} else if (result.isJsonObject()) {
obj = result.getAsJsonObject();
Expand All @@ -138,7 +138,7 @@ public static APINodeList<APINode> parseResponse(String json, APIContext context
arr = obj.get("data").getAsJsonArray();
for (int i = 0; i < arr.size(); i++) {
nodes.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header));
};
}
} else if (obj.get("data").isJsonObject()) {
// Third, check if it's a JSON object with "data"
obj = obj.get("data").getAsJsonObject();
Expand Down
24 changes: 12 additions & 12 deletions src/main/java/com/facebook/ads/sdk/APIRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,31 +110,31 @@ public APIRequest(APIContext context, String nodeId, String endpoint, String met

public APIResponse getLastResponse() {
return lastResponse;
};
}

public APIResponse parseResponse(String response, String header) throws APIException {
public APIResponse parseResponse(String response, String header) throws APIException {
if (parser != null) {
return parser.parseResponse(response, context, this, header);
} else {
return APINode.parseResponse(response, context, new APIRequest<APINode>(context, nodeId, endpoint, method, paramNames), header);
}
};
}

public APIResponse execute() throws APIException {
public APIResponse execute() throws APIException {
return execute(new HashMap<String, Object>());
};
}

public APIResponse execute(Map<String, Object> extraParams) throws APIException {
public APIResponse execute(Map<String, Object> extraParams) throws APIException {
ResponseWrapper rw = executeInternal(extraParams);
lastResponse = parseResponse(rw.getBody(), rw.getHeader());
return lastResponse;
};
}

public ListenableFuture<APIResponse> executeAsyncBase() throws APIException {
public ListenableFuture<APIResponse> executeAsyncBase() throws APIException {
return executeAsyncBase(new HashMap<String, Object>());
};
}

public ListenableFuture<APIResponse> executeAsyncBase(Map<String, Object> extraParams) throws APIException {
public ListenableFuture<APIResponse> executeAsyncBase(Map<String, Object> extraParams) throws APIException {
return Futures.transform(
executeAsyncInternal(extraParams),
new Function<ResponseWrapper, APIResponse>() {
Expand All @@ -147,9 +147,9 @@ public APIResponse apply(ResponseWrapper result) {
}
}
);
};
}

public APIRequest<T> setParam(String param, Object value) {
public APIRequest<T> setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
Expand Down
Loading