diff --git a/pom.xml b/pom.xml
index 0cc765cf..e8b0d184 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
com.facebook.business.sdk
facebook-java-business-sdk
jar
- 20.0.2
+ 20.0.3
${project.groupId}:${project.artifactId}
Facebook Business Solutions SDK for Java
https://developers.facebook.com/docs/marketing-api/sdks
diff --git a/src/main/java/com/facebook/ads/sdk/ALMAdAccountInfo.java b/src/main/java/com/facebook/ads/sdk/ALMAdAccountInfo.java
new file mode 100644
index 00000000..1d9a7f24
--- /dev/null
+++ b/src/main/java/com/facebook/ads/sdk/ALMAdAccountInfo.java
@@ -0,0 +1,512 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+package com.facebook.ads.sdk;
+
+import java.io.File;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.google.common.base.Function;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.MoreExecutors;
+import com.google.common.util.concurrent.SettableFuture;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonArray;
+import com.google.gson.annotations.SerializedName;
+import com.google.gson.reflect.TypeToken;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonParser;
+
+import com.facebook.ads.sdk.APIException.MalformedResponseException;
+
+/**
+ * This class is auto-generated.
+ *
+ * For any issues or feature requests related to this class, please let us know
+ * on github and we'll fix in our codegen framework. We'll not be able to accept
+ * pull request for this class.
+ *
+ */
+public class ALMAdAccountInfo extends APINode {
+ @SerializedName("ad_account_id")
+ private String mAdAccountId = null;
+ @SerializedName("id")
+ private String mId = null;
+ @SerializedName("managed_by")
+ private String mManagedBy = null;
+ @SerializedName("parent_advertiser_id")
+ private String mParentAdvertiserId = null;
+ @SerializedName("sub_vertical")
+ private String mSubVertical = null;
+ @SerializedName("tag")
+ private List mTag = null;
+ @SerializedName("user_ids")
+ private List mUserIds = null;
+ @SerializedName("vertical")
+ private String mVertical = null;
+ protected static Gson gson = null;
+
+ ALMAdAccountInfo() {
+ }
+
+ public ALMAdAccountInfo(Long id, APIContext context) {
+ this(id.toString(), context);
+ }
+
+ public ALMAdAccountInfo(String id, APIContext context) {
+ this.mId = id;
+
+ this.context = context;
+ }
+
+ public ALMAdAccountInfo fetch() throws APIException{
+ ALMAdAccountInfo newInstance = fetchById(this.getPrefixedId().toString(), this.context);
+ this.copyFrom(newInstance);
+ return this;
+ }
+
+ public static ALMAdAccountInfo fetchById(Long id, APIContext context) throws APIException {
+ return fetchById(id.toString(), context);
+ }
+
+ public static ListenableFuture fetchByIdAsync(Long id, APIContext context) throws APIException {
+ return fetchByIdAsync(id.toString(), context);
+ }
+
+ public static ALMAdAccountInfo fetchById(String id, APIContext context) throws APIException {
+ return
+ new APIRequestGet(id, context)
+ .requestAllFields()
+ .execute();
+ }
+
+ public static ListenableFuture fetchByIdAsync(String id, APIContext context) throws APIException {
+ return
+ new APIRequestGet(id, context)
+ .requestAllFields()
+ .executeAsync();
+ }
+
+ public static APINodeList fetchByIds(List ids, List fields, APIContext context) throws APIException {
+ return (APINodeList)(
+ new APIRequest(context, "", "/", "GET", ALMAdAccountInfo.getParser())
+ .setParam("ids", APIRequest.joinStringList(ids))
+ .requestFields(fields)
+ .execute()
+ );
+ }
+
+ public static ListenableFuture> fetchByIdsAsync(List ids, List fields, APIContext context) throws APIException {
+ return
+ new APIRequest(context, "", "/", "GET", ALMAdAccountInfo.getParser())
+ .setParam("ids", APIRequest.joinStringList(ids))
+ .requestFields(fields)
+ .executeAsyncBase();
+ }
+
+ private String getPrefixedId() {
+ return getId();
+ }
+
+ public String getId() {
+ return getFieldId().toString();
+ }
+ public static ALMAdAccountInfo loadJSON(String json, APIContext context, String header) {
+ ALMAdAccountInfo almAdAccountInfo = getGson().fromJson(json, ALMAdAccountInfo.class);
+ if (context.isDebug()) {
+ JsonParser parser = new JsonParser();
+ JsonElement o1 = parser.parse(json);
+ JsonElement o2 = parser.parse(almAdAccountInfo.toString());
+ if (o1.getAsJsonObject().get("__fb_trace_id__") != null) {
+ o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__"));
+ }
+ if (!o1.equals(o2)) {
+ context.log("[Warning] When parsing response, object is not consistent with JSON:");
+ context.log("[JSON]" + o1);
+ context.log("[Object]" + o2);
+ }
+ }
+ almAdAccountInfo.context = context;
+ almAdAccountInfo.rawValue = json;
+ almAdAccountInfo.header = header;
+ return almAdAccountInfo;
+ }
+
+ public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException {
+ APINodeList almAdAccountInfos = new APINodeList(request, json, header);
+ JsonArray arr;
+ JsonObject obj;
+ JsonParser parser = new JsonParser();
+ Exception exception = null;
+ try{
+ JsonElement result = parser.parse(json);
+ if (result.isJsonArray()) {
+ // First, check if it's a pure JSON Array
+ arr = result.getAsJsonArray();
+ for (int i = 0; i < arr.size(); i++) {
+ almAdAccountInfos.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header));
+ };
+ return almAdAccountInfos;
+ } else if (result.isJsonObject()) {
+ obj = result.getAsJsonObject();
+ if (obj.has("data")) {
+ if (obj.has("paging")) {
+ JsonObject paging = obj.get("paging").getAsJsonObject();
+ if (paging.has("cursors")) {
+ JsonObject cursors = paging.get("cursors").getAsJsonObject();
+ String before = cursors.has("before") ? cursors.get("before").getAsString() : null;
+ String after = cursors.has("after") ? cursors.get("after").getAsString() : null;
+ almAdAccountInfos.setCursors(before, after);
+ }
+ String previous = paging.has("previous") ? paging.get("previous").getAsString() : null;
+ String next = paging.has("next") ? paging.get("next").getAsString() : null;
+ almAdAccountInfos.setPaging(previous, next);
+ if (context.hasAppSecret()) {
+ almAdAccountInfos.setAppSecret(context.getAppSecretProof());
+ }
+ }
+ if (obj.get("data").isJsonArray()) {
+ // Second, check if it's a JSON array with "data"
+ arr = obj.get("data").getAsJsonArray();
+ for (int i = 0; i < arr.size(); i++) {
+ almAdAccountInfos.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();
+ boolean isRedownload = false;
+ for (String s : new String[]{"campaigns", "adsets", "ads"}) {
+ if (obj.has(s)) {
+ isRedownload = true;
+ obj = obj.getAsJsonObject(s);
+ for (Map.Entry entry : obj.entrySet()) {
+ almAdAccountInfos.add(loadJSON(entry.getValue().toString(), context, header));
+ }
+ break;
+ }
+ }
+ if (!isRedownload) {
+ almAdAccountInfos.add(loadJSON(obj.toString(), context, header));
+ }
+ }
+ return almAdAccountInfos;
+ } else if (obj.has("images")) {
+ // Fourth, check if it's a map of image objects
+ obj = obj.get("images").getAsJsonObject();
+ for (Map.Entry entry : obj.entrySet()) {
+ almAdAccountInfos.add(loadJSON(entry.getValue().toString(), context, header));
+ }
+ return almAdAccountInfos;
+ } else {
+ // Fifth, check if it's an array of objects indexed by id
+ boolean isIdIndexedArray = true;
+ for (Map.Entry entry : obj.entrySet()) {
+ String key = (String) entry.getKey();
+ if (key.equals("__fb_trace_id__")) {
+ continue;
+ }
+ JsonElement value = (JsonElement) entry.getValue();
+ if (
+ value != null &&
+ value.isJsonObject() &&
+ value.getAsJsonObject().has("id") &&
+ value.getAsJsonObject().get("id") != null &&
+ value.getAsJsonObject().get("id").getAsString().equals(key)
+ ) {
+ almAdAccountInfos.add(loadJSON(value.toString(), context, header));
+ } else {
+ isIdIndexedArray = false;
+ break;
+ }
+ }
+ if (isIdIndexedArray) {
+ return almAdAccountInfos;
+ }
+
+ // Sixth, check if it's pure JsonObject
+ almAdAccountInfos.clear();
+ almAdAccountInfos.add(loadJSON(json, context, header));
+ return almAdAccountInfos;
+ }
+ }
+ } catch (Exception e) {
+ exception = e;
+ }
+ throw new MalformedResponseException(
+ "Invalid response string: " + json,
+ exception
+ );
+ }
+
+ @Override
+ public APIContext getContext() {
+ return context;
+ }
+
+ @Override
+ public void setContext(APIContext context) {
+ this.context = context;
+ }
+
+ @Override
+ public String toString() {
+ return getGson().toJson(this);
+ }
+
+ public APIRequestGet get() {
+ return new APIRequestGet(this.getPrefixedId().toString(), context);
+ }
+
+
+ public String getFieldAdAccountId() {
+ return mAdAccountId;
+ }
+
+ public String getFieldId() {
+ return mId;
+ }
+
+ public String getFieldManagedBy() {
+ return mManagedBy;
+ }
+
+ public String getFieldParentAdvertiserId() {
+ return mParentAdvertiserId;
+ }
+
+ public String getFieldSubVertical() {
+ return mSubVertical;
+ }
+
+ public List getFieldTag() {
+ return mTag;
+ }
+
+ public List getFieldUserIds() {
+ return mUserIds;
+ }
+
+ public String getFieldVertical() {
+ return mVertical;
+ }
+
+
+
+ public static class APIRequestGet extends APIRequest {
+
+ ALMAdAccountInfo lastResponse = null;
+ @Override
+ public ALMAdAccountInfo getLastResponse() {
+ return lastResponse;
+ }
+ public static final String[] PARAMS = {
+ };
+
+ public static final String[] FIELDS = {
+ "ad_account_id",
+ "id",
+ "managed_by",
+ "parent_advertiser_id",
+ "sub_vertical",
+ "tag",
+ "user_ids",
+ "vertical",
+ };
+
+ @Override
+ public ALMAdAccountInfo parseResponse(String response, String header) throws APIException {
+ return ALMAdAccountInfo.parseResponse(response, getContext(), this, header).head();
+ }
+
+ @Override
+ public ALMAdAccountInfo execute() throws APIException {
+ return execute(new HashMap());
+ }
+
+ @Override
+ public ALMAdAccountInfo execute(Map extraParams) throws APIException {
+ ResponseWrapper rw = executeInternal(extraParams);
+ lastResponse = parseResponse(rw.getBody(), rw.getHeader());
+ return lastResponse;
+ }
+
+ public ListenableFuture executeAsync() throws APIException {
+ return executeAsync(new HashMap());
+ };
+
+ public ListenableFuture executeAsync(Map extraParams) throws APIException {
+ return Futures.transform(
+ executeAsyncInternal(extraParams),
+ new Function() {
+ public ALMAdAccountInfo apply(ResponseWrapper result) {
+ try {
+ return APIRequestGet.this.parseResponse(result.getBody(), result.getHeader());
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ },
+ MoreExecutors.directExecutor()
+ );
+ };
+
+ public APIRequestGet(String nodeId, APIContext context) {
+ super(context, nodeId, "/", "GET", Arrays.asList(PARAMS));
+ }
+
+ @Override
+ public APIRequestGet setParam(String param, Object value) {
+ setParamInternal(param, value);
+ return this;
+ }
+
+ @Override
+ public APIRequestGet setParams(Map params) {
+ setParamsInternal(params);
+ return this;
+ }
+
+
+ public APIRequestGet requestAllFields () {
+ return this.requestAllFields(true);
+ }
+
+ public APIRequestGet requestAllFields (boolean value) {
+ for (String field : FIELDS) {
+ this.requestField(field, value);
+ }
+ return this;
+ }
+
+ @Override
+ public APIRequestGet requestFields (List fields) {
+ return this.requestFields(fields, true);
+ }
+
+ @Override
+ public APIRequestGet requestFields (List fields, boolean value) {
+ for (String field : fields) {
+ this.requestField(field, value);
+ }
+ return this;
+ }
+
+ @Override
+ public APIRequestGet requestField (String field) {
+ this.requestField(field, true);
+ return this;
+ }
+
+ @Override
+ public APIRequestGet requestField (String field, boolean value) {
+ this.requestFieldInternal(field, value);
+ return this;
+ }
+
+ public APIRequestGet requestAdAccountIdField () {
+ return this.requestAdAccountIdField(true);
+ }
+ public APIRequestGet requestAdAccountIdField (boolean value) {
+ this.requestField("ad_account_id", value);
+ return this;
+ }
+ public APIRequestGet requestIdField () {
+ return this.requestIdField(true);
+ }
+ public APIRequestGet requestIdField (boolean value) {
+ this.requestField("id", value);
+ return this;
+ }
+ public APIRequestGet requestManagedByField () {
+ return this.requestManagedByField(true);
+ }
+ public APIRequestGet requestManagedByField (boolean value) {
+ this.requestField("managed_by", value);
+ return this;
+ }
+ public APIRequestGet requestParentAdvertiserIdField () {
+ return this.requestParentAdvertiserIdField(true);
+ }
+ public APIRequestGet requestParentAdvertiserIdField (boolean value) {
+ this.requestField("parent_advertiser_id", value);
+ return this;
+ }
+ public APIRequestGet requestSubVerticalField () {
+ return this.requestSubVerticalField(true);
+ }
+ public APIRequestGet requestSubVerticalField (boolean value) {
+ this.requestField("sub_vertical", value);
+ return this;
+ }
+ public APIRequestGet requestTagField () {
+ return this.requestTagField(true);
+ }
+ public APIRequestGet requestTagField (boolean value) {
+ this.requestField("tag", value);
+ return this;
+ }
+ public APIRequestGet requestUserIdsField () {
+ return this.requestUserIdsField(true);
+ }
+ public APIRequestGet requestUserIdsField (boolean value) {
+ this.requestField("user_ids", value);
+ return this;
+ }
+ public APIRequestGet requestVerticalField () {
+ return this.requestVerticalField(true);
+ }
+ public APIRequestGet requestVerticalField (boolean value) {
+ this.requestField("vertical", value);
+ return this;
+ }
+ }
+
+
+ synchronized /*package*/ static Gson getGson() {
+ if (gson != null) {
+ return gson;
+ } else {
+ gson = new GsonBuilder()
+ .excludeFieldsWithModifiers(Modifier.STATIC)
+ .excludeFieldsWithModifiers(Modifier.PROTECTED)
+ .disableHtmlEscaping()
+ .create();
+ }
+ return gson;
+ }
+
+ public ALMAdAccountInfo copyFrom(ALMAdAccountInfo instance) {
+ this.mAdAccountId = instance.mAdAccountId;
+ this.mId = instance.mId;
+ this.mManagedBy = instance.mManagedBy;
+ this.mParentAdvertiserId = instance.mParentAdvertiserId;
+ this.mSubVertical = instance.mSubVertical;
+ this.mTag = instance.mTag;
+ this.mUserIds = instance.mUserIds;
+ this.mVertical = instance.mVertical;
+ this.context = instance.context;
+ this.rawValue = instance.rawValue;
+ return this;
+ }
+
+ public static APIRequest.ResponseParser getParser() {
+ return new APIRequest.ResponseParser() {
+ public APINodeList parseResponse(String response, APIContext context, APIRequest request, String header) throws MalformedResponseException {
+ return ALMAdAccountInfo.parseResponse(response, context, request, header);
+ }
+ };
+ }
+}
diff --git a/src/main/java/com/facebook/ads/sdk/UserSetReportingRoot.java b/src/main/java/com/facebook/ads/sdk/ALMEndAdvertiserInfo.java
similarity index 64%
rename from src/main/java/com/facebook/ads/sdk/UserSetReportingRoot.java
rename to src/main/java/com/facebook/ads/sdk/ALMEndAdvertiserInfo.java
index 8f23c372..0aa0eaf9 100644
--- a/src/main/java/com/facebook/ads/sdk/UserSetReportingRoot.java
+++ b/src/main/java/com/facebook/ads/sdk/ALMEndAdvertiserInfo.java
@@ -40,68 +40,72 @@
* pull request for this class.
*
*/
-public class UserSetReportingRoot extends APINode {
- @SerializedName("creation_time")
- private String mCreationTime = null;
+public class ALMEndAdvertiserInfo extends APINode {
+ @SerializedName("estimated_ad_budget")
+ private Long mEstimatedAdBudget = null;
@SerializedName("id")
private String mId = null;
- @SerializedName("last_modified_time")
- private String mLastModifiedTime = null;
+ @SerializedName("parent_advertiser_id")
+ private String mParentAdvertiserId = null;
+ @SerializedName("parent_advertiser_name")
+ private String mParentAdvertiserName = null;
+ @SerializedName("tag")
+ private List mTag = null;
protected static Gson gson = null;
- UserSetReportingRoot() {
+ ALMEndAdvertiserInfo() {
}
- public UserSetReportingRoot(Long id, APIContext context) {
+ public ALMEndAdvertiserInfo(Long id, APIContext context) {
this(id.toString(), context);
}
- public UserSetReportingRoot(String id, APIContext context) {
+ public ALMEndAdvertiserInfo(String id, APIContext context) {
this.mId = id;
this.context = context;
}
- public UserSetReportingRoot fetch() throws APIException{
- UserSetReportingRoot newInstance = fetchById(this.getPrefixedId().toString(), this.context);
+ public ALMEndAdvertiserInfo fetch() throws APIException{
+ ALMEndAdvertiserInfo newInstance = fetchById(this.getPrefixedId().toString(), this.context);
this.copyFrom(newInstance);
return this;
}
- public static UserSetReportingRoot fetchById(Long id, APIContext context) throws APIException {
+ public static ALMEndAdvertiserInfo fetchById(Long id, APIContext context) throws APIException {
return fetchById(id.toString(), context);
}
- public static ListenableFuture fetchByIdAsync(Long id, APIContext context) throws APIException {
+ public static ListenableFuture fetchByIdAsync(Long id, APIContext context) throws APIException {
return fetchByIdAsync(id.toString(), context);
}
- public static UserSetReportingRoot fetchById(String id, APIContext context) throws APIException {
+ public static ALMEndAdvertiserInfo fetchById(String id, APIContext context) throws APIException {
return
new APIRequestGet(id, context)
.requestAllFields()
.execute();
}
- public static ListenableFuture fetchByIdAsync(String id, APIContext context) throws APIException {
+ public static ListenableFuture fetchByIdAsync(String id, APIContext context) throws APIException {
return
new APIRequestGet(id, context)
.requestAllFields()
.executeAsync();
}
- public static APINodeList fetchByIds(List ids, List fields, APIContext context) throws APIException {
- return (APINodeList)(
- new APIRequest(context, "", "/", "GET", UserSetReportingRoot.getParser())
+ public static APINodeList fetchByIds(List ids, List fields, APIContext context) throws APIException {
+ return (APINodeList)(
+ new APIRequest(context, "", "/", "GET", ALMEndAdvertiserInfo.getParser())
.setParam("ids", APIRequest.joinStringList(ids))
.requestFields(fields)
.execute()
);
}
- public static ListenableFuture> fetchByIdsAsync(List ids, List fields, APIContext context) throws APIException {
+ public static ListenableFuture> fetchByIdsAsync(List ids, List fields, APIContext context) throws APIException {
return
- new APIRequest(context, "", "/", "GET", UserSetReportingRoot.getParser())
+ new APIRequest(context, "", "/", "GET", ALMEndAdvertiserInfo.getParser())
.setParam("ids", APIRequest.joinStringList(ids))
.requestFields(fields)
.executeAsyncBase();
@@ -114,12 +118,12 @@ private String getPrefixedId() {
public String getId() {
return getFieldId().toString();
}
- public static UserSetReportingRoot loadJSON(String json, APIContext context, String header) {
- UserSetReportingRoot userSetReportingRoot = getGson().fromJson(json, UserSetReportingRoot.class);
+ public static ALMEndAdvertiserInfo loadJSON(String json, APIContext context, String header) {
+ ALMEndAdvertiserInfo almEndAdvertiserInfo = getGson().fromJson(json, ALMEndAdvertiserInfo.class);
if (context.isDebug()) {
JsonParser parser = new JsonParser();
JsonElement o1 = parser.parse(json);
- JsonElement o2 = parser.parse(userSetReportingRoot.toString());
+ JsonElement o2 = parser.parse(almEndAdvertiserInfo.toString());
if (o1.getAsJsonObject().get("__fb_trace_id__") != null) {
o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__"));
}
@@ -129,14 +133,14 @@ public static UserSetReportingRoot loadJSON(String json, APIContext context, Str
context.log("[Object]" + o2);
}
}
- userSetReportingRoot.context = context;
- userSetReportingRoot.rawValue = json;
- userSetReportingRoot.header = header;
- return userSetReportingRoot;
+ almEndAdvertiserInfo.context = context;
+ almEndAdvertiserInfo.rawValue = json;
+ almEndAdvertiserInfo.header = header;
+ return almEndAdvertiserInfo;
}
- public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException {
- APINodeList userSetReportingRoots = new APINodeList(request, json, header);
+ public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException {
+ APINodeList almEndAdvertiserInfos = new APINodeList(request, json, header);
JsonArray arr;
JsonObject obj;
JsonParser parser = new JsonParser();
@@ -147,9 +151,9 @@ public static APINodeList parseResponse(String json, APICo
// First, check if it's a pure JSON Array
arr = result.getAsJsonArray();
for (int i = 0; i < arr.size(); i++) {
- userSetReportingRoots.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header));
+ almEndAdvertiserInfos.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header));
};
- return userSetReportingRoots;
+ return almEndAdvertiserInfos;
} else if (result.isJsonObject()) {
obj = result.getAsJsonObject();
if (obj.has("data")) {
@@ -159,20 +163,20 @@ public static APINodeList parseResponse(String json, APICo
JsonObject cursors = paging.get("cursors").getAsJsonObject();
String before = cursors.has("before") ? cursors.get("before").getAsString() : null;
String after = cursors.has("after") ? cursors.get("after").getAsString() : null;
- userSetReportingRoots.setCursors(before, after);
+ almEndAdvertiserInfos.setCursors(before, after);
}
String previous = paging.has("previous") ? paging.get("previous").getAsString() : null;
String next = paging.has("next") ? paging.get("next").getAsString() : null;
- userSetReportingRoots.setPaging(previous, next);
+ almEndAdvertiserInfos.setPaging(previous, next);
if (context.hasAppSecret()) {
- userSetReportingRoots.setAppSecret(context.getAppSecretProof());
+ almEndAdvertiserInfos.setAppSecret(context.getAppSecretProof());
}
}
if (obj.get("data").isJsonArray()) {
// Second, check if it's a JSON array with "data"
arr = obj.get("data").getAsJsonArray();
for (int i = 0; i < arr.size(); i++) {
- userSetReportingRoots.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header));
+ almEndAdvertiserInfos.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"
@@ -183,23 +187,23 @@ public static APINodeList parseResponse(String json, APICo
isRedownload = true;
obj = obj.getAsJsonObject(s);
for (Map.Entry entry : obj.entrySet()) {
- userSetReportingRoots.add(loadJSON(entry.getValue().toString(), context, header));
+ almEndAdvertiserInfos.add(loadJSON(entry.getValue().toString(), context, header));
}
break;
}
}
if (!isRedownload) {
- userSetReportingRoots.add(loadJSON(obj.toString(), context, header));
+ almEndAdvertiserInfos.add(loadJSON(obj.toString(), context, header));
}
}
- return userSetReportingRoots;
+ return almEndAdvertiserInfos;
} else if (obj.has("images")) {
// Fourth, check if it's a map of image objects
obj = obj.get("images").getAsJsonObject();
for (Map.Entry entry : obj.entrySet()) {
- userSetReportingRoots.add(loadJSON(entry.getValue().toString(), context, header));
+ almEndAdvertiserInfos.add(loadJSON(entry.getValue().toString(), context, header));
}
- return userSetReportingRoots;
+ return almEndAdvertiserInfos;
} else {
// Fifth, check if it's an array of objects indexed by id
boolean isIdIndexedArray = true;
@@ -216,20 +220,20 @@ public static APINodeList parseResponse(String json, APICo
value.getAsJsonObject().get("id") != null &&
value.getAsJsonObject().get("id").getAsString().equals(key)
) {
- userSetReportingRoots.add(loadJSON(value.toString(), context, header));
+ almEndAdvertiserInfos.add(loadJSON(value.toString(), context, header));
} else {
isIdIndexedArray = false;
break;
}
}
if (isIdIndexedArray) {
- return userSetReportingRoots;
+ return almEndAdvertiserInfos;
}
// Sixth, check if it's pure JsonObject
- userSetReportingRoots.clear();
- userSetReportingRoots.add(loadJSON(json, context, header));
- return userSetReportingRoots;
+ almEndAdvertiserInfos.clear();
+ almEndAdvertiserInfos.add(loadJSON(json, context, header));
+ return almEndAdvertiserInfos;
}
}
} catch (Exception e) {
@@ -261,62 +265,72 @@ public APIRequestGet get() {
}
- public String getFieldCreationTime() {
- return mCreationTime;
+ public Long getFieldEstimatedAdBudget() {
+ return mEstimatedAdBudget;
}
public String getFieldId() {
return mId;
}
- public String getFieldLastModifiedTime() {
- return mLastModifiedTime;
+ public String getFieldParentAdvertiserId() {
+ return mParentAdvertiserId;
}
+ public String getFieldParentAdvertiserName() {
+ return mParentAdvertiserName;
+ }
+
+ public List getFieldTag() {
+ return mTag;
+ }
- public static class APIRequestGet extends APIRequest {
- UserSetReportingRoot lastResponse = null;
+ public static class APIRequestGet extends APIRequest {
+
+ ALMEndAdvertiserInfo lastResponse = null;
@Override
- public UserSetReportingRoot getLastResponse() {
+ public ALMEndAdvertiserInfo getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
};
public static final String[] FIELDS = {
- "creation_time",
+ "estimated_ad_budget",
"id",
- "last_modified_time",
+ "parent_advertiser_id",
+ "parent_advertiser_name",
+ "tag",
};
@Override
- public UserSetReportingRoot parseResponse(String response, String header) throws APIException {
- return UserSetReportingRoot.parseResponse(response, getContext(), this, header).head();
+ public ALMEndAdvertiserInfo parseResponse(String response, String header) throws APIException {
+ return ALMEndAdvertiserInfo.parseResponse(response, getContext(), this, header).head();
}
@Override
- public UserSetReportingRoot execute() throws APIException {
+ public ALMEndAdvertiserInfo execute() throws APIException {
return execute(new HashMap());
}
@Override
- public UserSetReportingRoot execute(Map extraParams) throws APIException {
+ public ALMEndAdvertiserInfo execute(Map extraParams) throws APIException {
ResponseWrapper rw = executeInternal(extraParams);
lastResponse = parseResponse(rw.getBody(), rw.getHeader());
return lastResponse;
}
- public ListenableFuture executeAsync() throws APIException {
+ public ListenableFuture executeAsync() throws APIException {
return executeAsync(new HashMap());
};
- public ListenableFuture executeAsync(Map extraParams) throws APIException {
+ public ListenableFuture executeAsync(Map extraParams) throws APIException {
return Futures.transform(
executeAsyncInternal(extraParams),
- new Function() {
- public UserSetReportingRoot apply(ResponseWrapper result) {
+ new Function() {
+ public ALMEndAdvertiserInfo apply(ResponseWrapper result) {
try {
return APIRequestGet.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
@@ -381,11 +395,11 @@ public APIRequestGet requestField (String field, boolean value) {
return this;
}
- public APIRequestGet requestCreationTimeField () {
- return this.requestCreationTimeField(true);
+ public APIRequestGet requestEstimatedAdBudgetField () {
+ return this.requestEstimatedAdBudgetField(true);
}
- public APIRequestGet requestCreationTimeField (boolean value) {
- this.requestField("creation_time", value);
+ public APIRequestGet requestEstimatedAdBudgetField (boolean value) {
+ this.requestField("estimated_ad_budget", value);
return this;
}
public APIRequestGet requestIdField () {
@@ -395,11 +409,25 @@ public APIRequestGet requestIdField (boolean value) {
this.requestField("id", value);
return this;
}
- public APIRequestGet requestLastModifiedTimeField () {
- return this.requestLastModifiedTimeField(true);
+ public APIRequestGet requestParentAdvertiserIdField () {
+ return this.requestParentAdvertiserIdField(true);
+ }
+ public APIRequestGet requestParentAdvertiserIdField (boolean value) {
+ this.requestField("parent_advertiser_id", value);
+ return this;
+ }
+ public APIRequestGet requestParentAdvertiserNameField () {
+ return this.requestParentAdvertiserNameField(true);
+ }
+ public APIRequestGet requestParentAdvertiserNameField (boolean value) {
+ this.requestField("parent_advertiser_name", value);
+ return this;
+ }
+ public APIRequestGet requestTagField () {
+ return this.requestTagField(true);
}
- public APIRequestGet requestLastModifiedTimeField (boolean value) {
- this.requestField("last_modified_time", value);
+ public APIRequestGet requestTagField (boolean value) {
+ this.requestField("tag", value);
return this;
}
}
@@ -418,19 +446,21 @@ public APIRequestGet requestLastModifiedTimeField (boolean value) {
return gson;
}
- public UserSetReportingRoot copyFrom(UserSetReportingRoot instance) {
- this.mCreationTime = instance.mCreationTime;
+ public ALMEndAdvertiserInfo copyFrom(ALMEndAdvertiserInfo instance) {
+ this.mEstimatedAdBudget = instance.mEstimatedAdBudget;
this.mId = instance.mId;
- this.mLastModifiedTime = instance.mLastModifiedTime;
+ this.mParentAdvertiserId = instance.mParentAdvertiserId;
+ this.mParentAdvertiserName = instance.mParentAdvertiserName;
+ this.mTag = instance.mTag;
this.context = instance.context;
this.rawValue = instance.rawValue;
return this;
}
- public static APIRequest.ResponseParser getParser() {
- return new APIRequest.ResponseParser() {
- public APINodeList parseResponse(String response, APIContext context, APIRequest request, String header) throws MalformedResponseException {
- return UserSetReportingRoot.parseResponse(response, context, request, header);
+ public static APIRequest.ResponseParser getParser() {
+ return new APIRequest.ResponseParser() {
+ public APINodeList parseResponse(String response, APIContext context, APIRequest request, String header) throws MalformedResponseException {
+ return ALMEndAdvertiserInfo.parseResponse(response, context, request, header);
}
};
}
diff --git a/src/main/java/com/facebook/ads/sdk/ALMEvent.java b/src/main/java/com/facebook/ads/sdk/ALMEvent.java
new file mode 100644
index 00000000..fd1fb341
--- /dev/null
+++ b/src/main/java/com/facebook/ads/sdk/ALMEvent.java
@@ -0,0 +1,572 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+package com.facebook.ads.sdk;
+
+import java.io.File;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.google.common.base.Function;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.MoreExecutors;
+import com.google.common.util.concurrent.SettableFuture;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonArray;
+import com.google.gson.annotations.SerializedName;
+import com.google.gson.reflect.TypeToken;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonParser;
+
+import com.facebook.ads.sdk.APIException.MalformedResponseException;
+
+/**
+ * This class is auto-generated.
+ *
+ * For any issues or feature requests related to this class, please let us know
+ * on github and we'll fix in our codegen framework. We'll not be able to accept
+ * pull request for this class.
+ *
+ */
+public class ALMEvent extends APINode {
+ @SerializedName("ad_account_ids")
+ private List mAdAccountIds = null;
+ @SerializedName("campaign_ids")
+ private List mCampaignIds = null;
+ @SerializedName("channel")
+ private String mChannel = null;
+ @SerializedName("event")
+ private String mEvent = null;
+ @SerializedName("event_time")
+ private String mEventTime = null;
+ @SerializedName("guidance")
+ private String mGuidance = null;
+ @SerializedName("guidance_detail")
+ private String mGuidanceDetail = null;
+ @SerializedName("id")
+ private String mId = null;
+ @SerializedName("parent_advertiser_ids")
+ private List mParentAdvertiserIds = null;
+ @SerializedName("reseller_business_id")
+ private String mResellerBusinessId = null;
+ @SerializedName("sub_channel")
+ private String mSubChannel = null;
+ @SerializedName("user_id")
+ private String mUserId = null;
+ protected static Gson gson = null;
+
+ ALMEvent() {
+ }
+
+ public ALMEvent(Long id, APIContext context) {
+ this(id.toString(), context);
+ }
+
+ public ALMEvent(String id, APIContext context) {
+ this.mId = id;
+
+ this.context = context;
+ }
+
+ public ALMEvent fetch() throws APIException{
+ ALMEvent newInstance = fetchById(this.getPrefixedId().toString(), this.context);
+ this.copyFrom(newInstance);
+ return this;
+ }
+
+ public static ALMEvent fetchById(Long id, APIContext context) throws APIException {
+ return fetchById(id.toString(), context);
+ }
+
+ public static ListenableFuture fetchByIdAsync(Long id, APIContext context) throws APIException {
+ return fetchByIdAsync(id.toString(), context);
+ }
+
+ public static ALMEvent fetchById(String id, APIContext context) throws APIException {
+ return
+ new APIRequestGet(id, context)
+ .requestAllFields()
+ .execute();
+ }
+
+ public static ListenableFuture fetchByIdAsync(String id, APIContext context) throws APIException {
+ return
+ new APIRequestGet(id, context)
+ .requestAllFields()
+ .executeAsync();
+ }
+
+ public static APINodeList fetchByIds(List ids, List fields, APIContext context) throws APIException {
+ return (APINodeList)(
+ new APIRequest(context, "", "/", "GET", ALMEvent.getParser())
+ .setParam("ids", APIRequest.joinStringList(ids))
+ .requestFields(fields)
+ .execute()
+ );
+ }
+
+ public static ListenableFuture> fetchByIdsAsync(List ids, List fields, APIContext context) throws APIException {
+ return
+ new APIRequest(context, "", "/", "GET", ALMEvent.getParser())
+ .setParam("ids", APIRequest.joinStringList(ids))
+ .requestFields(fields)
+ .executeAsyncBase();
+ }
+
+ private String getPrefixedId() {
+ return getId();
+ }
+
+ public String getId() {
+ return getFieldId().toString();
+ }
+ public static ALMEvent loadJSON(String json, APIContext context, String header) {
+ ALMEvent almEvent = getGson().fromJson(json, ALMEvent.class);
+ if (context.isDebug()) {
+ JsonParser parser = new JsonParser();
+ JsonElement o1 = parser.parse(json);
+ JsonElement o2 = parser.parse(almEvent.toString());
+ if (o1.getAsJsonObject().get("__fb_trace_id__") != null) {
+ o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__"));
+ }
+ if (!o1.equals(o2)) {
+ context.log("[Warning] When parsing response, object is not consistent with JSON:");
+ context.log("[JSON]" + o1);
+ context.log("[Object]" + o2);
+ }
+ }
+ almEvent.context = context;
+ almEvent.rawValue = json;
+ almEvent.header = header;
+ return almEvent;
+ }
+
+ public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException {
+ APINodeList almEvents = new APINodeList(request, json, header);
+ JsonArray arr;
+ JsonObject obj;
+ JsonParser parser = new JsonParser();
+ Exception exception = null;
+ try{
+ JsonElement result = parser.parse(json);
+ if (result.isJsonArray()) {
+ // First, check if it's a pure JSON Array
+ arr = result.getAsJsonArray();
+ for (int i = 0; i < arr.size(); i++) {
+ almEvents.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header));
+ };
+ return almEvents;
+ } else if (result.isJsonObject()) {
+ obj = result.getAsJsonObject();
+ if (obj.has("data")) {
+ if (obj.has("paging")) {
+ JsonObject paging = obj.get("paging").getAsJsonObject();
+ if (paging.has("cursors")) {
+ JsonObject cursors = paging.get("cursors").getAsJsonObject();
+ String before = cursors.has("before") ? cursors.get("before").getAsString() : null;
+ String after = cursors.has("after") ? cursors.get("after").getAsString() : null;
+ almEvents.setCursors(before, after);
+ }
+ String previous = paging.has("previous") ? paging.get("previous").getAsString() : null;
+ String next = paging.has("next") ? paging.get("next").getAsString() : null;
+ almEvents.setPaging(previous, next);
+ if (context.hasAppSecret()) {
+ almEvents.setAppSecret(context.getAppSecretProof());
+ }
+ }
+ if (obj.get("data").isJsonArray()) {
+ // Second, check if it's a JSON array with "data"
+ arr = obj.get("data").getAsJsonArray();
+ for (int i = 0; i < arr.size(); i++) {
+ almEvents.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();
+ boolean isRedownload = false;
+ for (String s : new String[]{"campaigns", "adsets", "ads"}) {
+ if (obj.has(s)) {
+ isRedownload = true;
+ obj = obj.getAsJsonObject(s);
+ for (Map.Entry entry : obj.entrySet()) {
+ almEvents.add(loadJSON(entry.getValue().toString(), context, header));
+ }
+ break;
+ }
+ }
+ if (!isRedownload) {
+ almEvents.add(loadJSON(obj.toString(), context, header));
+ }
+ }
+ return almEvents;
+ } else if (obj.has("images")) {
+ // Fourth, check if it's a map of image objects
+ obj = obj.get("images").getAsJsonObject();
+ for (Map.Entry entry : obj.entrySet()) {
+ almEvents.add(loadJSON(entry.getValue().toString(), context, header));
+ }
+ return almEvents;
+ } else {
+ // Fifth, check if it's an array of objects indexed by id
+ boolean isIdIndexedArray = true;
+ for (Map.Entry entry : obj.entrySet()) {
+ String key = (String) entry.getKey();
+ if (key.equals("__fb_trace_id__")) {
+ continue;
+ }
+ JsonElement value = (JsonElement) entry.getValue();
+ if (
+ value != null &&
+ value.isJsonObject() &&
+ value.getAsJsonObject().has("id") &&
+ value.getAsJsonObject().get("id") != null &&
+ value.getAsJsonObject().get("id").getAsString().equals(key)
+ ) {
+ almEvents.add(loadJSON(value.toString(), context, header));
+ } else {
+ isIdIndexedArray = false;
+ break;
+ }
+ }
+ if (isIdIndexedArray) {
+ return almEvents;
+ }
+
+ // Sixth, check if it's pure JsonObject
+ almEvents.clear();
+ almEvents.add(loadJSON(json, context, header));
+ return almEvents;
+ }
+ }
+ } catch (Exception e) {
+ exception = e;
+ }
+ throw new MalformedResponseException(
+ "Invalid response string: " + json,
+ exception
+ );
+ }
+
+ @Override
+ public APIContext getContext() {
+ return context;
+ }
+
+ @Override
+ public void setContext(APIContext context) {
+ this.context = context;
+ }
+
+ @Override
+ public String toString() {
+ return getGson().toJson(this);
+ }
+
+ public APIRequestGet get() {
+ return new APIRequestGet(this.getPrefixedId().toString(), context);
+ }
+
+
+ public List getFieldAdAccountIds() {
+ return mAdAccountIds;
+ }
+
+ public List getFieldCampaignIds() {
+ return mCampaignIds;
+ }
+
+ public String getFieldChannel() {
+ return mChannel;
+ }
+
+ public String getFieldEvent() {
+ return mEvent;
+ }
+
+ public String getFieldEventTime() {
+ return mEventTime;
+ }
+
+ public String getFieldGuidance() {
+ return mGuidance;
+ }
+
+ public String getFieldGuidanceDetail() {
+ return mGuidanceDetail;
+ }
+
+ public String getFieldId() {
+ return mId;
+ }
+
+ public List getFieldParentAdvertiserIds() {
+ return mParentAdvertiserIds;
+ }
+
+ public String getFieldResellerBusinessId() {
+ return mResellerBusinessId;
+ }
+
+ public String getFieldSubChannel() {
+ return mSubChannel;
+ }
+
+ public String getFieldUserId() {
+ return mUserId;
+ }
+
+
+
+ public static class APIRequestGet extends APIRequest {
+
+ ALMEvent lastResponse = null;
+ @Override
+ public ALMEvent getLastResponse() {
+ return lastResponse;
+ }
+ public static final String[] PARAMS = {
+ };
+
+ public static final String[] FIELDS = {
+ "ad_account_ids",
+ "campaign_ids",
+ "channel",
+ "event",
+ "event_time",
+ "guidance",
+ "guidance_detail",
+ "id",
+ "parent_advertiser_ids",
+ "reseller_business_id",
+ "sub_channel",
+ "user_id",
+ };
+
+ @Override
+ public ALMEvent parseResponse(String response, String header) throws APIException {
+ return ALMEvent.parseResponse(response, getContext(), this, header).head();
+ }
+
+ @Override
+ public ALMEvent execute() throws APIException {
+ return execute(new HashMap());
+ }
+
+ @Override
+ public ALMEvent execute(Map extraParams) throws APIException {
+ ResponseWrapper rw = executeInternal(extraParams);
+ lastResponse = parseResponse(rw.getBody(), rw.getHeader());
+ return lastResponse;
+ }
+
+ public ListenableFuture executeAsync() throws APIException {
+ return executeAsync(new HashMap());
+ };
+
+ public ListenableFuture executeAsync(Map extraParams) throws APIException {
+ return Futures.transform(
+ executeAsyncInternal(extraParams),
+ new Function() {
+ public ALMEvent apply(ResponseWrapper result) {
+ try {
+ return APIRequestGet.this.parseResponse(result.getBody(), result.getHeader());
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ },
+ MoreExecutors.directExecutor()
+ );
+ };
+
+ public APIRequestGet(String nodeId, APIContext context) {
+ super(context, nodeId, "/", "GET", Arrays.asList(PARAMS));
+ }
+
+ @Override
+ public APIRequestGet setParam(String param, Object value) {
+ setParamInternal(param, value);
+ return this;
+ }
+
+ @Override
+ public APIRequestGet setParams(Map params) {
+ setParamsInternal(params);
+ return this;
+ }
+
+
+ public APIRequestGet requestAllFields () {
+ return this.requestAllFields(true);
+ }
+
+ public APIRequestGet requestAllFields (boolean value) {
+ for (String field : FIELDS) {
+ this.requestField(field, value);
+ }
+ return this;
+ }
+
+ @Override
+ public APIRequestGet requestFields (List fields) {
+ return this.requestFields(fields, true);
+ }
+
+ @Override
+ public APIRequestGet requestFields (List fields, boolean value) {
+ for (String field : fields) {
+ this.requestField(field, value);
+ }
+ return this;
+ }
+
+ @Override
+ public APIRequestGet requestField (String field) {
+ this.requestField(field, true);
+ return this;
+ }
+
+ @Override
+ public APIRequestGet requestField (String field, boolean value) {
+ this.requestFieldInternal(field, value);
+ return this;
+ }
+
+ public APIRequestGet requestAdAccountIdsField () {
+ return this.requestAdAccountIdsField(true);
+ }
+ public APIRequestGet requestAdAccountIdsField (boolean value) {
+ this.requestField("ad_account_ids", value);
+ return this;
+ }
+ public APIRequestGet requestCampaignIdsField () {
+ return this.requestCampaignIdsField(true);
+ }
+ public APIRequestGet requestCampaignIdsField (boolean value) {
+ this.requestField("campaign_ids", value);
+ return this;
+ }
+ public APIRequestGet requestChannelField () {
+ return this.requestChannelField(true);
+ }
+ public APIRequestGet requestChannelField (boolean value) {
+ this.requestField("channel", value);
+ return this;
+ }
+ public APIRequestGet requestEventField () {
+ return this.requestEventField(true);
+ }
+ public APIRequestGet requestEventField (boolean value) {
+ this.requestField("event", value);
+ return this;
+ }
+ public APIRequestGet requestEventTimeField () {
+ return this.requestEventTimeField(true);
+ }
+ public APIRequestGet requestEventTimeField (boolean value) {
+ this.requestField("event_time", value);
+ return this;
+ }
+ public APIRequestGet requestGuidanceField () {
+ return this.requestGuidanceField(true);
+ }
+ public APIRequestGet requestGuidanceField (boolean value) {
+ this.requestField("guidance", value);
+ return this;
+ }
+ public APIRequestGet requestGuidanceDetailField () {
+ return this.requestGuidanceDetailField(true);
+ }
+ public APIRequestGet requestGuidanceDetailField (boolean value) {
+ this.requestField("guidance_detail", value);
+ return this;
+ }
+ public APIRequestGet requestIdField () {
+ return this.requestIdField(true);
+ }
+ public APIRequestGet requestIdField (boolean value) {
+ this.requestField("id", value);
+ return this;
+ }
+ public APIRequestGet requestParentAdvertiserIdsField () {
+ return this.requestParentAdvertiserIdsField(true);
+ }
+ public APIRequestGet requestParentAdvertiserIdsField (boolean value) {
+ this.requestField("parent_advertiser_ids", value);
+ return this;
+ }
+ public APIRequestGet requestResellerBusinessIdField () {
+ return this.requestResellerBusinessIdField(true);
+ }
+ public APIRequestGet requestResellerBusinessIdField (boolean value) {
+ this.requestField("reseller_business_id", value);
+ return this;
+ }
+ public APIRequestGet requestSubChannelField () {
+ return this.requestSubChannelField(true);
+ }
+ public APIRequestGet requestSubChannelField (boolean value) {
+ this.requestField("sub_channel", value);
+ return this;
+ }
+ public APIRequestGet requestUserIdField () {
+ return this.requestUserIdField(true);
+ }
+ public APIRequestGet requestUserIdField (boolean value) {
+ this.requestField("user_id", value);
+ return this;
+ }
+ }
+
+
+ synchronized /*package*/ static Gson getGson() {
+ if (gson != null) {
+ return gson;
+ } else {
+ gson = new GsonBuilder()
+ .excludeFieldsWithModifiers(Modifier.STATIC)
+ .excludeFieldsWithModifiers(Modifier.PROTECTED)
+ .disableHtmlEscaping()
+ .create();
+ }
+ return gson;
+ }
+
+ public ALMEvent copyFrom(ALMEvent instance) {
+ this.mAdAccountIds = instance.mAdAccountIds;
+ this.mCampaignIds = instance.mCampaignIds;
+ this.mChannel = instance.mChannel;
+ this.mEvent = instance.mEvent;
+ this.mEventTime = instance.mEventTime;
+ this.mGuidance = instance.mGuidance;
+ this.mGuidanceDetail = instance.mGuidanceDetail;
+ this.mId = instance.mId;
+ this.mParentAdvertiserIds = instance.mParentAdvertiserIds;
+ this.mResellerBusinessId = instance.mResellerBusinessId;
+ this.mSubChannel = instance.mSubChannel;
+ this.mUserId = instance.mUserId;
+ this.context = instance.context;
+ this.rawValue = instance.rawValue;
+ return this;
+ }
+
+ public static APIRequest.ResponseParser getParser() {
+ return new APIRequest.ResponseParser() {
+ public APINodeList parseResponse(String response, APIContext context, APIRequest request, String header) throws MalformedResponseException {
+ return ALMEvent.parseResponse(response, context, request, header);
+ }
+ };
+ }
+}
diff --git a/src/main/java/com/facebook/ads/sdk/ProductCatalogMicrodataStatsPixelInfo.java b/src/main/java/com/facebook/ads/sdk/ALMGuidance.java
similarity index 61%
rename from src/main/java/com/facebook/ads/sdk/ProductCatalogMicrodataStatsPixelInfo.java
rename to src/main/java/com/facebook/ads/sdk/ALMGuidance.java
index 657dc3ec..a069daeb 100644
--- a/src/main/java/com/facebook/ads/sdk/ProductCatalogMicrodataStatsPixelInfo.java
+++ b/src/main/java/com/facebook/ads/sdk/ALMGuidance.java
@@ -40,25 +40,29 @@
* pull request for this class.
*
*/
-public class ProductCatalogMicrodataStatsPixelInfo extends APINode {
- @SerializedName("is_already_connected")
- private Boolean mIsAlreadyConnected = null;
- @SerializedName("pixel_id")
- private String mPixelId = null;
+public class ALMGuidance extends APINode {
+ @SerializedName("ad_account_id")
+ private String mAdAccountId = null;
+ @SerializedName("guidances")
+ private List