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 mGuidances = null; + @SerializedName("parent_advertiser_id") + private String mParentAdvertiserId = null; + @SerializedName("parent_advertiser_name") + private String mParentAdvertiserName = null; protected static Gson gson = null; - public ProductCatalogMicrodataStatsPixelInfo() { + public ALMGuidance() { } public String getId() { return null; } - public static ProductCatalogMicrodataStatsPixelInfo loadJSON(String json, APIContext context, String header) { - ProductCatalogMicrodataStatsPixelInfo productCatalogMicrodataStatsPixelInfo = getGson().fromJson(json, ProductCatalogMicrodataStatsPixelInfo.class); + public static ALMGuidance loadJSON(String json, APIContext context, String header) { + ALMGuidance almGuidance = getGson().fromJson(json, ALMGuidance.class); if (context.isDebug()) { JsonParser parser = new JsonParser(); JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productCatalogMicrodataStatsPixelInfo.toString()); + JsonElement o2 = parser.parse(almGuidance.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -68,14 +72,14 @@ public static ProductCatalogMicrodataStatsPixelInfo loadJSON(String json, APICon context.log("[Object]" + o2); } } - productCatalogMicrodataStatsPixelInfo.context = context; - productCatalogMicrodataStatsPixelInfo.rawValue = json; - productCatalogMicrodataStatsPixelInfo.header = header; - return productCatalogMicrodataStatsPixelInfo; + almGuidance.context = context; + almGuidance.rawValue = json; + almGuidance.header = header; + return almGuidance; } - public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { - APINodeList productCatalogMicrodataStatsPixelInfos = new APINodeList(request, json, header); + public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { + APINodeList almGuidances = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; JsonParser parser = new JsonParser(); @@ -86,9 +90,9 @@ public static APINodeList parseResponse(S // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); for (int i = 0; i < arr.size(); i++) { - productCatalogMicrodataStatsPixelInfos.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); + almGuidances.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); }; - return productCatalogMicrodataStatsPixelInfos; + return almGuidances; } else if (result.isJsonObject()) { obj = result.getAsJsonObject(); if (obj.has("data")) { @@ -98,20 +102,20 @@ public static APINodeList parseResponse(S 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; - productCatalogMicrodataStatsPixelInfos.setCursors(before, after); + almGuidances.setCursors(before, after); } String previous = paging.has("previous") ? paging.get("previous").getAsString() : null; String next = paging.has("next") ? paging.get("next").getAsString() : null; - productCatalogMicrodataStatsPixelInfos.setPaging(previous, next); + almGuidances.setPaging(previous, next); if (context.hasAppSecret()) { - productCatalogMicrodataStatsPixelInfos.setAppSecret(context.getAppSecretProof()); + almGuidances.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++) { - productCatalogMicrodataStatsPixelInfos.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); + almGuidances.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" @@ -122,23 +126,23 @@ public static APINodeList parseResponse(S isRedownload = true; obj = obj.getAsJsonObject(s); for (Map.Entry entry : obj.entrySet()) { - productCatalogMicrodataStatsPixelInfos.add(loadJSON(entry.getValue().toString(), context, header)); + almGuidances.add(loadJSON(entry.getValue().toString(), context, header)); } break; } } if (!isRedownload) { - productCatalogMicrodataStatsPixelInfos.add(loadJSON(obj.toString(), context, header)); + almGuidances.add(loadJSON(obj.toString(), context, header)); } } - return productCatalogMicrodataStatsPixelInfos; + return almGuidances; } 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()) { - productCatalogMicrodataStatsPixelInfos.add(loadJSON(entry.getValue().toString(), context, header)); + almGuidances.add(loadJSON(entry.getValue().toString(), context, header)); } - return productCatalogMicrodataStatsPixelInfos; + return almGuidances; } else { // Fifth, check if it's an array of objects indexed by id boolean isIdIndexedArray = true; @@ -155,20 +159,20 @@ public static APINodeList parseResponse(S value.getAsJsonObject().get("id") != null && value.getAsJsonObject().get("id").getAsString().equals(key) ) { - productCatalogMicrodataStatsPixelInfos.add(loadJSON(value.toString(), context, header)); + almGuidances.add(loadJSON(value.toString(), context, header)); } else { isIdIndexedArray = false; break; } } if (isIdIndexedArray) { - return productCatalogMicrodataStatsPixelInfos; + return almGuidances; } // Sixth, check if it's pure JsonObject - productCatalogMicrodataStatsPixelInfos.clear(); - productCatalogMicrodataStatsPixelInfos.add(loadJSON(json, context, header)); - return productCatalogMicrodataStatsPixelInfos; + almGuidances.clear(); + almGuidances.add(loadJSON(json, context, header)); + return almGuidances; } } } catch (Exception e) { @@ -196,21 +200,39 @@ public String toString() { } - public Boolean getFieldIsAlreadyConnected() { - return mIsAlreadyConnected; + public String getFieldAdAccountId() { + return mAdAccountId; } - public ProductCatalogMicrodataStatsPixelInfo setFieldIsAlreadyConnected(Boolean value) { - this.mIsAlreadyConnected = value; + public ALMGuidance setFieldAdAccountId(String value) { + this.mAdAccountId = value; return this; } - public String getFieldPixelId() { - return mPixelId; + public List getFieldGuidances() { + return mGuidances; } - public ProductCatalogMicrodataStatsPixelInfo setFieldPixelId(String value) { - this.mPixelId = value; + public ALMGuidance setFieldGuidances(List value) { + this.mGuidances = value; + return this; + } + + public String getFieldParentAdvertiserId() { + return mParentAdvertiserId; + } + + public ALMGuidance setFieldParentAdvertiserId(String value) { + this.mParentAdvertiserId = value; + return this; + } + + public String getFieldParentAdvertiserName() { + return mParentAdvertiserName; + } + + public ALMGuidance setFieldParentAdvertiserName(String value) { + this.mParentAdvertiserName = value; return this; } @@ -230,18 +252,20 @@ public ProductCatalogMicrodataStatsPixelInfo setFieldPixelId(String value) { return gson; } - public ProductCatalogMicrodataStatsPixelInfo copyFrom(ProductCatalogMicrodataStatsPixelInfo instance) { - this.mIsAlreadyConnected = instance.mIsAlreadyConnected; - this.mPixelId = instance.mPixelId; + public ALMGuidance copyFrom(ALMGuidance instance) { + this.mAdAccountId = instance.mAdAccountId; + this.mGuidances = instance.mGuidances; + this.mParentAdvertiserId = instance.mParentAdvertiserId; + this.mParentAdvertiserName = instance.mParentAdvertiserName; 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 ProductCatalogMicrodataStatsPixelInfo.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 ALMGuidance.parseResponse(response, context, request, header); } }; } diff --git a/src/main/java/com/facebook/ads/sdk/ALMGuidanceMetrics.java b/src/main/java/com/facebook/ads/sdk/ALMGuidanceMetrics.java new file mode 100644 index 00000000..2a9cd4d9 --- /dev/null +++ b/src/main/java/com/facebook/ads/sdk/ALMGuidanceMetrics.java @@ -0,0 +1,380 @@ +/* + * 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 ALMGuidanceMetrics extends APINode { + @SerializedName("ad_account_id") + private String mAdAccountId = null; + @SerializedName("adopted_objects") + private List mAdoptedObjects = null; + @SerializedName("guidance_name") + private String mGuidanceName = null; + @SerializedName("guidance_type") + private String mGuidanceType = null; + @SerializedName("l28_adoption") + private Long mL28Adoption = null; + @SerializedName("l28_available") + private Long mL28Available = null; + @SerializedName("l28_click") + private Long mL28Click = null; + @SerializedName("l28_conversion") + private Long mL28Conversion = null; + @SerializedName("l28_impression") + private Long mL28Impression = null; + @SerializedName("l28_pitch") + private Long mL28Pitch = null; + @SerializedName("last_pitch_ds") + private String mLastPitchDs = null; + @SerializedName("parent_advertiser_id") + private String mParentAdvertiserId = null; + @SerializedName("report_ds") + private String mReportDs = null; + protected static Gson gson = null; + + public ALMGuidanceMetrics() { + } + + public String getId() { + return null; + } + public static ALMGuidanceMetrics loadJSON(String json, APIContext context, String header) { + ALMGuidanceMetrics almGuidanceMetrics = getGson().fromJson(json, ALMGuidanceMetrics.class); + if (context.isDebug()) { + JsonParser parser = new JsonParser(); + JsonElement o1 = parser.parse(json); + JsonElement o2 = parser.parse(almGuidanceMetrics.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); + } + } + almGuidanceMetrics.context = context; + almGuidanceMetrics.rawValue = json; + almGuidanceMetrics.header = header; + return almGuidanceMetrics; + } + + public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { + APINodeList almGuidanceMetricss = 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++) { + almGuidanceMetricss.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); + }; + return almGuidanceMetricss; + } 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; + almGuidanceMetricss.setCursors(before, after); + } + String previous = paging.has("previous") ? paging.get("previous").getAsString() : null; + String next = paging.has("next") ? paging.get("next").getAsString() : null; + almGuidanceMetricss.setPaging(previous, next); + if (context.hasAppSecret()) { + almGuidanceMetricss.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++) { + almGuidanceMetricss.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()) { + almGuidanceMetricss.add(loadJSON(entry.getValue().toString(), context, header)); + } + break; + } + } + if (!isRedownload) { + almGuidanceMetricss.add(loadJSON(obj.toString(), context, header)); + } + } + return almGuidanceMetricss; + } 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()) { + almGuidanceMetricss.add(loadJSON(entry.getValue().toString(), context, header)); + } + return almGuidanceMetricss; + } 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) + ) { + almGuidanceMetricss.add(loadJSON(value.toString(), context, header)); + } else { + isIdIndexedArray = false; + break; + } + } + if (isIdIndexedArray) { + return almGuidanceMetricss; + } + + // Sixth, check if it's pure JsonObject + almGuidanceMetricss.clear(); + almGuidanceMetricss.add(loadJSON(json, context, header)); + return almGuidanceMetricss; + } + } + } 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 String getFieldAdAccountId() { + return mAdAccountId; + } + + public ALMGuidanceMetrics setFieldAdAccountId(String value) { + this.mAdAccountId = value; + return this; + } + + public List getFieldAdoptedObjects() { + return mAdoptedObjects; + } + + public ALMGuidanceMetrics setFieldAdoptedObjects(List value) { + this.mAdoptedObjects = value; + return this; + } + + public String getFieldGuidanceName() { + return mGuidanceName; + } + + public ALMGuidanceMetrics setFieldGuidanceName(String value) { + this.mGuidanceName = value; + return this; + } + + public String getFieldGuidanceType() { + return mGuidanceType; + } + + public ALMGuidanceMetrics setFieldGuidanceType(String value) { + this.mGuidanceType = value; + return this; + } + + public Long getFieldL28Adoption() { + return mL28Adoption; + } + + public ALMGuidanceMetrics setFieldL28Adoption(Long value) { + this.mL28Adoption = value; + return this; + } + + public Long getFieldL28Available() { + return mL28Available; + } + + public ALMGuidanceMetrics setFieldL28Available(Long value) { + this.mL28Available = value; + return this; + } + + public Long getFieldL28Click() { + return mL28Click; + } + + public ALMGuidanceMetrics setFieldL28Click(Long value) { + this.mL28Click = value; + return this; + } + + public Long getFieldL28Conversion() { + return mL28Conversion; + } + + public ALMGuidanceMetrics setFieldL28Conversion(Long value) { + this.mL28Conversion = value; + return this; + } + + public Long getFieldL28Impression() { + return mL28Impression; + } + + public ALMGuidanceMetrics setFieldL28Impression(Long value) { + this.mL28Impression = value; + return this; + } + + public Long getFieldL28Pitch() { + return mL28Pitch; + } + + public ALMGuidanceMetrics setFieldL28Pitch(Long value) { + this.mL28Pitch = value; + return this; + } + + public String getFieldLastPitchDs() { + return mLastPitchDs; + } + + public ALMGuidanceMetrics setFieldLastPitchDs(String value) { + this.mLastPitchDs = value; + return this; + } + + public String getFieldParentAdvertiserId() { + return mParentAdvertiserId; + } + + public ALMGuidanceMetrics setFieldParentAdvertiserId(String value) { + this.mParentAdvertiserId = value; + return this; + } + + public String getFieldReportDs() { + return mReportDs; + } + + public ALMGuidanceMetrics setFieldReportDs(String value) { + this.mReportDs = 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 ALMGuidanceMetrics copyFrom(ALMGuidanceMetrics instance) { + this.mAdAccountId = instance.mAdAccountId; + this.mAdoptedObjects = instance.mAdoptedObjects; + this.mGuidanceName = instance.mGuidanceName; + this.mGuidanceType = instance.mGuidanceType; + this.mL28Adoption = instance.mL28Adoption; + this.mL28Available = instance.mL28Available; + this.mL28Click = instance.mL28Click; + this.mL28Conversion = instance.mL28Conversion; + this.mL28Impression = instance.mL28Impression; + this.mL28Pitch = instance.mL28Pitch; + this.mLastPitchDs = instance.mLastPitchDs; + this.mParentAdvertiserId = instance.mParentAdvertiserId; + this.mReportDs = instance.mReportDs; + 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 ALMGuidanceMetrics.parseResponse(response, context, request, header); + } + }; + } +} diff --git a/src/main/java/com/facebook/ads/sdk/APIConfig.java b/src/main/java/com/facebook/ads/sdk/APIConfig.java index 91148887..e45cf279 100644 --- a/src/main/java/com/facebook/ads/sdk/APIConfig.java +++ b/src/main/java/com/facebook/ads/sdk/APIConfig.java @@ -27,5 +27,5 @@ public class APIConfig { public static final String DEFAULT_API_VERSION = "v20.0"; 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-v20.0.2"; + public static final String USER_AGENT = "fbbizsdk-java-v20.0.3"; }; diff --git a/src/main/java/com/facebook/ads/sdk/AdAccount.java b/src/main/java/com/facebook/ads/sdk/AdAccount.java index 44a4bd97..076a98c5 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccount.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccount.java @@ -608,6 +608,10 @@ public APIRequestCreateBlockListDraft createBlockListDraft() { return new APIRequestCreateBlockListDraft(this.getPrefixedId().toString(), context); } + public APIRequestCreateBrandSafetyContentFilterLevel createBrandSafetyContentFilterLevel() { + return new APIRequestCreateBrandSafetyContentFilterLevel(this.getPrefixedId().toString(), context); + } + public APIRequestGetBroadTargetingCategories getBroadTargetingCategories() { return new APIRequestGetBroadTargetingCategories(this.getPrefixedId().toString(), context); } @@ -756,6 +760,14 @@ public APIRequestCreateReachFrequencyPrediction createReachFrequencyPrediction() return new APIRequestCreateReachFrequencyPrediction(this.getPrefixedId().toString(), context); } + public APIRequestGetRecommendations getRecommendations() { + return new APIRequestGetRecommendations(this.getPrefixedId().toString(), context); + } + + public APIRequestCreateRecommendation createRecommendation() { + return new APIRequestCreateRecommendation(this.getPrefixedId().toString(), context); + } + public APIRequestGetSavedAudiences getSavedAudiences() { return new APIRequestGetSavedAudiences(this.getPrefixedId().toString(), context); } @@ -7853,6 +7865,7 @@ public APINodeList getLastResponse() { "bid_info", "bid_strategy", "billing_event", + "brand_safety_config", "budget_remaining", "campaign", "campaign_active_time", @@ -8118,6 +8131,13 @@ public APIRequestGetAdSets requestBillingEventField (boolean value) { this.requestField("billing_event", value); return this; } + public APIRequestGetAdSets requestBrandSafetyConfigField () { + return this.requestBrandSafetyConfigField(true); + } + public APIRequestGetAdSets requestBrandSafetyConfigField (boolean value) { + this.requestField("brand_safety_config", value); + return this; + } public APIRequestGetAdSets requestBudgetRemainingField () { return this.requestBudgetRemainingField(true); } @@ -9064,6 +9084,7 @@ public APINodeList getLastResponse() { "bid_info", "bid_strategy", "billing_event", + "brand_safety_config", "budget_remaining", "campaign", "campaign_active_time", @@ -9302,6 +9323,13 @@ public APIRequestGetAdSetsByLabels requestBillingEventField (boolean value) { this.requestField("billing_event", value); return this; } + public APIRequestGetAdSetsByLabels requestBrandSafetyConfigField () { + return this.requestBrandSafetyConfigField(true); + } + public APIRequestGetAdSetsByLabels requestBrandSafetyConfigField (boolean value) { + this.requestField("brand_safety_config", value); + return this; + } public APIRequestGetAdSetsByLabels requestBudgetRemainingField () { return this.requestBudgetRemainingField(true); } @@ -11794,7 +11822,6 @@ public AdVideo getLastResponse() { return lastResponse; } public static final String[] PARAMS = { - "animated_effect_id", "application_id", "asked_fun_fact_prompt_id", "audio_story_wave_animation_handle", @@ -11933,15 +11960,6 @@ public APIRequestCreateAdVideo setUseVideoEndpoint(boolean useVideoEndpoint) { return this; } - public APIRequestCreateAdVideo setAnimatedEffectId (Long animatedEffectId) { - this.setParam("animated_effect_id", animatedEffectId); - return this; - } - public APIRequestCreateAdVideo setAnimatedEffectId (String animatedEffectId) { - this.setParam("animated_effect_id", animatedEffectId); - return this; - } - public APIRequestCreateAdVideo setApplicationId (String applicationId) { this.setParam("application_id", applicationId); return this; @@ -12492,6 +12510,7 @@ public APINodeList getLastResponse() { "bid_info", "bid_strategy", "billing_event", + "brand_safety_config", "budget_remaining", "campaign", "campaign_active_time", @@ -12712,6 +12731,13 @@ public APIRequestGetAffectedAdSets requestBillingEventField (boolean value) { this.requestField("billing_event", value); return this; } + public APIRequestGetAffectedAdSets requestBrandSafetyConfigField () { + return this.requestBrandSafetyConfigField(true); + } + public APIRequestGetAffectedAdSets requestBrandSafetyConfigField (boolean value) { + this.requestField("brand_safety_config", value); + return this; + } public APIRequestGetAffectedAdSets requestBudgetRemainingField () { return this.requestBudgetRemainingField(true); } @@ -15806,6 +15832,127 @@ public APIRequestCreateBlockListDraft requestField (String field, boolean value) } + public static class APIRequestCreateBrandSafetyContentFilterLevel extends APIRequest { + + AdAccount lastResponse = null; + @Override + public AdAccount getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "brand_safety_content_filter_levels", + "business_id", + }; + + public static final String[] FIELDS = { + }; + + @Override + public AdAccount parseResponse(String response, String header) throws APIException { + return AdAccount.parseResponse(response, getContext(), this, header).head(); + } + + @Override + public AdAccount execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public AdAccount 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 AdAccount apply(ResponseWrapper result) { + try { + return APIRequestCreateBrandSafetyContentFilterLevel.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestCreateBrandSafetyContentFilterLevel(String nodeId, APIContext context) { + super(context, nodeId, "/brand_safety_content_filter_levels", "POST", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestCreateBrandSafetyContentFilterLevel setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestCreateBrandSafetyContentFilterLevel setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestCreateBrandSafetyContentFilterLevel setBrandSafetyContentFilterLevels (List brandSafetyContentFilterLevels) { + this.setParam("brand_safety_content_filter_levels", brandSafetyContentFilterLevels); + return this; + } + public APIRequestCreateBrandSafetyContentFilterLevel setBrandSafetyContentFilterLevels (String brandSafetyContentFilterLevels) { + this.setParam("brand_safety_content_filter_levels", brandSafetyContentFilterLevels); + return this; + } + + public APIRequestCreateBrandSafetyContentFilterLevel setBusinessId (String businessId) { + this.setParam("business_id", businessId); + return this; + } + + public APIRequestCreateBrandSafetyContentFilterLevel requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestCreateBrandSafetyContentFilterLevel requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestCreateBrandSafetyContentFilterLevel requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestCreateBrandSafetyContentFilterLevel requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestCreateBrandSafetyContentFilterLevel requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestCreateBrandSafetyContentFilterLevel requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + public static class APIRequestGetBroadTargetingCategories extends APIRequest { APINodeList lastResponse = null; @@ -16355,6 +16502,7 @@ public APINodeList getLastResponse() { "smart_promotion_type", "source_campaign", "source_campaign_id", + "source_recommendation_type", "special_ad_categories", "special_ad_category", "special_ad_category_country", @@ -16709,6 +16857,13 @@ public APIRequestGetCampaigns requestSourceCampaignIdField (boolean value) { this.requestField("source_campaign_id", value); return this; } + public APIRequestGetCampaigns requestSourceRecommendationTypeField () { + return this.requestSourceRecommendationTypeField(true); + } + public APIRequestGetCampaigns requestSourceRecommendationTypeField (boolean value) { + this.requestField("source_recommendation_type", value); + return this; + } public APIRequestGetCampaigns requestSpecialAdCategoriesField () { return this.requestSpecialAdCategoriesField(true); } @@ -17109,6 +17264,7 @@ public APINodeList getLastResponse() { "smart_promotion_type", "source_campaign", "source_campaign_id", + "source_recommendation_type", "special_ad_categories", "special_ad_category", "special_ad_category_country", @@ -17445,6 +17601,13 @@ public APIRequestGetCampaignsByLabels requestSourceCampaignIdField (boolean valu this.requestField("source_campaign_id", value); return this; } + public APIRequestGetCampaignsByLabels requestSourceRecommendationTypeField () { + return this.requestSourceRecommendationTypeField(true); + } + public APIRequestGetCampaignsByLabels requestSourceRecommendationTypeField (boolean value) { + this.requestField("source_recommendation_type", value); + return this; + } public APIRequestGetCampaignsByLabels requestSpecialAdCategoriesField () { return this.requestSpecialAdCategoriesField(true); } @@ -19672,6 +19835,7 @@ public APINodeList getLastResponse() { "bid_info", "bid_strategy", "billing_event", + "brand_safety_config", "budget_remaining", "campaign", "campaign_active_time", @@ -19897,6 +20061,13 @@ public APIRequestGetDeprecatedTargetingAdSets requestBillingEventField (boolean this.requestField("billing_event", value); return this; } + public APIRequestGetDeprecatedTargetingAdSets requestBrandSafetyConfigField () { + return this.requestBrandSafetyConfigField(true); + } + public APIRequestGetDeprecatedTargetingAdSets requestBrandSafetyConfigField (boolean value) { + this.requestField("brand_safety_config", value); + return this; + } public APIRequestGetDeprecatedTargetingAdSets requestBudgetRemainingField () { return this.requestBudgetRemainingField(true); } @@ -26045,6 +26216,230 @@ public APIRequestCreateReachFrequencyPrediction requestField (String field, bool } + public static class APIRequestGetRecommendations extends APIRequest { + + APINodeList lastResponse = null; + @Override + public APINodeList getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + }; + + public static final String[] FIELDS = { + "recommendations", + }; + + @Override + public APINodeList parseResponse(String response, String header) throws APIException { + return AdAccountRecommendations.parseResponse(response, getContext(), this, header); + } + + @Override + public APINodeList execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + try { + return APIRequestGetRecommendations.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestGetRecommendations(String nodeId, APIContext context) { + super(context, nodeId, "/recommendations", "GET", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestGetRecommendations setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestGetRecommendations setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestGetRecommendations requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestGetRecommendations requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetRecommendations requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestGetRecommendations requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetRecommendations requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestGetRecommendations requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + public APIRequestGetRecommendations requestRecommendationsField () { + return this.requestRecommendationsField(true); + } + public APIRequestGetRecommendations requestRecommendationsField (boolean value) { + this.requestField("recommendations", value); + return this; + } + } + + public static class APIRequestCreateRecommendation extends APIRequest { + + AdAccountRecommendations lastResponse = null; + @Override + public AdAccountRecommendations getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "recommendation_signature", + }; + + public static final String[] FIELDS = { + }; + + @Override + public AdAccountRecommendations parseResponse(String response, String header) throws APIException { + return AdAccountRecommendations.parseResponse(response, getContext(), this, header).head(); + } + + @Override + public AdAccountRecommendations execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public AdAccountRecommendations 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 AdAccountRecommendations apply(ResponseWrapper result) { + try { + return APIRequestCreateRecommendation.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestCreateRecommendation(String nodeId, APIContext context) { + super(context, nodeId, "/recommendations", "POST", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestCreateRecommendation setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestCreateRecommendation setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestCreateRecommendation setRecommendationSignature (String recommendationSignature) { + this.setParam("recommendation_signature", recommendationSignature); + return this; + } + + public APIRequestCreateRecommendation requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestCreateRecommendation requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestCreateRecommendation requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestCreateRecommendation requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestCreateRecommendation requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestCreateRecommendation requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + public static class APIRequestGetSavedAudiences extends APIRequest { APINodeList lastResponse = null; @@ -30023,6 +30418,45 @@ public String toString() { } } + public static enum EnumBrandSafetyContentFilterLevels { + @SerializedName("AN_RELAXED") + VALUE_AN_RELAXED("AN_RELAXED"), + @SerializedName("AN_STANDARD") + VALUE_AN_STANDARD("AN_STANDARD"), + @SerializedName("AN_STRICT") + VALUE_AN_STRICT("AN_STRICT"), + @SerializedName("FACEBOOK_RELAXED") + VALUE_FACEBOOK_RELAXED("FACEBOOK_RELAXED"), + @SerializedName("FACEBOOK_STANDARD") + VALUE_FACEBOOK_STANDARD("FACEBOOK_STANDARD"), + @SerializedName("FACEBOOK_STRICT") + VALUE_FACEBOOK_STRICT("FACEBOOK_STRICT"), + @SerializedName("FEED_DNM") + VALUE_FEED_DNM("FEED_DNM"), + @SerializedName("FEED_RELAXED") + VALUE_FEED_RELAXED("FEED_RELAXED"), + @SerializedName("FEED_STANDARD") + VALUE_FEED_STANDARD("FEED_STANDARD"), + @SerializedName("FEED_STRICT") + VALUE_FEED_STRICT("FEED_STRICT"), + @SerializedName("UNINITIALIZED") + VALUE_UNINITIALIZED("UNINITIALIZED"), + @SerializedName("UNKNOWN") + VALUE_UNKNOWN("UNKNOWN"), + ; + + private String value; + + private EnumBrandSafetyContentFilterLevels(String value) { + this.value = value; + } + + @Override + public String toString() { + return value; + } + } + public static enum EnumClaimObjective { @SerializedName("AUTOMOTIVE_MODEL") VALUE_AUTOMOTIVE_MODEL("AUTOMOTIVE_MODEL"), diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountAdVolume.java b/src/main/java/com/facebook/ads/sdk/AdAccountAdVolume.java index d6d22adb..d169a93a 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountAdVolume.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountAdVolume.java @@ -339,8 +339,12 @@ public static enum EnumRecommendationType { VALUE_AAC_CREATION_PACKAGE("AAC_CREATION_PACKAGE"), @SerializedName("AB_TEST") VALUE_AB_TEST("AB_TEST"), + @SerializedName("ACCOUNT_NEEDS_CREDIT") + VALUE_ACCOUNT_NEEDS_CREDIT("ACCOUNT_NEEDS_CREDIT"), @SerializedName("ACCOUNT_SPEND_LIMIT") VALUE_ACCOUNT_SPEND_LIMIT("ACCOUNT_SPEND_LIMIT"), + @SerializedName("ACCOUNT_SPEND_LIMIT_DUPLICATION") + VALUE_ACCOUNT_SPEND_LIMIT_DUPLICATION("ACCOUNT_SPEND_LIMIT_DUPLICATION"), @SerializedName("ACO_TOGGLE") VALUE_ACO_TOGGLE("ACO_TOGGLE"), @SerializedName("ADS_REPORTING") @@ -349,14 +353,22 @@ public static enum EnumRecommendationType { VALUE_ADVANCED_CAMPAIGN_BUDGET("ADVANCED_CAMPAIGN_BUDGET"), @SerializedName("ADVANTAGE_APP_CAMPAIGN") VALUE_ADVANTAGE_APP_CAMPAIGN("ADVANTAGE_APP_CAMPAIGN"), + @SerializedName("ADVANTAGE_CAMPAIGN_BUDGET_DUPLICATION") + VALUE_ADVANTAGE_CAMPAIGN_BUDGET_DUPLICATION("ADVANTAGE_CAMPAIGN_BUDGET_DUPLICATION"), @SerializedName("ADVANTAGE_CUSTOM_AUDIENCE") VALUE_ADVANTAGE_CUSTOM_AUDIENCE("ADVANTAGE_CUSTOM_AUDIENCE"), + @SerializedName("ADVANTAGE_CUSTOM_AUDIENCE_DUPLICATION") + VALUE_ADVANTAGE_CUSTOM_AUDIENCE_DUPLICATION("ADVANTAGE_CUSTOM_AUDIENCE_DUPLICATION"), @SerializedName("ADVANTAGE_CUSTOM_AUDIENCE_UPSELL") VALUE_ADVANTAGE_CUSTOM_AUDIENCE_UPSELL("ADVANTAGE_CUSTOM_AUDIENCE_UPSELL"), @SerializedName("ADVANTAGE_DETAILED_TARGETING") VALUE_ADVANTAGE_DETAILED_TARGETING("ADVANTAGE_DETAILED_TARGETING"), @SerializedName("ADVANTAGE_LOOKALIKE_AUDIENCE") VALUE_ADVANTAGE_LOOKALIKE_AUDIENCE("ADVANTAGE_LOOKALIKE_AUDIENCE"), + @SerializedName("ADVANTAGE_LOOKALIKE_DUPLICATION") + VALUE_ADVANTAGE_LOOKALIKE_DUPLICATION("ADVANTAGE_LOOKALIKE_DUPLICATION"), + @SerializedName("ADVANTAGE_PLUS_APP_CAMPAIGN_PRECREATE") + VALUE_ADVANTAGE_PLUS_APP_CAMPAIGN_PRECREATE("ADVANTAGE_PLUS_APP_CAMPAIGN_PRECREATE"), @SerializedName("ADVANTAGE_PLUS_AUDIENCE") VALUE_ADVANTAGE_PLUS_AUDIENCE("ADVANTAGE_PLUS_AUDIENCE"), @SerializedName("ADVANTAGE_PLUS_AUDIENCE_DUPLICATION") @@ -367,6 +379,8 @@ public static enum EnumRecommendationType { VALUE_ADVANTAGE_PLUS_AUDIENCE_TOGGLE("ADVANTAGE_PLUS_AUDIENCE_TOGGLE"), @SerializedName("ADVANTAGE_PLUS_CAMPAIGN_BUDGET") VALUE_ADVANTAGE_PLUS_CAMPAIGN_BUDGET("ADVANTAGE_PLUS_CAMPAIGN_BUDGET"), + @SerializedName("ADVANTAGE_PLUS_CATALOG_ADS") + VALUE_ADVANTAGE_PLUS_CATALOG_ADS("ADVANTAGE_PLUS_CATALOG_ADS"), @SerializedName("ADVANTAGE_PLUS_CREATIVE") VALUE_ADVANTAGE_PLUS_CREATIVE("ADVANTAGE_PLUS_CREATIVE"), @SerializedName("ADVANTAGE_PLUS_CREATIVE_CATALOG") @@ -381,6 +395,10 @@ public static enum EnumRecommendationType { VALUE_ADVANTAGE_SHOPPING_CAMPAIGN("ADVANTAGE_SHOPPING_CAMPAIGN"), @SerializedName("ADVANTAGE_SHOPPING_CAMPAIGN_FRAGMENTATION") VALUE_ADVANTAGE_SHOPPING_CAMPAIGN_FRAGMENTATION("ADVANTAGE_SHOPPING_CAMPAIGN_FRAGMENTATION"), + @SerializedName("AD_LIFT_RECALL_GOAL_PRECREATE") + VALUE_AD_LIFT_RECALL_GOAL_PRECREATE("AD_LIFT_RECALL_GOAL_PRECREATE"), + @SerializedName("AD_LIFT_RECALL_OPTIMIZATION_GOAL") + VALUE_AD_LIFT_RECALL_OPTIMIZATION_GOAL("AD_LIFT_RECALL_OPTIMIZATION_GOAL"), @SerializedName("AD_OBJECTIVE") VALUE_AD_OBJECTIVE("AD_OBJECTIVE"), @SerializedName("AEM_V2_INELIGIBLE") @@ -391,14 +409,20 @@ public static enum EnumRecommendationType { VALUE_AGGREGATED_BUDGET_LIMITED("AGGREGATED_BUDGET_LIMITED"), @SerializedName("AGGREGATED_COST_LIMITED") VALUE_AGGREGATED_COST_LIMITED("AGGREGATED_COST_LIMITED"), + @SerializedName("APLUS_C_CATALOG_DUPLICATION") + VALUE_APLUS_C_CATALOG_DUPLICATION("APLUS_C_CATALOG_DUPLICATION"), @SerializedName("APP_AEM_V2_INSTALLATION_PROMOTION") VALUE_APP_AEM_V2_INSTALLATION_PROMOTION("APP_AEM_V2_INSTALLATION_PROMOTION"), + @SerializedName("APP_ENGAGED_VIEW_CONVERSIONS_DUPLICATION") + VALUE_APP_ENGAGED_VIEW_CONVERSIONS_DUPLICATION("APP_ENGAGED_VIEW_CONVERSIONS_DUPLICATION"), @SerializedName("ASC_BUDGET_OPTIMIZATION") VALUE_ASC_BUDGET_OPTIMIZATION("ASC_BUDGET_OPTIMIZATION"), @SerializedName("ASC_CREATION_PACKAGE") VALUE_ASC_CREATION_PACKAGE("ASC_CREATION_PACKAGE"), @SerializedName("ASC_FRAGMENTATION_V2") VALUE_ASC_FRAGMENTATION_V2("ASC_FRAGMENTATION_V2"), + @SerializedName("ASC_PRECREATE") + VALUE_ASC_PRECREATE("ASC_PRECREATE"), @SerializedName("ASPECT_RATIO") VALUE_ASPECT_RATIO("ASPECT_RATIO"), @SerializedName("ATLEAST_6_PLACEMENTS") @@ -427,22 +451,34 @@ public static enum EnumRecommendationType { VALUE_AUTOMATIC_PLACEMENTS_V2("AUTOMATIC_PLACEMENTS_V2"), @SerializedName("AUTO_BID") VALUE_AUTO_BID("AUTO_BID"), + @SerializedName("BACKGROUND_GENERATION") + VALUE_BACKGROUND_GENERATION("BACKGROUND_GENERATION"), @SerializedName("BLENDED_ADS") VALUE_BLENDED_ADS("BLENDED_ADS"), + @SerializedName("BLENDED_ADS_DUPLICATION") + VALUE_BLENDED_ADS_DUPLICATION("BLENDED_ADS_DUPLICATION"), @SerializedName("BROAD_TARGETING") VALUE_BROAD_TARGETING("BROAD_TARGETING"), @SerializedName("BUDGET_LIMITED") VALUE_BUDGET_LIMITED("BUDGET_LIMITED"), @SerializedName("CAPI") VALUE_CAPI("CAPI"), + @SerializedName("CAPI_CRM_GUIDANCE") + VALUE_CAPI_CRM_GUIDANCE("CAPI_CRM_GUIDANCE"), @SerializedName("CAPI_PERFORMANCE_MATCH_KEY") VALUE_CAPI_PERFORMANCE_MATCH_KEY("CAPI_PERFORMANCE_MATCH_KEY"), @SerializedName("CAPI_PERFORMANCE_MATCH_KEY_V2") VALUE_CAPI_PERFORMANCE_MATCH_KEY_V2("CAPI_PERFORMANCE_MATCH_KEY_V2"), @SerializedName("CASH_REWARDS_OPT_IN") VALUE_CASH_REWARDS_OPT_IN("CASH_REWARDS_OPT_IN"), + @SerializedName("CATALOG_MATCH_RATE") + VALUE_CATALOG_MATCH_RATE("CATALOG_MATCH_RATE"), + @SerializedName("COMMERCE_SHOPS_ADS_DUPLICATION") + VALUE_COMMERCE_SHOPS_ADS_DUPLICATION("COMMERCE_SHOPS_ADS_DUPLICATION"), @SerializedName("CONNECTED_SOURCES") VALUE_CONNECTED_SOURCES("CONNECTED_SOURCES"), + @SerializedName("CONNECTED_SOURCES_DUPLICATION") + VALUE_CONNECTED_SOURCES_DUPLICATION("CONNECTED_SOURCES_DUPLICATION"), @SerializedName("CONNECT_FACEBOOK_PAGE_TO_INSTAGRAM") VALUE_CONNECT_FACEBOOK_PAGE_TO_INSTAGRAM("CONNECT_FACEBOOK_PAGE_TO_INSTAGRAM"), @SerializedName("CONNECT_FACEBOOK_PAGE_TO_WHATSAPP") @@ -471,10 +507,14 @@ public static enum EnumRecommendationType { VALUE_CREATIVE_DIVERSITY("CREATIVE_DIVERSITY"), @SerializedName("CREATIVE_FATIGUE") VALUE_CREATIVE_FATIGUE("CREATIVE_FATIGUE"), + @SerializedName("CREATIVE_FATIGUE_DUPLICATION") + VALUE_CREATIVE_FATIGUE_DUPLICATION("CREATIVE_FATIGUE_DUPLICATION"), @SerializedName("CREATIVE_FATIGUE_HOURLY") VALUE_CREATIVE_FATIGUE_HOURLY("CREATIVE_FATIGUE_HOURLY"), @SerializedName("CREATIVE_LIMITED") VALUE_CREATIVE_LIMITED("CREATIVE_LIMITED"), + @SerializedName("CREATIVE_LIMITED_DUPLICATION") + VALUE_CREATIVE_LIMITED_DUPLICATION("CREATIVE_LIMITED_DUPLICATION"), @SerializedName("CREATIVE_LIMITED_HOURLY") VALUE_CREATIVE_LIMITED_HOURLY("CREATIVE_LIMITED_HOURLY"), @SerializedName("CREATOR_ADS_PA_CONVERSION") @@ -485,8 +525,12 @@ public static enum EnumRecommendationType { VALUE_CTX_BUDGET_OPTIMIZATION("CTX_BUDGET_OPTIMIZATION"), @SerializedName("CTX_CREATION_PACKAGE") VALUE_CTX_CREATION_PACKAGE("CTX_CREATION_PACKAGE"), + @SerializedName("CTX_CTA_UPGRADE_IN_DUPLICATION") + VALUE_CTX_CTA_UPGRADE_IN_DUPLICATION("CTX_CTA_UPGRADE_IN_DUPLICATION"), @SerializedName("CTX_GUIDANCE") VALUE_CTX_GUIDANCE("CTX_GUIDANCE"), + @SerializedName("CTX_PRECREATE") + VALUE_CTX_PRECREATE("CTX_PRECREATE"), @SerializedName("DA_ADVANTAGE_PLUS_CREATIVE_INFO_LABELS") VALUE_DA_ADVANTAGE_PLUS_CREATIVE_INFO_LABELS("DA_ADVANTAGE_PLUS_CREATIVE_INFO_LABELS"), @SerializedName("DA_DUPLICATION_PRODUCT_TAGS") @@ -495,6 +539,12 @@ public static enum EnumRecommendationType { VALUE_DEAD_LINK("DEAD_LINK"), @SerializedName("DEFRAGMENTATION_ACB") VALUE_DEFRAGMENTATION_ACB("DEFRAGMENTATION_ACB"), + @SerializedName("DEFRAGMENTATION_ACB_DUPLICATION") + VALUE_DEFRAGMENTATION_ACB_DUPLICATION("DEFRAGMENTATION_ACB_DUPLICATION"), + @SerializedName("DELIVERY_ERROR") + VALUE_DELIVERY_ERROR("DELIVERY_ERROR"), + @SerializedName("DELIVERY_WARNING") + VALUE_DELIVERY_WARNING("DELIVERY_WARNING"), @SerializedName("DYNAMIC_ADVANTAGE_CAMPAIGN_BUDGET") VALUE_DYNAMIC_ADVANTAGE_CAMPAIGN_BUDGET("DYNAMIC_ADVANTAGE_CAMPAIGN_BUDGET"), @SerializedName("ECOSYSTEM_BID_REDUCE_L1_CARDINALITY") @@ -505,8 +555,12 @@ public static enum EnumRecommendationType { VALUE_EVC_WEB_DUPLICATION_UPGRADE("EVC_WEB_DUPLICATION_UPGRADE"), @SerializedName("FRAGMENTATION") VALUE_FRAGMENTATION("FRAGMENTATION"), + @SerializedName("FRAGMENTATION_RESOLUTION_UPDATE") + VALUE_FRAGMENTATION_RESOLUTION_UPDATE("FRAGMENTATION_RESOLUTION_UPDATE"), @SerializedName("FRAGMENTATION_V2") VALUE_FRAGMENTATION_V2("FRAGMENTATION_V2"), + @SerializedName("GENERATIVE_UNCROP_DUPLICATION") + VALUE_GENERATIVE_UNCROP_DUPLICATION("GENERATIVE_UNCROP_DUPLICATION"), @SerializedName("GES_TEST") VALUE_GES_TEST("GES_TEST"), @SerializedName("GUIDANCE_CENTER_CODE_GEN") @@ -519,6 +573,10 @@ public static enum EnumRecommendationType { VALUE_HISTORICAL_BENCHMARK("HISTORICAL_BENCHMARK"), @SerializedName("IG_MULTI_ADS") VALUE_IG_MULTI_ADS("IG_MULTI_ADS"), + @SerializedName("LANDING_PAGE_VIEW_OPTIMIZATION_GOAL") + VALUE_LANDING_PAGE_VIEW_OPTIMIZATION_GOAL("LANDING_PAGE_VIEW_OPTIMIZATION_GOAL"), + @SerializedName("LANDING_PAGE_VIEW_PRECREATE") + VALUE_LANDING_PAGE_VIEW_PRECREATE("LANDING_PAGE_VIEW_PRECREATE"), @SerializedName("LEAD_ADS_GUIDANCE") VALUE_LEAD_ADS_GUIDANCE("LEAD_ADS_GUIDANCE"), @SerializedName("LEARNING_LIMITED") @@ -531,10 +589,20 @@ public static enum EnumRecommendationType { VALUE_LOW_OUTCOME("LOW_OUTCOME"), @SerializedName("MERLIN_GUIDANCE") VALUE_MERLIN_GUIDANCE("MERLIN_GUIDANCE"), + @SerializedName("MESSAGING_EVENTS_PRECREATE") + VALUE_MESSAGING_EVENTS_PRECREATE("MESSAGING_EVENTS_PRECREATE"), + @SerializedName("MESSAGING_PARTNERS_PRECREATE") + VALUE_MESSAGING_PARTNERS_PRECREATE("MESSAGING_PARTNERS_PRECREATE"), + @SerializedName("META_VERIFIED_ADS_PERFORMANCE_GUIDANCE") + VALUE_META_VERIFIED_ADS_PERFORMANCE_GUIDANCE("META_VERIFIED_ADS_PERFORMANCE_GUIDANCE"), + @SerializedName("MIXED_FORMATS") + VALUE_MIXED_FORMATS("MIXED_FORMATS"), @SerializedName("MIXED_PA_COMBINE_ADSETS") VALUE_MIXED_PA_COMBINE_ADSETS("MIXED_PA_COMBINE_ADSETS"), @SerializedName("MMT_CAROUSEL_TO_VIDEO") VALUE_MMT_CAROUSEL_TO_VIDEO("MMT_CAROUSEL_TO_VIDEO"), + @SerializedName("MOBILE_FIRST_CREATIVE") + VALUE_MOBILE_FIRST_CREATIVE("MOBILE_FIRST_CREATIVE"), @SerializedName("MOBILE_FIRST_VIDEO") VALUE_MOBILE_FIRST_VIDEO("MOBILE_FIRST_VIDEO"), @SerializedName("MR_AEMV2SUB_KCONSOLIDATION") @@ -547,6 +615,8 @@ public static enum EnumRecommendationType { VALUE_NOT_APPLICABLE("NOT_APPLICABLE"), @SerializedName("NO_DELIVERY_STATUS") VALUE_NO_DELIVERY_STATUS("NO_DELIVERY_STATUS"), + @SerializedName("OFFSITE_CONVERSION") + VALUE_OFFSITE_CONVERSION("OFFSITE_CONVERSION"), @SerializedName("OPTIMAL_BAU") VALUE_OPTIMAL_BAU("OPTIMAL_BAU"), @SerializedName("PAYMENT_METHOD") @@ -555,8 +625,16 @@ public static enum EnumRecommendationType { VALUE_PERFORMANT_CREATIVE_REELS_OPT_IN("PERFORMANT_CREATIVE_REELS_OPT_IN"), @SerializedName("PFR_L1_INLINE_MMT") VALUE_PFR_L1_INLINE_MMT("PFR_L1_INLINE_MMT"), + @SerializedName("PIXEL_OPTIMIZATION_AAM_PRECREATE") + VALUE_PIXEL_OPTIMIZATION_AAM_PRECREATE("PIXEL_OPTIMIZATION_AAM_PRECREATE"), + @SerializedName("PIXEL_OPTIMIZATION_HIE_PRECREATE") + VALUE_PIXEL_OPTIMIZATION_HIE_PRECREATE("PIXEL_OPTIMIZATION_HIE_PRECREATE"), + @SerializedName("PIXEL_SETUP_PRECREATE") + VALUE_PIXEL_SETUP_PRECREATE("PIXEL_SETUP_PRECREATE"), @SerializedName("PIXEL_UPSELL") VALUE_PIXEL_UPSELL("PIXEL_UPSELL"), + @SerializedName("PLACEMENTS_LIQUIDITY_AUTOMATIC_GUIDANCE") + VALUE_PLACEMENTS_LIQUIDITY_AUTOMATIC_GUIDANCE("PLACEMENTS_LIQUIDITY_AUTOMATIC_GUIDANCE"), @SerializedName("PREDICTIVE_CREATIVE_LIMITED") VALUE_PREDICTIVE_CREATIVE_LIMITED("PREDICTIVE_CREATIVE_LIMITED"), @SerializedName("PREDICTIVE_CREATIVE_LIMITED_HOURLY") @@ -569,14 +647,34 @@ public static enum EnumRecommendationType { VALUE_RAPID_LEARNING_LIMITED("RAPID_LEARNING_LIMITED"), @SerializedName("RAPID_LEARNING_PHASE") VALUE_RAPID_LEARNING_PHASE("RAPID_LEARNING_PHASE"), + @SerializedName("REACH_OPTIMIZATION_GOAL") + VALUE_REACH_OPTIMIZATION_GOAL("REACH_OPTIMIZATION_GOAL"), + @SerializedName("REACH_OPTIMIZATION_GOAL_PRECREATE") + VALUE_REACH_OPTIMIZATION_GOAL_PRECREATE("REACH_OPTIMIZATION_GOAL_PRECREATE"), @SerializedName("REELS_DUPLICATION_UPSELL") VALUE_REELS_DUPLICATION_UPSELL("REELS_DUPLICATION_UPSELL"), + @SerializedName("REELS_MUSIC_DUPLICATION") + VALUE_REELS_MUSIC_DUPLICATION("REELS_MUSIC_DUPLICATION"), + @SerializedName("REELS_PC_AND_MOBILE_FIRST_CREATIVE") + VALUE_REELS_PC_AND_MOBILE_FIRST_CREATIVE("REELS_PC_AND_MOBILE_FIRST_CREATIVE"), + @SerializedName("REELS_PERFORMANT_CREATIVE") + VALUE_REELS_PERFORMANT_CREATIVE("REELS_PERFORMANT_CREATIVE"), @SerializedName("REELS_PLACEMENT") VALUE_REELS_PLACEMENT("REELS_PLACEMENT"), @SerializedName("REVERT") VALUE_REVERT("REVERT"), + @SerializedName("SABR_DEFAULT_DURATION") + VALUE_SABR_DEFAULT_DURATION("SABR_DEFAULT_DURATION"), + @SerializedName("SALES_CONVERSION") + VALUE_SALES_CONVERSION("SALES_CONVERSION"), @SerializedName("SCALE_GOOD_CAMPAIGN") VALUE_SCALE_GOOD_CAMPAIGN("SCALE_GOOD_CAMPAIGN"), + @SerializedName("SCALE_GOOD_CAMPAIGN_DUPLICATION") + VALUE_SCALE_GOOD_CAMPAIGN_DUPLICATION("SCALE_GOOD_CAMPAIGN_DUPLICATION"), + @SerializedName("SCALE_GOOD_CTX_CAMPAIGN") + VALUE_SCALE_GOOD_CTX_CAMPAIGN("SCALE_GOOD_CTX_CAMPAIGN"), + @SerializedName("SEMANTIC_BASED_AUDIENCE_DUPLICATION") + VALUE_SEMANTIC_BASED_AUDIENCE_DUPLICATION("SEMANTIC_BASED_AUDIENCE_DUPLICATION"), @SerializedName("SEMANTIC_BASED_AUDIENCE_EXPANSION") VALUE_SEMANTIC_BASED_AUDIENCE_EXPANSION("SEMANTIC_BASED_AUDIENCE_EXPANSION"), @SerializedName("SETUP_PIXEL") @@ -585,8 +683,12 @@ public static enum EnumRecommendationType { VALUE_SHOPS_ADS("SHOPS_ADS"), @SerializedName("SHOPS_ADS_DUPLICATION") VALUE_SHOPS_ADS_DUPLICATION("SHOPS_ADS_DUPLICATION"), + @SerializedName("SHOP_ADS_V2") + VALUE_SHOP_ADS_V2("SHOP_ADS_V2"), @SerializedName("SIGNALS_GROWTH_CAPI") VALUE_SIGNALS_GROWTH_CAPI("SIGNALS_GROWTH_CAPI"), + @SerializedName("SIGNALS_GROWTH_CAPI_PRECREATE") + VALUE_SIGNALS_GROWTH_CAPI_PRECREATE("SIGNALS_GROWTH_CAPI_PRECREATE"), @SerializedName("SIGNALS_GROWTH_CAPI_TABLE") VALUE_SIGNALS_GROWTH_CAPI_TABLE("SIGNALS_GROWTH_CAPI_TABLE"), @SerializedName("SIGNALS_GROWTH_CAPI_V2") @@ -595,6 +697,8 @@ public static enum EnumRecommendationType { VALUE_SIMILAR_ADVERTISER_BUDGET_RECOMMENDATION("SIMILAR_ADVERTISER_BUDGET_RECOMMENDATION"), @SerializedName("SIX_PLUS_MANUAL_PLACEMENTS") VALUE_SIX_PLUS_MANUAL_PLACEMENTS("SIX_PLUS_MANUAL_PLACEMENTS"), + @SerializedName("SIX_PLUS_PLACEMENTS_DUPLICATION") + VALUE_SIX_PLUS_PLACEMENTS_DUPLICATION("SIX_PLUS_PLACEMENTS_DUPLICATION"), @SerializedName("SPEND_LIMIT") VALUE_SPEND_LIMIT("SPEND_LIMIT"), @SerializedName("SYD_TEST_MODE") @@ -621,10 +725,20 @@ public static enum EnumRecommendationType { VALUE_UNCROP_IMAGE("UNCROP_IMAGE"), @SerializedName("UNECONOMICAL_ADS_THROTTLING") VALUE_UNECONOMICAL_ADS_THROTTLING("UNECONOMICAL_ADS_THROTTLING"), + @SerializedName("UNIFIED_INBOX") + VALUE_UNIFIED_INBOX("UNIFIED_INBOX"), @SerializedName("UNUSED_BUDGET") VALUE_UNUSED_BUDGET("UNUSED_BUDGET"), @SerializedName("VIDEO_LENGTH") VALUE_VIDEO_LENGTH("VIDEO_LENGTH"), + @SerializedName("VIDEO_VIEWS_UPSELL") + VALUE_VIDEO_VIEWS_UPSELL("VIDEO_VIEWS_UPSELL"), + @SerializedName("VIDEO_VIEWS_UPSELL_PRECREATE") + VALUE_VIDEO_VIEWS_UPSELL_PRECREATE("VIDEO_VIEWS_UPSELL_PRECREATE"), + @SerializedName("WA_MESSAGING_PARTNERS_PRECREATE") + VALUE_WA_MESSAGING_PARTNERS_PRECREATE("WA_MESSAGING_PARTNERS_PRECREATE"), + @SerializedName("WEB_ENGAGED_VIEW_CONVERSIONS") + VALUE_WEB_ENGAGED_VIEW_CONVERSIONS("WEB_ENGAGED_VIEW_CONVERSIONS"), @SerializedName("ZERO_CONVERSION") VALUE_ZERO_CONVERSION("ZERO_CONVERSION"), @SerializedName("ZERO_IMPRESSION") diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountTargetingUnified.java b/src/main/java/com/facebook/ads/sdk/AdAccountTargetingUnified.java index b2ccb618..736e1222 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountTargetingUnified.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountTargetingUnified.java @@ -1131,6 +1131,8 @@ public static enum EnumWhitelistedTypes { VALUE_EFFECTIVE_OCULUS_POSITIONS("effective_oculus_positions"), @SerializedName("effective_publisher_platforms") VALUE_EFFECTIVE_PUBLISHER_PLATFORMS("effective_publisher_platforms"), + @SerializedName("effective_threads_positions") + VALUE_EFFECTIVE_THREADS_POSITIONS("effective_threads_positions"), @SerializedName("effective_whatsapp_positions") VALUE_EFFECTIVE_WHATSAPP_POSITIONS("effective_whatsapp_positions"), @SerializedName("engagement_specs") @@ -1289,6 +1291,8 @@ public static enum EnumWhitelistedTypes { VALUE_TARGETING_OPTIMIZATION("targeting_optimization"), @SerializedName("targeting_relaxation_types") VALUE_TARGETING_RELAXATION_TYPES("targeting_relaxation_types"), + @SerializedName("threads_positions") + VALUE_THREADS_POSITIONS("threads_positions"), @SerializedName("timezones") VALUE_TIMEZONES("timezones"), @SerializedName("topic") diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountUserSettings.java b/src/main/java/com/facebook/ads/sdk/AdAccountUserSettings.java index 250dd5c8..5959fbcf 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountUserSettings.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountUserSettings.java @@ -75,6 +75,8 @@ public class AdAccountUserSettings extends APINode { private Boolean mExportSummaryRow = null; @SerializedName("has_seen_groups_column_flexing_experience") private Boolean mHasSeenGroupsColumnFlexingExperience = null; + @SerializedName("has_seen_instagram_column_flexing_experience") + private Boolean mHasSeenInstagramColumnFlexingExperience = null; @SerializedName("has_seen_leads_column_flexing_experience") private Boolean mHasSeenLeadsColumnFlexingExperience = null; @SerializedName("has_seen_shops_ads_metrics_onboarding_tour") @@ -434,6 +436,10 @@ public Boolean getFieldHasSeenGroupsColumnFlexingExperience() { return mHasSeenGroupsColumnFlexingExperience; } + public Boolean getFieldHasSeenInstagramColumnFlexingExperience() { + return mHasSeenInstagramColumnFlexingExperience; + } + public Boolean getFieldHasSeenLeadsColumnFlexingExperience() { return mHasSeenLeadsColumnFlexingExperience; } @@ -615,6 +621,7 @@ public AdAccountUserSettings getLastResponse() { "export_deleted_items_with_delivery", "export_summary_row", "has_seen_groups_column_flexing_experience", + "has_seen_instagram_column_flexing_experience", "has_seen_leads_column_flexing_experience", "has_seen_shops_ads_metrics_onboarding_tour", "has_seen_shops_column_flexing_experience", @@ -863,6 +870,13 @@ public APIRequestGet requestHasSeenGroupsColumnFlexingExperienceField (boolean v this.requestField("has_seen_groups_column_flexing_experience", value); return this; } + public APIRequestGet requestHasSeenInstagramColumnFlexingExperienceField () { + return this.requestHasSeenInstagramColumnFlexingExperienceField(true); + } + public APIRequestGet requestHasSeenInstagramColumnFlexingExperienceField (boolean value) { + this.requestField("has_seen_instagram_column_flexing_experience", value); + return this; + } public APIRequestGet requestHasSeenLeadsColumnFlexingExperienceField () { return this.requestHasSeenLeadsColumnFlexingExperienceField(true); } @@ -1213,6 +1227,7 @@ public AdAccountUserSettings copyFrom(AdAccountUserSettings instance) { this.mExportDeletedItemsWithDelivery = instance.mExportDeletedItemsWithDelivery; this.mExportSummaryRow = instance.mExportSummaryRow; this.mHasSeenGroupsColumnFlexingExperience = instance.mHasSeenGroupsColumnFlexingExperience; + this.mHasSeenInstagramColumnFlexingExperience = instance.mHasSeenInstagramColumnFlexingExperience; this.mHasSeenLeadsColumnFlexingExperience = instance.mHasSeenLeadsColumnFlexingExperience; this.mHasSeenShopsAdsMetricsOnboardingTour = instance.mHasSeenShopsAdsMetricsOnboardingTour; this.mHasSeenShopsColumnFlexingExperience = instance.mHasSeenShopsColumnFlexingExperience; diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpec.java b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpec.java index d1041dd3..2bf51d29 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpec.java @@ -53,6 +53,8 @@ public class AdAssetFeedSpec extends APINode { private List mAutotranslate = null; @SerializedName("bodies") private List mBodies = null; + @SerializedName("call_ads_configuration") + private Object mCallAdsConfiguration = null; @SerializedName("call_to_action_types") private List mCallToActionTypes = null; @SerializedName("call_to_actions") @@ -309,6 +311,15 @@ public AdAssetFeedSpec setFieldBodies(String value) { this.mBodies = AdAssetFeedSpecBody.getGson().fromJson(value, type); return this; } + public Object getFieldCallAdsConfiguration() { + return mCallAdsConfiguration; + } + + public AdAssetFeedSpec setFieldCallAdsConfiguration(Object value) { + this.mCallAdsConfiguration = value; + return this; + } + public List getFieldCallToActionTypes() { return mCallToActionTypes; } @@ -690,6 +701,8 @@ public static enum EnumCallToActionTypes { VALUE_VIDEO_ANNOTATION("VIDEO_ANNOTATION"), @SerializedName("VIDEO_CALL") VALUE_VIDEO_CALL("VIDEO_CALL"), + @SerializedName("VIEW_CHANNEL") + VALUE_VIEW_CHANNEL("VIEW_CHANNEL"), @SerializedName("VIEW_PRODUCT") VALUE_VIEW_PRODUCT("VIEW_PRODUCT"), @SerializedName("VISIT_PAGES_FEED") @@ -737,6 +750,7 @@ public AdAssetFeedSpec copyFrom(AdAssetFeedSpec instance) { this.mAssetCustomizationRules = instance.mAssetCustomizationRules; this.mAutotranslate = instance.mAutotranslate; this.mBodies = instance.mBodies; + this.mCallAdsConfiguration = instance.mCallAdsConfiguration; this.mCallToActionTypes = instance.mCallToActionTypes; this.mCallToActions = instance.mCallToActions; this.mCaptions = instance.mCaptions; diff --git a/src/main/java/com/facebook/ads/sdk/AdCampaignConversionValueExpressionSpec.java b/src/main/java/com/facebook/ads/sdk/AdCampaignConversionValueExpressionSpec.java new file mode 100644 index 00000000..902c5f8d --- /dev/null +++ b/src/main/java/com/facebook/ads/sdk/AdCampaignConversionValueExpressionSpec.java @@ -0,0 +1,260 @@ +/* + * 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 AdCampaignConversionValueExpressionSpec extends APINode { + @SerializedName("adjustment_sign") + private String mAdjustmentSign = null; + @SerializedName("adjustment_weight") + private Long mAdjustmentWeight = null; + @SerializedName("destination_type") + private String mDestinationType = null; + protected static Gson gson = null; + + public AdCampaignConversionValueExpressionSpec() { + } + + public String getId() { + return null; + } + public static AdCampaignConversionValueExpressionSpec loadJSON(String json, APIContext context, String header) { + AdCampaignConversionValueExpressionSpec adCampaignConversionValueExpressionSpec = getGson().fromJson(json, AdCampaignConversionValueExpressionSpec.class); + if (context.isDebug()) { + JsonParser parser = new JsonParser(); + JsonElement o1 = parser.parse(json); + JsonElement o2 = parser.parse(adCampaignConversionValueExpressionSpec.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); + } + } + adCampaignConversionValueExpressionSpec.context = context; + adCampaignConversionValueExpressionSpec.rawValue = json; + adCampaignConversionValueExpressionSpec.header = header; + return adCampaignConversionValueExpressionSpec; + } + + public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { + APINodeList adCampaignConversionValueExpressionSpecs = 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++) { + adCampaignConversionValueExpressionSpecs.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); + }; + return adCampaignConversionValueExpressionSpecs; + } 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; + adCampaignConversionValueExpressionSpecs.setCursors(before, after); + } + String previous = paging.has("previous") ? paging.get("previous").getAsString() : null; + String next = paging.has("next") ? paging.get("next").getAsString() : null; + adCampaignConversionValueExpressionSpecs.setPaging(previous, next); + if (context.hasAppSecret()) { + adCampaignConversionValueExpressionSpecs.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++) { + adCampaignConversionValueExpressionSpecs.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()) { + adCampaignConversionValueExpressionSpecs.add(loadJSON(entry.getValue().toString(), context, header)); + } + break; + } + } + if (!isRedownload) { + adCampaignConversionValueExpressionSpecs.add(loadJSON(obj.toString(), context, header)); + } + } + return adCampaignConversionValueExpressionSpecs; + } 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()) { + adCampaignConversionValueExpressionSpecs.add(loadJSON(entry.getValue().toString(), context, header)); + } + return adCampaignConversionValueExpressionSpecs; + } 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) + ) { + adCampaignConversionValueExpressionSpecs.add(loadJSON(value.toString(), context, header)); + } else { + isIdIndexedArray = false; + break; + } + } + if (isIdIndexedArray) { + return adCampaignConversionValueExpressionSpecs; + } + + // Sixth, check if it's pure JsonObject + adCampaignConversionValueExpressionSpecs.clear(); + adCampaignConversionValueExpressionSpecs.add(loadJSON(json, context, header)); + return adCampaignConversionValueExpressionSpecs; + } + } + } 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 String getFieldAdjustmentSign() { + return mAdjustmentSign; + } + + public AdCampaignConversionValueExpressionSpec setFieldAdjustmentSign(String value) { + this.mAdjustmentSign = value; + return this; + } + + public Long getFieldAdjustmentWeight() { + return mAdjustmentWeight; + } + + public AdCampaignConversionValueExpressionSpec setFieldAdjustmentWeight(Long value) { + this.mAdjustmentWeight = value; + return this; + } + + public String getFieldDestinationType() { + return mDestinationType; + } + + public AdCampaignConversionValueExpressionSpec setFieldDestinationType(String value) { + this.mDestinationType = 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 AdCampaignConversionValueExpressionSpec copyFrom(AdCampaignConversionValueExpressionSpec instance) { + this.mAdjustmentSign = instance.mAdjustmentSign; + this.mAdjustmentWeight = instance.mAdjustmentWeight; + this.mDestinationType = instance.mDestinationType; + 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 AdCampaignConversionValueExpressionSpec.parseResponse(response, context, request, header); + } + }; + } +} diff --git a/src/main/java/com/facebook/ads/sdk/AdCreative.java b/src/main/java/com/facebook/ads/sdk/AdCreative.java index 6f09d80b..9bce68cd 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreative.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreative.java @@ -2665,6 +2665,8 @@ public static enum EnumCallToActionType { VALUE_VIDEO_ANNOTATION("VIDEO_ANNOTATION"), @SerializedName("VIDEO_CALL") VALUE_VIDEO_CALL("VIDEO_CALL"), + @SerializedName("VIEW_CHANNEL") + VALUE_VIEW_CHANNEL("VIEW_CHANNEL"), @SerializedName("VIEW_PRODUCT") VALUE_VIEW_PRODUCT("VIEW_PRODUCT"), @SerializedName("VISIT_PAGES_FEED") diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeBrandedContentAds.java b/src/main/java/com/facebook/ads/sdk/AdCreativeBrandedContentAds.java index ee8700c8..6f44b363 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeBrandedContentAds.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeBrandedContentAds.java @@ -55,8 +55,12 @@ public class AdCreativeBrandedContentAds extends APINode { private Boolean mIsMcaInternal = null; @SerializedName("partners") private List mPartners = null; + @SerializedName("product_set_partner_selection_status") + private String mProductSetPartnerSelectionStatus = null; @SerializedName("promoted_page_id") private String mPromotedPageId = null; + @SerializedName("testimonial") + private String mTestimonial = null; @SerializedName("ui_version") private Long mUiVersion = null; protected static Gson gson = null; @@ -278,6 +282,15 @@ public AdCreativeBrandedContentAds setFieldPartners(String value) { this.mPartners = AdCreativeBrandedContentAdsPartners.getGson().fromJson(value, type); return this; } + public String getFieldProductSetPartnerSelectionStatus() { + return mProductSetPartnerSelectionStatus; + } + + public AdCreativeBrandedContentAds setFieldProductSetPartnerSelectionStatus(String value) { + this.mProductSetPartnerSelectionStatus = value; + return this; + } + public String getFieldPromotedPageId() { return mPromotedPageId; } @@ -287,6 +300,15 @@ public AdCreativeBrandedContentAds setFieldPromotedPageId(String value) { return this; } + public String getFieldTestimonial() { + return mTestimonial; + } + + public AdCreativeBrandedContentAds setFieldTestimonial(String value) { + this.mTestimonial = value; + return this; + } + public Long getFieldUiVersion() { return mUiVersion; } @@ -320,7 +342,9 @@ public AdCreativeBrandedContentAds copyFrom(AdCreativeBrandedContentAds instance this.mInstagramBoostPostAccessToken = instance.mInstagramBoostPostAccessToken; this.mIsMcaInternal = instance.mIsMcaInternal; this.mPartners = instance.mPartners; + this.mProductSetPartnerSelectionStatus = instance.mProductSetPartnerSelectionStatus; this.mPromotedPageId = instance.mPromotedPageId; + this.mTestimonial = instance.mTestimonial; this.mUiVersion = instance.mUiVersion; this.context = instance.context; this.rawValue = instance.rawValue; diff --git a/src/main/java/com/facebook/ads/sdk/ProductCatalogExampleFeed.java b/src/main/java/com/facebook/ads/sdk/AdCreativeDestinationSpec.java similarity index 72% rename from src/main/java/com/facebook/ads/sdk/ProductCatalogExampleFeed.java rename to src/main/java/com/facebook/ads/sdk/AdCreativeDestinationSpec.java index 35ad91b3..b14cef90 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductCatalogExampleFeed.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeDestinationSpec.java @@ -40,23 +40,23 @@ * pull request for this class. * */ -public class ProductCatalogExampleFeed extends APINode { - @SerializedName("example_feed") - private String mExampleFeed = null; +public class AdCreativeDestinationSpec extends APINode { + @SerializedName("destination_type") + private String mDestinationType = null; protected static Gson gson = null; - public ProductCatalogExampleFeed() { + public AdCreativeDestinationSpec() { } public String getId() { return null; } - public static ProductCatalogExampleFeed loadJSON(String json, APIContext context, String header) { - ProductCatalogExampleFeed productCatalogExampleFeed = getGson().fromJson(json, ProductCatalogExampleFeed.class); + public static AdCreativeDestinationSpec loadJSON(String json, APIContext context, String header) { + AdCreativeDestinationSpec adCreativeDestinationSpec = getGson().fromJson(json, AdCreativeDestinationSpec.class); if (context.isDebug()) { JsonParser parser = new JsonParser(); JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productCatalogExampleFeed.toString()); + JsonElement o2 = parser.parse(adCreativeDestinationSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -66,14 +66,14 @@ public static ProductCatalogExampleFeed loadJSON(String json, APIContext context context.log("[Object]" + o2); } } - productCatalogExampleFeed.context = context; - productCatalogExampleFeed.rawValue = json; - productCatalogExampleFeed.header = header; - return productCatalogExampleFeed; + adCreativeDestinationSpec.context = context; + adCreativeDestinationSpec.rawValue = json; + adCreativeDestinationSpec.header = header; + return adCreativeDestinationSpec; } - public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { - APINodeList productCatalogExampleFeeds = new APINodeList(request, json, header); + public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { + APINodeList adCreativeDestinationSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; JsonParser parser = new JsonParser(); @@ -84,9 +84,9 @@ public static APINodeList parseResponse(String json, // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); for (int i = 0; i < arr.size(); i++) { - productCatalogExampleFeeds.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); + adCreativeDestinationSpecs.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); }; - return productCatalogExampleFeeds; + return adCreativeDestinationSpecs; } else if (result.isJsonObject()) { obj = result.getAsJsonObject(); if (obj.has("data")) { @@ -96,20 +96,20 @@ public static APINodeList parseResponse(String json, 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; - productCatalogExampleFeeds.setCursors(before, after); + adCreativeDestinationSpecs.setCursors(before, after); } String previous = paging.has("previous") ? paging.get("previous").getAsString() : null; String next = paging.has("next") ? paging.get("next").getAsString() : null; - productCatalogExampleFeeds.setPaging(previous, next); + adCreativeDestinationSpecs.setPaging(previous, next); if (context.hasAppSecret()) { - productCatalogExampleFeeds.setAppSecret(context.getAppSecretProof()); + adCreativeDestinationSpecs.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++) { - productCatalogExampleFeeds.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); + adCreativeDestinationSpecs.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" @@ -120,23 +120,23 @@ public static APINodeList parseResponse(String json, isRedownload = true; obj = obj.getAsJsonObject(s); for (Map.Entry entry : obj.entrySet()) { - productCatalogExampleFeeds.add(loadJSON(entry.getValue().toString(), context, header)); + adCreativeDestinationSpecs.add(loadJSON(entry.getValue().toString(), context, header)); } break; } } if (!isRedownload) { - productCatalogExampleFeeds.add(loadJSON(obj.toString(), context, header)); + adCreativeDestinationSpecs.add(loadJSON(obj.toString(), context, header)); } } - return productCatalogExampleFeeds; + return adCreativeDestinationSpecs; } 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()) { - productCatalogExampleFeeds.add(loadJSON(entry.getValue().toString(), context, header)); + adCreativeDestinationSpecs.add(loadJSON(entry.getValue().toString(), context, header)); } - return productCatalogExampleFeeds; + return adCreativeDestinationSpecs; } else { // Fifth, check if it's an array of objects indexed by id boolean isIdIndexedArray = true; @@ -153,20 +153,20 @@ public static APINodeList parseResponse(String json, value.getAsJsonObject().get("id") != null && value.getAsJsonObject().get("id").getAsString().equals(key) ) { - productCatalogExampleFeeds.add(loadJSON(value.toString(), context, header)); + adCreativeDestinationSpecs.add(loadJSON(value.toString(), context, header)); } else { isIdIndexedArray = false; break; } } if (isIdIndexedArray) { - return productCatalogExampleFeeds; + return adCreativeDestinationSpecs; } // Sixth, check if it's pure JsonObject - productCatalogExampleFeeds.clear(); - productCatalogExampleFeeds.add(loadJSON(json, context, header)); - return productCatalogExampleFeeds; + adCreativeDestinationSpecs.clear(); + adCreativeDestinationSpecs.add(loadJSON(json, context, header)); + return adCreativeDestinationSpecs; } } } catch (Exception e) { @@ -194,12 +194,12 @@ public String toString() { } - public String getFieldExampleFeed() { - return mExampleFeed; + public String getFieldDestinationType() { + return mDestinationType; } - public ProductCatalogExampleFeed setFieldExampleFeed(String value) { - this.mExampleFeed = value; + public AdCreativeDestinationSpec setFieldDestinationType(String value) { + this.mDestinationType = value; return this; } @@ -219,17 +219,17 @@ public ProductCatalogExampleFeed setFieldExampleFeed(String value) { return gson; } - public ProductCatalogExampleFeed copyFrom(ProductCatalogExampleFeed instance) { - this.mExampleFeed = instance.mExampleFeed; + public AdCreativeDestinationSpec copyFrom(AdCreativeDestinationSpec instance) { + this.mDestinationType = instance.mDestinationType; 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 ProductCatalogExampleFeed.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 AdCreativeDestinationSpec.parseResponse(response, context, request, header); } }; } diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeFeatureCustomizations.java b/src/main/java/com/facebook/ads/sdk/AdCreativeFeatureCustomizations.java index fc6c03f8..a9c9768f 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeFeatureCustomizations.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeFeatureCustomizations.java @@ -49,6 +49,8 @@ public class AdCreativeFeatureCustomizations extends APINode { private String mFontName = null; @SerializedName("product_recommendation_type") private String mProductRecommendationType = null; + @SerializedName("product_versioning_fallback_strategy") + private String mProductVersioningFallbackStrategy = null; @SerializedName("showcase_card_display") private String mShowcaseCardDisplay = null; @SerializedName("text_style") @@ -242,6 +244,15 @@ public AdCreativeFeatureCustomizations setFieldProductRecommendationType(String return this; } + public String getFieldProductVersioningFallbackStrategy() { + return mProductVersioningFallbackStrategy; + } + + public AdCreativeFeatureCustomizations setFieldProductVersioningFallbackStrategy(String value) { + this.mProductVersioningFallbackStrategy = value; + return this; + } + public String getFieldShowcaseCardDisplay() { return mShowcaseCardDisplay; } @@ -290,6 +301,7 @@ public AdCreativeFeatureCustomizations copyFrom(AdCreativeFeatureCustomizations this.mCatalogFeedTagName = instance.mCatalogFeedTagName; this.mFontName = instance.mFontName; this.mProductRecommendationType = instance.mProductRecommendationType; + this.mProductVersioningFallbackStrategy = instance.mProductVersioningFallbackStrategy; this.mShowcaseCardDisplay = instance.mShowcaseCardDisplay; this.mTextStyle = instance.mTextStyle; this.mVideoCropStyle = instance.mVideoCropStyle; diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeFeaturesSpec.java b/src/main/java/com/facebook/ads/sdk/AdCreativeFeaturesSpec.java index 1f215282..8f6ddf86 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeFeaturesSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeFeaturesSpec.java @@ -43,6 +43,8 @@ public class AdCreativeFeaturesSpec extends APINode { @SerializedName("adapt_to_placement") private AdCreativeFeatureDetails mAdaptToPlacement = null; + @SerializedName("add_text_overlay") + private AdCreativeFeatureDetails mAddTextOverlay = null; @SerializedName("ads_with_benefits") private AdCreativeFeatureDetails mAdsWithBenefits = null; @SerializedName("advantage_plus_creative") @@ -63,6 +65,8 @@ public class AdCreativeFeaturesSpec extends APINode { private AdCreativeFeatureDetails mDescriptionAutomation = null; @SerializedName("dha_optimization") private AdCreativeFeatureDetails mDhaOptimization = null; + @SerializedName("enhance_cta") + private AdCreativeFeatureDetails mEnhanceCta = null; @SerializedName("feed_caption_optimization") private AdCreativeFeatureDetails mFeedCaptionOptimization = null; @SerializedName("ig_glados_feed") @@ -83,6 +87,8 @@ public class AdCreativeFeaturesSpec extends APINode { private AdCreativeFeatureDetails mImageUncrop = null; @SerializedName("inline_comment") private AdCreativeFeatureDetails mInlineComment = null; + @SerializedName("local_store_extension") + private AdCreativeFeatureDetails mLocalStoreExtension = null; @SerializedName("media_liquidity_animated_image") private AdCreativeFeatureDetails mMediaLiquidityAnimatedImage = null; @SerializedName("media_order") @@ -278,6 +284,20 @@ public AdCreativeFeaturesSpec setFieldAdaptToPlacement(String value) { this.mAdaptToPlacement = AdCreativeFeatureDetails.getGson().fromJson(value, type); return this; } + public AdCreativeFeatureDetails getFieldAddTextOverlay() { + return mAddTextOverlay; + } + + public AdCreativeFeaturesSpec setFieldAddTextOverlay(AdCreativeFeatureDetails value) { + this.mAddTextOverlay = value; + return this; + } + + public AdCreativeFeaturesSpec setFieldAddTextOverlay(String value) { + Type type = new TypeToken(){}.getType(); + this.mAddTextOverlay = AdCreativeFeatureDetails.getGson().fromJson(value, type); + return this; + } public AdCreativeFeatureDetails getFieldAdsWithBenefits() { return mAdsWithBenefits; } @@ -418,6 +438,20 @@ public AdCreativeFeaturesSpec setFieldDhaOptimization(String value) { this.mDhaOptimization = AdCreativeFeatureDetails.getGson().fromJson(value, type); return this; } + public AdCreativeFeatureDetails getFieldEnhanceCta() { + return mEnhanceCta; + } + + public AdCreativeFeaturesSpec setFieldEnhanceCta(AdCreativeFeatureDetails value) { + this.mEnhanceCta = value; + return this; + } + + public AdCreativeFeaturesSpec setFieldEnhanceCta(String value) { + Type type = new TypeToken(){}.getType(); + this.mEnhanceCta = AdCreativeFeatureDetails.getGson().fromJson(value, type); + return this; + } public AdCreativeFeatureDetails getFieldFeedCaptionOptimization() { return mFeedCaptionOptimization; } @@ -558,6 +592,20 @@ public AdCreativeFeaturesSpec setFieldInlineComment(String value) { this.mInlineComment = AdCreativeFeatureDetails.getGson().fromJson(value, type); return this; } + public AdCreativeFeatureDetails getFieldLocalStoreExtension() { + return mLocalStoreExtension; + } + + public AdCreativeFeaturesSpec setFieldLocalStoreExtension(AdCreativeFeatureDetails value) { + this.mLocalStoreExtension = value; + return this; + } + + public AdCreativeFeaturesSpec setFieldLocalStoreExtension(String value) { + Type type = new TypeToken(){}.getType(); + this.mLocalStoreExtension = AdCreativeFeatureDetails.getGson().fromJson(value, type); + return this; + } public AdCreativeFeatureDetails getFieldMediaLiquidityAnimatedImage() { return mMediaLiquidityAnimatedImage; } @@ -786,6 +834,7 @@ public AdCreativeFeaturesSpec setFieldVideoHighlight(String value) { public AdCreativeFeaturesSpec copyFrom(AdCreativeFeaturesSpec instance) { this.mAdaptToPlacement = instance.mAdaptToPlacement; + this.mAddTextOverlay = instance.mAddTextOverlay; this.mAdsWithBenefits = instance.mAdsWithBenefits; this.mAdvantagePlusCreative = instance.mAdvantagePlusCreative; this.mAppHighlights = instance.mAppHighlights; @@ -796,6 +845,7 @@ public AdCreativeFeaturesSpec copyFrom(AdCreativeFeaturesSpec instance) { this.mCvTransformation = instance.mCvTransformation; this.mDescriptionAutomation = instance.mDescriptionAutomation; this.mDhaOptimization = instance.mDhaOptimization; + this.mEnhanceCta = instance.mEnhanceCta; this.mFeedCaptionOptimization = instance.mFeedCaptionOptimization; this.mIgGladosFeed = instance.mIgGladosFeed; this.mImageAutoCrop = instance.mImageAutoCrop; @@ -806,6 +856,7 @@ public AdCreativeFeaturesSpec copyFrom(AdCreativeFeaturesSpec instance) { this.mImageTouchups = instance.mImageTouchups; this.mImageUncrop = instance.mImageUncrop; this.mInlineComment = instance.mInlineComment; + this.mLocalStoreExtension = instance.mLocalStoreExtension; this.mMediaLiquidityAnimatedImage = instance.mMediaLiquidityAnimatedImage; this.mMediaOrder = instance.mMediaOrder; this.mMediaTypeAutomation = instance.mMediaTypeAutomation; diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkData.java b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkData.java index 0036fa95..d2620262 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkData.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkData.java @@ -101,6 +101,8 @@ public class AdCreativeLinkData extends APINode { private AdCreativePostClickConfiguration mPostClickConfiguration = null; @SerializedName("preferred_image_tags") private List mPreferredImageTags = null; + @SerializedName("preferred_video_tags") + private List mPreferredVideoTags = null; @SerializedName("retailer_item_ids") private List mRetailerItemIds = null; @SerializedName("show_multiple_images") @@ -575,6 +577,15 @@ public AdCreativeLinkData setFieldPreferredImageTags(List value) { return this; } + public List getFieldPreferredVideoTags() { + return mPreferredVideoTags; + } + + public AdCreativeLinkData setFieldPreferredVideoTags(List value) { + this.mPreferredVideoTags = value; + return this; + } + public List getFieldRetailerItemIds() { return mRetailerItemIds; } @@ -690,6 +701,7 @@ public AdCreativeLinkData copyFrom(AdCreativeLinkData instance) { this.mPicture = instance.mPicture; this.mPostClickConfiguration = instance.mPostClickConfiguration; this.mPreferredImageTags = instance.mPreferredImageTags; + this.mPreferredVideoTags = instance.mPreferredVideoTags; this.mRetailerItemIds = instance.mRetailerItemIds; this.mShowMultipleImages = instance.mShowMultipleImages; this.mStaticFallbackSpec = instance.mStaticFallbackSpec; diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataCallToAction.java b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataCallToAction.java index 218c34ec..44011289 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataCallToAction.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataCallToAction.java @@ -378,6 +378,8 @@ public static enum EnumType { VALUE_VIDEO_ANNOTATION("VIDEO_ANNOTATION"), @SerializedName("VIDEO_CALL") VALUE_VIDEO_CALL("VIDEO_CALL"), + @SerializedName("VIEW_CHANNEL") + VALUE_VIEW_CHANNEL("VIEW_CHANNEL"), @SerializedName("VIEW_PRODUCT") VALUE_VIEW_PRODUCT("VIEW_PRODUCT"), @SerializedName("VISIT_PAGES_FEED") diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataCallToActionValue.java b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataCallToActionValue.java index db42d110..5f8ea248 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataCallToActionValue.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataCallToActionValue.java @@ -57,6 +57,8 @@ public class AdCreativeLinkDataCallToActionValue extends APINode { private String mLinkCaption = null; @SerializedName("link_format") private String mLinkFormat = null; + @SerializedName("object_store_urls") + private List mObjectStoreUrls = null; @SerializedName("page") private String mPage = null; @SerializedName("product_link") @@ -286,6 +288,15 @@ public AdCreativeLinkDataCallToActionValue setFieldLinkFormat(String value) { return this; } + public List getFieldObjectStoreUrls() { + return mObjectStoreUrls; + } + + public AdCreativeLinkDataCallToActionValue setFieldObjectStoreUrls(List value) { + this.mObjectStoreUrls = value; + return this; + } + public String getFieldPage() { return mPage; } @@ -338,6 +349,7 @@ public AdCreativeLinkDataCallToActionValue copyFrom(AdCreativeLinkDataCallToActi this.mLink = instance.mLink; this.mLinkCaption = instance.mLinkCaption; this.mLinkFormat = instance.mLinkFormat; + this.mObjectStoreUrls = instance.mObjectStoreUrls; this.mPage = instance.mPage; this.mProductLink = instance.mProductLink; this.mWhatsappNumber = instance.mWhatsappNumber; diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataImageLayerSpec.java b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataImageLayerSpec.java index 0c812af1..2e6775a1 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataImageLayerSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataImageLayerSpec.java @@ -45,6 +45,8 @@ public class AdCreativeLinkDataImageLayerSpec extends APINode { private EnumBlendingMode mBlendingMode = null; @SerializedName("content") private Object mContent = null; + @SerializedName("frame_auto_show_enroll_status") + private String mFrameAutoShowEnrollStatus = null; @SerializedName("frame_image_hash") private String mFrameImageHash = null; @SerializedName("frame_source") @@ -236,6 +238,15 @@ public AdCreativeLinkDataImageLayerSpec setFieldContent(Object value) { return this; } + public String getFieldFrameAutoShowEnrollStatus() { + return mFrameAutoShowEnrollStatus; + } + + public AdCreativeLinkDataImageLayerSpec setFieldFrameAutoShowEnrollStatus(String value) { + this.mFrameAutoShowEnrollStatus = value; + return this; + } + public String getFieldFrameImageHash() { return mFrameImageHash; } @@ -521,6 +532,7 @@ public String toString() { public AdCreativeLinkDataImageLayerSpec copyFrom(AdCreativeLinkDataImageLayerSpec instance) { this.mBlendingMode = instance.mBlendingMode; this.mContent = instance.mContent; + this.mFrameAutoShowEnrollStatus = instance.mFrameAutoShowEnrollStatus; this.mFrameImageHash = instance.mFrameImageHash; this.mFrameSource = instance.mFrameSource; this.mImageSource = instance.mImageSource; diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataMoment.java b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataMoment.java index a86fd142..03b0af68 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataMoment.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataMoment.java @@ -219,8 +219,6 @@ public AdCreativeLinkDataMoment setFieldType(EnumType value) { public static enum EnumType { @SerializedName("FB_LIVE_SHOPPING") VALUE_FB_LIVE_SHOPPING("FB_LIVE_SHOPPING"), - @SerializedName("IG_DROPS") - VALUE_IG_DROPS("IG_DROPS"), @SerializedName("IG_LIVE_SHOPPING") VALUE_IG_LIVE_SHOPPING("IG_LIVE_SHOPPING"), ; diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeMarketingMessageStructuredSpec.java b/src/main/java/com/facebook/ads/sdk/AdCreativeMarketingMessageStructuredSpec.java index 60ba342e..9a06519d 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeMarketingMessageStructuredSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeMarketingMessageStructuredSpec.java @@ -47,6 +47,8 @@ public class AdCreativeMarketingMessageStructuredSpec extends APINode { private String mFooter = null; @SerializedName("greeting") private String mGreeting = null; + @SerializedName("is_optimized_text") + private Boolean mIsOptimizedText = null; @SerializedName("language") private String mLanguage = null; @SerializedName("referenced_adgroup_id") @@ -231,6 +233,15 @@ public AdCreativeMarketingMessageStructuredSpec setFieldGreeting(String value) { return this; } + public Boolean getFieldIsOptimizedText() { + return mIsOptimizedText; + } + + public AdCreativeMarketingMessageStructuredSpec setFieldIsOptimizedText(Boolean value) { + this.mIsOptimizedText = value; + return this; + } + public String getFieldLanguage() { return mLanguage; } @@ -278,6 +289,7 @@ public AdCreativeMarketingMessageStructuredSpec copyFrom(AdCreativeMarketingMess this.mButtons = instance.mButtons; this.mFooter = instance.mFooter; this.mGreeting = instance.mGreeting; + this.mIsOptimizedText = instance.mIsOptimizedText; this.mLanguage = instance.mLanguage; this.mReferencedAdgroupId = instance.mReferencedAdgroupId; this.mWhatsAppBusinessPhoneNumberId = instance.mWhatsAppBusinessPhoneNumberId; diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeObjectStorySpec.java b/src/main/java/com/facebook/ads/sdk/AdCreativeObjectStorySpec.java index 06ae1a3c..833bcb38 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeObjectStorySpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeObjectStorySpec.java @@ -53,6 +53,8 @@ public class AdCreativeObjectStorySpec extends APINode { private AdCreativeLinkData mTemplateData = null; @SerializedName("text_data") private AdCreativeTextData mTextData = null; + @SerializedName("threads_actor_id") + private String mThreadsActorId = null; @SerializedName("video_data") private AdCreativeVideoData mVideoData = null; protected static Gson gson = null; @@ -280,6 +282,15 @@ public AdCreativeObjectStorySpec setFieldTextData(String value) { this.mTextData = AdCreativeTextData.getGson().fromJson(value, type); return this; } + public String getFieldThreadsActorId() { + return mThreadsActorId; + } + + public AdCreativeObjectStorySpec setFieldThreadsActorId(String value) { + this.mThreadsActorId = value; + return this; + } + public AdCreativeVideoData getFieldVideoData() { return mVideoData; } @@ -317,6 +328,7 @@ public AdCreativeObjectStorySpec copyFrom(AdCreativeObjectStorySpec instance) { this.mPhotoData = instance.mPhotoData; this.mTemplateData = instance.mTemplateData; this.mTextData = instance.mTextData; + this.mThreadsActorId = instance.mThreadsActorId; this.mVideoData = instance.mVideoData; this.context = instance.context; this.rawValue = instance.rawValue; diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeSiteLinksSpec.java b/src/main/java/com/facebook/ads/sdk/AdCreativeSiteLinksSpec.java index dfbb8f73..ec2ff447 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeSiteLinksSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeSiteLinksSpec.java @@ -41,6 +41,12 @@ * */ public class AdCreativeSiteLinksSpec extends APINode { + @SerializedName("site_link_image_hash") + private String mSiteLinkImageHash = null; + @SerializedName("site_link_image_url") + private String mSiteLinkImageUrl = null; + @SerializedName("site_link_recommendation_type") + private String mSiteLinkRecommendationType = null; @SerializedName("site_link_title") private String mSiteLinkTitle = null; @SerializedName("site_link_url") @@ -196,6 +202,33 @@ public String toString() { } + public String getFieldSiteLinkImageHash() { + return mSiteLinkImageHash; + } + + public AdCreativeSiteLinksSpec setFieldSiteLinkImageHash(String value) { + this.mSiteLinkImageHash = value; + return this; + } + + public String getFieldSiteLinkImageUrl() { + return mSiteLinkImageUrl; + } + + public AdCreativeSiteLinksSpec setFieldSiteLinkImageUrl(String value) { + this.mSiteLinkImageUrl = value; + return this; + } + + public String getFieldSiteLinkRecommendationType() { + return mSiteLinkRecommendationType; + } + + public AdCreativeSiteLinksSpec setFieldSiteLinkRecommendationType(String value) { + this.mSiteLinkRecommendationType = value; + return this; + } + public String getFieldSiteLinkTitle() { return mSiteLinkTitle; } @@ -231,6 +264,9 @@ public AdCreativeSiteLinksSpec setFieldSiteLinkUrl(String value) { } public AdCreativeSiteLinksSpec copyFrom(AdCreativeSiteLinksSpec instance) { + this.mSiteLinkImageHash = instance.mSiteLinkImageHash; + this.mSiteLinkImageUrl = instance.mSiteLinkImageUrl; + this.mSiteLinkRecommendationType = instance.mSiteLinkRecommendationType; this.mSiteLinkTitle = instance.mSiteLinkTitle; this.mSiteLinkUrl = instance.mSiteLinkUrl; this.context = instance.context; diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeSourcingSpec.java b/src/main/java/com/facebook/ads/sdk/AdCreativeSourcingSpec.java index 07588160..1184b8f3 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeSourcingSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeSourcingSpec.java @@ -43,6 +43,8 @@ public class AdCreativeSourcingSpec extends APINode { @SerializedName("associated_product_set_id") private String mAssociatedProductSetId = null; + @SerializedName("enable_social_feedback_preservation") + private Boolean mEnableSocialFeedbackPreservation = null; @SerializedName("promotion_metadata_spec") private List mPromotionMetadataSpec = null; @SerializedName("site_links_spec") @@ -209,6 +211,15 @@ public AdCreativeSourcingSpec setFieldAssociatedProductSetId(String value) { return this; } + public Boolean getFieldEnableSocialFeedbackPreservation() { + return mEnableSocialFeedbackPreservation; + } + + public AdCreativeSourcingSpec setFieldEnableSocialFeedbackPreservation(Boolean value) { + this.mEnableSocialFeedbackPreservation = value; + return this; + } + public List getFieldPromotionMetadataSpec() { return mPromotionMetadataSpec; } @@ -264,6 +275,7 @@ public AdCreativeSourcingSpec setFieldSourceUrl(String value) { public AdCreativeSourcingSpec copyFrom(AdCreativeSourcingSpec instance) { this.mAssociatedProductSetId = instance.mAssociatedProductSetId; + this.mEnableSocialFeedbackPreservation = instance.mEnableSocialFeedbackPreservation; this.mPromotionMetadataSpec = instance.mPromotionMetadataSpec; this.mSiteLinksSpec = instance.mSiteLinksSpec; this.mSourceUrl = instance.mSourceUrl; diff --git a/src/main/java/com/facebook/ads/sdk/AdLabel.java b/src/main/java/com/facebook/ads/sdk/AdLabel.java index e256599d..7162ca98 100644 --- a/src/main/java/com/facebook/ads/sdk/AdLabel.java +++ b/src/main/java/com/facebook/ads/sdk/AdLabel.java @@ -1386,6 +1386,7 @@ public APINodeList getLastResponse() { "bid_info", "bid_strategy", "billing_event", + "brand_safety_config", "budget_remaining", "campaign", "campaign_active_time", @@ -1606,6 +1607,13 @@ public APIRequestGetAdSets requestBillingEventField (boolean value) { this.requestField("billing_event", value); return this; } + public APIRequestGetAdSets requestBrandSafetyConfigField () { + return this.requestBrandSafetyConfigField(true); + } + public APIRequestGetAdSets requestBrandSafetyConfigField (boolean value) { + this.requestField("brand_safety_config", value); + return this; + } public APIRequestGetAdSets requestBudgetRemainingField () { return this.requestBudgetRemainingField(true); } @@ -2007,6 +2015,7 @@ public APINodeList getLastResponse() { "smart_promotion_type", "source_campaign", "source_campaign_id", + "source_recommendation_type", "special_ad_categories", "special_ad_category", "special_ad_category_country", @@ -2325,6 +2334,13 @@ public APIRequestGetCampaigns requestSourceCampaignIdField (boolean value) { this.requestField("source_campaign_id", value); return this; } + public APIRequestGetCampaigns requestSourceRecommendationTypeField () { + return this.requestSourceRecommendationTypeField(true); + } + public APIRequestGetCampaigns requestSourceRecommendationTypeField (boolean value) { + this.requestField("source_recommendation_type", value); + return this; + } public APIRequestGetCampaigns requestSpecialAdCategoriesField () { return this.requestSpecialAdCategoriesField(true); } diff --git a/src/main/java/com/facebook/ads/sdk/AdPromotedObject.java b/src/main/java/com/facebook/ads/sdk/AdPromotedObject.java index 0c6b444d..eafa3a0f 100644 --- a/src/main/java/com/facebook/ads/sdk/AdPromotedObject.java +++ b/src/main/java/com/facebook/ads/sdk/AdPromotedObject.java @@ -43,6 +43,8 @@ public class AdPromotedObject extends APINode { @SerializedName("application_id") private String mApplicationId = null; + @SerializedName("boosted_product_set_id") + private String mBoostedProductSetId = null; @SerializedName("conversion_goal_id") private String mConversionGoalId = null; @SerializedName("custom_conversion_id") @@ -251,6 +253,15 @@ public AdPromotedObject setFieldApplicationId(String value) { return this; } + public String getFieldBoostedProductSetId() { + return mBoostedProductSetId; + } + + public AdPromotedObject setFieldBoostedProductSetId(String value) { + this.mBoostedProductSetId = value; + return this; + } + public String getFieldConversionGoalId() { return mConversionGoalId; } @@ -574,6 +585,7 @@ public String toString() { public AdPromotedObject copyFrom(AdPromotedObject instance) { this.mApplicationId = instance.mApplicationId; + this.mBoostedProductSetId = instance.mBoostedProductSetId; this.mConversionGoalId = instance.mConversionGoalId; this.mCustomConversionId = instance.mCustomConversionId; this.mCustomEventStr = instance.mCustomEventStr; diff --git a/src/main/java/com/facebook/ads/sdk/AdReportRun.java b/src/main/java/com/facebook/ads/sdk/AdReportRun.java index ec13015c..ff2b8811 100644 --- a/src/main/java/com/facebook/ads/sdk/AdReportRun.java +++ b/src/main/java/com/facebook/ads/sdk/AdReportRun.java @@ -368,7 +368,6 @@ public APINodeList getLastResponse() { "ad_id", "ad_impression_actions", "ad_name", - "adjusted_offline_purchase", "adset_end", "adset_id", "adset_name", @@ -442,6 +441,9 @@ public APINodeList getLastResponse() { "instant_experience_outbound_clicks", "interactive_component_tap", "labels", + "landing_page_view_actions_per_link_click", + "landing_page_view_per_purchase_rate", + "link_clicks_per_results", "location", "marketing_messages_cost_per_delivered", "marketing_messages_cost_per_link_btn_click", @@ -455,6 +457,7 @@ public APINodeList getLastResponse() { "outbound_clicks_ctr", "place_page_name", "purchase_roas", + "purchases_per_link_click", "qualifying_question_qualify_answer_rate", "quality_ranking", "reach", @@ -650,13 +653,6 @@ public APIRequestGetInsights requestAdNameField (boolean value) { this.requestField("ad_name", value); return this; } - public APIRequestGetInsights requestAdjustedOfflinePurchaseField () { - return this.requestAdjustedOfflinePurchaseField(true); - } - public APIRequestGetInsights requestAdjustedOfflinePurchaseField (boolean value) { - this.requestField("adjusted_offline_purchase", value); - return this; - } public APIRequestGetInsights requestAdsetEndField () { return this.requestAdsetEndField(true); } @@ -1168,6 +1164,27 @@ public APIRequestGetInsights requestLabelsField (boolean value) { this.requestField("labels", value); return this; } + public APIRequestGetInsights requestLandingPageViewActionsPerLinkClickField () { + return this.requestLandingPageViewActionsPerLinkClickField(true); + } + public APIRequestGetInsights requestLandingPageViewActionsPerLinkClickField (boolean value) { + this.requestField("landing_page_view_actions_per_link_click", value); + return this; + } + public APIRequestGetInsights requestLandingPageViewPerPurchaseRateField () { + return this.requestLandingPageViewPerPurchaseRateField(true); + } + public APIRequestGetInsights requestLandingPageViewPerPurchaseRateField (boolean value) { + this.requestField("landing_page_view_per_purchase_rate", value); + return this; + } + public APIRequestGetInsights requestLinkClicksPerResultsField () { + return this.requestLinkClicksPerResultsField(true); + } + public APIRequestGetInsights requestLinkClicksPerResultsField (boolean value) { + this.requestField("link_clicks_per_results", value); + return this; + } public APIRequestGetInsights requestLocationField () { return this.requestLocationField(true); } @@ -1259,6 +1276,13 @@ public APIRequestGetInsights requestPurchaseRoasField (boolean value) { this.requestField("purchase_roas", value); return this; } + public APIRequestGetInsights requestPurchasesPerLinkClickField () { + return this.requestPurchasesPerLinkClickField(true); + } + public APIRequestGetInsights requestPurchasesPerLinkClickField (boolean value) { + this.requestField("purchases_per_link_click", value); + return this; + } public APIRequestGetInsights requestQualifyingQuestionQualifyAnswerRateField () { return this.requestQualifyingQuestionQualifyAnswerRateField(true); } @@ -1902,6 +1926,8 @@ public static enum EnumBreakdowns { VALUE_IMPRESSION_DEVICE("impression_device"), @SerializedName("is_conversion_id_modeled") VALUE_IS_CONVERSION_ID_MODELED("is_conversion_id_modeled"), + @SerializedName("is_rendered_as_delayed_skip_ad") + VALUE_IS_RENDERED_AS_DELAYED_SKIP_AD("is_rendered_as_delayed_skip_ad"), @SerializedName("landing_destination") VALUE_LANDING_DESTINATION("landing_destination"), @SerializedName("link_url_asset") diff --git a/src/main/java/com/facebook/ads/sdk/AdRuleExecutionSpec.java b/src/main/java/com/facebook/ads/sdk/AdRuleExecutionSpec.java index 910a3878..6ccfc3ca 100644 --- a/src/main/java/com/facebook/ads/sdk/AdRuleExecutionSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdRuleExecutionSpec.java @@ -409,6 +409,8 @@ public static enum EnumExecutionType { VALUE_ADD_INTEREST_RELAXATION("ADD_INTEREST_RELAXATION"), @SerializedName("ADD_QUESTIONNAIRE_INTERESTS") VALUE_ADD_QUESTIONNAIRE_INTERESTS("ADD_QUESTIONNAIRE_INTERESTS"), + @SerializedName("AD_RECOMMENDATION_APPLY") + VALUE_AD_RECOMMENDATION_APPLY("AD_RECOMMENDATION_APPLY"), @SerializedName("AUDIENCE_CONSOLIDATION") VALUE_AUDIENCE_CONSOLIDATION("AUDIENCE_CONSOLIDATION"), @SerializedName("AUDIENCE_CONSOLIDATION_ASK_FIRST") diff --git a/src/main/java/com/facebook/ads/sdk/AdSet.java b/src/main/java/com/facebook/ads/sdk/AdSet.java index a11f7643..b8d31520 100644 --- a/src/main/java/com/facebook/ads/sdk/AdSet.java +++ b/src/main/java/com/facebook/ads/sdk/AdSet.java @@ -63,6 +63,8 @@ public class AdSet extends APINode { private EnumBidStrategy mBidStrategy = null; @SerializedName("billing_event") private EnumBillingEvent mBillingEvent = null; + @SerializedName("brand_safety_config") + private BrandSafetyCampaignConfig mBrandSafetyConfig = null; @SerializedName("budget_remaining") private String mBudgetRemaining = null; @SerializedName("campaign") @@ -430,6 +432,10 @@ public APIRequestGetInsightsAsync getInsightsAsync() { return new APIRequestGetInsightsAsync(this.getPrefixedId().toString(), context); } + public APIRequestGetMessageDeliveryEstimate getMessageDeliveryEstimate() { + return new APIRequestGetMessageDeliveryEstimate(this.getPrefixedId().toString(), context); + } + public APIRequestGetTargetingSentenceLines getTargetingSentenceLines() { return new APIRequestGetTargetingSentenceLines(this.getPrefixedId().toString(), context); } @@ -571,6 +577,20 @@ public AdSet setFieldBillingEvent(EnumBillingEvent value) { return this; } + public BrandSafetyCampaignConfig getFieldBrandSafetyConfig() { + return mBrandSafetyConfig; + } + + public AdSet setFieldBrandSafetyConfig(BrandSafetyCampaignConfig value) { + this.mBrandSafetyConfig = value; + return this; + } + + public AdSet setFieldBrandSafetyConfig(String value) { + Type type = new TypeToken(){}.getType(); + this.mBrandSafetyConfig = BrandSafetyCampaignConfig.getGson().fromJson(value, type); + return this; + } public String getFieldBudgetRemaining() { return mBudgetRemaining; } @@ -3480,6 +3500,7 @@ public APINodeList getLastResponse() { "bid_info", "bid_strategy", "billing_event", + "brand_safety_config", "budget_remaining", "campaign", "campaign_active_time", @@ -3736,6 +3757,13 @@ public APIRequestGetCopies requestBillingEventField (boolean value) { this.requestField("billing_event", value); return this; } + public APIRequestGetCopies requestBrandSafetyConfigField () { + return this.requestBrandSafetyConfigField(true); + } + public APIRequestGetCopies requestBrandSafetyConfigField (boolean value) { + this.requestField("brand_safety_config", value); + return this; + } public APIRequestGetCopies requestBudgetRemainingField () { return this.requestBudgetRemainingField(true); } @@ -5047,6 +5075,253 @@ public APIRequestGetInsightsAsync requestField (String field, boolean value) { } + public static class APIRequestGetMessageDeliveryEstimate extends APIRequest { + + APINodeList lastResponse = null; + @Override + public APINodeList getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "bid_amount", + "lifetime_budget", + "lifetime_in_days", + "optimization_goal", + "pacing_type", + "promoted_object", + "targeting_spec", + }; + + public static final String[] FIELDS = { + "estimate_cost", + "estimate_cost_lower_bound", + "estimate_cost_upper_bound", + "estimate_coverage_lower_bound", + "estimate_coverage_upper_bound", + "estimate_delivery", + "estimate_delivery_lower_bound", + "estimate_delivery_upper_bound", + "estimate_status", + }; + + @Override + public APINodeList parseResponse(String response, String header) throws APIException { + return MessageDeliveryEstimate.parseResponse(response, getContext(), this, header); + } + + @Override + public APINodeList execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + try { + return APIRequestGetMessageDeliveryEstimate.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestGetMessageDeliveryEstimate(String nodeId, APIContext context) { + super(context, nodeId, "/message_delivery_estimate", "GET", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestGetMessageDeliveryEstimate setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestGetMessageDeliveryEstimate setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestGetMessageDeliveryEstimate setBidAmount (Long bidAmount) { + this.setParam("bid_amount", bidAmount); + return this; + } + public APIRequestGetMessageDeliveryEstimate setBidAmount (String bidAmount) { + this.setParam("bid_amount", bidAmount); + return this; + } + + public APIRequestGetMessageDeliveryEstimate setLifetimeBudget (Long lifetimeBudget) { + this.setParam("lifetime_budget", lifetimeBudget); + return this; + } + public APIRequestGetMessageDeliveryEstimate setLifetimeBudget (String lifetimeBudget) { + this.setParam("lifetime_budget", lifetimeBudget); + return this; + } + + public APIRequestGetMessageDeliveryEstimate setLifetimeInDays (Long lifetimeInDays) { + this.setParam("lifetime_in_days", lifetimeInDays); + return this; + } + public APIRequestGetMessageDeliveryEstimate setLifetimeInDays (String lifetimeInDays) { + this.setParam("lifetime_in_days", lifetimeInDays); + return this; + } + + public APIRequestGetMessageDeliveryEstimate setOptimizationGoal (MessageDeliveryEstimate.EnumOptimizationGoal optimizationGoal) { + this.setParam("optimization_goal", optimizationGoal); + return this; + } + public APIRequestGetMessageDeliveryEstimate setOptimizationGoal (String optimizationGoal) { + this.setParam("optimization_goal", optimizationGoal); + return this; + } + + public APIRequestGetMessageDeliveryEstimate setPacingType (MessageDeliveryEstimate.EnumPacingType pacingType) { + this.setParam("pacing_type", pacingType); + return this; + } + public APIRequestGetMessageDeliveryEstimate setPacingType (String pacingType) { + this.setParam("pacing_type", pacingType); + return this; + } + + public APIRequestGetMessageDeliveryEstimate setPromotedObject (Object promotedObject) { + this.setParam("promoted_object", promotedObject); + return this; + } + public APIRequestGetMessageDeliveryEstimate setPromotedObject (String promotedObject) { + this.setParam("promoted_object", promotedObject); + return this; + } + + public APIRequestGetMessageDeliveryEstimate setTargetingSpec (Targeting targetingSpec) { + this.setParam("targeting_spec", targetingSpec); + return this; + } + public APIRequestGetMessageDeliveryEstimate setTargetingSpec (String targetingSpec) { + this.setParam("targeting_spec", targetingSpec); + return this; + } + + public APIRequestGetMessageDeliveryEstimate requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestGetMessageDeliveryEstimate requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetMessageDeliveryEstimate requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestGetMessageDeliveryEstimate requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetMessageDeliveryEstimate requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestGetMessageDeliveryEstimate requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + public APIRequestGetMessageDeliveryEstimate requestEstimateCostField () { + return this.requestEstimateCostField(true); + } + public APIRequestGetMessageDeliveryEstimate requestEstimateCostField (boolean value) { + this.requestField("estimate_cost", value); + return this; + } + public APIRequestGetMessageDeliveryEstimate requestEstimateCostLowerBoundField () { + return this.requestEstimateCostLowerBoundField(true); + } + public APIRequestGetMessageDeliveryEstimate requestEstimateCostLowerBoundField (boolean value) { + this.requestField("estimate_cost_lower_bound", value); + return this; + } + public APIRequestGetMessageDeliveryEstimate requestEstimateCostUpperBoundField () { + return this.requestEstimateCostUpperBoundField(true); + } + public APIRequestGetMessageDeliveryEstimate requestEstimateCostUpperBoundField (boolean value) { + this.requestField("estimate_cost_upper_bound", value); + return this; + } + public APIRequestGetMessageDeliveryEstimate requestEstimateCoverageLowerBoundField () { + return this.requestEstimateCoverageLowerBoundField(true); + } + public APIRequestGetMessageDeliveryEstimate requestEstimateCoverageLowerBoundField (boolean value) { + this.requestField("estimate_coverage_lower_bound", value); + return this; + } + public APIRequestGetMessageDeliveryEstimate requestEstimateCoverageUpperBoundField () { + return this.requestEstimateCoverageUpperBoundField(true); + } + public APIRequestGetMessageDeliveryEstimate requestEstimateCoverageUpperBoundField (boolean value) { + this.requestField("estimate_coverage_upper_bound", value); + return this; + } + public APIRequestGetMessageDeliveryEstimate requestEstimateDeliveryField () { + return this.requestEstimateDeliveryField(true); + } + public APIRequestGetMessageDeliveryEstimate requestEstimateDeliveryField (boolean value) { + this.requestField("estimate_delivery", value); + return this; + } + public APIRequestGetMessageDeliveryEstimate requestEstimateDeliveryLowerBoundField () { + return this.requestEstimateDeliveryLowerBoundField(true); + } + public APIRequestGetMessageDeliveryEstimate requestEstimateDeliveryLowerBoundField (boolean value) { + this.requestField("estimate_delivery_lower_bound", value); + return this; + } + public APIRequestGetMessageDeliveryEstimate requestEstimateDeliveryUpperBoundField () { + return this.requestEstimateDeliveryUpperBoundField(true); + } + public APIRequestGetMessageDeliveryEstimate requestEstimateDeliveryUpperBoundField (boolean value) { + this.requestField("estimate_delivery_upper_bound", value); + return this; + } + public APIRequestGetMessageDeliveryEstimate requestEstimateStatusField () { + return this.requestEstimateStatusField(true); + } + public APIRequestGetMessageDeliveryEstimate requestEstimateStatusField (boolean value) { + this.requestField("estimate_status", value); + return this; + } + } + public static class APIRequestGetTargetingSentenceLines extends APIRequest { APINodeList lastResponse = null; @@ -5307,6 +5582,7 @@ public AdSet getLastResponse() { "bid_info", "bid_strategy", "billing_event", + "brand_safety_config", "budget_remaining", "campaign", "campaign_active_time", @@ -5563,6 +5839,13 @@ public APIRequestGet requestBillingEventField (boolean value) { this.requestField("billing_event", value); return this; } + public APIRequestGet requestBrandSafetyConfigField () { + return this.requestBrandSafetyConfigField(true); + } + public APIRequestGet requestBrandSafetyConfigField (boolean value) { + this.requestField("brand_safety_config", value); + return this; + } public APIRequestGet requestBudgetRemainingField () { return this.requestBudgetRemainingField(true); } @@ -6711,10 +6994,14 @@ public static enum EnumDestinationType { VALUE_APPLINKS_AUTOMATIC("APPLINKS_AUTOMATIC"), @SerializedName("FACEBOOK") VALUE_FACEBOOK("FACEBOOK"), + @SerializedName("FACEBOOK_PAGE") + VALUE_FACEBOOK_PAGE("FACEBOOK_PAGE"), @SerializedName("INSTAGRAM_DIRECT") VALUE_INSTAGRAM_DIRECT("INSTAGRAM_DIRECT"), @SerializedName("INSTAGRAM_PROFILE") VALUE_INSTAGRAM_PROFILE("INSTAGRAM_PROFILE"), + @SerializedName("INSTAGRAM_PROFILE_AND_FACEBOOK_PAGE") + VALUE_INSTAGRAM_PROFILE_AND_FACEBOOK_PAGE("INSTAGRAM_PROFILE_AND_FACEBOOK_PAGE"), @SerializedName("MESSAGING_INSTAGRAM_DIRECT_MESSENGER") VALUE_MESSAGING_INSTAGRAM_DIRECT_MESSENGER("MESSAGING_INSTAGRAM_DIRECT_MESSENGER"), @SerializedName("MESSAGING_INSTAGRAM_DIRECT_MESSENGER_WHATSAPP") @@ -6965,6 +7252,7 @@ public AdSet copyFrom(AdSet instance) { this.mBidInfo = instance.mBidInfo; this.mBidStrategy = instance.mBidStrategy; this.mBillingEvent = instance.mBillingEvent; + this.mBrandSafetyConfig = instance.mBrandSafetyConfig; this.mBudgetRemaining = instance.mBudgetRemaining; this.mCampaign = instance.mCampaign; this.mCampaignActiveTime = instance.mCampaignActiveTime; diff --git a/src/main/java/com/facebook/ads/sdk/AdStudyCell.java b/src/main/java/com/facebook/ads/sdk/AdStudyCell.java index 94b9a9c6..383fe87c 100644 --- a/src/main/java/com/facebook/ads/sdk/AdStudyCell.java +++ b/src/main/java/com/facebook/ads/sdk/AdStudyCell.java @@ -990,6 +990,7 @@ public APINodeList getLastResponse() { "bid_info", "bid_strategy", "billing_event", + "brand_safety_config", "budget_remaining", "campaign", "campaign_active_time", @@ -1210,6 +1211,13 @@ public APIRequestGetAdSets requestBillingEventField (boolean value) { this.requestField("billing_event", value); return this; } + public APIRequestGetAdSets requestBrandSafetyConfigField () { + return this.requestBrandSafetyConfigField(true); + } + public APIRequestGetAdSets requestBrandSafetyConfigField (boolean value) { + this.requestField("brand_safety_config", value); + return this; + } public APIRequestGetAdSets requestBudgetRemainingField () { return this.requestBudgetRemainingField(true); } @@ -1611,6 +1619,7 @@ public APINodeList getLastResponse() { "smart_promotion_type", "source_campaign", "source_campaign_id", + "source_recommendation_type", "special_ad_categories", "special_ad_category", "special_ad_category_country", @@ -1929,6 +1938,13 @@ public APIRequestGetCampaigns requestSourceCampaignIdField (boolean value) { this.requestField("source_campaign_id", value); return this; } + public APIRequestGetCampaigns requestSourceRecommendationTypeField () { + return this.requestSourceRecommendationTypeField(true); + } + public APIRequestGetCampaigns requestSourceRecommendationTypeField (boolean value) { + this.requestField("source_recommendation_type", value); + return this; + } public APIRequestGetCampaigns requestSpecialAdCategoriesField () { return this.requestSpecialAdCategoriesField(true); } diff --git a/src/main/java/com/facebook/ads/sdk/AdVideo.java b/src/main/java/com/facebook/ads/sdk/AdVideo.java index 06037fe5..d2487683 100644 --- a/src/main/java/com/facebook/ads/sdk/AdVideo.java +++ b/src/main/java/com/facebook/ads/sdk/AdVideo.java @@ -402,10 +402,6 @@ public APIRequestGetTags getTags() { return new APIRequestGetTags(this.getPrefixedId().toString(), context); } - public APIRequestCreateTag createTag() { - return new APIRequestCreateTag(this.getPrefixedId().toString(), context); - } - public APIRequestGetThumbnails getThumbnails() { return new APIRequestGetThumbnails(this.getPrefixedId().toString(), context); } @@ -5236,137 +5232,6 @@ public APIRequestGetTags requestNameField (boolean value) { } } - public static class APIRequestCreateTag extends APIRequest { - - AdVideo lastResponse = null; - @Override - public AdVideo getLastResponse() { - return lastResponse; - } - public static final String[] PARAMS = { - "tag_uid", - "uid", - "vid", - }; - - public static final String[] FIELDS = { - }; - - @Override - public AdVideo parseResponse(String response, String header) throws APIException { - return AdVideo.parseResponse(response, getContext(), this, header).head(); - } - - @Override - public AdVideo execute() throws APIException { - return execute(new HashMap()); - } - - @Override - public AdVideo 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 AdVideo apply(ResponseWrapper result) { - try { - return APIRequestCreateTag.this.parseResponse(result.getBody(), result.getHeader()); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - }, - MoreExecutors.directExecutor() - ); - }; - - public APIRequestCreateTag(String nodeId, APIContext context) { - super(context, nodeId, "/tags", "POST", Arrays.asList(PARAMS)); - } - - @Override - public APIRequestCreateTag setParam(String param, Object value) { - setParamInternal(param, value); - return this; - } - - @Override - public APIRequestCreateTag setParams(Map params) { - setParamsInternal(params); - return this; - } - - - public APIRequestCreateTag setTagUid (Long tagUid) { - this.setParam("tag_uid", tagUid); - return this; - } - public APIRequestCreateTag setTagUid (String tagUid) { - this.setParam("tag_uid", tagUid); - return this; - } - - public APIRequestCreateTag setUid (Long uid) { - this.setParam("uid", uid); - return this; - } - public APIRequestCreateTag setUid (String uid) { - this.setParam("uid", uid); - return this; - } - - public APIRequestCreateTag setVid (String vid) { - this.setParam("vid", vid); - return this; - } - - public APIRequestCreateTag requestAllFields () { - return this.requestAllFields(true); - } - - public APIRequestCreateTag requestAllFields (boolean value) { - for (String field : FIELDS) { - this.requestField(field, value); - } - return this; - } - - @Override - public APIRequestCreateTag requestFields (List fields) { - return this.requestFields(fields, true); - } - - @Override - public APIRequestCreateTag requestFields (List fields, boolean value) { - for (String field : fields) { - this.requestField(field, value); - } - return this; - } - - @Override - public APIRequestCreateTag requestField (String field) { - this.requestField(field, true); - return this; - } - - @Override - public APIRequestCreateTag requestField (String field, boolean value) { - this.requestFieldInternal(field, value); - return this; - } - - } - public static class APIRequestGetThumbnails extends APIRequest { APINodeList lastResponse = null; @@ -6836,6 +6701,8 @@ public static enum EnumContainerType { VALUE_COPYRIGHT_REFERENCE_VIDEO("COPYRIGHT_REFERENCE_VIDEO"), @SerializedName("CREATION_ML_PRECREATION") VALUE_CREATION_ML_PRECREATION("CREATION_ML_PRECREATION"), + @SerializedName("CREATOR_STOREFRONT_PERSONALIZED_VIDEO") + VALUE_CREATOR_STOREFRONT_PERSONALIZED_VIDEO("CREATOR_STOREFRONT_PERSONALIZED_VIDEO"), @SerializedName("DATAGENIX_VIDEO") VALUE_DATAGENIX_VIDEO("DATAGENIX_VIDEO"), @SerializedName("DCO_AD_ASSET_FEED") @@ -7002,6 +6869,8 @@ public static enum EnumContainerType { VALUE_OCULUS_VENUES_BROADCAST("OCULUS_VENUES_BROADCAST"), @SerializedName("OFFERS_VIDEO") VALUE_OFFERS_VIDEO("OFFERS_VIDEO"), + @SerializedName("ORIGINALITY_SELF_ADVOCACY") + VALUE_ORIGINALITY_SELF_ADVOCACY("ORIGINALITY_SELF_ADVOCACY"), @SerializedName("PAGES_COVER_VIDEO") VALUE_PAGES_COVER_VIDEO("PAGES_COVER_VIDEO"), @SerializedName("PAGE_REVIEW_SCREENCAST") diff --git a/src/main/java/com/facebook/ads/sdk/AdjacentContentDeliveryReport.java b/src/main/java/com/facebook/ads/sdk/AdjacentContentDeliveryReport.java index 137985df..e16af890 100644 --- a/src/main/java/com/facebook/ads/sdk/AdjacentContentDeliveryReport.java +++ b/src/main/java/com/facebook/ads/sdk/AdjacentContentDeliveryReport.java @@ -41,8 +41,12 @@ * */ public class AdjacentContentDeliveryReport extends APINode { + @SerializedName("ad_id") + private String mAdId = null; @SerializedName("content") private List mContent = null; + @SerializedName("impression_id") + private String mImpressionId = null; protected static Gson gson = null; public AdjacentContentDeliveryReport() { @@ -194,6 +198,15 @@ public String toString() { } + public String getFieldAdId() { + return mAdId; + } + + public AdjacentContentDeliveryReport setFieldAdId(String value) { + this.mAdId = value; + return this; + } + public List getFieldContent() { return mContent; } @@ -203,6 +216,15 @@ public AdjacentContentDeliveryReport setFieldContent(List value) { return this; } + public String getFieldImpressionId() { + return mImpressionId; + } + + public AdjacentContentDeliveryReport setFieldImpressionId(String value) { + this.mImpressionId = value; + return this; + } + @@ -220,7 +242,9 @@ public AdjacentContentDeliveryReport setFieldContent(List value) { } public AdjacentContentDeliveryReport copyFrom(AdjacentContentDeliveryReport instance) { + this.mAdId = instance.mAdId; this.mContent = instance.mContent; + this.mImpressionId = instance.mImpressionId; this.context = instance.context; this.rawValue = instance.rawValue; return this; diff --git a/src/main/java/com/facebook/ads/sdk/AdoptablePet.java b/src/main/java/com/facebook/ads/sdk/AdoptablePet.java deleted file mode 100644 index f3308508..00000000 --- a/src/main/java/com/facebook/ads/sdk/AdoptablePet.java +++ /dev/null @@ -1,1347 +0,0 @@ -/* - * 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 AdoptablePet extends APINode { - @SerializedName("adoptable_pet_id") - private String mAdoptablePetId = null; - @SerializedName("adoption_application_form_url") - private String mAdoptionApplicationFormUrl = null; - @SerializedName("age_bucket") - private String mAgeBucket = null; - @SerializedName("animal_type") - private String mAnimalType = null; - @SerializedName("applinks") - private CatalogItemAppLinks mApplinks = null; - @SerializedName("availability") - private String mAvailability = null; - @SerializedName("breed") - private String mBreed = null; - @SerializedName("category_specific_fields") - private CatalogSubVerticalList mCategorySpecificFields = null; - @SerializedName("coat_length") - private String mCoatLength = null; - @SerializedName("color") - private String mColor = null; - @SerializedName("currency") - private String mCurrency = null; - @SerializedName("description") - private String mDescription = null; - @SerializedName("features") - private List mFeatures = null; - @SerializedName("gender") - private String mGender = null; - @SerializedName("id") - private String mId = null; - @SerializedName("image_fetch_status") - private EnumImageFetchStatus mImageFetchStatus = null; - @SerializedName("images") - private List mImages = null; - @SerializedName("name") - private String mName = null; - @SerializedName("price") - private String mPrice = null; - @SerializedName("sanitized_images") - private List mSanitizedImages = null; - @SerializedName("secondary_color") - private String mSecondaryColor = null; - @SerializedName("shelter_email") - private String mShelterEmail = null; - @SerializedName("shelter_name") - private String mShelterName = null; - @SerializedName("shelter_page_id") - private Page mShelterPageId = null; - @SerializedName("shelter_phone") - private String mShelterPhone = null; - @SerializedName("size") - private String mSize = null; - @SerializedName("tertiary_color") - private String mTertiaryColor = null; - @SerializedName("url") - private String mUrl = null; - @SerializedName("visibility") - private EnumVisibility mVisibility = null; - protected static Gson gson = null; - - AdoptablePet() { - } - - public AdoptablePet(Long id, APIContext context) { - this(id.toString(), context); - } - - public AdoptablePet(String id, APIContext context) { - this.mId = id; - - this.context = context; - } - - public AdoptablePet fetch() throws APIException{ - AdoptablePet newInstance = fetchById(this.getPrefixedId().toString(), this.context); - this.copyFrom(newInstance); - return this; - } - - public static AdoptablePet 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 AdoptablePet 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", AdoptablePet.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", AdoptablePet.getParser()) - .setParam("ids", APIRequest.joinStringList(ids)) - .requestFields(fields) - .executeAsyncBase(); - } - - private String getPrefixedId() { - return getId(); - } - - public String getId() { - return getFieldId().toString(); - } - public static AdoptablePet loadJSON(String json, APIContext context, String header) { - AdoptablePet adoptablePet = getGson().fromJson(json, AdoptablePet.class); - if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adoptablePet.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); - } - } - adoptablePet.context = context; - adoptablePet.rawValue = json; - adoptablePet.header = header; - return adoptablePet; - } - - public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { - APINodeList adoptablePets = 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++) { - adoptablePets.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); - }; - return adoptablePets; - } 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; - adoptablePets.setCursors(before, after); - } - String previous = paging.has("previous") ? paging.get("previous").getAsString() : null; - String next = paging.has("next") ? paging.get("next").getAsString() : null; - adoptablePets.setPaging(previous, next); - if (context.hasAppSecret()) { - adoptablePets.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++) { - adoptablePets.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()) { - adoptablePets.add(loadJSON(entry.getValue().toString(), context, header)); - } - break; - } - } - if (!isRedownload) { - adoptablePets.add(loadJSON(obj.toString(), context, header)); - } - } - return adoptablePets; - } 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()) { - adoptablePets.add(loadJSON(entry.getValue().toString(), context, header)); - } - return adoptablePets; - } 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) - ) { - adoptablePets.add(loadJSON(value.toString(), context, header)); - } else { - isIdIndexedArray = false; - break; - } - } - if (isIdIndexedArray) { - return adoptablePets; - } - - // Sixth, check if it's pure JsonObject - adoptablePets.clear(); - adoptablePets.add(loadJSON(json, context, header)); - return adoptablePets; - } - } - } 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 APIRequestGetAugmentedRealitiesMetadata getAugmentedRealitiesMetadata() { - return new APIRequestGetAugmentedRealitiesMetadata(this.getPrefixedId().toString(), context); - } - - public APIRequestGetChannelsToIntegrityStatus getChannelsToIntegrityStatus() { - return new APIRequestGetChannelsToIntegrityStatus(this.getPrefixedId().toString(), context); - } - - public APIRequestGetVideosMetadata getVideosMetadata() { - return new APIRequestGetVideosMetadata(this.getPrefixedId().toString(), context); - } - - public APIRequestGet get() { - return new APIRequestGet(this.getPrefixedId().toString(), context); - } - - - public String getFieldAdoptablePetId() { - return mAdoptablePetId; - } - - public String getFieldAdoptionApplicationFormUrl() { - return mAdoptionApplicationFormUrl; - } - - public String getFieldAgeBucket() { - return mAgeBucket; - } - - public String getFieldAnimalType() { - return mAnimalType; - } - - public CatalogItemAppLinks getFieldApplinks() { - return mApplinks; - } - - public String getFieldAvailability() { - return mAvailability; - } - - public String getFieldBreed() { - return mBreed; - } - - public CatalogSubVerticalList getFieldCategorySpecificFields() { - return mCategorySpecificFields; - } - - public String getFieldCoatLength() { - return mCoatLength; - } - - public String getFieldColor() { - return mColor; - } - - public String getFieldCurrency() { - return mCurrency; - } - - public String getFieldDescription() { - return mDescription; - } - - public List getFieldFeatures() { - return mFeatures; - } - - public String getFieldGender() { - return mGender; - } - - public String getFieldId() { - return mId; - } - - public EnumImageFetchStatus getFieldImageFetchStatus() { - return mImageFetchStatus; - } - - public List getFieldImages() { - return mImages; - } - - public String getFieldName() { - return mName; - } - - public String getFieldPrice() { - return mPrice; - } - - public List getFieldSanitizedImages() { - return mSanitizedImages; - } - - public String getFieldSecondaryColor() { - return mSecondaryColor; - } - - public String getFieldShelterEmail() { - return mShelterEmail; - } - - public String getFieldShelterName() { - return mShelterName; - } - - public Page getFieldShelterPageId() { - if (mShelterPageId != null) { - mShelterPageId.context = getContext(); - } - return mShelterPageId; - } - - public String getFieldShelterPhone() { - return mShelterPhone; - } - - public String getFieldSize() { - return mSize; - } - - public String getFieldTertiaryColor() { - return mTertiaryColor; - } - - public String getFieldUrl() { - return mUrl; - } - - public EnumVisibility getFieldVisibility() { - return mVisibility; - } - - - - public static class APIRequestGetAugmentedRealitiesMetadata extends APIRequest { - - APINodeList lastResponse = null; - @Override - public APINodeList getLastResponse() { - return lastResponse; - } - public static final String[] PARAMS = { - }; - - public static final String[] FIELDS = { - "anchor_point", - "container_effect_enum", - "effect_icon_url", - "effect_id", - "id", - "platforms", - "scale_factor", - "shadow_texture_url", - "source_url", - "state", - "tags", - "variant_picker_url", - }; - - @Override - public APINodeList parseResponse(String response, String header) throws APIException { - return DynamicARMetadata.parseResponse(response, getContext(), this, header); - } - - @Override - public APINodeList execute() throws APIException { - return execute(new HashMap()); - } - - @Override - public APINodeList 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 APINodeList apply(ResponseWrapper result) { - try { - return APIRequestGetAugmentedRealitiesMetadata.this.parseResponse(result.getBody(), result.getHeader()); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - }, - MoreExecutors.directExecutor() - ); - }; - - public APIRequestGetAugmentedRealitiesMetadata(String nodeId, APIContext context) { - super(context, nodeId, "/augmented_realities_metadata", "GET", Arrays.asList(PARAMS)); - } - - @Override - public APIRequestGetAugmentedRealitiesMetadata setParam(String param, Object value) { - setParamInternal(param, value); - return this; - } - - @Override - public APIRequestGetAugmentedRealitiesMetadata setParams(Map params) { - setParamsInternal(params); - return this; - } - - - public APIRequestGetAugmentedRealitiesMetadata requestAllFields () { - return this.requestAllFields(true); - } - - public APIRequestGetAugmentedRealitiesMetadata requestAllFields (boolean value) { - for (String field : FIELDS) { - this.requestField(field, value); - } - return this; - } - - @Override - public APIRequestGetAugmentedRealitiesMetadata requestFields (List fields) { - return this.requestFields(fields, true); - } - - @Override - public APIRequestGetAugmentedRealitiesMetadata requestFields (List fields, boolean value) { - for (String field : fields) { - this.requestField(field, value); - } - return this; - } - - @Override - public APIRequestGetAugmentedRealitiesMetadata requestField (String field) { - this.requestField(field, true); - return this; - } - - @Override - public APIRequestGetAugmentedRealitiesMetadata requestField (String field, boolean value) { - this.requestFieldInternal(field, value); - return this; - } - - public APIRequestGetAugmentedRealitiesMetadata requestAnchorPointField () { - return this.requestAnchorPointField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestAnchorPointField (boolean value) { - this.requestField("anchor_point", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestContainerEffectEnumField () { - return this.requestContainerEffectEnumField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestContainerEffectEnumField (boolean value) { - this.requestField("container_effect_enum", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIconUrlField () { - return this.requestEffectIconUrlField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIconUrlField (boolean value) { - this.requestField("effect_icon_url", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIdField () { - return this.requestEffectIdField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIdField (boolean value) { - this.requestField("effect_id", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestIdField () { - return this.requestIdField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestIdField (boolean value) { - this.requestField("id", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestPlatformsField () { - return this.requestPlatformsField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestPlatformsField (boolean value) { - this.requestField("platforms", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestScaleFactorField () { - return this.requestScaleFactorField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestScaleFactorField (boolean value) { - this.requestField("scale_factor", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestShadowTextureUrlField () { - return this.requestShadowTextureUrlField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestShadowTextureUrlField (boolean value) { - this.requestField("shadow_texture_url", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestSourceUrlField () { - return this.requestSourceUrlField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestSourceUrlField (boolean value) { - this.requestField("source_url", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestStateField () { - return this.requestStateField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestStateField (boolean value) { - this.requestField("state", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestTagsField () { - return this.requestTagsField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestTagsField (boolean value) { - this.requestField("tags", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestVariantPickerUrlField () { - return this.requestVariantPickerUrlField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestVariantPickerUrlField (boolean value) { - this.requestField("variant_picker_url", value); - return this; - } - } - - public static class APIRequestGetChannelsToIntegrityStatus extends APIRequest { - - APINodeList lastResponse = null; - @Override - public APINodeList getLastResponse() { - return lastResponse; - } - public static final String[] PARAMS = { - }; - - public static final String[] FIELDS = { - "channels", - "rejection_information", - }; - - @Override - public APINodeList parseResponse(String response, String header) throws APIException { - return CatalogItemChannelsToIntegrityStatus.parseResponse(response, getContext(), this, header); - } - - @Override - public APINodeList execute() throws APIException { - return execute(new HashMap()); - } - - @Override - public APINodeList 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 APINodeList apply(ResponseWrapper result) { - try { - return APIRequestGetChannelsToIntegrityStatus.this.parseResponse(result.getBody(), result.getHeader()); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - }, - MoreExecutors.directExecutor() - ); - }; - - public APIRequestGetChannelsToIntegrityStatus(String nodeId, APIContext context) { - super(context, nodeId, "/channels_to_integrity_status", "GET", Arrays.asList(PARAMS)); - } - - @Override - public APIRequestGetChannelsToIntegrityStatus setParam(String param, Object value) { - setParamInternal(param, value); - return this; - } - - @Override - public APIRequestGetChannelsToIntegrityStatus setParams(Map params) { - setParamsInternal(params); - return this; - } - - - public APIRequestGetChannelsToIntegrityStatus requestAllFields () { - return this.requestAllFields(true); - } - - public APIRequestGetChannelsToIntegrityStatus requestAllFields (boolean value) { - for (String field : FIELDS) { - this.requestField(field, value); - } - return this; - } - - @Override - public APIRequestGetChannelsToIntegrityStatus requestFields (List fields) { - return this.requestFields(fields, true); - } - - @Override - public APIRequestGetChannelsToIntegrityStatus requestFields (List fields, boolean value) { - for (String field : fields) { - this.requestField(field, value); - } - return this; - } - - @Override - public APIRequestGetChannelsToIntegrityStatus requestField (String field) { - this.requestField(field, true); - return this; - } - - @Override - public APIRequestGetChannelsToIntegrityStatus requestField (String field, boolean value) { - this.requestFieldInternal(field, value); - return this; - } - - public APIRequestGetChannelsToIntegrityStatus requestChannelsField () { - return this.requestChannelsField(true); - } - public APIRequestGetChannelsToIntegrityStatus requestChannelsField (boolean value) { - this.requestField("channels", value); - return this; - } - public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField () { - return this.requestRejectionInformationField(true); - } - public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField (boolean value) { - this.requestField("rejection_information", value); - return this; - } - } - - public static class APIRequestGetVideosMetadata extends APIRequest { - - APINodeList lastResponse = null; - @Override - public APINodeList getLastResponse() { - return lastResponse; - } - public static final String[] PARAMS = { - }; - - public static final String[] FIELDS = { - "id", - "tags", - "url", - "video", - }; - - @Override - public APINodeList parseResponse(String response, String header) throws APIException { - return DynamicVideoMetadata.parseResponse(response, getContext(), this, header); - } - - @Override - public APINodeList execute() throws APIException { - return execute(new HashMap()); - } - - @Override - public APINodeList 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 APINodeList apply(ResponseWrapper result) { - try { - return APIRequestGetVideosMetadata.this.parseResponse(result.getBody(), result.getHeader()); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - }, - MoreExecutors.directExecutor() - ); - }; - - public APIRequestGetVideosMetadata(String nodeId, APIContext context) { - super(context, nodeId, "/videos_metadata", "GET", Arrays.asList(PARAMS)); - } - - @Override - public APIRequestGetVideosMetadata setParam(String param, Object value) { - setParamInternal(param, value); - return this; - } - - @Override - public APIRequestGetVideosMetadata setParams(Map params) { - setParamsInternal(params); - return this; - } - - - public APIRequestGetVideosMetadata requestAllFields () { - return this.requestAllFields(true); - } - - public APIRequestGetVideosMetadata requestAllFields (boolean value) { - for (String field : FIELDS) { - this.requestField(field, value); - } - return this; - } - - @Override - public APIRequestGetVideosMetadata requestFields (List fields) { - return this.requestFields(fields, true); - } - - @Override - public APIRequestGetVideosMetadata requestFields (List fields, boolean value) { - for (String field : fields) { - this.requestField(field, value); - } - return this; - } - - @Override - public APIRequestGetVideosMetadata requestField (String field) { - this.requestField(field, true); - return this; - } - - @Override - public APIRequestGetVideosMetadata requestField (String field, boolean value) { - this.requestFieldInternal(field, value); - return this; - } - - public APIRequestGetVideosMetadata requestIdField () { - return this.requestIdField(true); - } - public APIRequestGetVideosMetadata requestIdField (boolean value) { - this.requestField("id", value); - return this; - } - public APIRequestGetVideosMetadata requestTagsField () { - return this.requestTagsField(true); - } - public APIRequestGetVideosMetadata requestTagsField (boolean value) { - this.requestField("tags", value); - return this; - } - public APIRequestGetVideosMetadata requestUrlField () { - return this.requestUrlField(true); - } - public APIRequestGetVideosMetadata requestUrlField (boolean value) { - this.requestField("url", value); - return this; - } - public APIRequestGetVideosMetadata requestVideoField () { - return this.requestVideoField(true); - } - public APIRequestGetVideosMetadata requestVideoField (boolean value) { - this.requestField("video", value); - return this; - } - } - - public static class APIRequestGet extends APIRequest { - - AdoptablePet lastResponse = null; - @Override - public AdoptablePet getLastResponse() { - return lastResponse; - } - public static final String[] PARAMS = { - }; - - public static final String[] FIELDS = { - "adoptable_pet_id", - "adoption_application_form_url", - "age_bucket", - "animal_type", - "applinks", - "availability", - "breed", - "category_specific_fields", - "coat_length", - "color", - "currency", - "description", - "features", - "gender", - "id", - "image_fetch_status", - "images", - "name", - "price", - "sanitized_images", - "secondary_color", - "shelter_email", - "shelter_name", - "shelter_page_id", - "shelter_phone", - "size", - "tertiary_color", - "url", - "visibility", - }; - - @Override - public AdoptablePet parseResponse(String response, String header) throws APIException { - return AdoptablePet.parseResponse(response, getContext(), this, header).head(); - } - - @Override - public AdoptablePet execute() throws APIException { - return execute(new HashMap()); - } - - @Override - public AdoptablePet 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 AdoptablePet 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 requestAdoptablePetIdField () { - return this.requestAdoptablePetIdField(true); - } - public APIRequestGet requestAdoptablePetIdField (boolean value) { - this.requestField("adoptable_pet_id", value); - return this; - } - public APIRequestGet requestAdoptionApplicationFormUrlField () { - return this.requestAdoptionApplicationFormUrlField(true); - } - public APIRequestGet requestAdoptionApplicationFormUrlField (boolean value) { - this.requestField("adoption_application_form_url", value); - return this; - } - public APIRequestGet requestAgeBucketField () { - return this.requestAgeBucketField(true); - } - public APIRequestGet requestAgeBucketField (boolean value) { - this.requestField("age_bucket", value); - return this; - } - public APIRequestGet requestAnimalTypeField () { - return this.requestAnimalTypeField(true); - } - public APIRequestGet requestAnimalTypeField (boolean value) { - this.requestField("animal_type", value); - return this; - } - public APIRequestGet requestApplinksField () { - return this.requestApplinksField(true); - } - public APIRequestGet requestApplinksField (boolean value) { - this.requestField("applinks", value); - return this; - } - public APIRequestGet requestAvailabilityField () { - return this.requestAvailabilityField(true); - } - public APIRequestGet requestAvailabilityField (boolean value) { - this.requestField("availability", value); - return this; - } - public APIRequestGet requestBreedField () { - return this.requestBreedField(true); - } - public APIRequestGet requestBreedField (boolean value) { - this.requestField("breed", value); - return this; - } - public APIRequestGet requestCategorySpecificFieldsField () { - return this.requestCategorySpecificFieldsField(true); - } - public APIRequestGet requestCategorySpecificFieldsField (boolean value) { - this.requestField("category_specific_fields", value); - return this; - } - public APIRequestGet requestCoatLengthField () { - return this.requestCoatLengthField(true); - } - public APIRequestGet requestCoatLengthField (boolean value) { - this.requestField("coat_length", value); - return this; - } - public APIRequestGet requestColorField () { - return this.requestColorField(true); - } - public APIRequestGet requestColorField (boolean value) { - this.requestField("color", value); - return this; - } - public APIRequestGet requestCurrencyField () { - return this.requestCurrencyField(true); - } - public APIRequestGet requestCurrencyField (boolean value) { - this.requestField("currency", value); - return this; - } - public APIRequestGet requestDescriptionField () { - return this.requestDescriptionField(true); - } - public APIRequestGet requestDescriptionField (boolean value) { - this.requestField("description", value); - return this; - } - public APIRequestGet requestFeaturesField () { - return this.requestFeaturesField(true); - } - public APIRequestGet requestFeaturesField (boolean value) { - this.requestField("features", value); - return this; - } - public APIRequestGet requestGenderField () { - return this.requestGenderField(true); - } - public APIRequestGet requestGenderField (boolean value) { - this.requestField("gender", value); - return this; - } - public APIRequestGet requestIdField () { - return this.requestIdField(true); - } - public APIRequestGet requestIdField (boolean value) { - this.requestField("id", value); - return this; - } - public APIRequestGet requestImageFetchStatusField () { - return this.requestImageFetchStatusField(true); - } - public APIRequestGet requestImageFetchStatusField (boolean value) { - this.requestField("image_fetch_status", value); - return this; - } - public APIRequestGet requestImagesField () { - return this.requestImagesField(true); - } - public APIRequestGet requestImagesField (boolean value) { - this.requestField("images", value); - return this; - } - public APIRequestGet requestNameField () { - return this.requestNameField(true); - } - public APIRequestGet requestNameField (boolean value) { - this.requestField("name", value); - return this; - } - public APIRequestGet requestPriceField () { - return this.requestPriceField(true); - } - public APIRequestGet requestPriceField (boolean value) { - this.requestField("price", value); - return this; - } - public APIRequestGet requestSanitizedImagesField () { - return this.requestSanitizedImagesField(true); - } - public APIRequestGet requestSanitizedImagesField (boolean value) { - this.requestField("sanitized_images", value); - return this; - } - public APIRequestGet requestSecondaryColorField () { - return this.requestSecondaryColorField(true); - } - public APIRequestGet requestSecondaryColorField (boolean value) { - this.requestField("secondary_color", value); - return this; - } - public APIRequestGet requestShelterEmailField () { - return this.requestShelterEmailField(true); - } - public APIRequestGet requestShelterEmailField (boolean value) { - this.requestField("shelter_email", value); - return this; - } - public APIRequestGet requestShelterNameField () { - return this.requestShelterNameField(true); - } - public APIRequestGet requestShelterNameField (boolean value) { - this.requestField("shelter_name", value); - return this; - } - public APIRequestGet requestShelterPageIdField () { - return this.requestShelterPageIdField(true); - } - public APIRequestGet requestShelterPageIdField (boolean value) { - this.requestField("shelter_page_id", value); - return this; - } - public APIRequestGet requestShelterPhoneField () { - return this.requestShelterPhoneField(true); - } - public APIRequestGet requestShelterPhoneField (boolean value) { - this.requestField("shelter_phone", value); - return this; - } - public APIRequestGet requestSizeField () { - return this.requestSizeField(true); - } - public APIRequestGet requestSizeField (boolean value) { - this.requestField("size", value); - return this; - } - public APIRequestGet requestTertiaryColorField () { - return this.requestTertiaryColorField(true); - } - public APIRequestGet requestTertiaryColorField (boolean value) { - this.requestField("tertiary_color", value); - return this; - } - public APIRequestGet requestUrlField () { - return this.requestUrlField(true); - } - public APIRequestGet requestUrlField (boolean value) { - this.requestField("url", value); - return this; - } - public APIRequestGet requestVisibilityField () { - return this.requestVisibilityField(true); - } - public APIRequestGet requestVisibilityField (boolean value) { - this.requestField("visibility", value); - return this; - } - } - - public static enum EnumImageFetchStatus { - @SerializedName("DIRECT_UPLOAD") - VALUE_DIRECT_UPLOAD("DIRECT_UPLOAD"), - @SerializedName("FETCHED") - VALUE_FETCHED("FETCHED"), - @SerializedName("FETCH_FAILED") - VALUE_FETCH_FAILED("FETCH_FAILED"), - @SerializedName("NO_STATUS") - VALUE_NO_STATUS("NO_STATUS"), - @SerializedName("OUTDATED") - VALUE_OUTDATED("OUTDATED"), - @SerializedName("PARTIAL_FETCH") - VALUE_PARTIAL_FETCH("PARTIAL_FETCH"), - ; - - private String value; - - private EnumImageFetchStatus(String value) { - this.value = value; - } - - @Override - public String toString() { - return value; - } - } - - public static enum EnumVisibility { - @SerializedName("PUBLISHED") - VALUE_PUBLISHED("PUBLISHED"), - @SerializedName("STAGING") - VALUE_STAGING("STAGING"), - ; - - private String value; - - private EnumVisibility(String value) { - this.value = value; - } - - @Override - public String toString() { - return value; - } - } - - - 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 AdoptablePet copyFrom(AdoptablePet instance) { - this.mAdoptablePetId = instance.mAdoptablePetId; - this.mAdoptionApplicationFormUrl = instance.mAdoptionApplicationFormUrl; - this.mAgeBucket = instance.mAgeBucket; - this.mAnimalType = instance.mAnimalType; - this.mApplinks = instance.mApplinks; - this.mAvailability = instance.mAvailability; - this.mBreed = instance.mBreed; - this.mCategorySpecificFields = instance.mCategorySpecificFields; - this.mCoatLength = instance.mCoatLength; - this.mColor = instance.mColor; - this.mCurrency = instance.mCurrency; - this.mDescription = instance.mDescription; - this.mFeatures = instance.mFeatures; - this.mGender = instance.mGender; - this.mId = instance.mId; - this.mImageFetchStatus = instance.mImageFetchStatus; - this.mImages = instance.mImages; - this.mName = instance.mName; - this.mPrice = instance.mPrice; - this.mSanitizedImages = instance.mSanitizedImages; - this.mSecondaryColor = instance.mSecondaryColor; - this.mShelterEmail = instance.mShelterEmail; - this.mShelterName = instance.mShelterName; - this.mShelterPageId = instance.mShelterPageId; - this.mShelterPhone = instance.mShelterPhone; - this.mSize = instance.mSize; - this.mTertiaryColor = instance.mTertiaryColor; - this.mUrl = instance.mUrl; - this.mVisibility = instance.mVisibility; - 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 AdoptablePet.parseResponse(response, context, request, header); - } - }; - } -} diff --git a/src/main/java/com/facebook/ads/sdk/AdsInsights.java b/src/main/java/com/facebook/ads/sdk/AdsInsights.java index 46a577e1..c616536e 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsInsights.java +++ b/src/main/java/com/facebook/ads/sdk/AdsInsights.java @@ -59,8 +59,6 @@ public class AdsInsights extends APINode { private List mAdImpressionActions = null; @SerializedName("ad_name") private String mAdName = null; - @SerializedName("adjusted_offline_purchase") - private List mAdjustedOfflinePurchase = null; @SerializedName("adset_end") private String mAdsetEnd = null; @SerializedName("adset_id") @@ -207,6 +205,12 @@ public class AdsInsights extends APINode { private List mInteractiveComponentTap = null; @SerializedName("labels") private String mLabels = null; + @SerializedName("landing_page_view_actions_per_link_click") + private List mLandingPageViewActionsPerLinkClick = null; + @SerializedName("landing_page_view_per_purchase_rate") + private List mLandingPageViewPerPurchaseRate = null; + @SerializedName("link_clicks_per_results") + private List mLinkClicksPerResults = null; @SerializedName("location") private String mLocation = null; @SerializedName("marketing_messages_cost_per_delivered") @@ -233,6 +237,8 @@ public class AdsInsights extends APINode { private String mPlacePageName = null; @SerializedName("purchase_roas") private List mPurchaseRoas = null; + @SerializedName("purchases_per_link_click") + private List mPurchasesPerLinkClick = null; @SerializedName("qualifying_question_qualify_answer_rate") private String mQualifyingQuestionQualifyAnswerRate = null; @SerializedName("quality_ranking") @@ -354,6 +360,8 @@ public class AdsInsights extends APINode { private String mImpressionDevice = null; @SerializedName("is_conversion_id_modeled") private String mIsConversionIdModeled = null; + @SerializedName("is_rendered_as_delayed_skip_ad") + private String mIsRenderedAsDelayedSkipAd = null; @SerializedName("landing_destination") private String mLandingDestination = null; @SerializedName("link_url_asset") @@ -660,15 +668,6 @@ public AdsInsights setFieldAdName(String value) { return this; } - public List getFieldAdjustedOfflinePurchase() { - return mAdjustedOfflinePurchase; - } - - public AdsInsights setFieldAdjustedOfflinePurchase(List value) { - this.mAdjustedOfflinePurchase = value; - return this; - } - public String getFieldAdsetEnd() { return mAdsetEnd; } @@ -1436,6 +1435,48 @@ public AdsInsights setFieldLabels(String value) { return this; } + public List getFieldLandingPageViewActionsPerLinkClick() { + return mLandingPageViewActionsPerLinkClick; + } + + public AdsInsights setFieldLandingPageViewActionsPerLinkClick(List value) { + this.mLandingPageViewActionsPerLinkClick = value; + return this; + } + + public AdsInsights setFieldLandingPageViewActionsPerLinkClick(String value) { + Type type = new TypeToken>(){}.getType(); + this.mLandingPageViewActionsPerLinkClick = AdsActionStats.getGson().fromJson(value, type); + return this; + } + public List getFieldLandingPageViewPerPurchaseRate() { + return mLandingPageViewPerPurchaseRate; + } + + public AdsInsights setFieldLandingPageViewPerPurchaseRate(List value) { + this.mLandingPageViewPerPurchaseRate = value; + return this; + } + + public AdsInsights setFieldLandingPageViewPerPurchaseRate(String value) { + Type type = new TypeToken>(){}.getType(); + this.mLandingPageViewPerPurchaseRate = AdsActionStats.getGson().fromJson(value, type); + return this; + } + public List getFieldLinkClicksPerResults() { + return mLinkClicksPerResults; + } + + public AdsInsights setFieldLinkClicksPerResults(List value) { + this.mLinkClicksPerResults = value; + return this; + } + + public AdsInsights setFieldLinkClicksPerResults(String value) { + Type type = new TypeToken>(){}.getType(); + this.mLinkClicksPerResults = AdsActionStats.getGson().fromJson(value, type); + return this; + } public String getFieldLocation() { return mLocation; } @@ -1578,6 +1619,20 @@ public AdsInsights setFieldPurchaseRoas(String value) { this.mPurchaseRoas = AdsActionStats.getGson().fromJson(value, type); return this; } + public List getFieldPurchasesPerLinkClick() { + return mPurchasesPerLinkClick; + } + + public AdsInsights setFieldPurchasesPerLinkClick(List value) { + this.mPurchasesPerLinkClick = value; + return this; + } + + public AdsInsights setFieldPurchasesPerLinkClick(String value) { + Type type = new TypeToken>(){}.getType(); + this.mPurchasesPerLinkClick = AdsActionStats.getGson().fromJson(value, type); + return this; + } public String getFieldQualifyingQuestionQualifyAnswerRate() { return mQualifyingQuestionQualifyAnswerRate; } @@ -2148,6 +2203,10 @@ public String getFieldIsConversionIdModeled() { return mIsConversionIdModeled; } + public String getFieldIsRenderedAsDelayedSkipAd() { + return mIsRenderedAsDelayedSkipAd; + } + public String getFieldLandingDestination() { return mLandingDestination; } @@ -2410,6 +2469,8 @@ public static enum EnumBreakdowns { VALUE_IMPRESSION_DEVICE("impression_device"), @SerializedName("is_conversion_id_modeled") VALUE_IS_CONVERSION_ID_MODELED("is_conversion_id_modeled"), + @SerializedName("is_rendered_as_delayed_skip_ad") + VALUE_IS_RENDERED_AS_DELAYED_SKIP_AD("is_rendered_as_delayed_skip_ad"), @SerializedName("landing_destination") VALUE_LANDING_DESTINATION("landing_destination"), @SerializedName("link_url_asset") @@ -2625,7 +2686,6 @@ public AdsInsights copyFrom(AdsInsights instance) { this.mAdId = instance.mAdId; this.mAdImpressionActions = instance.mAdImpressionActions; this.mAdName = instance.mAdName; - this.mAdjustedOfflinePurchase = instance.mAdjustedOfflinePurchase; this.mAdsetEnd = instance.mAdsetEnd; this.mAdsetId = instance.mAdsetId; this.mAdsetName = instance.mAdsetName; @@ -2699,6 +2759,9 @@ public AdsInsights copyFrom(AdsInsights instance) { this.mInstantExperienceOutboundClicks = instance.mInstantExperienceOutboundClicks; this.mInteractiveComponentTap = instance.mInteractiveComponentTap; this.mLabels = instance.mLabels; + this.mLandingPageViewActionsPerLinkClick = instance.mLandingPageViewActionsPerLinkClick; + this.mLandingPageViewPerPurchaseRate = instance.mLandingPageViewPerPurchaseRate; + this.mLinkClicksPerResults = instance.mLinkClicksPerResults; this.mLocation = instance.mLocation; this.mMarketingMessagesCostPerDelivered = instance.mMarketingMessagesCostPerDelivered; this.mMarketingMessagesCostPerLinkBtnClick = instance.mMarketingMessagesCostPerLinkBtnClick; @@ -2712,6 +2775,7 @@ public AdsInsights copyFrom(AdsInsights instance) { this.mOutboundClicksCtr = instance.mOutboundClicksCtr; this.mPlacePageName = instance.mPlacePageName; this.mPurchaseRoas = instance.mPurchaseRoas; + this.mPurchasesPerLinkClick = instance.mPurchasesPerLinkClick; this.mQualifyingQuestionQualifyAnswerRate = instance.mQualifyingQuestionQualifyAnswerRate; this.mQualityRanking = instance.mQualityRanking; this.mReach = instance.mReach; @@ -2772,6 +2836,7 @@ public AdsInsights copyFrom(AdsInsights instance) { this.mImageAsset = instance.mImageAsset; this.mImpressionDevice = instance.mImpressionDevice; this.mIsConversionIdModeled = instance.mIsConversionIdModeled; + this.mIsRenderedAsDelayedSkipAd = instance.mIsRenderedAsDelayedSkipAd; this.mLandingDestination = instance.mLandingDestination; this.mLinkUrlAsset = instance.mLinkUrlAsset; this.mMarketingMessagesBtnName = instance.mMarketingMessagesBtnName; diff --git a/src/main/java/com/facebook/ads/sdk/AdsPixel.java b/src/main/java/com/facebook/ads/sdk/AdsPixel.java index e84871d4..14f35578 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsPixel.java +++ b/src/main/java/com/facebook/ads/sdk/AdsPixel.java @@ -4974,6 +4974,8 @@ public static enum EnumPermittedTasks { VALUE_ADVERTISE("ADVERTISE"), @SerializedName("ANALYZE") VALUE_ANALYZE("ANALYZE"), + @SerializedName("EDIT") + VALUE_EDIT("EDIT"), @SerializedName("UPLOAD") VALUE_UPLOAD("UPLOAD"), ; diff --git a/src/main/java/com/facebook/ads/sdk/AdsUserSettings.java b/src/main/java/com/facebook/ads/sdk/AdsUserSettings.java index 6636c7be..b39252ee 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsUserSettings.java +++ b/src/main/java/com/facebook/ads/sdk/AdsUserSettings.java @@ -45,6 +45,8 @@ public class AdsUserSettings extends APINode { private Boolean mAPlusCSurveySeen = null; @SerializedName("adgroup_name_template") private Object mAdgroupNameTemplate = null; + @SerializedName("ads_cs_catalog_opt_out_timestamp") + private List> mAdsCsCatalogOptOutTimestamp = null; @SerializedName("ads_tool_visits") private List mAdsToolVisits = null; @SerializedName("aplusc_carousel_cda_opt_in_status") @@ -61,6 +63,8 @@ public class AdsUserSettings extends APINode { private Boolean mAutoflowLiteShouldOptIn = null; @SerializedName("blended_ads_creation_defaulting_opt_in_status") private String mBlendedAdsCreationDefaultingOptInStatus = null; + @SerializedName("blended_ads_creation_defaulting_opt_out_campaign_group_ids") + private List mBlendedAdsCreationDefaultingOptOutCampaignGroupIds = null; @SerializedName("bookmarked_pages") private List mBookmarkedPages = null; @SerializedName("campaign_group_name_template") @@ -93,8 +97,6 @@ public class AdsUserSettings extends APINode { private String mLastUsedPostFormat = null; @SerializedName("last_visited_time") private String mLastVisitedTime = null; - @SerializedName("multi_ads_settings") - private List> mMultiAdsSettings = null; @SerializedName("music_on_reels_opt_in") private List> mMusicOnReelsOptIn = null; @SerializedName("muted_cbo_midflight_education_messages") @@ -145,6 +147,8 @@ public class AdsUserSettings extends APINode { private Long mTotalCouponSydDismissals = null; @SerializedName("total_coupon_upsell_dismissals") private Long mTotalCouponUpsellDismissals = null; + @SerializedName("url_prefill_removal_timestamp") + private Long mUrlPrefillRemovalTimestamp = null; @SerializedName("use_pe_create_flow") private Boolean mUsePeCreateFlow = null; @SerializedName("use_stepper_primary_entry") @@ -373,6 +377,10 @@ public Object getFieldAdgroupNameTemplate() { return mAdgroupNameTemplate; } + public List> getFieldAdsCsCatalogOptOutTimestamp() { + return mAdsCsCatalogOptOutTimestamp; + } + public List getFieldAdsToolVisits() { return mAdsToolVisits; } @@ -405,6 +413,10 @@ public String getFieldBlendedAdsCreationDefaultingOptInStatus() { return mBlendedAdsCreationDefaultingOptInStatus; } + public List getFieldBlendedAdsCreationDefaultingOptOutCampaignGroupIds() { + return mBlendedAdsCreationDefaultingOptOutCampaignGroupIds; + } + public List getFieldBookmarkedPages() { return mBookmarkedPages; } @@ -469,10 +481,6 @@ public String getFieldLastVisitedTime() { return mLastVisitedTime; } - public List> getFieldMultiAdsSettings() { - return mMultiAdsSettings; - } - public List> getFieldMusicOnReelsOptIn() { return mMusicOnReelsOptIn; } @@ -579,6 +587,10 @@ public Long getFieldTotalCouponUpsellDismissals() { return mTotalCouponUpsellDismissals; } + public Long getFieldUrlPrefillRemovalTimestamp() { + return mUrlPrefillRemovalTimestamp; + } + public Boolean getFieldUsePeCreateFlow() { return mUsePeCreateFlow; } @@ -609,6 +621,7 @@ public AdsUserSettings getLastResponse() { public static final String[] FIELDS = { "a_plus_c_survey_seen", "adgroup_name_template", + "ads_cs_catalog_opt_out_timestamp", "ads_tool_visits", "aplusc_carousel_cda_opt_in_status", "aplusc_carousel_inline_comment_opt_in_status", @@ -617,6 +630,7 @@ public AdsUserSettings getLastResponse() { "autoflow_lite_opt_in_status", "autoflow_lite_should_opt_in", "blended_ads_creation_defaulting_opt_in_status", + "blended_ads_creation_defaulting_opt_out_campaign_group_ids", "bookmarked_pages", "campaign_group_name_template", "campaign_name_template", @@ -633,7 +647,6 @@ public AdsUserSettings getLastResponse() { "is_se_removal_guidance_dismissed", "last_used_post_format", "last_visited_time", - "multi_ads_settings", "music_on_reels_opt_in", "muted_cbo_midflight_education_messages", "onsite_destination_optimization_opt_in", @@ -659,6 +672,7 @@ public AdsUserSettings getLastResponse() { "syd_campaign_trends_metric", "total_coupon_syd_dismissals", "total_coupon_upsell_dismissals", + "url_prefill_removal_timestamp", "use_pe_create_flow", "use_stepper_primary_entry", "user", @@ -768,6 +782,13 @@ public APIRequestGet requestAdgroupNameTemplateField (boolean value) { this.requestField("adgroup_name_template", value); return this; } + public APIRequestGet requestAdsCsCatalogOptOutTimestampField () { + return this.requestAdsCsCatalogOptOutTimestampField(true); + } + public APIRequestGet requestAdsCsCatalogOptOutTimestampField (boolean value) { + this.requestField("ads_cs_catalog_opt_out_timestamp", value); + return this; + } public APIRequestGet requestAdsToolVisitsField () { return this.requestAdsToolVisitsField(true); } @@ -824,6 +845,13 @@ public APIRequestGet requestBlendedAdsCreationDefaultingOptInStatusField (boolea this.requestField("blended_ads_creation_defaulting_opt_in_status", value); return this; } + public APIRequestGet requestBlendedAdsCreationDefaultingOptOutCampaignGroupIdsField () { + return this.requestBlendedAdsCreationDefaultingOptOutCampaignGroupIdsField(true); + } + public APIRequestGet requestBlendedAdsCreationDefaultingOptOutCampaignGroupIdsField (boolean value) { + this.requestField("blended_ads_creation_defaulting_opt_out_campaign_group_ids", value); + return this; + } public APIRequestGet requestBookmarkedPagesField () { return this.requestBookmarkedPagesField(true); } @@ -936,13 +964,6 @@ public APIRequestGet requestLastVisitedTimeField (boolean value) { this.requestField("last_visited_time", value); return this; } - public APIRequestGet requestMultiAdsSettingsField () { - return this.requestMultiAdsSettingsField(true); - } - public APIRequestGet requestMultiAdsSettingsField (boolean value) { - this.requestField("multi_ads_settings", value); - return this; - } public APIRequestGet requestMusicOnReelsOptInField () { return this.requestMusicOnReelsOptInField(true); } @@ -1118,6 +1139,13 @@ public APIRequestGet requestTotalCouponUpsellDismissalsField (boolean value) { this.requestField("total_coupon_upsell_dismissals", value); return this; } + public APIRequestGet requestUrlPrefillRemovalTimestampField () { + return this.requestUrlPrefillRemovalTimestampField(true); + } + public APIRequestGet requestUrlPrefillRemovalTimestampField (boolean value) { + this.requestField("url_prefill_removal_timestamp", value); + return this; + } public APIRequestGet requestUsePeCreateFlowField () { return this.requestUsePeCreateFlowField(true); } @@ -1158,6 +1186,7 @@ public APIRequestGet requestUserField (boolean value) { public AdsUserSettings copyFrom(AdsUserSettings instance) { this.mAPlusCSurveySeen = instance.mAPlusCSurveySeen; this.mAdgroupNameTemplate = instance.mAdgroupNameTemplate; + this.mAdsCsCatalogOptOutTimestamp = instance.mAdsCsCatalogOptOutTimestamp; this.mAdsToolVisits = instance.mAdsToolVisits; this.mApluscCarouselCdaOptInStatus = instance.mApluscCarouselCdaOptInStatus; this.mApluscCarouselInlineCommentOptInStatus = instance.mApluscCarouselInlineCommentOptInStatus; @@ -1166,6 +1195,7 @@ public AdsUserSettings copyFrom(AdsUserSettings instance) { this.mAutoflowLiteOptInStatus = instance.mAutoflowLiteOptInStatus; this.mAutoflowLiteShouldOptIn = instance.mAutoflowLiteShouldOptIn; this.mBlendedAdsCreationDefaultingOptInStatus = instance.mBlendedAdsCreationDefaultingOptInStatus; + this.mBlendedAdsCreationDefaultingOptOutCampaignGroupIds = instance.mBlendedAdsCreationDefaultingOptOutCampaignGroupIds; this.mBookmarkedPages = instance.mBookmarkedPages; this.mCampaignGroupNameTemplate = instance.mCampaignGroupNameTemplate; this.mCampaignNameTemplate = instance.mCampaignNameTemplate; @@ -1182,7 +1212,6 @@ public AdsUserSettings copyFrom(AdsUserSettings instance) { this.mIsSeRemovalGuidanceDismissed = instance.mIsSeRemovalGuidanceDismissed; this.mLastUsedPostFormat = instance.mLastUsedPostFormat; this.mLastVisitedTime = instance.mLastVisitedTime; - this.mMultiAdsSettings = instance.mMultiAdsSettings; this.mMusicOnReelsOptIn = instance.mMusicOnReelsOptIn; this.mMutedCboMidflightEducationMessages = instance.mMutedCboMidflightEducationMessages; this.mOnsiteDestinationOptimizationOptIn = instance.mOnsiteDestinationOptimizationOptIn; @@ -1208,6 +1237,7 @@ public AdsUserSettings copyFrom(AdsUserSettings instance) { this.mSydCampaignTrendsMetric = instance.mSydCampaignTrendsMetric; this.mTotalCouponSydDismissals = instance.mTotalCouponSydDismissals; this.mTotalCouponUpsellDismissals = instance.mTotalCouponUpsellDismissals; + this.mUrlPrefillRemovalTimestamp = instance.mUrlPrefillRemovalTimestamp; this.mUsePeCreateFlow = instance.mUsePeCreateFlow; this.mUseStepperPrimaryEntry = instance.mUseStepperPrimaryEntry; this.mUser = instance.mUser; diff --git a/src/main/java/com/facebook/ads/sdk/Application.java b/src/main/java/com/facebook/ads/sdk/Application.java index 41d1d6d5..f7f88daf 100644 --- a/src/main/java/com/facebook/ads/sdk/Application.java +++ b/src/main/java/com/facebook/ads/sdk/Application.java @@ -672,6 +672,10 @@ public APIRequestDeleteSubscriptions deleteSubscriptions() { return new APIRequestDeleteSubscriptions(this.getPrefixedId().toString(), context); } + public APIRequestGetSubscriptions getSubscriptions() { + return new APIRequestGetSubscriptions(this.getPrefixedId().toString(), context); + } + public APIRequestCreateSubscription createSubscription() { return new APIRequestCreateSubscription(this.getPrefixedId().toString(), context); } @@ -9482,6 +9486,111 @@ public APIRequestDeleteSubscriptions requestField (String field, boolean value) } + public static class APIRequestGetSubscriptions extends APIRequest { + + APINodeList lastResponse = null; + @Override + public APINodeList getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + }; + + public static final String[] FIELDS = { + }; + + @Override + public APINodeList parseResponse(String response, String header) throws APIException { + return APINode.parseResponse(response, getContext(), this, header); + } + + @Override + public APINodeList execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + try { + return APIRequestGetSubscriptions.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestGetSubscriptions(String nodeId, APIContext context) { + super(context, nodeId, "/subscriptions", "GET", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestGetSubscriptions setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestGetSubscriptions setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestGetSubscriptions requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestGetSubscriptions requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetSubscriptions requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestGetSubscriptions requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetSubscriptions requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestGetSubscriptions requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + public static class APIRequestCreateSubscription extends APIRequest { APINode lastResponse = null; diff --git a/src/main/java/com/facebook/ads/sdk/AutomotiveModel.java b/src/main/java/com/facebook/ads/sdk/AutomotiveModel.java index fb2c256e..16445102 100644 --- a/src/main/java/com/facebook/ads/sdk/AutomotiveModel.java +++ b/src/main/java/com/facebook/ads/sdk/AutomotiveModel.java @@ -310,14 +310,14 @@ public String toString() { return getGson().toJson(this); } - public APIRequestGetAugmentedRealitiesMetadata getAugmentedRealitiesMetadata() { - return new APIRequestGetAugmentedRealitiesMetadata(this.getPrefixedId().toString(), context); - } - public APIRequestGetChannelsToIntegrityStatus getChannelsToIntegrityStatus() { return new APIRequestGetChannelsToIntegrityStatus(this.getPrefixedId().toString(), context); } + public APIRequestGetOverrideDetails getOverrideDetails() { + return new APIRequestGetOverrideDetails(this.getPrefixedId().toString(), context); + } + public APIRequestGetVideosMetadata getVideosMetadata() { return new APIRequestGetVideosMetadata(this.getPrefixedId().toString(), context); } @@ -449,59 +449,49 @@ public Long getFieldYear() { - public static class APIRequestGetAugmentedRealitiesMetadata extends APIRequest { + public static class APIRequestGetChannelsToIntegrityStatus extends APIRequest { - APINodeList lastResponse = null; + APINodeList lastResponse = null; @Override - public APINodeList getLastResponse() { + public APINodeList getLastResponse() { return lastResponse; } public static final String[] PARAMS = { }; public static final String[] FIELDS = { - "anchor_point", - "container_effect_enum", - "effect_icon_url", - "effect_id", - "id", - "platforms", - "scale_factor", - "shadow_texture_url", - "source_url", - "state", - "tags", - "variant_picker_url", + "channels", + "rejection_information", }; @Override - public APINodeList parseResponse(String response, String header) throws APIException { - return DynamicARMetadata.parseResponse(response, getContext(), this, header); + public APINodeList parseResponse(String response, String header) throws APIException { + return CatalogItemChannelsToIntegrityStatus.parseResponse(response, getContext(), this, header); } @Override - public APINodeList execute() throws APIException { + public APINodeList execute() throws APIException { return execute(new HashMap()); } @Override - public APINodeList execute(Map extraParams) throws APIException { + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + new Function>() { + public APINodeList apply(ResponseWrapper result) { try { - return APIRequestGetAugmentedRealitiesMetadata.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestGetChannelsToIntegrityStatus.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -511,28 +501,28 @@ public APINodeList apply(ResponseWrapper result) { ); }; - public APIRequestGetAugmentedRealitiesMetadata(String nodeId, APIContext context) { - super(context, nodeId, "/augmented_realities_metadata", "GET", Arrays.asList(PARAMS)); + public APIRequestGetChannelsToIntegrityStatus(String nodeId, APIContext context) { + super(context, nodeId, "/channels_to_integrity_status", "GET", Arrays.asList(PARAMS)); } @Override - public APIRequestGetAugmentedRealitiesMetadata setParam(String param, Object value) { + public APIRequestGetChannelsToIntegrityStatus setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestGetAugmentedRealitiesMetadata setParams(Map params) { + public APIRequestGetChannelsToIntegrityStatus setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestGetAugmentedRealitiesMetadata requestAllFields () { + public APIRequestGetChannelsToIntegrityStatus requestAllFields () { return this.requestAllFields(true); } - public APIRequestGetAugmentedRealitiesMetadata requestAllFields (boolean value) { + public APIRequestGetChannelsToIntegrityStatus requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -540,12 +530,12 @@ public APIRequestGetAugmentedRealitiesMetadata requestAllFields (boolean value) } @Override - public APIRequestGetAugmentedRealitiesMetadata requestFields (List fields) { + public APIRequestGetChannelsToIntegrityStatus requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestGetAugmentedRealitiesMetadata requestFields (List fields, boolean value) { + public APIRequestGetChannelsToIntegrityStatus requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -553,146 +543,79 @@ public APIRequestGetAugmentedRealitiesMetadata requestFields (List field } @Override - public APIRequestGetAugmentedRealitiesMetadata requestField (String field) { + public APIRequestGetChannelsToIntegrityStatus requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestGetAugmentedRealitiesMetadata requestField (String field, boolean value) { + public APIRequestGetChannelsToIntegrityStatus requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } - public APIRequestGetAugmentedRealitiesMetadata requestAnchorPointField () { - return this.requestAnchorPointField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestAnchorPointField (boolean value) { - this.requestField("anchor_point", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestContainerEffectEnumField () { - return this.requestContainerEffectEnumField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestContainerEffectEnumField (boolean value) { - this.requestField("container_effect_enum", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIconUrlField () { - return this.requestEffectIconUrlField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIconUrlField (boolean value) { - this.requestField("effect_icon_url", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIdField () { - return this.requestEffectIdField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIdField (boolean value) { - this.requestField("effect_id", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestIdField () { - return this.requestIdField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestIdField (boolean value) { - this.requestField("id", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestPlatformsField () { - return this.requestPlatformsField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestPlatformsField (boolean value) { - this.requestField("platforms", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestScaleFactorField () { - return this.requestScaleFactorField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestScaleFactorField (boolean value) { - this.requestField("scale_factor", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestShadowTextureUrlField () { - return this.requestShadowTextureUrlField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestShadowTextureUrlField (boolean value) { - this.requestField("shadow_texture_url", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestSourceUrlField () { - return this.requestSourceUrlField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestSourceUrlField (boolean value) { - this.requestField("source_url", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestStateField () { - return this.requestStateField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestStateField (boolean value) { - this.requestField("state", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestTagsField () { - return this.requestTagsField(true); + public APIRequestGetChannelsToIntegrityStatus requestChannelsField () { + return this.requestChannelsField(true); } - public APIRequestGetAugmentedRealitiesMetadata requestTagsField (boolean value) { - this.requestField("tags", value); + public APIRequestGetChannelsToIntegrityStatus requestChannelsField (boolean value) { + this.requestField("channels", value); return this; } - public APIRequestGetAugmentedRealitiesMetadata requestVariantPickerUrlField () { - return this.requestVariantPickerUrlField(true); + public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField () { + return this.requestRejectionInformationField(true); } - public APIRequestGetAugmentedRealitiesMetadata requestVariantPickerUrlField (boolean value) { - this.requestField("variant_picker_url", value); + public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField (boolean value) { + this.requestField("rejection_information", value); return this; } } - public static class APIRequestGetChannelsToIntegrityStatus extends APIRequest { + public static class APIRequestGetOverrideDetails extends APIRequest { - APINodeList lastResponse = null; + APINodeList lastResponse = null; @Override - public APINodeList getLastResponse() { + public APINodeList getLastResponse() { return lastResponse; } public static final String[] PARAMS = { + "keys", + "type", }; public static final String[] FIELDS = { - "channels", - "rejection_information", + "key", + "type", + "values", }; @Override - public APINodeList parseResponse(String response, String header) throws APIException { - return CatalogItemChannelsToIntegrityStatus.parseResponse(response, getContext(), this, header); + public APINodeList parseResponse(String response, String header) throws APIException { + return OverrideDetails.parseResponse(response, getContext(), this, header); } @Override - public APINodeList execute() throws APIException { + public APINodeList execute() throws APIException { return execute(new HashMap()); } @Override - public APINodeList execute(Map extraParams) throws APIException { + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + new Function>() { + public APINodeList apply(ResponseWrapper result) { try { - return APIRequestGetChannelsToIntegrityStatus.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestGetOverrideDetails.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -702,28 +625,46 @@ public APINodeList apply(ResponseWrapper r ); }; - public APIRequestGetChannelsToIntegrityStatus(String nodeId, APIContext context) { - super(context, nodeId, "/channels_to_integrity_status", "GET", Arrays.asList(PARAMS)); + public APIRequestGetOverrideDetails(String nodeId, APIContext context) { + super(context, nodeId, "/override_details", "GET", Arrays.asList(PARAMS)); } @Override - public APIRequestGetChannelsToIntegrityStatus setParam(String param, Object value) { + public APIRequestGetOverrideDetails setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestGetChannelsToIntegrityStatus setParams(Map params) { + public APIRequestGetOverrideDetails setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestGetChannelsToIntegrityStatus requestAllFields () { + public APIRequestGetOverrideDetails setKeys (List keys) { + this.setParam("keys", keys); + return this; + } + public APIRequestGetOverrideDetails setKeys (String keys) { + this.setParam("keys", keys); + return this; + } + + public APIRequestGetOverrideDetails setType (OverrideDetails.EnumType type) { + this.setParam("type", type); + return this; + } + public APIRequestGetOverrideDetails setType (String type) { + this.setParam("type", type); + return this; + } + + public APIRequestGetOverrideDetails requestAllFields () { return this.requestAllFields(true); } - public APIRequestGetChannelsToIntegrityStatus requestAllFields (boolean value) { + public APIRequestGetOverrideDetails requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -731,12 +672,12 @@ public APIRequestGetChannelsToIntegrityStatus requestAllFields (boolean value) { } @Override - public APIRequestGetChannelsToIntegrityStatus requestFields (List fields) { + public APIRequestGetOverrideDetails requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestGetChannelsToIntegrityStatus requestFields (List fields, boolean value) { + public APIRequestGetOverrideDetails requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -744,29 +685,36 @@ public APIRequestGetChannelsToIntegrityStatus requestFields (List fields } @Override - public APIRequestGetChannelsToIntegrityStatus requestField (String field) { + public APIRequestGetOverrideDetails requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestGetChannelsToIntegrityStatus requestField (String field, boolean value) { + public APIRequestGetOverrideDetails requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } - public APIRequestGetChannelsToIntegrityStatus requestChannelsField () { - return this.requestChannelsField(true); + public APIRequestGetOverrideDetails requestKeyField () { + return this.requestKeyField(true); } - public APIRequestGetChannelsToIntegrityStatus requestChannelsField (boolean value) { - this.requestField("channels", value); + public APIRequestGetOverrideDetails requestKeyField (boolean value) { + this.requestField("key", value); return this; } - public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField () { - return this.requestRejectionInformationField(true); + public APIRequestGetOverrideDetails requestTypeField () { + return this.requestTypeField(true); } - public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField (boolean value) { - this.requestField("rejection_information", value); + public APIRequestGetOverrideDetails requestTypeField (boolean value) { + this.requestField("type", value); + return this; + } + public APIRequestGetOverrideDetails requestValuesField () { + return this.requestValuesField(true); + } + public APIRequestGetOverrideDetails requestValuesField (boolean value) { + this.requestField("values", value); return this; } } diff --git a/src/main/java/com/facebook/ads/sdk/BrandSafetyCampaignConfig.java b/src/main/java/com/facebook/ads/sdk/BrandSafetyCampaignConfig.java new file mode 100644 index 00000000..2ec4f871 --- /dev/null +++ b/src/main/java/com/facebook/ads/sdk/BrandSafetyCampaignConfig.java @@ -0,0 +1,236 @@ +/* + * 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 BrandSafetyCampaignConfig extends APINode { + @SerializedName("comment_moderation_filter") + private String mCommentModerationFilter = null; + protected static Gson gson = null; + + public BrandSafetyCampaignConfig() { + } + + public String getId() { + return null; + } + public static BrandSafetyCampaignConfig loadJSON(String json, APIContext context, String header) { + BrandSafetyCampaignConfig brandSafetyCampaignConfig = getGson().fromJson(json, BrandSafetyCampaignConfig.class); + if (context.isDebug()) { + JsonParser parser = new JsonParser(); + JsonElement o1 = parser.parse(json); + JsonElement o2 = parser.parse(brandSafetyCampaignConfig.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); + } + } + brandSafetyCampaignConfig.context = context; + brandSafetyCampaignConfig.rawValue = json; + brandSafetyCampaignConfig.header = header; + return brandSafetyCampaignConfig; + } + + public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { + APINodeList brandSafetyCampaignConfigs = 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++) { + brandSafetyCampaignConfigs.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); + }; + return brandSafetyCampaignConfigs; + } 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; + brandSafetyCampaignConfigs.setCursors(before, after); + } + String previous = paging.has("previous") ? paging.get("previous").getAsString() : null; + String next = paging.has("next") ? paging.get("next").getAsString() : null; + brandSafetyCampaignConfigs.setPaging(previous, next); + if (context.hasAppSecret()) { + brandSafetyCampaignConfigs.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++) { + brandSafetyCampaignConfigs.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()) { + brandSafetyCampaignConfigs.add(loadJSON(entry.getValue().toString(), context, header)); + } + break; + } + } + if (!isRedownload) { + brandSafetyCampaignConfigs.add(loadJSON(obj.toString(), context, header)); + } + } + return brandSafetyCampaignConfigs; + } 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()) { + brandSafetyCampaignConfigs.add(loadJSON(entry.getValue().toString(), context, header)); + } + return brandSafetyCampaignConfigs; + } 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) + ) { + brandSafetyCampaignConfigs.add(loadJSON(value.toString(), context, header)); + } else { + isIdIndexedArray = false; + break; + } + } + if (isIdIndexedArray) { + return brandSafetyCampaignConfigs; + } + + // Sixth, check if it's pure JsonObject + brandSafetyCampaignConfigs.clear(); + brandSafetyCampaignConfigs.add(loadJSON(json, context, header)); + return brandSafetyCampaignConfigs; + } + } + } 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 String getFieldCommentModerationFilter() { + return mCommentModerationFilter; + } + + public BrandSafetyCampaignConfig setFieldCommentModerationFilter(String value) { + this.mCommentModerationFilter = 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 BrandSafetyCampaignConfig copyFrom(BrandSafetyCampaignConfig instance) { + this.mCommentModerationFilter = instance.mCommentModerationFilter; + 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 BrandSafetyCampaignConfig.parseResponse(response, context, request, header); + } + }; + } +} diff --git a/src/main/java/com/facebook/ads/sdk/Business.java b/src/main/java/com/facebook/ads/sdk/Business.java index 2741fcc2..c70c4928 100644 --- a/src/main/java/com/facebook/ads/sdk/Business.java +++ b/src/main/java/com/facebook/ads/sdk/Business.java @@ -298,10 +298,18 @@ public APIRequestCreateAccessToken createAccessToken() { return new APIRequestCreateAccessToken(this.getPrefixedId().toString(), context); } + public APIRequestGetAdAccountInfos getAdAccountInfos() { + return new APIRequestGetAdAccountInfos(this.getPrefixedId().toString(), context); + } + public APIRequestDeleteAdAccounts deleteAdAccounts() { return new APIRequestDeleteAdAccounts(this.getPrefixedId().toString(), context); } + public APIRequestCreateAdReviewRequest createAdReviewRequest() { + return new APIRequestCreateAdReviewRequest(this.getPrefixedId().toString(), context); + } + public APIRequestGetAdStudies getAdStudies() { return new APIRequestGetAdStudies(this.getPrefixedId().toString(), context); } @@ -366,6 +374,10 @@ public APIRequestCreateBlockListDraft createBlockListDraft() { return new APIRequestCreateBlockListDraft(this.getPrefixedId().toString(), context); } + public APIRequestCreateBmReviewRequest createBmReviewRequest() { + return new APIRequestCreateBmReviewRequest(this.getPrefixedId().toString(), context); + } + public APIRequestGetBusinessAssetGroups getBusinessAssetGroups() { return new APIRequestGetBusinessAssetGroups(this.getPrefixedId().toString(), context); } @@ -666,8 +678,8 @@ public APIRequestGetResellerGuidances getResellerGuidances() { return new APIRequestGetResellerGuidances(this.getPrefixedId().toString(), context); } - public APIRequestGetSelfCertifiedWhatsappBusinessSubmissions getSelfCertifiedWhatsappBusinessSubmissions() { - return new APIRequestGetSelfCertifiedWhatsappBusinessSubmissions(this.getPrefixedId().toString(), context); + public APIRequestGetSelfCertifiedWhatsAppBusinessSubmissions getSelfCertifiedWhatsAppBusinessSubmissions() { + return new APIRequestGetSelfCertifiedWhatsAppBusinessSubmissions(this.getPrefixedId().toString(), context); } public APIRequestCreateSetupManagedPartnerAdAccount createSetupManagedPartnerAdAccount() { @@ -937,6 +949,193 @@ public APIRequestCreateAccessToken requestField (String field, boolean value) { } + public static class APIRequestGetAdAccountInfos extends APIRequest { + + APINodeList lastResponse = null; + @Override + public APINodeList getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "ad_account_id", + "parent_advertiser_id", + "user_id", + }; + + public static final String[] FIELDS = { + "ad_account_id", + "id", + "managed_by", + "parent_advertiser_id", + "sub_vertical", + "tag", + "user_ids", + "vertical", + }; + + @Override + public APINodeList parseResponse(String response, String header) throws APIException { + return ALMAdAccountInfo.parseResponse(response, getContext(), this, header); + } + + @Override + public APINodeList execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + try { + return APIRequestGetAdAccountInfos.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestGetAdAccountInfos(String nodeId, APIContext context) { + super(context, nodeId, "/ad_account_infos", "GET", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestGetAdAccountInfos setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestGetAdAccountInfos setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestGetAdAccountInfos setAdAccountId (String adAccountId) { + this.setParam("ad_account_id", adAccountId); + return this; + } + + public APIRequestGetAdAccountInfos setParentAdvertiserId (String parentAdvertiserId) { + this.setParam("parent_advertiser_id", parentAdvertiserId); + return this; + } + + public APIRequestGetAdAccountInfos setUserId (String userId) { + this.setParam("user_id", userId); + return this; + } + + public APIRequestGetAdAccountInfos requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestGetAdAccountInfos requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetAdAccountInfos requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestGetAdAccountInfos requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetAdAccountInfos requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestGetAdAccountInfos requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + public APIRequestGetAdAccountInfos requestAdAccountIdField () { + return this.requestAdAccountIdField(true); + } + public APIRequestGetAdAccountInfos requestAdAccountIdField (boolean value) { + this.requestField("ad_account_id", value); + return this; + } + public APIRequestGetAdAccountInfos requestIdField () { + return this.requestIdField(true); + } + public APIRequestGetAdAccountInfos requestIdField (boolean value) { + this.requestField("id", value); + return this; + } + public APIRequestGetAdAccountInfos requestManagedByField () { + return this.requestManagedByField(true); + } + public APIRequestGetAdAccountInfos requestManagedByField (boolean value) { + this.requestField("managed_by", value); + return this; + } + public APIRequestGetAdAccountInfos requestParentAdvertiserIdField () { + return this.requestParentAdvertiserIdField(true); + } + public APIRequestGetAdAccountInfos requestParentAdvertiserIdField (boolean value) { + this.requestField("parent_advertiser_id", value); + return this; + } + public APIRequestGetAdAccountInfos requestSubVerticalField () { + return this.requestSubVerticalField(true); + } + public APIRequestGetAdAccountInfos requestSubVerticalField (boolean value) { + this.requestField("sub_vertical", value); + return this; + } + public APIRequestGetAdAccountInfos requestTagField () { + return this.requestTagField(true); + } + public APIRequestGetAdAccountInfos requestTagField (boolean value) { + this.requestField("tag", value); + return this; + } + public APIRequestGetAdAccountInfos requestUserIdsField () { + return this.requestUserIdsField(true); + } + public APIRequestGetAdAccountInfos requestUserIdsField (boolean value) { + this.requestField("user_ids", value); + return this; + } + public APIRequestGetAdAccountInfos requestVerticalField () { + return this.requestVerticalField(true); + } + public APIRequestGetAdAccountInfos requestVerticalField (boolean value) { + this.requestField("vertical", value); + return this; + } + } + public static class APIRequestDeleteAdAccounts extends APIRequest { APINodeList lastResponse = null; @@ -1048,6 +1247,121 @@ public APIRequestDeleteAdAccounts requestField (String field, boolean value) { } + public static class APIRequestCreateAdReviewRequest extends APIRequest { + + APINode lastResponse = null; + @Override + public APINode getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "ad_account_ids", + }; + + public static final String[] FIELDS = { + }; + + @Override + public APINode parseResponse(String response, String header) throws APIException { + return APINode.parseResponse(response, getContext(), this, header).head(); + } + + @Override + public APINode execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINode 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 APINode apply(ResponseWrapper result) { + try { + return APIRequestCreateAdReviewRequest.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestCreateAdReviewRequest(String nodeId, APIContext context) { + super(context, nodeId, "/ad_review_requests", "POST", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestCreateAdReviewRequest setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestCreateAdReviewRequest setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestCreateAdReviewRequest setAdAccountIds (List adAccountIds) { + this.setParam("ad_account_ids", adAccountIds); + return this; + } + public APIRequestCreateAdReviewRequest setAdAccountIds (String adAccountIds) { + this.setParam("ad_account_ids", adAccountIds); + return this; + } + + public APIRequestCreateAdReviewRequest requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestCreateAdReviewRequest requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestCreateAdReviewRequest requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestCreateAdReviewRequest requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestCreateAdReviewRequest requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestCreateAdReviewRequest requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + public static class APIRequestGetAdStudies extends APIRequest { APINodeList lastResponse = null; @@ -4020,6 +4334,121 @@ public APIRequestCreateBlockListDraft requestField (String field, boolean value) } + public static class APIRequestCreateBmReviewRequest extends APIRequest { + + APINode lastResponse = null; + @Override + public APINode getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "business_manager_ids", + }; + + public static final String[] FIELDS = { + }; + + @Override + public APINode parseResponse(String response, String header) throws APIException { + return APINode.parseResponse(response, getContext(), this, header).head(); + } + + @Override + public APINode execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINode 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 APINode apply(ResponseWrapper result) { + try { + return APIRequestCreateBmReviewRequest.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestCreateBmReviewRequest(String nodeId, APIContext context) { + super(context, nodeId, "/bm_review_requests", "POST", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestCreateBmReviewRequest setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestCreateBmReviewRequest setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestCreateBmReviewRequest setBusinessManagerIds (List businessManagerIds) { + this.setParam("business_manager_ids", businessManagerIds); + return this; + } + public APIRequestCreateBmReviewRequest setBusinessManagerIds (String businessManagerIds) { + this.setParam("business_manager_ids", businessManagerIds); + return this; + } + + public APIRequestCreateBmReviewRequest requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestCreateBmReviewRequest requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestCreateBmReviewRequest requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestCreateBmReviewRequest requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestCreateBmReviewRequest requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestCreateBmReviewRequest requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + public static class APIRequestGetBusinessAssetGroups extends APIRequest { APINodeList lastResponse = null; @@ -4682,6 +5111,7 @@ public BusinessUser getLastResponse() { } public static final String[] PARAMS = { "email", + "invited_user_type", "role", }; @@ -4747,6 +5177,15 @@ public APIRequestCreateBusinessUser setEmail (String email) { return this; } + public APIRequestCreateBusinessUser setInvitedUserType (List invitedUserType) { + this.setParam("invited_user_type", invitedUserType); + return this; + } + public APIRequestCreateBusinessUser setInvitedUserType (String invitedUserType) { + this.setParam("invited_user_type", invitedUserType); + return this; + } + public APIRequestCreateBusinessUser setRole (BusinessUser.EnumRole role) { this.setParam("role", role); return this; @@ -21217,6 +21656,7 @@ public APINodeList getLastResponse() { "finance_role", "id", "invite_link", + "invited_user_type", "ip_role", "owner", "role", @@ -21376,6 +21816,13 @@ public APIRequestGetPendingUsers requestInviteLinkField (boolean value) { this.requestField("invite_link", value); return this; } + public APIRequestGetPendingUsers requestInvitedUserTypeField () { + return this.requestInvitedUserTypeField(true); + } + public APIRequestGetPendingUsers requestInvitedUserTypeField (boolean value) { + this.requestField("invited_user_type", value); + return this; + } public APIRequestGetPendingUsers requestIpRoleField () { return this.requestIpRoleField(true); } @@ -22097,10 +22544,7 @@ public APINodeList getLastResponse() { "advertiser_name", "attributed_to_reseller_l7d", "available_guidance", - "benchmark_report_link", "guidance_adoption_rate_l7d", - "no_adsets_gte_benchmark", - "no_adsets_lt_benchmark", "nurtured_by_reseller_l7d", "planning_agency_name", "recommendation_time", @@ -22242,13 +22686,6 @@ public APIRequestGetResellerGuidances requestAvailableGuidanceField (boolean val this.requestField("available_guidance", value); return this; } - public APIRequestGetResellerGuidances requestBenchmarkReportLinkField () { - return this.requestBenchmarkReportLinkField(true); - } - public APIRequestGetResellerGuidances requestBenchmarkReportLinkField (boolean value) { - this.requestField("benchmark_report_link", value); - return this; - } public APIRequestGetResellerGuidances requestGuidanceAdoptionRateL7dField () { return this.requestGuidanceAdoptionRateL7dField(true); } @@ -22256,20 +22693,6 @@ public APIRequestGetResellerGuidances requestGuidanceAdoptionRateL7dField (boole this.requestField("guidance_adoption_rate_l7d", value); return this; } - public APIRequestGetResellerGuidances requestNoAdsetsGteBenchmarkField () { - return this.requestNoAdsetsGteBenchmarkField(true); - } - public APIRequestGetResellerGuidances requestNoAdsetsGteBenchmarkField (boolean value) { - this.requestField("no_adsets_gte_benchmark", value); - return this; - } - public APIRequestGetResellerGuidances requestNoAdsetsLtBenchmarkField () { - return this.requestNoAdsetsLtBenchmarkField(true); - } - public APIRequestGetResellerGuidances requestNoAdsetsLtBenchmarkField (boolean value) { - this.requestField("no_adsets_lt_benchmark", value); - return this; - } public APIRequestGetResellerGuidances requestNurturedByResellerL7dField () { return this.requestNurturedByResellerL7dField(true); } @@ -22321,7 +22744,7 @@ public APIRequestGetResellerGuidances requestUltimateAdvertiserNameField (boolea } } - public static class APIRequestGetSelfCertifiedWhatsappBusinessSubmissions extends APIRequest { + public static class APIRequestGetSelfCertifiedWhatsAppBusinessSubmissions extends APIRequest { APINodeList lastResponse = null; @Override @@ -22369,7 +22792,7 @@ public ListenableFuture>() { public APINodeList apply(ResponseWrapper result) { try { - return APIRequestGetSelfCertifiedWhatsappBusinessSubmissions.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestGetSelfCertifiedWhatsAppBusinessSubmissions.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -22379,33 +22802,33 @@ public APINodeList apply(Re ); }; - public APIRequestGetSelfCertifiedWhatsappBusinessSubmissions(String nodeId, APIContext context) { + public APIRequestGetSelfCertifiedWhatsAppBusinessSubmissions(String nodeId, APIContext context) { super(context, nodeId, "/self_certified_whatsapp_business_submissions", "GET", Arrays.asList(PARAMS)); } @Override - public APIRequestGetSelfCertifiedWhatsappBusinessSubmissions setParam(String param, Object value) { + public APIRequestGetSelfCertifiedWhatsAppBusinessSubmissions setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestGetSelfCertifiedWhatsappBusinessSubmissions setParams(Map params) { + public APIRequestGetSelfCertifiedWhatsAppBusinessSubmissions setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestGetSelfCertifiedWhatsappBusinessSubmissions setEndBusinessId (String endBusinessId) { + public APIRequestGetSelfCertifiedWhatsAppBusinessSubmissions setEndBusinessId (String endBusinessId) { this.setParam("end_business_id", endBusinessId); return this; } - public APIRequestGetSelfCertifiedWhatsappBusinessSubmissions requestAllFields () { + public APIRequestGetSelfCertifiedWhatsAppBusinessSubmissions requestAllFields () { return this.requestAllFields(true); } - public APIRequestGetSelfCertifiedWhatsappBusinessSubmissions requestAllFields (boolean value) { + public APIRequestGetSelfCertifiedWhatsAppBusinessSubmissions requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -22413,12 +22836,12 @@ public APIRequestGetSelfCertifiedWhatsappBusinessSubmissions requestAllFields (b } @Override - public APIRequestGetSelfCertifiedWhatsappBusinessSubmissions requestFields (List fields) { + public APIRequestGetSelfCertifiedWhatsAppBusinessSubmissions requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestGetSelfCertifiedWhatsappBusinessSubmissions requestFields (List fields, boolean value) { + public APIRequestGetSelfCertifiedWhatsAppBusinessSubmissions requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -22426,63 +22849,63 @@ public APIRequestGetSelfCertifiedWhatsappBusinessSubmissions requestFields (List } @Override - public APIRequestGetSelfCertifiedWhatsappBusinessSubmissions requestField (String field) { + public APIRequestGetSelfCertifiedWhatsAppBusinessSubmissions requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestGetSelfCertifiedWhatsappBusinessSubmissions requestField (String field, boolean value) { + public APIRequestGetSelfCertifiedWhatsAppBusinessSubmissions requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } - public APIRequestGetSelfCertifiedWhatsappBusinessSubmissions requestClientBusinessIdField () { + public APIRequestGetSelfCertifiedWhatsAppBusinessSubmissions requestClientBusinessIdField () { return this.requestClientBusinessIdField(true); } - public APIRequestGetSelfCertifiedWhatsappBusinessSubmissions requestClientBusinessIdField (boolean value) { + public APIRequestGetSelfCertifiedWhatsAppBusinessSubmissions requestClientBusinessIdField (boolean value) { this.requestField("client_business_id", value); return this; } - public APIRequestGetSelfCertifiedWhatsappBusinessSubmissions requestIdField () { + public APIRequestGetSelfCertifiedWhatsAppBusinessSubmissions requestIdField () { return this.requestIdField(true); } - public APIRequestGetSelfCertifiedWhatsappBusinessSubmissions requestIdField (boolean value) { + public APIRequestGetSelfCertifiedWhatsAppBusinessSubmissions requestIdField (boolean value) { this.requestField("id", value); return this; } - public APIRequestGetSelfCertifiedWhatsappBusinessSubmissions requestRejectionReasonsField () { + public APIRequestGetSelfCertifiedWhatsAppBusinessSubmissions requestRejectionReasonsField () { return this.requestRejectionReasonsField(true); } - public APIRequestGetSelfCertifiedWhatsappBusinessSubmissions requestRejectionReasonsField (boolean value) { + public APIRequestGetSelfCertifiedWhatsAppBusinessSubmissions requestRejectionReasonsField (boolean value) { this.requestField("rejection_reasons", value); return this; } - public APIRequestGetSelfCertifiedWhatsappBusinessSubmissions requestSubmittedInfoField () { + public APIRequestGetSelfCertifiedWhatsAppBusinessSubmissions requestSubmittedInfoField () { return this.requestSubmittedInfoField(true); } - public APIRequestGetSelfCertifiedWhatsappBusinessSubmissions requestSubmittedInfoField (boolean value) { + public APIRequestGetSelfCertifiedWhatsAppBusinessSubmissions requestSubmittedInfoField (boolean value) { this.requestField("submitted_info", value); return this; } - public APIRequestGetSelfCertifiedWhatsappBusinessSubmissions requestSubmittedTimeField () { + public APIRequestGetSelfCertifiedWhatsAppBusinessSubmissions requestSubmittedTimeField () { return this.requestSubmittedTimeField(true); } - public APIRequestGetSelfCertifiedWhatsappBusinessSubmissions requestSubmittedTimeField (boolean value) { + public APIRequestGetSelfCertifiedWhatsAppBusinessSubmissions requestSubmittedTimeField (boolean value) { this.requestField("submitted_time", value); return this; } - public APIRequestGetSelfCertifiedWhatsappBusinessSubmissions requestUpdateTimeField () { + public APIRequestGetSelfCertifiedWhatsAppBusinessSubmissions requestUpdateTimeField () { return this.requestUpdateTimeField(true); } - public APIRequestGetSelfCertifiedWhatsappBusinessSubmissions requestUpdateTimeField (boolean value) { + public APIRequestGetSelfCertifiedWhatsAppBusinessSubmissions requestUpdateTimeField (boolean value) { this.requestField("update_time", value); return this; } - public APIRequestGetSelfCertifiedWhatsappBusinessSubmissions requestVerificationStatusField () { + public APIRequestGetSelfCertifiedWhatsAppBusinessSubmissions requestVerificationStatusField () { return this.requestVerificationStatusField(true); } - public APIRequestGetSelfCertifiedWhatsappBusinessSubmissions requestVerificationStatusField (boolean value) { + public APIRequestGetSelfCertifiedWhatsAppBusinessSubmissions requestVerificationStatusField (boolean value) { this.requestField("verification_status", value); return this; } @@ -23458,7 +23881,6 @@ public AdVideo getLastResponse() { } public static final String[] PARAMS = { "ad_placements_validation_only", - "animated_effect_id", "application_id", "asked_fun_fact_prompt_id", "audio_story_wave_animation_handle", @@ -23596,15 +24018,6 @@ public APIRequestCreateVideo setAdPlacementsValidationOnly (String adPlacementsV return this; } - public APIRequestCreateVideo setAnimatedEffectId (Long animatedEffectId) { - this.setParam("animated_effect_id", animatedEffectId); - return this; - } - public APIRequestCreateVideo setAnimatedEffectId (String animatedEffectId) { - this.setParam("animated_effect_id", animatedEffectId); - return this; - } - public APIRequestCreateVideo setApplicationId (String applicationId) { this.setParam("application_id", applicationId); return this; diff --git a/src/main/java/com/facebook/ads/sdk/BusinessRoleRequest.java b/src/main/java/com/facebook/ads/sdk/BusinessRoleRequest.java index 9870dd03..5e2eba0b 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessRoleRequest.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessRoleRequest.java @@ -57,6 +57,8 @@ public class BusinessRoleRequest extends APINode { private String mId = null; @SerializedName("invite_link") private String mInviteLink = null; + @SerializedName("invited_user_type") + private List mInvitedUserType = null; @SerializedName("ip_role") private String mIpRole = null; @SerializedName("owner") @@ -323,6 +325,10 @@ public String getFieldInviteLink() { return mInviteLink; } + public List getFieldInvitedUserType() { + return mInvitedUserType; + } + public String getFieldIpRole() { return mIpRole; } @@ -476,6 +482,7 @@ public BusinessRoleRequest getLastResponse() { "finance_role", "id", "invite_link", + "invited_user_type", "ip_role", "owner", "role", @@ -630,6 +637,13 @@ public APIRequestGet requestInviteLinkField (boolean value) { this.requestField("invite_link", value); return this; } + public APIRequestGet requestInvitedUserTypeField () { + return this.requestInvitedUserTypeField(true); + } + public APIRequestGet requestInvitedUserTypeField (boolean value) { + this.requestField("invited_user_type", value); + return this; + } public APIRequestGet requestIpRoleField () { return this.requestIpRoleField(true); } @@ -857,6 +871,7 @@ public BusinessRoleRequest copyFrom(BusinessRoleRequest instance) { this.mFinanceRole = instance.mFinanceRole; this.mId = instance.mId; this.mInviteLink = instance.mInviteLink; + this.mInvitedUserType = instance.mInvitedUserType; this.mIpRole = instance.mIpRole; this.mOwner = instance.mOwner; this.mRole = instance.mRole; diff --git a/src/main/java/com/facebook/ads/sdk/BusinessUser.java b/src/main/java/com/facebook/ads/sdk/BusinessUser.java index 4eb32cc9..03cc3a03 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessUser.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessUser.java @@ -3238,6 +3238,25 @@ public APIRequestUpdate requestField (String field, boolean value) { } + public static enum EnumInvitedUserType { + @SerializedName("FB") + VALUE_FB("FB"), + @SerializedName("MWA") + VALUE_MWA("MWA"), + ; + + private String value; + + private EnumInvitedUserType(String value) { + this.value = value; + } + + @Override + public String toString() { + return value; + } + } + public static enum EnumRole { @SerializedName("ADMIN") VALUE_ADMIN("ADMIN"), diff --git a/src/main/java/com/facebook/ads/sdk/CTWAWhatsAppNumbersInfo.java b/src/main/java/com/facebook/ads/sdk/CTWAWhatsAppNumbersInfo.java index d7b5c882..cf0a9509 100644 --- a/src/main/java/com/facebook/ads/sdk/CTWAWhatsAppNumbersInfo.java +++ b/src/main/java/com/facebook/ads/sdk/CTWAWhatsAppNumbersInfo.java @@ -49,6 +49,8 @@ public class CTWAWhatsAppNumbersInfo extends APINode { private Boolean mIsBusinessNumber = null; @SerializedName("page_whatsapp_number_id") private String mPageWhatsappNumberId = null; + @SerializedName("waba_id") + private String mWabaId = null; @SerializedName("whatsapp_number") private String mWhatsappNumber = null; @SerializedName("whatsapp_smb_device") @@ -240,6 +242,15 @@ public CTWAWhatsAppNumbersInfo setFieldPageWhatsappNumberId(String value) { return this; } + public String getFieldWabaId() { + return mWabaId; + } + + public CTWAWhatsAppNumbersInfo setFieldWabaId(String value) { + this.mWabaId = value; + return this; + } + public String getFieldWhatsappNumber() { return mWhatsappNumber; } @@ -279,6 +290,7 @@ public CTWAWhatsAppNumbersInfo copyFrom(CTWAWhatsAppNumbersInfo instance) { this.mFormattedWhatsappNumber = instance.mFormattedWhatsappNumber; this.mIsBusinessNumber = instance.mIsBusinessNumber; this.mPageWhatsappNumberId = instance.mPageWhatsappNumberId; + this.mWabaId = instance.mWabaId; this.mWhatsappNumber = instance.mWhatsappNumber; this.mWhatsappSmbDevice = instance.mWhatsappSmbDevice; this.context = instance.context; diff --git a/src/main/java/com/facebook/ads/sdk/CTXPartnerAppWelcomeMessageFlow.java b/src/main/java/com/facebook/ads/sdk/CTXPartnerAppWelcomeMessageFlow.java index ad71c5d5..3cf1dd44 100644 --- a/src/main/java/com/facebook/ads/sdk/CTXPartnerAppWelcomeMessageFlow.java +++ b/src/main/java/com/facebook/ads/sdk/CTXPartnerAppWelcomeMessageFlow.java @@ -47,6 +47,8 @@ public class CTXPartnerAppWelcomeMessageFlow extends APINode { private List mEligiblePlatforms = null; @SerializedName("id") private String mId = null; + @SerializedName("is_ig_only_flow") + private Boolean mIsIgOnlyFlow = null; @SerializedName("is_used_in_ad") private Boolean mIsUsedInAd = null; @SerializedName("last_update_time") @@ -55,6 +57,8 @@ public class CTXPartnerAppWelcomeMessageFlow extends APINode { private String mName = null; @SerializedName("welcome_message_flow") private String mWelcomeMessageFlow = null; + @SerializedName("welcome_message_sequence") + private String mWelcomeMessageSequence = null; protected static Gson gson = null; CTXPartnerAppWelcomeMessageFlow() { @@ -281,6 +285,10 @@ public String getFieldId() { return mId; } + public Boolean getFieldIsIgOnlyFlow() { + return mIsIgOnlyFlow; + } + public Boolean getFieldIsUsedInAd() { return mIsUsedInAd; } @@ -297,6 +305,10 @@ public String getFieldWelcomeMessageFlow() { return mWelcomeMessageFlow; } + public String getFieldWelcomeMessageSequence() { + return mWelcomeMessageSequence; + } + public static class APIRequestGet extends APIRequest { @@ -313,10 +325,12 @@ public CTXPartnerAppWelcomeMessageFlow getLastResponse() { "compatible_platforms", "eligible_platforms", "id", + "is_ig_only_flow", "is_used_in_ad", "last_update_time", "name", "welcome_message_flow", + "welcome_message_sequence", }; @Override @@ -430,6 +444,13 @@ public APIRequestGet requestIdField (boolean value) { this.requestField("id", value); return this; } + public APIRequestGet requestIsIgOnlyFlowField () { + return this.requestIsIgOnlyFlowField(true); + } + public APIRequestGet requestIsIgOnlyFlowField (boolean value) { + this.requestField("is_ig_only_flow", value); + return this; + } public APIRequestGet requestIsUsedInAdField () { return this.requestIsUsedInAdField(true); } @@ -458,6 +479,13 @@ public APIRequestGet requestWelcomeMessageFlowField (boolean value) { this.requestField("welcome_message_flow", value); return this; } + public APIRequestGet requestWelcomeMessageSequenceField () { + return this.requestWelcomeMessageSequenceField(true); + } + public APIRequestGet requestWelcomeMessageSequenceField (boolean value) { + this.requestField("welcome_message_sequence", value); + return this; + } } @@ -478,10 +506,12 @@ public CTXPartnerAppWelcomeMessageFlow copyFrom(CTXPartnerAppWelcomeMessageFlow this.mCompatiblePlatforms = instance.mCompatiblePlatforms; this.mEligiblePlatforms = instance.mEligiblePlatforms; this.mId = instance.mId; + this.mIsIgOnlyFlow = instance.mIsIgOnlyFlow; this.mIsUsedInAd = instance.mIsUsedInAd; this.mLastUpdateTime = instance.mLastUpdateTime; this.mName = instance.mName; this.mWelcomeMessageFlow = instance.mWelcomeMessageFlow; + this.mWelcomeMessageSequence = instance.mWelcomeMessageSequence; this.context = instance.context; this.rawValue = instance.rawValue; return this; diff --git a/src/main/java/com/facebook/ads/sdk/Campaign.java b/src/main/java/com/facebook/ads/sdk/Campaign.java index 082a5c5d..69ab2f45 100644 --- a/src/main/java/com/facebook/ads/sdk/Campaign.java +++ b/src/main/java/com/facebook/ads/sdk/Campaign.java @@ -103,6 +103,8 @@ public class Campaign extends APINode { private Campaign mSourceCampaign = null; @SerializedName("source_campaign_id") private String mSourceCampaignId = null; + @SerializedName("source_recommendation_type") + private String mSourceRecommendationType = null; @SerializedName("special_ad_categories") private List mSpecialAdCategories = null; @SerializedName("special_ad_category") @@ -510,6 +512,10 @@ public String getFieldSourceCampaignId() { return mSourceCampaignId; } + public String getFieldSourceRecommendationType() { + return mSourceRecommendationType; + } + public List getFieldSpecialAdCategories() { return mSpecialAdCategories; } @@ -1592,6 +1598,7 @@ public APINodeList getLastResponse() { "bid_info", "bid_strategy", "billing_event", + "brand_safety_config", "budget_remaining", "campaign", "campaign_active_time", @@ -1848,6 +1855,13 @@ public APIRequestGetAdSets requestBillingEventField (boolean value) { this.requestField("billing_event", value); return this; } + public APIRequestGetAdSets requestBrandSafetyConfigField () { + return this.requestBrandSafetyConfigField(true); + } + public APIRequestGetAdSets requestBrandSafetyConfigField (boolean value) { + this.requestField("brand_safety_config", value); + return this; + } public APIRequestGetAdSets requestBudgetRemainingField () { return this.requestBudgetRemainingField(true); } @@ -2398,6 +2412,7 @@ public APINodeList getLastResponse() { "smart_promotion_type", "source_campaign", "source_campaign_id", + "source_recommendation_type", "special_ad_categories", "special_ad_category", "special_ad_category_country", @@ -2752,6 +2767,13 @@ public APIRequestGetCopies requestSourceCampaignIdField (boolean value) { this.requestField("source_campaign_id", value); return this; } + public APIRequestGetCopies requestSourceRecommendationTypeField () { + return this.requestSourceRecommendationTypeField(true); + } + public APIRequestGetCopies requestSourceRecommendationTypeField (boolean value) { + this.requestField("source_recommendation_type", value); + return this; + } public APIRequestGetCopies requestSpecialAdCategoriesField () { return this.requestSpecialAdCategoriesField(true); } @@ -3721,6 +3743,7 @@ public Campaign getLastResponse() { "smart_promotion_type", "source_campaign", "source_campaign_id", + "source_recommendation_type", "special_ad_categories", "special_ad_category", "special_ad_category_country", @@ -4075,6 +4098,13 @@ public APIRequestGet requestSourceCampaignIdField (boolean value) { this.requestField("source_campaign_id", value); return this; } + public APIRequestGet requestSourceRecommendationTypeField () { + return this.requestSourceRecommendationTypeField(true); + } + public APIRequestGet requestSourceRecommendationTypeField (boolean value) { + this.requestField("source_recommendation_type", value); + return this; + } public APIRequestGet requestSpecialAdCategoriesField () { return this.requestSpecialAdCategoriesField(true); } @@ -5356,6 +5386,7 @@ public Campaign copyFrom(Campaign instance) { this.mSmartPromotionType = instance.mSmartPromotionType; this.mSourceCampaign = instance.mSourceCampaign; this.mSourceCampaignId = instance.mSourceCampaignId; + this.mSourceRecommendationType = instance.mSourceRecommendationType; this.mSpecialAdCategories = instance.mSpecialAdCategories; this.mSpecialAdCategory = instance.mSpecialAdCategory; this.mSpecialAdCategoryCountry = instance.mSpecialAdCategoryCountry; diff --git a/src/main/java/com/facebook/ads/sdk/CatalogItemAppealStatus.java b/src/main/java/com/facebook/ads/sdk/CatalogItemAppealStatus.java deleted file mode 100644 index 8da3e6ca..00000000 --- a/src/main/java/com/facebook/ads/sdk/CatalogItemAppealStatus.java +++ /dev/null @@ -1,297 +0,0 @@ -/* - * 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 CatalogItemAppealStatus extends APINode { - @SerializedName("handle") - private String mHandle = null; - @SerializedName("item_id") - private Long mItemId = null; - @SerializedName("status") - private EnumStatus mStatus = null; - @SerializedName("use_cases") - private List mUseCases = null; - protected static Gson gson = null; - - public CatalogItemAppealStatus() { - } - - public String getId() { - return null; - } - public static CatalogItemAppealStatus loadJSON(String json, APIContext context, String header) { - CatalogItemAppealStatus catalogItemAppealStatus = getGson().fromJson(json, CatalogItemAppealStatus.class); - if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(catalogItemAppealStatus.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); - } - } - catalogItemAppealStatus.context = context; - catalogItemAppealStatus.rawValue = json; - catalogItemAppealStatus.header = header; - return catalogItemAppealStatus; - } - - public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { - APINodeList catalogItemAppealStatuss = 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++) { - catalogItemAppealStatuss.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); - }; - return catalogItemAppealStatuss; - } 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; - catalogItemAppealStatuss.setCursors(before, after); - } - String previous = paging.has("previous") ? paging.get("previous").getAsString() : null; - String next = paging.has("next") ? paging.get("next").getAsString() : null; - catalogItemAppealStatuss.setPaging(previous, next); - if (context.hasAppSecret()) { - catalogItemAppealStatuss.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++) { - catalogItemAppealStatuss.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()) { - catalogItemAppealStatuss.add(loadJSON(entry.getValue().toString(), context, header)); - } - break; - } - } - if (!isRedownload) { - catalogItemAppealStatuss.add(loadJSON(obj.toString(), context, header)); - } - } - return catalogItemAppealStatuss; - } 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()) { - catalogItemAppealStatuss.add(loadJSON(entry.getValue().toString(), context, header)); - } - return catalogItemAppealStatuss; - } 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) - ) { - catalogItemAppealStatuss.add(loadJSON(value.toString(), context, header)); - } else { - isIdIndexedArray = false; - break; - } - } - if (isIdIndexedArray) { - return catalogItemAppealStatuss; - } - - // Sixth, check if it's pure JsonObject - catalogItemAppealStatuss.clear(); - catalogItemAppealStatuss.add(loadJSON(json, context, header)); - return catalogItemAppealStatuss; - } - } - } 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 String getFieldHandle() { - return mHandle; - } - - public CatalogItemAppealStatus setFieldHandle(String value) { - this.mHandle = value; - return this; - } - - public Long getFieldItemId() { - return mItemId; - } - - public CatalogItemAppealStatus setFieldItemId(Long value) { - this.mItemId = value; - return this; - } - - public EnumStatus getFieldStatus() { - return mStatus; - } - - public CatalogItemAppealStatus setFieldStatus(EnumStatus value) { - this.mStatus = value; - return this; - } - - public List getFieldUseCases() { - return mUseCases; - } - - public CatalogItemAppealStatus setFieldUseCases(List value) { - this.mUseCases = value; - return this; - } - - - - public static enum EnumStatus { - @SerializedName("This item cannot be appealed as it is either approved or already has an appeal") - VALUE_THIS_ITEM_CANNOT_BE_APPEALED_AS_IT_IS_EITHER_APPROVED_OR_ALREADY_HAS_AN_APPEAL("This item cannot be appealed as it is either approved or already has an appeal"), - @SerializedName("This item is not rejected for any of channels") - VALUE_THIS_ITEM_IS_NOT_REJECTED_FOR_ANY_OF_CHANNELS("This item is not rejected for any of channels"), - @SerializedName("We've encountered unexpected error while processing this request. Please try again later !") - VALUE_WE_VE_ENCOUNTERED_UNEXPECTED_ERROR_WHILE_PROCESSING_THIS_REQUEST_PLEASE_TRY_AGAIN_LATER_("We've encountered unexpected error while processing this request. Please try again later !"), - @SerializedName("You've reached the maximum number of item requests you can make this week. You'll be able to request item reviews again within the next 7 days.") - VALUE_YOU_VE_REACHED_THE_MAXIMUM_NUMBER_OF_ITEM_REQUESTS_YOU_CAN_MAKE_THIS_WEEK_YOU_LL_BE_ABLE_TO_REQUEST_ITEM_REVIEWS_AGAIN_WITHIN_THE_NEXT_7_DAYS_("You've reached the maximum number of item requests you can make this week. You'll be able to request item reviews again within the next 7 days."), - @SerializedName("Your request was received. See information below to learn more.") - VALUE_YOUR_REQUEST_WAS_RECEIVED_SEE_INFORMATION_BELOW_TO_LEARN_MORE_("Your request was received. See information below to learn more."), - ; - - private String value; - - private EnumStatus(String value) { - this.value = value; - } - - @Override - public String toString() { - return value; - } - } - - - 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 CatalogItemAppealStatus copyFrom(CatalogItemAppealStatus instance) { - this.mHandle = instance.mHandle; - this.mItemId = instance.mItemId; - this.mStatus = instance.mStatus; - this.mUseCases = instance.mUseCases; - 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 CatalogItemAppealStatus.parseResponse(response, context, request, header); - } - }; - } -} diff --git a/src/main/java/com/facebook/ads/sdk/CatalogItemRejectionReasons.java b/src/main/java/com/facebook/ads/sdk/CatalogItemRejectionReasons.java index e2f4c53a..2a58086e 100644 --- a/src/main/java/com/facebook/ads/sdk/CatalogItemRejectionReasons.java +++ b/src/main/java/com/facebook/ads/sdk/CatalogItemRejectionReasons.java @@ -227,6 +227,8 @@ public static enum EnumCapability { VALUE_UNIVERSAL_CHECKOUT("universal_checkout"), @SerializedName("us_marketplace") VALUE_US_MARKETPLACE("us_marketplace"), + @SerializedName("whatsapp_marketing_message") + VALUE_WHATSAPP_MARKETING_MESSAGE("whatsapp_marketing_message"), ; private String value; diff --git a/src/main/java/com/facebook/ads/sdk/CatalogSmartPixelSettings.java b/src/main/java/com/facebook/ads/sdk/CatalogSmartPixelSettings.java index 0097cf1e..9fff086b 100644 --- a/src/main/java/com/facebook/ads/sdk/CatalogSmartPixelSettings.java +++ b/src/main/java/com/facebook/ads/sdk/CatalogSmartPixelSettings.java @@ -51,10 +51,6 @@ public class CatalogSmartPixelSettings extends APINode { private List mCbbCustomOverrideFilters = null; @SerializedName("cbb_default_filter") private List>> mCbbDefaultFilter = null; - @SerializedName("cbb_default_filter_crawl_params") - private String mCbbDefaultFilterCrawlParams = null; - @SerializedName("cbb_override_type_field_mapping") - private List>> mCbbOverrideTypeFieldMapping = null; @SerializedName("defaults") private List> mDefaults = null; @SerializedName("filters") @@ -75,8 +71,6 @@ public class CatalogSmartPixelSettings extends APINode { private AdsPixel mPixel = null; @SerializedName("property_filter") private List mPropertyFilter = null; - @SerializedName("retention_time_sec") - private Long mRetentionTimeSec = null; @SerializedName("trusted_domains") private List mTrustedDomains = null; protected static Gson gson = null; @@ -316,14 +310,6 @@ public List>> getFieldCbbDefaultFilter() { return mCbbDefaultFilter; } - public String getFieldCbbDefaultFilterCrawlParams() { - return mCbbDefaultFilterCrawlParams; - } - - public List>> getFieldCbbOverrideTypeFieldMapping() { - return mCbbOverrideTypeFieldMapping; - } - public List> getFieldDefaults() { return mDefaults; } @@ -367,10 +353,6 @@ public List getFieldPropertyFilter() { return mPropertyFilter; } - public Long getFieldRetentionTimeSec() { - return mRetentionTimeSec; - } - public List getFieldTrustedDomains() { return mTrustedDomains; } @@ -393,8 +375,6 @@ public CatalogSmartPixelSettings getLastResponse() { "catalog", "cbb_custom_override_filters", "cbb_default_filter", - "cbb_default_filter_crawl_params", - "cbb_override_type_field_mapping", "defaults", "filters", "id", @@ -405,7 +385,6 @@ public CatalogSmartPixelSettings getLastResponse() { "microdata_format_precedence", "pixel", "property_filter", - "retention_time_sec", "trusted_domains", }; @@ -534,20 +513,6 @@ public APIRequestGet requestCbbDefaultFilterField (boolean value) { this.requestField("cbb_default_filter", value); return this; } - public APIRequestGet requestCbbDefaultFilterCrawlParamsField () { - return this.requestCbbDefaultFilterCrawlParamsField(true); - } - public APIRequestGet requestCbbDefaultFilterCrawlParamsField (boolean value) { - this.requestField("cbb_default_filter_crawl_params", value); - return this; - } - public APIRequestGet requestCbbOverrideTypeFieldMappingField () { - return this.requestCbbOverrideTypeFieldMappingField(true); - } - public APIRequestGet requestCbbOverrideTypeFieldMappingField (boolean value) { - this.requestField("cbb_override_type_field_mapping", value); - return this; - } public APIRequestGet requestDefaultsField () { return this.requestDefaultsField(true); } @@ -618,13 +583,6 @@ public APIRequestGet requestPropertyFilterField (boolean value) { this.requestField("property_filter", value); return this; } - public APIRequestGet requestRetentionTimeSecField () { - return this.requestRetentionTimeSecField(true); - } - public APIRequestGet requestRetentionTimeSecField (boolean value) { - this.requestField("retention_time_sec", value); - return this; - } public APIRequestGet requestTrustedDomainsField () { return this.requestTrustedDomainsField(true); } @@ -654,8 +612,6 @@ public CatalogSmartPixelSettings copyFrom(CatalogSmartPixelSettings instance) { this.mCatalog = instance.mCatalog; this.mCbbCustomOverrideFilters = instance.mCbbCustomOverrideFilters; this.mCbbDefaultFilter = instance.mCbbDefaultFilter; - this.mCbbDefaultFilterCrawlParams = instance.mCbbDefaultFilterCrawlParams; - this.mCbbOverrideTypeFieldMapping = instance.mCbbOverrideTypeFieldMapping; this.mDefaults = instance.mDefaults; this.mFilters = instance.mFilters; this.mId = instance.mId; @@ -666,7 +622,6 @@ public CatalogSmartPixelSettings copyFrom(CatalogSmartPixelSettings instance) { this.mMicrodataFormatPrecedence = instance.mMicrodataFormatPrecedence; this.mPixel = instance.mPixel; this.mPropertyFilter = instance.mPropertyFilter; - this.mRetentionTimeSec = instance.mRetentionTimeSec; this.mTrustedDomains = instance.mTrustedDomains; this.context = instance.context; this.rawValue = instance.rawValue; diff --git a/src/main/java/com/facebook/ads/sdk/CommerceMerchantSettings.java b/src/main/java/com/facebook/ads/sdk/CommerceMerchantSettings.java index 87ed593f..f011d25d 100644 --- a/src/main/java/com/facebook/ads/sdk/CommerceMerchantSettings.java +++ b/src/main/java/com/facebook/ads/sdk/CommerceMerchantSettings.java @@ -543,6 +543,7 @@ public APINodeList getLastResponse() { "last_updated", "merchant_order_id", "order_status", + "pre_order_details", "selected_shipping_option", "ship_by_date", "shipping_address", @@ -743,6 +744,13 @@ public APIRequestGetCommerceOrders requestOrderStatusField (boolean value) { this.requestField("order_status", value); return this; } + public APIRequestGetCommerceOrders requestPreOrderDetailsField () { + return this.requestPreOrderDetailsField(true); + } + public APIRequestGetCommerceOrders requestPreOrderDetailsField (boolean value) { + this.requestField("pre_order_details", value); + return this; + } public APIRequestGetCommerceOrders requestSelectedShippingOptionField () { return this.requestSelectedShippingOptionField(true); } @@ -937,10 +945,15 @@ public APINodeList getLastResponse() { }; public static final String[] FIELDS = { + "merchant_order_id", "net_payment_amount", + "order_created", "order_details", + "order_id", "payout_reference_id", + "postal_code", "processing_fee", + "state", "tax_rate", "transaction_date", "transaction_type", @@ -1053,6 +1066,13 @@ public APIRequestGetCommerceTransactions requestField (String field, boolean val return this; } + public APIRequestGetCommerceTransactions requestMerchantOrderIdField () { + return this.requestMerchantOrderIdField(true); + } + public APIRequestGetCommerceTransactions requestMerchantOrderIdField (boolean value) { + this.requestField("merchant_order_id", value); + return this; + } public APIRequestGetCommerceTransactions requestNetPaymentAmountField () { return this.requestNetPaymentAmountField(true); } @@ -1060,6 +1080,13 @@ public APIRequestGetCommerceTransactions requestNetPaymentAmountField (boolean v this.requestField("net_payment_amount", value); return this; } + public APIRequestGetCommerceTransactions requestOrderCreatedField () { + return this.requestOrderCreatedField(true); + } + public APIRequestGetCommerceTransactions requestOrderCreatedField (boolean value) { + this.requestField("order_created", value); + return this; + } public APIRequestGetCommerceTransactions requestOrderDetailsField () { return this.requestOrderDetailsField(true); } @@ -1067,6 +1094,13 @@ public APIRequestGetCommerceTransactions requestOrderDetailsField (boolean value this.requestField("order_details", value); return this; } + public APIRequestGetCommerceTransactions requestOrderIdField () { + return this.requestOrderIdField(true); + } + public APIRequestGetCommerceTransactions requestOrderIdField (boolean value) { + this.requestField("order_id", value); + return this; + } public APIRequestGetCommerceTransactions requestPayoutReferenceIdField () { return this.requestPayoutReferenceIdField(true); } @@ -1074,6 +1108,13 @@ public APIRequestGetCommerceTransactions requestPayoutReferenceIdField (boolean this.requestField("payout_reference_id", value); return this; } + public APIRequestGetCommerceTransactions requestPostalCodeField () { + return this.requestPostalCodeField(true); + } + public APIRequestGetCommerceTransactions requestPostalCodeField (boolean value) { + this.requestField("postal_code", value); + return this; + } public APIRequestGetCommerceTransactions requestProcessingFeeField () { return this.requestProcessingFeeField(true); } @@ -1081,6 +1122,13 @@ public APIRequestGetCommerceTransactions requestProcessingFeeField (boolean valu this.requestField("processing_fee", value); return this; } + public APIRequestGetCommerceTransactions requestStateField () { + return this.requestStateField(true); + } + public APIRequestGetCommerceTransactions requestStateField (boolean value) { + this.requestField("state", value); + return this; + } public APIRequestGetCommerceTransactions requestTaxRateField () { return this.requestTaxRateField(true); } diff --git a/src/main/java/com/facebook/ads/sdk/CommerceOrder.java b/src/main/java/com/facebook/ads/sdk/CommerceOrder.java index f4c95b70..7d342718 100644 --- a/src/main/java/com/facebook/ads/sdk/CommerceOrder.java +++ b/src/main/java/com/facebook/ads/sdk/CommerceOrder.java @@ -63,6 +63,8 @@ public class CommerceOrder extends APINode { private String mMerchantOrderId = null; @SerializedName("order_status") private Object mOrderStatus = null; + @SerializedName("pre_order_details") + private Object mPreOrderDetails = null; @SerializedName("selected_shipping_option") private Object mSelectedShippingOption = null; @SerializedName("ship_by_date") @@ -286,8 +288,8 @@ public APIRequestGetCancellations getCancellations() { return new APIRequestGetCancellations(this.getPrefixedId().toString(), context); } - public APIRequestCreateCanCellATIOn createCanCellATIOn() { - return new APIRequestCreateCanCellATIOn(this.getPrefixedId().toString(), context); + public APIRequestCreateCancellation createCancellation() { + return new APIRequestCreateCancellation(this.getPrefixedId().toString(), context); } public APIRequestCreateItemUpdate createItemUpdate() { @@ -391,6 +393,10 @@ public Object getFieldOrderStatus() { return mOrderStatus; } + public Object getFieldPreOrderDetails() { + return mPreOrderDetails; + } + public Object getFieldSelectedShippingOption() { return mSelectedShippingOption; } @@ -627,7 +633,7 @@ public APIRequestGetCancellations requestField (String field, boolean value) { } - public static class APIRequestCreateCanCellATIOn extends APIRequest { + public static class APIRequestCreateCancellation extends APIRequest { CommerceOrder lastResponse = null; @Override @@ -671,7 +677,7 @@ public ListenableFuture executeAsync(Map extraPar new Function() { public CommerceOrder apply(ResponseWrapper result) { try { - return APIRequestCreateCanCellATIOn.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestCreateCancellation.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -681,60 +687,60 @@ public CommerceOrder apply(ResponseWrapper result) { ); }; - public APIRequestCreateCanCellATIOn(String nodeId, APIContext context) { + public APIRequestCreateCancellation(String nodeId, APIContext context) { super(context, nodeId, "/cancellations", "POST", Arrays.asList(PARAMS)); } @Override - public APIRequestCreateCanCellATIOn setParam(String param, Object value) { + public APIRequestCreateCancellation setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestCreateCanCellATIOn setParams(Map params) { + public APIRequestCreateCancellation setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestCreateCanCellATIOn setCancelReason (Map cancelReason) { + public APIRequestCreateCancellation setCancelReason (Map cancelReason) { this.setParam("cancel_reason", cancelReason); return this; } - public APIRequestCreateCanCellATIOn setCancelReason (String cancelReason) { + public APIRequestCreateCancellation setCancelReason (String cancelReason) { this.setParam("cancel_reason", cancelReason); return this; } - public APIRequestCreateCanCellATIOn setIdempotencyKey (String idempotencyKey) { + public APIRequestCreateCancellation setIdempotencyKey (String idempotencyKey) { this.setParam("idempotency_key", idempotencyKey); return this; } - public APIRequestCreateCanCellATIOn setItems (List> items) { + public APIRequestCreateCancellation setItems (List> items) { this.setParam("items", items); return this; } - public APIRequestCreateCanCellATIOn setItems (String items) { + public APIRequestCreateCancellation setItems (String items) { this.setParam("items", items); return this; } - public APIRequestCreateCanCellATIOn setRestockItems (Boolean restockItems) { + public APIRequestCreateCancellation setRestockItems (Boolean restockItems) { this.setParam("restock_items", restockItems); return this; } - public APIRequestCreateCanCellATIOn setRestockItems (String restockItems) { + public APIRequestCreateCancellation setRestockItems (String restockItems) { this.setParam("restock_items", restockItems); return this; } - public APIRequestCreateCanCellATIOn requestAllFields () { + public APIRequestCreateCancellation requestAllFields () { return this.requestAllFields(true); } - public APIRequestCreateCanCellATIOn requestAllFields (boolean value) { + public APIRequestCreateCancellation requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -742,12 +748,12 @@ public APIRequestCreateCanCellATIOn requestAllFields (boolean value) { } @Override - public APIRequestCreateCanCellATIOn requestFields (List fields) { + public APIRequestCreateCancellation requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestCreateCanCellATIOn requestFields (List fields, boolean value) { + public APIRequestCreateCancellation requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -755,13 +761,13 @@ public APIRequestCreateCanCellATIOn requestFields (List fields, boolean } @Override - public APIRequestCreateCanCellATIOn requestField (String field) { + public APIRequestCreateCancellation requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestCreateCanCellATIOn requestField (String field, boolean value) { + public APIRequestCreateCancellation requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } @@ -2447,6 +2453,7 @@ public CommerceOrder getLastResponse() { "last_updated", "merchant_order_id", "order_status", + "pre_order_details", "selected_shipping_option", "ship_by_date", "shipping_address", @@ -2619,6 +2626,13 @@ public APIRequestGet requestOrderStatusField (boolean value) { this.requestField("order_status", value); return this; } + public APIRequestGet requestPreOrderDetailsField () { + return this.requestPreOrderDetailsField(true); + } + public APIRequestGet requestPreOrderDetailsField (boolean value) { + this.requestField("pre_order_details", value); + return this; + } public APIRequestGet requestSelectedShippingOptionField () { return this.requestSelectedShippingOptionField(true); } @@ -2780,6 +2794,7 @@ public CommerceOrder copyFrom(CommerceOrder instance) { this.mLastUpdated = instance.mLastUpdated; this.mMerchantOrderId = instance.mMerchantOrderId; this.mOrderStatus = instance.mOrderStatus; + this.mPreOrderDetails = instance.mPreOrderDetails; this.mSelectedShippingOption = instance.mSelectedShippingOption; this.mShipByDate = instance.mShipByDate; this.mShippingAddress = instance.mShippingAddress; diff --git a/src/main/java/com/facebook/ads/sdk/CommerceOrderTransactionDetail.java b/src/main/java/com/facebook/ads/sdk/CommerceOrderTransactionDetail.java index d984dc0f..198322a4 100644 --- a/src/main/java/com/facebook/ads/sdk/CommerceOrderTransactionDetail.java +++ b/src/main/java/com/facebook/ads/sdk/CommerceOrderTransactionDetail.java @@ -41,14 +41,24 @@ * */ public class CommerceOrderTransactionDetail extends APINode { + @SerializedName("merchant_order_id") + private String mMerchantOrderId = null; @SerializedName("net_payment_amount") private Object mNetPaymentAmount = null; + @SerializedName("order_created") + private String mOrderCreated = null; @SerializedName("order_details") private CommerceOrder mOrderDetails = null; + @SerializedName("order_id") + private String mOrderId = null; @SerializedName("payout_reference_id") private String mPayoutReferenceId = null; + @SerializedName("postal_code") + private String mPostalCode = null; @SerializedName("processing_fee") private Object mProcessingFee = null; + @SerializedName("state") + private String mState = null; @SerializedName("tax_rate") private String mTaxRate = null; @SerializedName("transaction_date") @@ -218,6 +228,15 @@ public APIRequestGetTaxDetails getTaxDetails() { } + public String getFieldMerchantOrderId() { + return mMerchantOrderId; + } + + public CommerceOrderTransactionDetail setFieldMerchantOrderId(String value) { + this.mMerchantOrderId = value; + return this; + } + public Object getFieldNetPaymentAmount() { return mNetPaymentAmount; } @@ -227,6 +246,15 @@ public CommerceOrderTransactionDetail setFieldNetPaymentAmount(Object value) { return this; } + public String getFieldOrderCreated() { + return mOrderCreated; + } + + public CommerceOrderTransactionDetail setFieldOrderCreated(String value) { + this.mOrderCreated = value; + return this; + } + public CommerceOrder getFieldOrderDetails() { if (mOrderDetails != null) { mOrderDetails.context = getContext(); @@ -244,6 +272,15 @@ public CommerceOrderTransactionDetail setFieldOrderDetails(String value) { this.mOrderDetails = CommerceOrder.getGson().fromJson(value, type); return this; } + public String getFieldOrderId() { + return mOrderId; + } + + public CommerceOrderTransactionDetail setFieldOrderId(String value) { + this.mOrderId = value; + return this; + } + public String getFieldPayoutReferenceId() { return mPayoutReferenceId; } @@ -253,6 +290,15 @@ public CommerceOrderTransactionDetail setFieldPayoutReferenceId(String value) { return this; } + public String getFieldPostalCode() { + return mPostalCode; + } + + public CommerceOrderTransactionDetail setFieldPostalCode(String value) { + this.mPostalCode = value; + return this; + } + public Object getFieldProcessingFee() { return mProcessingFee; } @@ -262,6 +308,15 @@ public CommerceOrderTransactionDetail setFieldProcessingFee(Object value) { return this; } + public String getFieldState() { + return mState; + } + + public CommerceOrderTransactionDetail setFieldState(String value) { + this.mState = value; + return this; + } + public String getFieldTaxRate() { return mTaxRate; } @@ -534,10 +589,15 @@ public APIRequestGetTaxDetails requestField (String field, boolean value) { } public CommerceOrderTransactionDetail copyFrom(CommerceOrderTransactionDetail instance) { + this.mMerchantOrderId = instance.mMerchantOrderId; this.mNetPaymentAmount = instance.mNetPaymentAmount; + this.mOrderCreated = instance.mOrderCreated; this.mOrderDetails = instance.mOrderDetails; + this.mOrderId = instance.mOrderId; this.mPayoutReferenceId = instance.mPayoutReferenceId; + this.mPostalCode = instance.mPostalCode; this.mProcessingFee = instance.mProcessingFee; + this.mState = instance.mState; this.mTaxRate = instance.mTaxRate; this.mTransactionDate = instance.mTransactionDate; this.mTransactionType = instance.mTransactionType; diff --git a/src/main/java/com/facebook/ads/sdk/ContentBlockList.java b/src/main/java/com/facebook/ads/sdk/ContentBlockList.java new file mode 100644 index 00000000..9e9eb5cd --- /dev/null +++ b/src/main/java/com/facebook/ads/sdk/ContentBlockList.java @@ -0,0 +1,1471 @@ +/* + * 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 ContentBlockList extends APINode { + @SerializedName("business") + private Business mBusiness = null; + @SerializedName("id") + private String mId = null; + @SerializedName("name") + private String mName = null; + protected static Gson gson = null; + + ContentBlockList() { + } + + public ContentBlockList(Long id, APIContext context) { + this(id.toString(), context); + } + + public ContentBlockList(String id, APIContext context) { + this.mId = id; + + this.context = context; + } + + public ContentBlockList fetch() throws APIException{ + ContentBlockList newInstance = fetchById(this.getPrefixedId().toString(), this.context); + this.copyFrom(newInstance); + return this; + } + + public static ContentBlockList 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 ContentBlockList 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", ContentBlockList.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", ContentBlockList.getParser()) + .setParam("ids", APIRequest.joinStringList(ids)) + .requestFields(fields) + .executeAsyncBase(); + } + + private String getPrefixedId() { + return getId(); + } + + public String getId() { + return getFieldId().toString(); + } + public static ContentBlockList loadJSON(String json, APIContext context, String header) { + ContentBlockList contentBlockList = getGson().fromJson(json, ContentBlockList.class); + if (context.isDebug()) { + JsonParser parser = new JsonParser(); + JsonElement o1 = parser.parse(json); + JsonElement o2 = parser.parse(contentBlockList.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); + } + } + contentBlockList.context = context; + contentBlockList.rawValue = json; + contentBlockList.header = header; + return contentBlockList; + } + + public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { + APINodeList contentBlockLists = 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++) { + contentBlockLists.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); + }; + return contentBlockLists; + } 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; + contentBlockLists.setCursors(before, after); + } + String previous = paging.has("previous") ? paging.get("previous").getAsString() : null; + String next = paging.has("next") ? paging.get("next").getAsString() : null; + contentBlockLists.setPaging(previous, next); + if (context.hasAppSecret()) { + contentBlockLists.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++) { + contentBlockLists.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()) { + contentBlockLists.add(loadJSON(entry.getValue().toString(), context, header)); + } + break; + } + } + if (!isRedownload) { + contentBlockLists.add(loadJSON(obj.toString(), context, header)); + } + } + return contentBlockLists; + } 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()) { + contentBlockLists.add(loadJSON(entry.getValue().toString(), context, header)); + } + return contentBlockLists; + } 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) + ) { + contentBlockLists.add(loadJSON(value.toString(), context, header)); + } else { + isIdIndexedArray = false; + break; + } + } + if (isIdIndexedArray) { + return contentBlockLists; + } + + // Sixth, check if it's pure JsonObject + contentBlockLists.clear(); + contentBlockLists.add(loadJSON(json, context, header)); + return contentBlockLists; + } + } + } 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 APIRequestGetAppliedAdAccounts getAppliedAdAccounts() { + return new APIRequestGetAppliedAdAccounts(this.getPrefixedId().toString(), context); + } + + public APIRequestGetFacebookContent getFacebookContent() { + return new APIRequestGetFacebookContent(this.getPrefixedId().toString(), context); + } + + public APIRequestGetInstagramContent getInstagramContent() { + return new APIRequestGetInstagramContent(this.getPrefixedId().toString(), context); + } + + public APIRequestGet get() { + return new APIRequestGet(this.getPrefixedId().toString(), context); + } + + + public Business getFieldBusiness() { + if (mBusiness != null) { + mBusiness.context = getContext(); + } + return mBusiness; + } + + public String getFieldId() { + return mId; + } + + public String getFieldName() { + return mName; + } + + + + public static class APIRequestGetAppliedAdAccounts extends APIRequest { + + APINodeList lastResponse = null; + @Override + public APINodeList getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + }; + + public static final String[] FIELDS = { + "account_id", + "account_status", + "ad_account_promotable_objects", + "age", + "agency_client_declaration", + "all_capabilities", + "amount_spent", + "attribution_spec", + "balance", + "brand_safety_content_filter_levels", + "business", + "business_city", + "business_country_code", + "business_name", + "business_state", + "business_street", + "business_street2", + "business_zip", + "capabilities", + "created_time", + "currency", + "custom_audience_info", + "default_dsa_beneficiary", + "default_dsa_payor", + "disable_reason", + "end_advertiser", + "end_advertiser_name", + "existing_customers", + "extended_credit_invoice_group", + "failed_delivery_checks", + "fb_entity", + "funding_source", + "funding_source_details", + "has_migrated_permissions", + "has_page_authorized_adaccount", + "id", + "io_number", + "is_attribution_spec_system_default", + "is_direct_deals_enabled", + "is_in_3ds_authorization_enabled_market", + "is_notifications_enabled", + "is_personal", + "is_prepay_account", + "is_tax_id_required", + "liable_address", + "line_numbers", + "media_agency", + "min_campaign_group_spend_cap", + "min_daily_budget", + "name", + "offsite_pixels_tos_accepted", + "owner", + "owner_business", + "partner", + "rf_spec", + "send_bill_to_address", + "show_checkout_experience", + "sold_to_address", + "spend_cap", + "tax_id", + "tax_id_status", + "tax_id_type", + "timezone_id", + "timezone_name", + "timezone_offset_hours_utc", + "tos_accepted", + "user_access_expire_time", + "user_tasks", + "user_tos_accepted", + "viewable_business", + }; + + @Override + public APINodeList parseResponse(String response, String header) throws APIException { + return AdAccount.parseResponse(response, getContext(), this, header); + } + + @Override + public APINodeList execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + try { + return APIRequestGetAppliedAdAccounts.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestGetAppliedAdAccounts(String nodeId, APIContext context) { + super(context, nodeId, "/applied_ad_accounts", "GET", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestGetAppliedAdAccounts setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestGetAppliedAdAccounts setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestGetAppliedAdAccounts requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestGetAppliedAdAccounts requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetAppliedAdAccounts requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestGetAppliedAdAccounts requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetAppliedAdAccounts requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestGetAppliedAdAccounts requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + public APIRequestGetAppliedAdAccounts requestAccountIdField () { + return this.requestAccountIdField(true); + } + public APIRequestGetAppliedAdAccounts requestAccountIdField (boolean value) { + this.requestField("account_id", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestAccountStatusField () { + return this.requestAccountStatusField(true); + } + public APIRequestGetAppliedAdAccounts requestAccountStatusField (boolean value) { + this.requestField("account_status", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestAdAccountPromotableObjectsField () { + return this.requestAdAccountPromotableObjectsField(true); + } + public APIRequestGetAppliedAdAccounts requestAdAccountPromotableObjectsField (boolean value) { + this.requestField("ad_account_promotable_objects", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestAgeField () { + return this.requestAgeField(true); + } + public APIRequestGetAppliedAdAccounts requestAgeField (boolean value) { + this.requestField("age", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestAgencyClientDeclarationField () { + return this.requestAgencyClientDeclarationField(true); + } + public APIRequestGetAppliedAdAccounts requestAgencyClientDeclarationField (boolean value) { + this.requestField("agency_client_declaration", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestAllCapabilitiesField () { + return this.requestAllCapabilitiesField(true); + } + public APIRequestGetAppliedAdAccounts requestAllCapabilitiesField (boolean value) { + this.requestField("all_capabilities", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestAmountSpentField () { + return this.requestAmountSpentField(true); + } + public APIRequestGetAppliedAdAccounts requestAmountSpentField (boolean value) { + this.requestField("amount_spent", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestAttributionSpecField () { + return this.requestAttributionSpecField(true); + } + public APIRequestGetAppliedAdAccounts requestAttributionSpecField (boolean value) { + this.requestField("attribution_spec", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestBalanceField () { + return this.requestBalanceField(true); + } + public APIRequestGetAppliedAdAccounts requestBalanceField (boolean value) { + this.requestField("balance", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestBrandSafetyContentFilterLevelsField () { + return this.requestBrandSafetyContentFilterLevelsField(true); + } + public APIRequestGetAppliedAdAccounts requestBrandSafetyContentFilterLevelsField (boolean value) { + this.requestField("brand_safety_content_filter_levels", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestBusinessField () { + return this.requestBusinessField(true); + } + public APIRequestGetAppliedAdAccounts requestBusinessField (boolean value) { + this.requestField("business", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestBusinessCityField () { + return this.requestBusinessCityField(true); + } + public APIRequestGetAppliedAdAccounts requestBusinessCityField (boolean value) { + this.requestField("business_city", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestBusinessCountryCodeField () { + return this.requestBusinessCountryCodeField(true); + } + public APIRequestGetAppliedAdAccounts requestBusinessCountryCodeField (boolean value) { + this.requestField("business_country_code", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestBusinessNameField () { + return this.requestBusinessNameField(true); + } + public APIRequestGetAppliedAdAccounts requestBusinessNameField (boolean value) { + this.requestField("business_name", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestBusinessStateField () { + return this.requestBusinessStateField(true); + } + public APIRequestGetAppliedAdAccounts requestBusinessStateField (boolean value) { + this.requestField("business_state", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestBusinessStreetField () { + return this.requestBusinessStreetField(true); + } + public APIRequestGetAppliedAdAccounts requestBusinessStreetField (boolean value) { + this.requestField("business_street", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestBusinessStreet2Field () { + return this.requestBusinessStreet2Field(true); + } + public APIRequestGetAppliedAdAccounts requestBusinessStreet2Field (boolean value) { + this.requestField("business_street2", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestBusinessZipField () { + return this.requestBusinessZipField(true); + } + public APIRequestGetAppliedAdAccounts requestBusinessZipField (boolean value) { + this.requestField("business_zip", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestCapabilitiesField () { + return this.requestCapabilitiesField(true); + } + public APIRequestGetAppliedAdAccounts requestCapabilitiesField (boolean value) { + this.requestField("capabilities", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestCreatedTimeField () { + return this.requestCreatedTimeField(true); + } + public APIRequestGetAppliedAdAccounts requestCreatedTimeField (boolean value) { + this.requestField("created_time", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestCurrencyField () { + return this.requestCurrencyField(true); + } + public APIRequestGetAppliedAdAccounts requestCurrencyField (boolean value) { + this.requestField("currency", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestCustomAudienceInfoField () { + return this.requestCustomAudienceInfoField(true); + } + public APIRequestGetAppliedAdAccounts requestCustomAudienceInfoField (boolean value) { + this.requestField("custom_audience_info", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestDefaultDsaBeneficiaryField () { + return this.requestDefaultDsaBeneficiaryField(true); + } + public APIRequestGetAppliedAdAccounts requestDefaultDsaBeneficiaryField (boolean value) { + this.requestField("default_dsa_beneficiary", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestDefaultDsaPayorField () { + return this.requestDefaultDsaPayorField(true); + } + public APIRequestGetAppliedAdAccounts requestDefaultDsaPayorField (boolean value) { + this.requestField("default_dsa_payor", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestDisableReasonField () { + return this.requestDisableReasonField(true); + } + public APIRequestGetAppliedAdAccounts requestDisableReasonField (boolean value) { + this.requestField("disable_reason", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestEndAdvertiserField () { + return this.requestEndAdvertiserField(true); + } + public APIRequestGetAppliedAdAccounts requestEndAdvertiserField (boolean value) { + this.requestField("end_advertiser", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestEndAdvertiserNameField () { + return this.requestEndAdvertiserNameField(true); + } + public APIRequestGetAppliedAdAccounts requestEndAdvertiserNameField (boolean value) { + this.requestField("end_advertiser_name", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestExistingCustomersField () { + return this.requestExistingCustomersField(true); + } + public APIRequestGetAppliedAdAccounts requestExistingCustomersField (boolean value) { + this.requestField("existing_customers", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestExtendedCreditInvoiceGroupField () { + return this.requestExtendedCreditInvoiceGroupField(true); + } + public APIRequestGetAppliedAdAccounts requestExtendedCreditInvoiceGroupField (boolean value) { + this.requestField("extended_credit_invoice_group", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestFailedDeliveryChecksField () { + return this.requestFailedDeliveryChecksField(true); + } + public APIRequestGetAppliedAdAccounts requestFailedDeliveryChecksField (boolean value) { + this.requestField("failed_delivery_checks", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestFbEntityField () { + return this.requestFbEntityField(true); + } + public APIRequestGetAppliedAdAccounts requestFbEntityField (boolean value) { + this.requestField("fb_entity", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestFundingSourceField () { + return this.requestFundingSourceField(true); + } + public APIRequestGetAppliedAdAccounts requestFundingSourceField (boolean value) { + this.requestField("funding_source", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestFundingSourceDetailsField () { + return this.requestFundingSourceDetailsField(true); + } + public APIRequestGetAppliedAdAccounts requestFundingSourceDetailsField (boolean value) { + this.requestField("funding_source_details", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestHasMigratedPermissionsField () { + return this.requestHasMigratedPermissionsField(true); + } + public APIRequestGetAppliedAdAccounts requestHasMigratedPermissionsField (boolean value) { + this.requestField("has_migrated_permissions", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestHasPageAuthorizedAdaccountField () { + return this.requestHasPageAuthorizedAdaccountField(true); + } + public APIRequestGetAppliedAdAccounts requestHasPageAuthorizedAdaccountField (boolean value) { + this.requestField("has_page_authorized_adaccount", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestIdField () { + return this.requestIdField(true); + } + public APIRequestGetAppliedAdAccounts requestIdField (boolean value) { + this.requestField("id", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestIoNumberField () { + return this.requestIoNumberField(true); + } + public APIRequestGetAppliedAdAccounts requestIoNumberField (boolean value) { + this.requestField("io_number", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestIsAttributionSpecSystemDefaultField () { + return this.requestIsAttributionSpecSystemDefaultField(true); + } + public APIRequestGetAppliedAdAccounts requestIsAttributionSpecSystemDefaultField (boolean value) { + this.requestField("is_attribution_spec_system_default", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestIsDirectDealsEnabledField () { + return this.requestIsDirectDealsEnabledField(true); + } + public APIRequestGetAppliedAdAccounts requestIsDirectDealsEnabledField (boolean value) { + this.requestField("is_direct_deals_enabled", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestIsIn3dsAuthorizationEnabledMarketField () { + return this.requestIsIn3dsAuthorizationEnabledMarketField(true); + } + public APIRequestGetAppliedAdAccounts requestIsIn3dsAuthorizationEnabledMarketField (boolean value) { + this.requestField("is_in_3ds_authorization_enabled_market", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestIsNotificationsEnabledField () { + return this.requestIsNotificationsEnabledField(true); + } + public APIRequestGetAppliedAdAccounts requestIsNotificationsEnabledField (boolean value) { + this.requestField("is_notifications_enabled", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestIsPersonalField () { + return this.requestIsPersonalField(true); + } + public APIRequestGetAppliedAdAccounts requestIsPersonalField (boolean value) { + this.requestField("is_personal", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestIsPrepayAccountField () { + return this.requestIsPrepayAccountField(true); + } + public APIRequestGetAppliedAdAccounts requestIsPrepayAccountField (boolean value) { + this.requestField("is_prepay_account", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestIsTaxIdRequiredField () { + return this.requestIsTaxIdRequiredField(true); + } + public APIRequestGetAppliedAdAccounts requestIsTaxIdRequiredField (boolean value) { + this.requestField("is_tax_id_required", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestLiableAddressField () { + return this.requestLiableAddressField(true); + } + public APIRequestGetAppliedAdAccounts requestLiableAddressField (boolean value) { + this.requestField("liable_address", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestLineNumbersField () { + return this.requestLineNumbersField(true); + } + public APIRequestGetAppliedAdAccounts requestLineNumbersField (boolean value) { + this.requestField("line_numbers", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestMediaAgencyField () { + return this.requestMediaAgencyField(true); + } + public APIRequestGetAppliedAdAccounts requestMediaAgencyField (boolean value) { + this.requestField("media_agency", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestMinCampaignGroupSpendCapField () { + return this.requestMinCampaignGroupSpendCapField(true); + } + public APIRequestGetAppliedAdAccounts requestMinCampaignGroupSpendCapField (boolean value) { + this.requestField("min_campaign_group_spend_cap", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestMinDailyBudgetField () { + return this.requestMinDailyBudgetField(true); + } + public APIRequestGetAppliedAdAccounts requestMinDailyBudgetField (boolean value) { + this.requestField("min_daily_budget", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestNameField () { + return this.requestNameField(true); + } + public APIRequestGetAppliedAdAccounts requestNameField (boolean value) { + this.requestField("name", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestOffsitePixelsTosAcceptedField () { + return this.requestOffsitePixelsTosAcceptedField(true); + } + public APIRequestGetAppliedAdAccounts requestOffsitePixelsTosAcceptedField (boolean value) { + this.requestField("offsite_pixels_tos_accepted", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestOwnerField () { + return this.requestOwnerField(true); + } + public APIRequestGetAppliedAdAccounts requestOwnerField (boolean value) { + this.requestField("owner", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestOwnerBusinessField () { + return this.requestOwnerBusinessField(true); + } + public APIRequestGetAppliedAdAccounts requestOwnerBusinessField (boolean value) { + this.requestField("owner_business", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestPartnerField () { + return this.requestPartnerField(true); + } + public APIRequestGetAppliedAdAccounts requestPartnerField (boolean value) { + this.requestField("partner", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestRfSpecField () { + return this.requestRfSpecField(true); + } + public APIRequestGetAppliedAdAccounts requestRfSpecField (boolean value) { + this.requestField("rf_spec", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestSendBillToAddressField () { + return this.requestSendBillToAddressField(true); + } + public APIRequestGetAppliedAdAccounts requestSendBillToAddressField (boolean value) { + this.requestField("send_bill_to_address", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestShowCheckoutExperienceField () { + return this.requestShowCheckoutExperienceField(true); + } + public APIRequestGetAppliedAdAccounts requestShowCheckoutExperienceField (boolean value) { + this.requestField("show_checkout_experience", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestSoldToAddressField () { + return this.requestSoldToAddressField(true); + } + public APIRequestGetAppliedAdAccounts requestSoldToAddressField (boolean value) { + this.requestField("sold_to_address", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestSpendCapField () { + return this.requestSpendCapField(true); + } + public APIRequestGetAppliedAdAccounts requestSpendCapField (boolean value) { + this.requestField("spend_cap", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestTaxIdField () { + return this.requestTaxIdField(true); + } + public APIRequestGetAppliedAdAccounts requestTaxIdField (boolean value) { + this.requestField("tax_id", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestTaxIdStatusField () { + return this.requestTaxIdStatusField(true); + } + public APIRequestGetAppliedAdAccounts requestTaxIdStatusField (boolean value) { + this.requestField("tax_id_status", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestTaxIdTypeField () { + return this.requestTaxIdTypeField(true); + } + public APIRequestGetAppliedAdAccounts requestTaxIdTypeField (boolean value) { + this.requestField("tax_id_type", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestTimezoneIdField () { + return this.requestTimezoneIdField(true); + } + public APIRequestGetAppliedAdAccounts requestTimezoneIdField (boolean value) { + this.requestField("timezone_id", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestTimezoneNameField () { + return this.requestTimezoneNameField(true); + } + public APIRequestGetAppliedAdAccounts requestTimezoneNameField (boolean value) { + this.requestField("timezone_name", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestTimezoneOffsetHoursUtcField () { + return this.requestTimezoneOffsetHoursUtcField(true); + } + public APIRequestGetAppliedAdAccounts requestTimezoneOffsetHoursUtcField (boolean value) { + this.requestField("timezone_offset_hours_utc", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestTosAcceptedField () { + return this.requestTosAcceptedField(true); + } + public APIRequestGetAppliedAdAccounts requestTosAcceptedField (boolean value) { + this.requestField("tos_accepted", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestUserAccessExpireTimeField () { + return this.requestUserAccessExpireTimeField(true); + } + public APIRequestGetAppliedAdAccounts requestUserAccessExpireTimeField (boolean value) { + this.requestField("user_access_expire_time", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestUserTasksField () { + return this.requestUserTasksField(true); + } + public APIRequestGetAppliedAdAccounts requestUserTasksField (boolean value) { + this.requestField("user_tasks", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestUserTosAcceptedField () { + return this.requestUserTosAcceptedField(true); + } + public APIRequestGetAppliedAdAccounts requestUserTosAcceptedField (boolean value) { + this.requestField("user_tos_accepted", value); + return this; + } + public APIRequestGetAppliedAdAccounts requestViewableBusinessField () { + return this.requestViewableBusinessField(true); + } + public APIRequestGetAppliedAdAccounts requestViewableBusinessField (boolean value) { + this.requestField("viewable_business", value); + return this; + } + } + + public static class APIRequestGetFacebookContent extends APIRequest { + + APINodeList lastResponse = null; + @Override + public APINodeList getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + }; + + public static final String[] FIELDS = { + }; + + @Override + public APINodeList parseResponse(String response, String header) throws APIException { + return APINode.parseResponse(response, getContext(), this, header); + } + + @Override + public APINodeList execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + try { + return APIRequestGetFacebookContent.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestGetFacebookContent(String nodeId, APIContext context) { + super(context, nodeId, "/facebook_content", "GET", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestGetFacebookContent setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestGetFacebookContent setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestGetFacebookContent requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestGetFacebookContent requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetFacebookContent requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestGetFacebookContent requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetFacebookContent requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestGetFacebookContent requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + + public static class APIRequestGetInstagramContent extends APIRequest { + + APINodeList lastResponse = null; + @Override + public APINodeList getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + }; + + public static final String[] FIELDS = { + "boost_eligibility_info", + "caption", + "comments_count", + "copyright_check_information", + "id", + "ig_id", + "is_comment_enabled", + "is_shared_to_feed", + "like_count", + "media_product_type", + "media_type", + "media_url", + "owner", + "permalink", + "shortcode", + "thumbnail_url", + "timestamp", + "username", + }; + + @Override + public APINodeList parseResponse(String response, String header) throws APIException { + return IGMedia.parseResponse(response, getContext(), this, header); + } + + @Override + public APINodeList execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + try { + return APIRequestGetInstagramContent.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestGetInstagramContent(String nodeId, APIContext context) { + super(context, nodeId, "/instagram_content", "GET", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestGetInstagramContent setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestGetInstagramContent setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestGetInstagramContent requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestGetInstagramContent requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetInstagramContent requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestGetInstagramContent requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetInstagramContent requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestGetInstagramContent requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + public APIRequestGetInstagramContent requestBoostEligibilityInfoField () { + return this.requestBoostEligibilityInfoField(true); + } + public APIRequestGetInstagramContent requestBoostEligibilityInfoField (boolean value) { + this.requestField("boost_eligibility_info", value); + return this; + } + public APIRequestGetInstagramContent requestCaptionField () { + return this.requestCaptionField(true); + } + public APIRequestGetInstagramContent requestCaptionField (boolean value) { + this.requestField("caption", value); + return this; + } + public APIRequestGetInstagramContent requestCommentsCountField () { + return this.requestCommentsCountField(true); + } + public APIRequestGetInstagramContent requestCommentsCountField (boolean value) { + this.requestField("comments_count", value); + return this; + } + public APIRequestGetInstagramContent requestCopyrightCheckInformationField () { + return this.requestCopyrightCheckInformationField(true); + } + public APIRequestGetInstagramContent requestCopyrightCheckInformationField (boolean value) { + this.requestField("copyright_check_information", value); + return this; + } + public APIRequestGetInstagramContent requestIdField () { + return this.requestIdField(true); + } + public APIRequestGetInstagramContent requestIdField (boolean value) { + this.requestField("id", value); + return this; + } + public APIRequestGetInstagramContent requestIgIdField () { + return this.requestIgIdField(true); + } + public APIRequestGetInstagramContent requestIgIdField (boolean value) { + this.requestField("ig_id", value); + return this; + } + public APIRequestGetInstagramContent requestIsCommentEnabledField () { + return this.requestIsCommentEnabledField(true); + } + public APIRequestGetInstagramContent requestIsCommentEnabledField (boolean value) { + this.requestField("is_comment_enabled", value); + return this; + } + public APIRequestGetInstagramContent requestIsSharedToFeedField () { + return this.requestIsSharedToFeedField(true); + } + public APIRequestGetInstagramContent requestIsSharedToFeedField (boolean value) { + this.requestField("is_shared_to_feed", value); + return this; + } + public APIRequestGetInstagramContent requestLikeCountField () { + return this.requestLikeCountField(true); + } + public APIRequestGetInstagramContent requestLikeCountField (boolean value) { + this.requestField("like_count", value); + return this; + } + public APIRequestGetInstagramContent requestMediaProductTypeField () { + return this.requestMediaProductTypeField(true); + } + public APIRequestGetInstagramContent requestMediaProductTypeField (boolean value) { + this.requestField("media_product_type", value); + return this; + } + public APIRequestGetInstagramContent requestMediaTypeField () { + return this.requestMediaTypeField(true); + } + public APIRequestGetInstagramContent requestMediaTypeField (boolean value) { + this.requestField("media_type", value); + return this; + } + public APIRequestGetInstagramContent requestMediaUrlField () { + return this.requestMediaUrlField(true); + } + public APIRequestGetInstagramContent requestMediaUrlField (boolean value) { + this.requestField("media_url", value); + return this; + } + public APIRequestGetInstagramContent requestOwnerField () { + return this.requestOwnerField(true); + } + public APIRequestGetInstagramContent requestOwnerField (boolean value) { + this.requestField("owner", value); + return this; + } + public APIRequestGetInstagramContent requestPermalinkField () { + return this.requestPermalinkField(true); + } + public APIRequestGetInstagramContent requestPermalinkField (boolean value) { + this.requestField("permalink", value); + return this; + } + public APIRequestGetInstagramContent requestShortcodeField () { + return this.requestShortcodeField(true); + } + public APIRequestGetInstagramContent requestShortcodeField (boolean value) { + this.requestField("shortcode", value); + return this; + } + public APIRequestGetInstagramContent requestThumbnailUrlField () { + return this.requestThumbnailUrlField(true); + } + public APIRequestGetInstagramContent requestThumbnailUrlField (boolean value) { + this.requestField("thumbnail_url", value); + return this; + } + public APIRequestGetInstagramContent requestTimestampField () { + return this.requestTimestampField(true); + } + public APIRequestGetInstagramContent requestTimestampField (boolean value) { + this.requestField("timestamp", value); + return this; + } + public APIRequestGetInstagramContent requestUsernameField () { + return this.requestUsernameField(true); + } + public APIRequestGetInstagramContent requestUsernameField (boolean value) { + this.requestField("username", value); + return this; + } + } + + public static class APIRequestGet extends APIRequest { + + ContentBlockList lastResponse = null; + @Override + public ContentBlockList getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + }; + + public static final String[] FIELDS = { + "business", + "id", + "name", + }; + + @Override + public ContentBlockList parseResponse(String response, String header) throws APIException { + return ContentBlockList.parseResponse(response, getContext(), this, header).head(); + } + + @Override + public ContentBlockList execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public ContentBlockList 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 ContentBlockList 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 requestBusinessField () { + return this.requestBusinessField(true); + } + public APIRequestGet requestBusinessField (boolean value) { + this.requestField("business", value); + return this; + } + public APIRequestGet requestIdField () { + return this.requestIdField(true); + } + public APIRequestGet requestIdField (boolean value) { + this.requestField("id", value); + return this; + } + public APIRequestGet requestNameField () { + return this.requestNameField(true); + } + public APIRequestGet requestNameField (boolean value) { + this.requestField("name", 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 ContentBlockList copyFrom(ContentBlockList instance) { + this.mBusiness = instance.mBusiness; + this.mId = instance.mId; + this.mName = instance.mName; + 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 ContentBlockList.parseResponse(response, context, request, header); + } + }; + } +} diff --git a/src/main/java/com/facebook/ads/sdk/PageVideosYouCanUse.java b/src/main/java/com/facebook/ads/sdk/Dataset.java similarity index 67% rename from src/main/java/com/facebook/ads/sdk/PageVideosYouCanUse.java rename to src/main/java/com/facebook/ads/sdk/Dataset.java index 5f566b08..8e9b5f41 100644 --- a/src/main/java/com/facebook/ads/sdk/PageVideosYouCanUse.java +++ b/src/main/java/com/facebook/ads/sdk/Dataset.java @@ -40,27 +40,25 @@ * pull request for this class. * */ -public class PageVideosYouCanUse extends APINode { - @SerializedName("description") - private String mDescription = null; +public class Dataset extends APINode { @SerializedName("id") private String mId = null; - @SerializedName("title") - private String mTitle = null; + @SerializedName("name") + private String mName = null; protected static Gson gson = null; - public PageVideosYouCanUse() { + public Dataset() { } public String getId() { return getFieldId().toString(); } - public static PageVideosYouCanUse loadJSON(String json, APIContext context, String header) { - PageVideosYouCanUse pageVideosYouCanUse = getGson().fromJson(json, PageVideosYouCanUse.class); + public static Dataset loadJSON(String json, APIContext context, String header) { + Dataset dataset = getGson().fromJson(json, Dataset.class); if (context.isDebug()) { JsonParser parser = new JsonParser(); JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pageVideosYouCanUse.toString()); + JsonElement o2 = parser.parse(dataset.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -70,14 +68,14 @@ public static PageVideosYouCanUse loadJSON(String json, APIContext context, Stri context.log("[Object]" + o2); } } - pageVideosYouCanUse.context = context; - pageVideosYouCanUse.rawValue = json; - pageVideosYouCanUse.header = header; - return pageVideosYouCanUse; + dataset.context = context; + dataset.rawValue = json; + dataset.header = header; + return dataset; } - public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { - APINodeList pageVideosYouCanUses = new APINodeList(request, json, header); + public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { + APINodeList datasets = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; JsonParser parser = new JsonParser(); @@ -88,9 +86,9 @@ public static APINodeList parseResponse(String json, APICon // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); for (int i = 0; i < arr.size(); i++) { - pageVideosYouCanUses.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); + datasets.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); }; - return pageVideosYouCanUses; + return datasets; } else if (result.isJsonObject()) { obj = result.getAsJsonObject(); if (obj.has("data")) { @@ -100,20 +98,20 @@ public static APINodeList parseResponse(String json, APICon 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; - pageVideosYouCanUses.setCursors(before, after); + datasets.setCursors(before, after); } String previous = paging.has("previous") ? paging.get("previous").getAsString() : null; String next = paging.has("next") ? paging.get("next").getAsString() : null; - pageVideosYouCanUses.setPaging(previous, next); + datasets.setPaging(previous, next); if (context.hasAppSecret()) { - pageVideosYouCanUses.setAppSecret(context.getAppSecretProof()); + datasets.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++) { - pageVideosYouCanUses.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); + datasets.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" @@ -124,23 +122,23 @@ public static APINodeList parseResponse(String json, APICon isRedownload = true; obj = obj.getAsJsonObject(s); for (Map.Entry entry : obj.entrySet()) { - pageVideosYouCanUses.add(loadJSON(entry.getValue().toString(), context, header)); + datasets.add(loadJSON(entry.getValue().toString(), context, header)); } break; } } if (!isRedownload) { - pageVideosYouCanUses.add(loadJSON(obj.toString(), context, header)); + datasets.add(loadJSON(obj.toString(), context, header)); } } - return pageVideosYouCanUses; + return datasets; } 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()) { - pageVideosYouCanUses.add(loadJSON(entry.getValue().toString(), context, header)); + datasets.add(loadJSON(entry.getValue().toString(), context, header)); } - return pageVideosYouCanUses; + return datasets; } else { // Fifth, check if it's an array of objects indexed by id boolean isIdIndexedArray = true; @@ -157,20 +155,20 @@ public static APINodeList parseResponse(String json, APICon value.getAsJsonObject().get("id") != null && value.getAsJsonObject().get("id").getAsString().equals(key) ) { - pageVideosYouCanUses.add(loadJSON(value.toString(), context, header)); + datasets.add(loadJSON(value.toString(), context, header)); } else { isIdIndexedArray = false; break; } } if (isIdIndexedArray) { - return pageVideosYouCanUses; + return datasets; } // Sixth, check if it's pure JsonObject - pageVideosYouCanUses.clear(); - pageVideosYouCanUses.add(loadJSON(json, context, header)); - return pageVideosYouCanUses; + datasets.clear(); + datasets.add(loadJSON(json, context, header)); + return datasets; } } } catch (Exception e) { @@ -198,30 +196,21 @@ public String toString() { } - public String getFieldDescription() { - return mDescription; - } - - public PageVideosYouCanUse setFieldDescription(String value) { - this.mDescription = value; - return this; - } - public String getFieldId() { return mId; } - public PageVideosYouCanUse setFieldId(String value) { + public Dataset setFieldId(String value) { this.mId = value; return this; } - public String getFieldTitle() { - return mTitle; + public String getFieldName() { + return mName; } - public PageVideosYouCanUse setFieldTitle(String value) { - this.mTitle = value; + public Dataset setFieldName(String value) { + this.mName = value; return this; } @@ -241,19 +230,18 @@ public PageVideosYouCanUse setFieldTitle(String value) { return gson; } - public PageVideosYouCanUse copyFrom(PageVideosYouCanUse instance) { - this.mDescription = instance.mDescription; + public Dataset copyFrom(Dataset instance) { this.mId = instance.mId; - this.mTitle = instance.mTitle; + this.mName = instance.mName; 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 PageVideosYouCanUse.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 Dataset.parseResponse(response, context, request, header); } }; } diff --git a/src/main/java/com/facebook/ads/sdk/Destination.java b/src/main/java/com/facebook/ads/sdk/Destination.java index 86a11d7f..89d9e6cb 100644 --- a/src/main/java/com/facebook/ads/sdk/Destination.java +++ b/src/main/java/com/facebook/ads/sdk/Destination.java @@ -286,14 +286,14 @@ public String toString() { return getGson().toJson(this); } - public APIRequestGetAugmentedRealitiesMetadata getAugmentedRealitiesMetadata() { - return new APIRequestGetAugmentedRealitiesMetadata(this.getPrefixedId().toString(), context); - } - public APIRequestGetChannelsToIntegrityStatus getChannelsToIntegrityStatus() { return new APIRequestGetChannelsToIntegrityStatus(this.getPrefixedId().toString(), context); } + public APIRequestGetOverrideDetails getOverrideDetails() { + return new APIRequestGetOverrideDetails(this.getPrefixedId().toString(), context); + } + public APIRequestGetVideosMetadata getVideosMetadata() { return new APIRequestGetVideosMetadata(this.getPrefixedId().toString(), context); } @@ -377,59 +377,49 @@ public EnumVisibility getFieldVisibility() { - public static class APIRequestGetAugmentedRealitiesMetadata extends APIRequest { + public static class APIRequestGetChannelsToIntegrityStatus extends APIRequest { - APINodeList lastResponse = null; + APINodeList lastResponse = null; @Override - public APINodeList getLastResponse() { + public APINodeList getLastResponse() { return lastResponse; } public static final String[] PARAMS = { }; public static final String[] FIELDS = { - "anchor_point", - "container_effect_enum", - "effect_icon_url", - "effect_id", - "id", - "platforms", - "scale_factor", - "shadow_texture_url", - "source_url", - "state", - "tags", - "variant_picker_url", + "channels", + "rejection_information", }; @Override - public APINodeList parseResponse(String response, String header) throws APIException { - return DynamicARMetadata.parseResponse(response, getContext(), this, header); + public APINodeList parseResponse(String response, String header) throws APIException { + return CatalogItemChannelsToIntegrityStatus.parseResponse(response, getContext(), this, header); } @Override - public APINodeList execute() throws APIException { + public APINodeList execute() throws APIException { return execute(new HashMap()); } @Override - public APINodeList execute(Map extraParams) throws APIException { + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + new Function>() { + public APINodeList apply(ResponseWrapper result) { try { - return APIRequestGetAugmentedRealitiesMetadata.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestGetChannelsToIntegrityStatus.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -439,28 +429,28 @@ public APINodeList apply(ResponseWrapper result) { ); }; - public APIRequestGetAugmentedRealitiesMetadata(String nodeId, APIContext context) { - super(context, nodeId, "/augmented_realities_metadata", "GET", Arrays.asList(PARAMS)); + public APIRequestGetChannelsToIntegrityStatus(String nodeId, APIContext context) { + super(context, nodeId, "/channels_to_integrity_status", "GET", Arrays.asList(PARAMS)); } @Override - public APIRequestGetAugmentedRealitiesMetadata setParam(String param, Object value) { + public APIRequestGetChannelsToIntegrityStatus setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestGetAugmentedRealitiesMetadata setParams(Map params) { + public APIRequestGetChannelsToIntegrityStatus setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestGetAugmentedRealitiesMetadata requestAllFields () { + public APIRequestGetChannelsToIntegrityStatus requestAllFields () { return this.requestAllFields(true); } - public APIRequestGetAugmentedRealitiesMetadata requestAllFields (boolean value) { + public APIRequestGetChannelsToIntegrityStatus requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -468,12 +458,12 @@ public APIRequestGetAugmentedRealitiesMetadata requestAllFields (boolean value) } @Override - public APIRequestGetAugmentedRealitiesMetadata requestFields (List fields) { + public APIRequestGetChannelsToIntegrityStatus requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestGetAugmentedRealitiesMetadata requestFields (List fields, boolean value) { + public APIRequestGetChannelsToIntegrityStatus requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -481,146 +471,79 @@ public APIRequestGetAugmentedRealitiesMetadata requestFields (List field } @Override - public APIRequestGetAugmentedRealitiesMetadata requestField (String field) { + public APIRequestGetChannelsToIntegrityStatus requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestGetAugmentedRealitiesMetadata requestField (String field, boolean value) { + public APIRequestGetChannelsToIntegrityStatus requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } - public APIRequestGetAugmentedRealitiesMetadata requestAnchorPointField () { - return this.requestAnchorPointField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestAnchorPointField (boolean value) { - this.requestField("anchor_point", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestContainerEffectEnumField () { - return this.requestContainerEffectEnumField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestContainerEffectEnumField (boolean value) { - this.requestField("container_effect_enum", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIconUrlField () { - return this.requestEffectIconUrlField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIconUrlField (boolean value) { - this.requestField("effect_icon_url", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIdField () { - return this.requestEffectIdField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIdField (boolean value) { - this.requestField("effect_id", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestIdField () { - return this.requestIdField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestIdField (boolean value) { - this.requestField("id", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestPlatformsField () { - return this.requestPlatformsField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestPlatformsField (boolean value) { - this.requestField("platforms", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestScaleFactorField () { - return this.requestScaleFactorField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestScaleFactorField (boolean value) { - this.requestField("scale_factor", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestShadowTextureUrlField () { - return this.requestShadowTextureUrlField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestShadowTextureUrlField (boolean value) { - this.requestField("shadow_texture_url", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestSourceUrlField () { - return this.requestSourceUrlField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestSourceUrlField (boolean value) { - this.requestField("source_url", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestStateField () { - return this.requestStateField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestStateField (boolean value) { - this.requestField("state", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestTagsField () { - return this.requestTagsField(true); + public APIRequestGetChannelsToIntegrityStatus requestChannelsField () { + return this.requestChannelsField(true); } - public APIRequestGetAugmentedRealitiesMetadata requestTagsField (boolean value) { - this.requestField("tags", value); + public APIRequestGetChannelsToIntegrityStatus requestChannelsField (boolean value) { + this.requestField("channels", value); return this; } - public APIRequestGetAugmentedRealitiesMetadata requestVariantPickerUrlField () { - return this.requestVariantPickerUrlField(true); + public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField () { + return this.requestRejectionInformationField(true); } - public APIRequestGetAugmentedRealitiesMetadata requestVariantPickerUrlField (boolean value) { - this.requestField("variant_picker_url", value); + public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField (boolean value) { + this.requestField("rejection_information", value); return this; } } - public static class APIRequestGetChannelsToIntegrityStatus extends APIRequest { + public static class APIRequestGetOverrideDetails extends APIRequest { - APINodeList lastResponse = null; + APINodeList lastResponse = null; @Override - public APINodeList getLastResponse() { + public APINodeList getLastResponse() { return lastResponse; } public static final String[] PARAMS = { + "keys", + "type", }; public static final String[] FIELDS = { - "channels", - "rejection_information", + "key", + "type", + "values", }; @Override - public APINodeList parseResponse(String response, String header) throws APIException { - return CatalogItemChannelsToIntegrityStatus.parseResponse(response, getContext(), this, header); + public APINodeList parseResponse(String response, String header) throws APIException { + return OverrideDetails.parseResponse(response, getContext(), this, header); } @Override - public APINodeList execute() throws APIException { + public APINodeList execute() throws APIException { return execute(new HashMap()); } @Override - public APINodeList execute(Map extraParams) throws APIException { + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + new Function>() { + public APINodeList apply(ResponseWrapper result) { try { - return APIRequestGetChannelsToIntegrityStatus.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestGetOverrideDetails.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -630,28 +553,46 @@ public APINodeList apply(ResponseWrapper r ); }; - public APIRequestGetChannelsToIntegrityStatus(String nodeId, APIContext context) { - super(context, nodeId, "/channels_to_integrity_status", "GET", Arrays.asList(PARAMS)); + public APIRequestGetOverrideDetails(String nodeId, APIContext context) { + super(context, nodeId, "/override_details", "GET", Arrays.asList(PARAMS)); } @Override - public APIRequestGetChannelsToIntegrityStatus setParam(String param, Object value) { + public APIRequestGetOverrideDetails setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestGetChannelsToIntegrityStatus setParams(Map params) { + public APIRequestGetOverrideDetails setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestGetChannelsToIntegrityStatus requestAllFields () { + public APIRequestGetOverrideDetails setKeys (List keys) { + this.setParam("keys", keys); + return this; + } + public APIRequestGetOverrideDetails setKeys (String keys) { + this.setParam("keys", keys); + return this; + } + + public APIRequestGetOverrideDetails setType (OverrideDetails.EnumType type) { + this.setParam("type", type); + return this; + } + public APIRequestGetOverrideDetails setType (String type) { + this.setParam("type", type); + return this; + } + + public APIRequestGetOverrideDetails requestAllFields () { return this.requestAllFields(true); } - public APIRequestGetChannelsToIntegrityStatus requestAllFields (boolean value) { + public APIRequestGetOverrideDetails requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -659,12 +600,12 @@ public APIRequestGetChannelsToIntegrityStatus requestAllFields (boolean value) { } @Override - public APIRequestGetChannelsToIntegrityStatus requestFields (List fields) { + public APIRequestGetOverrideDetails requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestGetChannelsToIntegrityStatus requestFields (List fields, boolean value) { + public APIRequestGetOverrideDetails requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -672,29 +613,36 @@ public APIRequestGetChannelsToIntegrityStatus requestFields (List fields } @Override - public APIRequestGetChannelsToIntegrityStatus requestField (String field) { + public APIRequestGetOverrideDetails requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestGetChannelsToIntegrityStatus requestField (String field, boolean value) { + public APIRequestGetOverrideDetails requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } - public APIRequestGetChannelsToIntegrityStatus requestChannelsField () { - return this.requestChannelsField(true); + public APIRequestGetOverrideDetails requestKeyField () { + return this.requestKeyField(true); } - public APIRequestGetChannelsToIntegrityStatus requestChannelsField (boolean value) { - this.requestField("channels", value); + public APIRequestGetOverrideDetails requestKeyField (boolean value) { + this.requestField("key", value); return this; } - public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField () { - return this.requestRejectionInformationField(true); + public APIRequestGetOverrideDetails requestTypeField () { + return this.requestTypeField(true); } - public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField (boolean value) { - this.requestField("rejection_information", value); + public APIRequestGetOverrideDetails requestTypeField (boolean value) { + this.requestField("type", value); + return this; + } + public APIRequestGetOverrideDetails requestValuesField () { + return this.requestValuesField(true); + } + public APIRequestGetOverrideDetails requestValuesField (boolean value) { + this.requestField("values", value); return this; } } diff --git a/src/main/java/com/facebook/ads/sdk/ExpirablePost.java b/src/main/java/com/facebook/ads/sdk/ExpirablePost.java deleted file mode 100644 index 6f285f66..00000000 --- a/src/main/java/com/facebook/ads/sdk/ExpirablePost.java +++ /dev/null @@ -1,485 +0,0 @@ -/* - * 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 ExpirablePost extends APINode { - @SerializedName("admin_creator") - private User mAdminCreator = null; - @SerializedName("can_republish") - private Boolean mCanRepublish = null; - @SerializedName("content_type") - private String mContentType = null; - @SerializedName("creation_time") - private String mCreationTime = null; - @SerializedName("expiration") - private Object mExpiration = null; - @SerializedName("feed_audience_description") - private String mFeedAudienceDescription = null; - @SerializedName("feed_targeting") - private Targeting mFeedTargeting = null; - @SerializedName("id") - private String mId = null; - @SerializedName("is_post_in_good_state") - private Boolean mIsPostInGoodState = null; - @SerializedName("message") - private String mMessage = null; - @SerializedName("modified_time") - private String mModifiedTime = null; - @SerializedName("og_action_summary") - private String mOgActionSummary = null; - @SerializedName("permalink_url") - private String mPermalinkUrl = null; - @SerializedName("place") - private Place mPlace = null; - @SerializedName("privacy_description") - private String mPrivacyDescription = null; - @SerializedName("scheduled_failure_notice") - private String mScheduledFailureNotice = null; - @SerializedName("scheduled_publish_time") - private String mScheduledPublishTime = null; - @SerializedName("story_token") - private String mStoryToken = null; - @SerializedName("thumbnail") - private String mThumbnail = null; - @SerializedName("video_id") - private String mVideoId = null; - protected static Gson gson = null; - - public ExpirablePost() { - } - - public String getId() { - return getFieldId().toString(); - } - public static ExpirablePost loadJSON(String json, APIContext context, String header) { - ExpirablePost expirablePost = getGson().fromJson(json, ExpirablePost.class); - if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(expirablePost.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); - } - } - expirablePost.context = context; - expirablePost.rawValue = json; - expirablePost.header = header; - return expirablePost; - } - - public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { - APINodeList expirablePosts = 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++) { - expirablePosts.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); - }; - return expirablePosts; - } 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; - expirablePosts.setCursors(before, after); - } - String previous = paging.has("previous") ? paging.get("previous").getAsString() : null; - String next = paging.has("next") ? paging.get("next").getAsString() : null; - expirablePosts.setPaging(previous, next); - if (context.hasAppSecret()) { - expirablePosts.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++) { - expirablePosts.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()) { - expirablePosts.add(loadJSON(entry.getValue().toString(), context, header)); - } - break; - } - } - if (!isRedownload) { - expirablePosts.add(loadJSON(obj.toString(), context, header)); - } - } - return expirablePosts; - } 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()) { - expirablePosts.add(loadJSON(entry.getValue().toString(), context, header)); - } - return expirablePosts; - } 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) - ) { - expirablePosts.add(loadJSON(value.toString(), context, header)); - } else { - isIdIndexedArray = false; - break; - } - } - if (isIdIndexedArray) { - return expirablePosts; - } - - // Sixth, check if it's pure JsonObject - expirablePosts.clear(); - expirablePosts.add(loadJSON(json, context, header)); - return expirablePosts; - } - } - } 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 User getFieldAdminCreator() { - if (mAdminCreator != null) { - mAdminCreator.context = getContext(); - } - return mAdminCreator; - } - - public ExpirablePost setFieldAdminCreator(User value) { - this.mAdminCreator = value; - return this; - } - - public ExpirablePost setFieldAdminCreator(String value) { - Type type = new TypeToken(){}.getType(); - this.mAdminCreator = User.getGson().fromJson(value, type); - return this; - } - public Boolean getFieldCanRepublish() { - return mCanRepublish; - } - - public ExpirablePost setFieldCanRepublish(Boolean value) { - this.mCanRepublish = value; - return this; - } - - public String getFieldContentType() { - return mContentType; - } - - public ExpirablePost setFieldContentType(String value) { - this.mContentType = value; - return this; - } - - public String getFieldCreationTime() { - return mCreationTime; - } - - public ExpirablePost setFieldCreationTime(String value) { - this.mCreationTime = value; - return this; - } - - public Object getFieldExpiration() { - return mExpiration; - } - - public ExpirablePost setFieldExpiration(Object value) { - this.mExpiration = value; - return this; - } - - public String getFieldFeedAudienceDescription() { - return mFeedAudienceDescription; - } - - public ExpirablePost setFieldFeedAudienceDescription(String value) { - this.mFeedAudienceDescription = value; - return this; - } - - public Targeting getFieldFeedTargeting() { - return mFeedTargeting; - } - - public ExpirablePost setFieldFeedTargeting(Targeting value) { - this.mFeedTargeting = value; - return this; - } - - public ExpirablePost setFieldFeedTargeting(String value) { - Type type = new TypeToken(){}.getType(); - this.mFeedTargeting = Targeting.getGson().fromJson(value, type); - return this; - } - public String getFieldId() { - return mId; - } - - public ExpirablePost setFieldId(String value) { - this.mId = value; - return this; - } - - public Boolean getFieldIsPostInGoodState() { - return mIsPostInGoodState; - } - - public ExpirablePost setFieldIsPostInGoodState(Boolean value) { - this.mIsPostInGoodState = value; - return this; - } - - public String getFieldMessage() { - return mMessage; - } - - public ExpirablePost setFieldMessage(String value) { - this.mMessage = value; - return this; - } - - public String getFieldModifiedTime() { - return mModifiedTime; - } - - public ExpirablePost setFieldModifiedTime(String value) { - this.mModifiedTime = value; - return this; - } - - public String getFieldOgActionSummary() { - return mOgActionSummary; - } - - public ExpirablePost setFieldOgActionSummary(String value) { - this.mOgActionSummary = value; - return this; - } - - public String getFieldPermalinkUrl() { - return mPermalinkUrl; - } - - public ExpirablePost setFieldPermalinkUrl(String value) { - this.mPermalinkUrl = value; - return this; - } - - public Place getFieldPlace() { - if (mPlace != null) { - mPlace.context = getContext(); - } - return mPlace; - } - - public ExpirablePost setFieldPlace(Place value) { - this.mPlace = value; - return this; - } - - public ExpirablePost setFieldPlace(String value) { - Type type = new TypeToken(){}.getType(); - this.mPlace = Place.getGson().fromJson(value, type); - return this; - } - public String getFieldPrivacyDescription() { - return mPrivacyDescription; - } - - public ExpirablePost setFieldPrivacyDescription(String value) { - this.mPrivacyDescription = value; - return this; - } - - public String getFieldScheduledFailureNotice() { - return mScheduledFailureNotice; - } - - public ExpirablePost setFieldScheduledFailureNotice(String value) { - this.mScheduledFailureNotice = value; - return this; - } - - public String getFieldScheduledPublishTime() { - return mScheduledPublishTime; - } - - public ExpirablePost setFieldScheduledPublishTime(String value) { - this.mScheduledPublishTime = value; - return this; - } - - public String getFieldStoryToken() { - return mStoryToken; - } - - public ExpirablePost setFieldStoryToken(String value) { - this.mStoryToken = value; - return this; - } - - public String getFieldThumbnail() { - return mThumbnail; - } - - public ExpirablePost setFieldThumbnail(String value) { - this.mThumbnail = value; - return this; - } - - public String getFieldVideoId() { - return mVideoId; - } - - public ExpirablePost setFieldVideoId(String value) { - this.mVideoId = 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 ExpirablePost copyFrom(ExpirablePost instance) { - this.mAdminCreator = instance.mAdminCreator; - this.mCanRepublish = instance.mCanRepublish; - this.mContentType = instance.mContentType; - this.mCreationTime = instance.mCreationTime; - this.mExpiration = instance.mExpiration; - this.mFeedAudienceDescription = instance.mFeedAudienceDescription; - this.mFeedTargeting = instance.mFeedTargeting; - this.mId = instance.mId; - this.mIsPostInGoodState = instance.mIsPostInGoodState; - this.mMessage = instance.mMessage; - this.mModifiedTime = instance.mModifiedTime; - this.mOgActionSummary = instance.mOgActionSummary; - this.mPermalinkUrl = instance.mPermalinkUrl; - this.mPlace = instance.mPlace; - this.mPrivacyDescription = instance.mPrivacyDescription; - this.mScheduledFailureNotice = instance.mScheduledFailureNotice; - this.mScheduledPublishTime = instance.mScheduledPublishTime; - this.mStoryToken = instance.mStoryToken; - this.mThumbnail = instance.mThumbnail; - this.mVideoId = instance.mVideoId; - 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 ExpirablePost.parseResponse(response, context, request, header); - } - }; - } -} diff --git a/src/main/java/com/facebook/ads/sdk/Flight.java b/src/main/java/com/facebook/ads/sdk/Flight.java index efdb47c4..fd27ba78 100644 --- a/src/main/java/com/facebook/ads/sdk/Flight.java +++ b/src/main/java/com/facebook/ads/sdk/Flight.java @@ -290,14 +290,14 @@ public String toString() { return getGson().toJson(this); } - public APIRequestGetAugmentedRealitiesMetadata getAugmentedRealitiesMetadata() { - return new APIRequestGetAugmentedRealitiesMetadata(this.getPrefixedId().toString(), context); - } - public APIRequestGetChannelsToIntegrityStatus getChannelsToIntegrityStatus() { return new APIRequestGetChannelsToIntegrityStatus(this.getPrefixedId().toString(), context); } + public APIRequestGetOverrideDetails getOverrideDetails() { + return new APIRequestGetOverrideDetails(this.getPrefixedId().toString(), context); + } + public APIRequestGetVideosMetadata getVideosMetadata() { return new APIRequestGetVideosMetadata(this.getPrefixedId().toString(), context); } @@ -393,59 +393,49 @@ public EnumVisibility getFieldVisibility() { - public static class APIRequestGetAugmentedRealitiesMetadata extends APIRequest { + public static class APIRequestGetChannelsToIntegrityStatus extends APIRequest { - APINodeList lastResponse = null; + APINodeList lastResponse = null; @Override - public APINodeList getLastResponse() { + public APINodeList getLastResponse() { return lastResponse; } public static final String[] PARAMS = { }; public static final String[] FIELDS = { - "anchor_point", - "container_effect_enum", - "effect_icon_url", - "effect_id", - "id", - "platforms", - "scale_factor", - "shadow_texture_url", - "source_url", - "state", - "tags", - "variant_picker_url", + "channels", + "rejection_information", }; @Override - public APINodeList parseResponse(String response, String header) throws APIException { - return DynamicARMetadata.parseResponse(response, getContext(), this, header); + public APINodeList parseResponse(String response, String header) throws APIException { + return CatalogItemChannelsToIntegrityStatus.parseResponse(response, getContext(), this, header); } @Override - public APINodeList execute() throws APIException { + public APINodeList execute() throws APIException { return execute(new HashMap()); } @Override - public APINodeList execute(Map extraParams) throws APIException { + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + new Function>() { + public APINodeList apply(ResponseWrapper result) { try { - return APIRequestGetAugmentedRealitiesMetadata.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestGetChannelsToIntegrityStatus.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -455,28 +445,28 @@ public APINodeList apply(ResponseWrapper result) { ); }; - public APIRequestGetAugmentedRealitiesMetadata(String nodeId, APIContext context) { - super(context, nodeId, "/augmented_realities_metadata", "GET", Arrays.asList(PARAMS)); + public APIRequestGetChannelsToIntegrityStatus(String nodeId, APIContext context) { + super(context, nodeId, "/channels_to_integrity_status", "GET", Arrays.asList(PARAMS)); } @Override - public APIRequestGetAugmentedRealitiesMetadata setParam(String param, Object value) { + public APIRequestGetChannelsToIntegrityStatus setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestGetAugmentedRealitiesMetadata setParams(Map params) { + public APIRequestGetChannelsToIntegrityStatus setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestGetAugmentedRealitiesMetadata requestAllFields () { + public APIRequestGetChannelsToIntegrityStatus requestAllFields () { return this.requestAllFields(true); } - public APIRequestGetAugmentedRealitiesMetadata requestAllFields (boolean value) { + public APIRequestGetChannelsToIntegrityStatus requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -484,12 +474,12 @@ public APIRequestGetAugmentedRealitiesMetadata requestAllFields (boolean value) } @Override - public APIRequestGetAugmentedRealitiesMetadata requestFields (List fields) { + public APIRequestGetChannelsToIntegrityStatus requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestGetAugmentedRealitiesMetadata requestFields (List fields, boolean value) { + public APIRequestGetChannelsToIntegrityStatus requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -497,146 +487,79 @@ public APIRequestGetAugmentedRealitiesMetadata requestFields (List field } @Override - public APIRequestGetAugmentedRealitiesMetadata requestField (String field) { + public APIRequestGetChannelsToIntegrityStatus requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestGetAugmentedRealitiesMetadata requestField (String field, boolean value) { + public APIRequestGetChannelsToIntegrityStatus requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } - public APIRequestGetAugmentedRealitiesMetadata requestAnchorPointField () { - return this.requestAnchorPointField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestAnchorPointField (boolean value) { - this.requestField("anchor_point", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestContainerEffectEnumField () { - return this.requestContainerEffectEnumField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestContainerEffectEnumField (boolean value) { - this.requestField("container_effect_enum", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIconUrlField () { - return this.requestEffectIconUrlField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIconUrlField (boolean value) { - this.requestField("effect_icon_url", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIdField () { - return this.requestEffectIdField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIdField (boolean value) { - this.requestField("effect_id", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestIdField () { - return this.requestIdField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestIdField (boolean value) { - this.requestField("id", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestPlatformsField () { - return this.requestPlatformsField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestPlatformsField (boolean value) { - this.requestField("platforms", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestScaleFactorField () { - return this.requestScaleFactorField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestScaleFactorField (boolean value) { - this.requestField("scale_factor", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestShadowTextureUrlField () { - return this.requestShadowTextureUrlField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestShadowTextureUrlField (boolean value) { - this.requestField("shadow_texture_url", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestSourceUrlField () { - return this.requestSourceUrlField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestSourceUrlField (boolean value) { - this.requestField("source_url", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestStateField () { - return this.requestStateField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestStateField (boolean value) { - this.requestField("state", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestTagsField () { - return this.requestTagsField(true); + public APIRequestGetChannelsToIntegrityStatus requestChannelsField () { + return this.requestChannelsField(true); } - public APIRequestGetAugmentedRealitiesMetadata requestTagsField (boolean value) { - this.requestField("tags", value); + public APIRequestGetChannelsToIntegrityStatus requestChannelsField (boolean value) { + this.requestField("channels", value); return this; } - public APIRequestGetAugmentedRealitiesMetadata requestVariantPickerUrlField () { - return this.requestVariantPickerUrlField(true); + public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField () { + return this.requestRejectionInformationField(true); } - public APIRequestGetAugmentedRealitiesMetadata requestVariantPickerUrlField (boolean value) { - this.requestField("variant_picker_url", value); + public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField (boolean value) { + this.requestField("rejection_information", value); return this; } } - public static class APIRequestGetChannelsToIntegrityStatus extends APIRequest { + public static class APIRequestGetOverrideDetails extends APIRequest { - APINodeList lastResponse = null; + APINodeList lastResponse = null; @Override - public APINodeList getLastResponse() { + public APINodeList getLastResponse() { return lastResponse; } public static final String[] PARAMS = { + "keys", + "type", }; public static final String[] FIELDS = { - "channels", - "rejection_information", + "key", + "type", + "values", }; @Override - public APINodeList parseResponse(String response, String header) throws APIException { - return CatalogItemChannelsToIntegrityStatus.parseResponse(response, getContext(), this, header); + public APINodeList parseResponse(String response, String header) throws APIException { + return OverrideDetails.parseResponse(response, getContext(), this, header); } @Override - public APINodeList execute() throws APIException { + public APINodeList execute() throws APIException { return execute(new HashMap()); } @Override - public APINodeList execute(Map extraParams) throws APIException { + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + new Function>() { + public APINodeList apply(ResponseWrapper result) { try { - return APIRequestGetChannelsToIntegrityStatus.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestGetOverrideDetails.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -646,28 +569,46 @@ public APINodeList apply(ResponseWrapper r ); }; - public APIRequestGetChannelsToIntegrityStatus(String nodeId, APIContext context) { - super(context, nodeId, "/channels_to_integrity_status", "GET", Arrays.asList(PARAMS)); + public APIRequestGetOverrideDetails(String nodeId, APIContext context) { + super(context, nodeId, "/override_details", "GET", Arrays.asList(PARAMS)); } @Override - public APIRequestGetChannelsToIntegrityStatus setParam(String param, Object value) { + public APIRequestGetOverrideDetails setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestGetChannelsToIntegrityStatus setParams(Map params) { + public APIRequestGetOverrideDetails setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestGetChannelsToIntegrityStatus requestAllFields () { + public APIRequestGetOverrideDetails setKeys (List keys) { + this.setParam("keys", keys); + return this; + } + public APIRequestGetOverrideDetails setKeys (String keys) { + this.setParam("keys", keys); + return this; + } + + public APIRequestGetOverrideDetails setType (OverrideDetails.EnumType type) { + this.setParam("type", type); + return this; + } + public APIRequestGetOverrideDetails setType (String type) { + this.setParam("type", type); + return this; + } + + public APIRequestGetOverrideDetails requestAllFields () { return this.requestAllFields(true); } - public APIRequestGetChannelsToIntegrityStatus requestAllFields (boolean value) { + public APIRequestGetOverrideDetails requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -675,12 +616,12 @@ public APIRequestGetChannelsToIntegrityStatus requestAllFields (boolean value) { } @Override - public APIRequestGetChannelsToIntegrityStatus requestFields (List fields) { + public APIRequestGetOverrideDetails requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestGetChannelsToIntegrityStatus requestFields (List fields, boolean value) { + public APIRequestGetOverrideDetails requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -688,29 +629,36 @@ public APIRequestGetChannelsToIntegrityStatus requestFields (List fields } @Override - public APIRequestGetChannelsToIntegrityStatus requestField (String field) { + public APIRequestGetOverrideDetails requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestGetChannelsToIntegrityStatus requestField (String field, boolean value) { + public APIRequestGetOverrideDetails requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } - public APIRequestGetChannelsToIntegrityStatus requestChannelsField () { - return this.requestChannelsField(true); + public APIRequestGetOverrideDetails requestKeyField () { + return this.requestKeyField(true); } - public APIRequestGetChannelsToIntegrityStatus requestChannelsField (boolean value) { - this.requestField("channels", value); + public APIRequestGetOverrideDetails requestKeyField (boolean value) { + this.requestField("key", value); return this; } - public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField () { - return this.requestRejectionInformationField(true); + public APIRequestGetOverrideDetails requestTypeField () { + return this.requestTypeField(true); } - public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField (boolean value) { - this.requestField("rejection_information", value); + public APIRequestGetOverrideDetails requestTypeField (boolean value) { + this.requestField("type", value); + return this; + } + public APIRequestGetOverrideDetails requestValuesField () { + return this.requestValuesField(true); + } + public APIRequestGetOverrideDetails requestValuesField (boolean value) { + this.requestField("values", value); return this; } } diff --git a/src/main/java/com/facebook/ads/sdk/FundingSourceDetailsCoupon.java b/src/main/java/com/facebook/ads/sdk/FundingSourceDetailsCoupon.java index f3c42936..d052ecbd 100644 --- a/src/main/java/com/facebook/ads/sdk/FundingSourceDetailsCoupon.java +++ b/src/main/java/com/facebook/ads/sdk/FundingSourceDetailsCoupon.java @@ -45,12 +45,18 @@ public class FundingSourceDetailsCoupon extends APINode { private Long mAmount = null; @SerializedName("campaign_ids") private List mCampaignIds = null; + @SerializedName("coupon_id") + private String mCouponId = null; @SerializedName("currency") private String mCurrency = null; @SerializedName("display_amount") private String mDisplayAmount = null; @SerializedName("expiration") private String mExpiration = null; + @SerializedName("original_amount") + private Long mOriginalAmount = null; + @SerializedName("original_display_amount") + private String mOriginalDisplayAmount = null; protected static Gson gson = null; public FundingSourceDetailsCoupon() { @@ -220,6 +226,15 @@ public FundingSourceDetailsCoupon setFieldCampaignIds(List value) { return this; } + public String getFieldCouponId() { + return mCouponId; + } + + public FundingSourceDetailsCoupon setFieldCouponId(String value) { + this.mCouponId = value; + return this; + } + public String getFieldCurrency() { return mCurrency; } @@ -247,6 +262,24 @@ public FundingSourceDetailsCoupon setFieldExpiration(String value) { return this; } + public Long getFieldOriginalAmount() { + return mOriginalAmount; + } + + public FundingSourceDetailsCoupon setFieldOriginalAmount(Long value) { + this.mOriginalAmount = value; + return this; + } + + public String getFieldOriginalDisplayAmount() { + return mOriginalDisplayAmount; + } + + public FundingSourceDetailsCoupon setFieldOriginalDisplayAmount(String value) { + this.mOriginalDisplayAmount = value; + return this; + } + @@ -266,9 +299,12 @@ public FundingSourceDetailsCoupon setFieldExpiration(String value) { public FundingSourceDetailsCoupon copyFrom(FundingSourceDetailsCoupon instance) { this.mAmount = instance.mAmount; this.mCampaignIds = instance.mCampaignIds; + this.mCouponId = instance.mCouponId; this.mCurrency = instance.mCurrency; this.mDisplayAmount = instance.mDisplayAmount; this.mExpiration = instance.mExpiration; + this.mOriginalAmount = instance.mOriginalAmount; + this.mOriginalDisplayAmount = instance.mOriginalDisplayAmount; this.context = instance.context; this.rawValue = instance.rawValue; return this; diff --git a/src/main/java/com/facebook/ads/sdk/GenericVideoAsset.java b/src/main/java/com/facebook/ads/sdk/GenericVideoAsset.java deleted file mode 100644 index de702d7c..00000000 --- a/src/main/java/com/facebook/ads/sdk/GenericVideoAsset.java +++ /dev/null @@ -1,797 +0,0 @@ -/* - * 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 GenericVideoAsset extends APINode { - @SerializedName("broadcast_id") - private String mBroadcastId = null; - @SerializedName("broadcast_planned_start_time") - private String mBroadcastPlannedStartTime = null; - @SerializedName("can_viewer_edit") - private Boolean mCanViewerEdit = null; - @SerializedName("copyright_monitoring_status") - private String mCopyrightMonitoringStatus = null; - @SerializedName("created_time") - private String mCreatedTime = null; - @SerializedName("creator") - private User mCreator = null; - @SerializedName("description") - private String mDescription = null; - @SerializedName("download_hd_url") - private String mDownloadHdUrl = null; - @SerializedName("download_sd_url") - private String mDownloadSdUrl = null; - @SerializedName("embeddable") - private Boolean mEmbeddable = null; - @SerializedName("expiration") - private Object mExpiration = null; - @SerializedName("feed_type") - private String mFeedType = null; - @SerializedName("id") - private String mId = null; - @SerializedName("is_crossposting_eligible") - private Boolean mIsCrosspostingEligible = null; - @SerializedName("is_crossposting_within_bm_eligible") - private Boolean mIsCrosspostingWithinBmEligible = null; - @SerializedName("is_crossposting_within_bm_enabled") - private Boolean mIsCrosspostingWithinBmEnabled = null; - @SerializedName("is_episode") - private Boolean mIsEpisode = null; - @SerializedName("is_featured") - private Boolean mIsFeatured = null; - @SerializedName("is_live_premiere") - private Boolean mIsLivePremiere = null; - @SerializedName("is_video_asset") - private Boolean mIsVideoAsset = null; - @SerializedName("last_added_time") - private String mLastAddedTime = null; - @SerializedName("latest_creator") - private User mLatestCreator = null; - @SerializedName("latest_owned_description") - private String mLatestOwnedDescription = null; - @SerializedName("latest_owned_title") - private String mLatestOwnedTitle = null; - @SerializedName("length") - private Double mLength = null; - @SerializedName("live_status") - private String mLiveStatus = null; - @SerializedName("no_story") - private Boolean mNoStory = null; - @SerializedName("owner_name") - private String mOwnerName = null; - @SerializedName("owner_picture") - private String mOwnerPicture = null; - @SerializedName("owner_post_state") - private String mOwnerPostState = null; - @SerializedName("permalink_url") - private String mPermalinkUrl = null; - @SerializedName("picture") - private String mPicture = null; - @SerializedName("posts_count") - private Long mPostsCount = null; - @SerializedName("posts_ids") - private List mPostsIds = null; - @SerializedName("posts_status") - private Object mPostsStatus = null; - @SerializedName("premiere_living_room_status") - private String mPremiereLivingRoomStatus = null; - @SerializedName("published") - private Boolean mPublished = null; - @SerializedName("scheduled_publish_time") - private String mScheduledPublishTime = null; - @SerializedName("secret") - private Boolean mSecret = null; - @SerializedName("secure_stream_url") - private String mSecureStreamUrl = null; - @SerializedName("social_actions") - private Boolean mSocialActions = null; - @SerializedName("status") - private VideoStatus mStatus = null; - @SerializedName("stream_url") - private String mStreamUrl = null; - @SerializedName("thumbnail_while_encoding") - private String mThumbnailWhileEncoding = null; - @SerializedName("title") - private String mTitle = null; - @SerializedName("views") - private Long mViews = null; - protected static Gson gson = null; - - public GenericVideoAsset() { - } - - public String getId() { - return getFieldId().toString(); - } - public static GenericVideoAsset loadJSON(String json, APIContext context, String header) { - GenericVideoAsset genericVideoAsset = getGson().fromJson(json, GenericVideoAsset.class); - if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(genericVideoAsset.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); - } - } - genericVideoAsset.context = context; - genericVideoAsset.rawValue = json; - genericVideoAsset.header = header; - return genericVideoAsset; - } - - public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { - APINodeList genericVideoAssets = 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++) { - genericVideoAssets.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); - }; - return genericVideoAssets; - } 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; - genericVideoAssets.setCursors(before, after); - } - String previous = paging.has("previous") ? paging.get("previous").getAsString() : null; - String next = paging.has("next") ? paging.get("next").getAsString() : null; - genericVideoAssets.setPaging(previous, next); - if (context.hasAppSecret()) { - genericVideoAssets.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++) { - genericVideoAssets.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()) { - genericVideoAssets.add(loadJSON(entry.getValue().toString(), context, header)); - } - break; - } - } - if (!isRedownload) { - genericVideoAssets.add(loadJSON(obj.toString(), context, header)); - } - } - return genericVideoAssets; - } 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()) { - genericVideoAssets.add(loadJSON(entry.getValue().toString(), context, header)); - } - return genericVideoAssets; - } 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) - ) { - genericVideoAssets.add(loadJSON(value.toString(), context, header)); - } else { - isIdIndexedArray = false; - break; - } - } - if (isIdIndexedArray) { - return genericVideoAssets; - } - - // Sixth, check if it's pure JsonObject - genericVideoAssets.clear(); - genericVideoAssets.add(loadJSON(json, context, header)); - return genericVideoAssets; - } - } - } 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 String getFieldBroadcastId() { - return mBroadcastId; - } - - public GenericVideoAsset setFieldBroadcastId(String value) { - this.mBroadcastId = value; - return this; - } - - public String getFieldBroadcastPlannedStartTime() { - return mBroadcastPlannedStartTime; - } - - public GenericVideoAsset setFieldBroadcastPlannedStartTime(String value) { - this.mBroadcastPlannedStartTime = value; - return this; - } - - public Boolean getFieldCanViewerEdit() { - return mCanViewerEdit; - } - - public GenericVideoAsset setFieldCanViewerEdit(Boolean value) { - this.mCanViewerEdit = value; - return this; - } - - public String getFieldCopyrightMonitoringStatus() { - return mCopyrightMonitoringStatus; - } - - public GenericVideoAsset setFieldCopyrightMonitoringStatus(String value) { - this.mCopyrightMonitoringStatus = value; - return this; - } - - public String getFieldCreatedTime() { - return mCreatedTime; - } - - public GenericVideoAsset setFieldCreatedTime(String value) { - this.mCreatedTime = value; - return this; - } - - public User getFieldCreator() { - if (mCreator != null) { - mCreator.context = getContext(); - } - return mCreator; - } - - public GenericVideoAsset setFieldCreator(User value) { - this.mCreator = value; - return this; - } - - public GenericVideoAsset setFieldCreator(String value) { - Type type = new TypeToken(){}.getType(); - this.mCreator = User.getGson().fromJson(value, type); - return this; - } - public String getFieldDescription() { - return mDescription; - } - - public GenericVideoAsset setFieldDescription(String value) { - this.mDescription = value; - return this; - } - - public String getFieldDownloadHdUrl() { - return mDownloadHdUrl; - } - - public GenericVideoAsset setFieldDownloadHdUrl(String value) { - this.mDownloadHdUrl = value; - return this; - } - - public String getFieldDownloadSdUrl() { - return mDownloadSdUrl; - } - - public GenericVideoAsset setFieldDownloadSdUrl(String value) { - this.mDownloadSdUrl = value; - return this; - } - - public Boolean getFieldEmbeddable() { - return mEmbeddable; - } - - public GenericVideoAsset setFieldEmbeddable(Boolean value) { - this.mEmbeddable = value; - return this; - } - - public Object getFieldExpiration() { - return mExpiration; - } - - public GenericVideoAsset setFieldExpiration(Object value) { - this.mExpiration = value; - return this; - } - - public String getFieldFeedType() { - return mFeedType; - } - - public GenericVideoAsset setFieldFeedType(String value) { - this.mFeedType = value; - return this; - } - - public String getFieldId() { - return mId; - } - - public GenericVideoAsset setFieldId(String value) { - this.mId = value; - return this; - } - - public Boolean getFieldIsCrosspostingEligible() { - return mIsCrosspostingEligible; - } - - public GenericVideoAsset setFieldIsCrosspostingEligible(Boolean value) { - this.mIsCrosspostingEligible = value; - return this; - } - - public Boolean getFieldIsCrosspostingWithinBmEligible() { - return mIsCrosspostingWithinBmEligible; - } - - public GenericVideoAsset setFieldIsCrosspostingWithinBmEligible(Boolean value) { - this.mIsCrosspostingWithinBmEligible = value; - return this; - } - - public Boolean getFieldIsCrosspostingWithinBmEnabled() { - return mIsCrosspostingWithinBmEnabled; - } - - public GenericVideoAsset setFieldIsCrosspostingWithinBmEnabled(Boolean value) { - this.mIsCrosspostingWithinBmEnabled = value; - return this; - } - - public Boolean getFieldIsEpisode() { - return mIsEpisode; - } - - public GenericVideoAsset setFieldIsEpisode(Boolean value) { - this.mIsEpisode = value; - return this; - } - - public Boolean getFieldIsFeatured() { - return mIsFeatured; - } - - public GenericVideoAsset setFieldIsFeatured(Boolean value) { - this.mIsFeatured = value; - return this; - } - - public Boolean getFieldIsLivePremiere() { - return mIsLivePremiere; - } - - public GenericVideoAsset setFieldIsLivePremiere(Boolean value) { - this.mIsLivePremiere = value; - return this; - } - - public Boolean getFieldIsVideoAsset() { - return mIsVideoAsset; - } - - public GenericVideoAsset setFieldIsVideoAsset(Boolean value) { - this.mIsVideoAsset = value; - return this; - } - - public String getFieldLastAddedTime() { - return mLastAddedTime; - } - - public GenericVideoAsset setFieldLastAddedTime(String value) { - this.mLastAddedTime = value; - return this; - } - - public User getFieldLatestCreator() { - if (mLatestCreator != null) { - mLatestCreator.context = getContext(); - } - return mLatestCreator; - } - - public GenericVideoAsset setFieldLatestCreator(User value) { - this.mLatestCreator = value; - return this; - } - - public GenericVideoAsset setFieldLatestCreator(String value) { - Type type = new TypeToken(){}.getType(); - this.mLatestCreator = User.getGson().fromJson(value, type); - return this; - } - public String getFieldLatestOwnedDescription() { - return mLatestOwnedDescription; - } - - public GenericVideoAsset setFieldLatestOwnedDescription(String value) { - this.mLatestOwnedDescription = value; - return this; - } - - public String getFieldLatestOwnedTitle() { - return mLatestOwnedTitle; - } - - public GenericVideoAsset setFieldLatestOwnedTitle(String value) { - this.mLatestOwnedTitle = value; - return this; - } - - public Double getFieldLength() { - return mLength; - } - - public GenericVideoAsset setFieldLength(Double value) { - this.mLength = value; - return this; - } - - public String getFieldLiveStatus() { - return mLiveStatus; - } - - public GenericVideoAsset setFieldLiveStatus(String value) { - this.mLiveStatus = value; - return this; - } - - public Boolean getFieldNoStory() { - return mNoStory; - } - - public GenericVideoAsset setFieldNoStory(Boolean value) { - this.mNoStory = value; - return this; - } - - public String getFieldOwnerName() { - return mOwnerName; - } - - public GenericVideoAsset setFieldOwnerName(String value) { - this.mOwnerName = value; - return this; - } - - public String getFieldOwnerPicture() { - return mOwnerPicture; - } - - public GenericVideoAsset setFieldOwnerPicture(String value) { - this.mOwnerPicture = value; - return this; - } - - public String getFieldOwnerPostState() { - return mOwnerPostState; - } - - public GenericVideoAsset setFieldOwnerPostState(String value) { - this.mOwnerPostState = value; - return this; - } - - public String getFieldPermalinkUrl() { - return mPermalinkUrl; - } - - public GenericVideoAsset setFieldPermalinkUrl(String value) { - this.mPermalinkUrl = value; - return this; - } - - public String getFieldPicture() { - return mPicture; - } - - public GenericVideoAsset setFieldPicture(String value) { - this.mPicture = value; - return this; - } - - public Long getFieldPostsCount() { - return mPostsCount; - } - - public GenericVideoAsset setFieldPostsCount(Long value) { - this.mPostsCount = value; - return this; - } - - public List getFieldPostsIds() { - return mPostsIds; - } - - public GenericVideoAsset setFieldPostsIds(List value) { - this.mPostsIds = value; - return this; - } - - public Object getFieldPostsStatus() { - return mPostsStatus; - } - - public GenericVideoAsset setFieldPostsStatus(Object value) { - this.mPostsStatus = value; - return this; - } - - public String getFieldPremiereLivingRoomStatus() { - return mPremiereLivingRoomStatus; - } - - public GenericVideoAsset setFieldPremiereLivingRoomStatus(String value) { - this.mPremiereLivingRoomStatus = value; - return this; - } - - public Boolean getFieldPublished() { - return mPublished; - } - - public GenericVideoAsset setFieldPublished(Boolean value) { - this.mPublished = value; - return this; - } - - public String getFieldScheduledPublishTime() { - return mScheduledPublishTime; - } - - public GenericVideoAsset setFieldScheduledPublishTime(String value) { - this.mScheduledPublishTime = value; - return this; - } - - public Boolean getFieldSecret() { - return mSecret; - } - - public GenericVideoAsset setFieldSecret(Boolean value) { - this.mSecret = value; - return this; - } - - public String getFieldSecureStreamUrl() { - return mSecureStreamUrl; - } - - public GenericVideoAsset setFieldSecureStreamUrl(String value) { - this.mSecureStreamUrl = value; - return this; - } - - public Boolean getFieldSocialActions() { - return mSocialActions; - } - - public GenericVideoAsset setFieldSocialActions(Boolean value) { - this.mSocialActions = value; - return this; - } - - public VideoStatus getFieldStatus() { - return mStatus; - } - - public GenericVideoAsset setFieldStatus(VideoStatus value) { - this.mStatus = value; - return this; - } - - public GenericVideoAsset setFieldStatus(String value) { - Type type = new TypeToken(){}.getType(); - this.mStatus = VideoStatus.getGson().fromJson(value, type); - return this; - } - public String getFieldStreamUrl() { - return mStreamUrl; - } - - public GenericVideoAsset setFieldStreamUrl(String value) { - this.mStreamUrl = value; - return this; - } - - public String getFieldThumbnailWhileEncoding() { - return mThumbnailWhileEncoding; - } - - public GenericVideoAsset setFieldThumbnailWhileEncoding(String value) { - this.mThumbnailWhileEncoding = value; - return this; - } - - public String getFieldTitle() { - return mTitle; - } - - public GenericVideoAsset setFieldTitle(String value) { - this.mTitle = value; - return this; - } - - public Long getFieldViews() { - return mViews; - } - - public GenericVideoAsset setFieldViews(Long value) { - this.mViews = 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 GenericVideoAsset copyFrom(GenericVideoAsset instance) { - this.mBroadcastId = instance.mBroadcastId; - this.mBroadcastPlannedStartTime = instance.mBroadcastPlannedStartTime; - this.mCanViewerEdit = instance.mCanViewerEdit; - this.mCopyrightMonitoringStatus = instance.mCopyrightMonitoringStatus; - this.mCreatedTime = instance.mCreatedTime; - this.mCreator = instance.mCreator; - this.mDescription = instance.mDescription; - this.mDownloadHdUrl = instance.mDownloadHdUrl; - this.mDownloadSdUrl = instance.mDownloadSdUrl; - this.mEmbeddable = instance.mEmbeddable; - this.mExpiration = instance.mExpiration; - this.mFeedType = instance.mFeedType; - this.mId = instance.mId; - this.mIsCrosspostingEligible = instance.mIsCrosspostingEligible; - this.mIsCrosspostingWithinBmEligible = instance.mIsCrosspostingWithinBmEligible; - this.mIsCrosspostingWithinBmEnabled = instance.mIsCrosspostingWithinBmEnabled; - this.mIsEpisode = instance.mIsEpisode; - this.mIsFeatured = instance.mIsFeatured; - this.mIsLivePremiere = instance.mIsLivePremiere; - this.mIsVideoAsset = instance.mIsVideoAsset; - this.mLastAddedTime = instance.mLastAddedTime; - this.mLatestCreator = instance.mLatestCreator; - this.mLatestOwnedDescription = instance.mLatestOwnedDescription; - this.mLatestOwnedTitle = instance.mLatestOwnedTitle; - this.mLength = instance.mLength; - this.mLiveStatus = instance.mLiveStatus; - this.mNoStory = instance.mNoStory; - this.mOwnerName = instance.mOwnerName; - this.mOwnerPicture = instance.mOwnerPicture; - this.mOwnerPostState = instance.mOwnerPostState; - this.mPermalinkUrl = instance.mPermalinkUrl; - this.mPicture = instance.mPicture; - this.mPostsCount = instance.mPostsCount; - this.mPostsIds = instance.mPostsIds; - this.mPostsStatus = instance.mPostsStatus; - this.mPremiereLivingRoomStatus = instance.mPremiereLivingRoomStatus; - this.mPublished = instance.mPublished; - this.mScheduledPublishTime = instance.mScheduledPublishTime; - this.mSecret = instance.mSecret; - this.mSecureStreamUrl = instance.mSecureStreamUrl; - this.mSocialActions = instance.mSocialActions; - this.mStatus = instance.mStatus; - this.mStreamUrl = instance.mStreamUrl; - this.mThumbnailWhileEncoding = instance.mThumbnailWhileEncoding; - this.mTitle = instance.mTitle; - this.mViews = instance.mViews; - 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 GenericVideoAsset.parseResponse(response, context, request, header); - } - }; - } -} diff --git a/src/main/java/com/facebook/ads/sdk/Group.java b/src/main/java/com/facebook/ads/sdk/Group.java index c3148811..b4884002 100644 --- a/src/main/java/com/facebook/ads/sdk/Group.java +++ b/src/main/java/com/facebook/ads/sdk/Group.java @@ -2325,7 +2325,6 @@ public Post getLastResponse() { "actions", "album_id", "android_key_hash", - "animated_effect_id", "application_id", "asked_fun_fact_prompt_id", "asset3d_id", @@ -2509,15 +2508,6 @@ public APIRequestCreateFeed setAndroidKeyHash (String androidKeyHash) { return this; } - public APIRequestCreateFeed setAnimatedEffectId (Long animatedEffectId) { - this.setParam("animated_effect_id", animatedEffectId); - return this; - } - public APIRequestCreateFeed setAnimatedEffectId (String animatedEffectId) { - this.setParam("animated_effect_id", animatedEffectId); - return this; - } - public APIRequestCreateFeed setApplicationId (String applicationId) { this.setParam("application_id", applicationId); return this; @@ -6486,7 +6476,6 @@ public AdVideo getLastResponse() { return lastResponse; } public static final String[] PARAMS = { - "animated_effect_id", "application_id", "asked_fun_fact_prompt_id", "audio_story_wave_animation_handle", @@ -6616,15 +6605,6 @@ public APIRequestCreateVideo setParams(Map params) { } - public APIRequestCreateVideo setAnimatedEffectId (Long animatedEffectId) { - this.setParam("animated_effect_id", animatedEffectId); - return this; - } - public APIRequestCreateVideo setAnimatedEffectId (String animatedEffectId) { - this.setParam("animated_effect_id", animatedEffectId); - return this; - } - public APIRequestCreateVideo setApplicationId (String applicationId) { this.setParam("application_id", applicationId); return this; diff --git a/src/main/java/com/facebook/ads/sdk/HomeListing.java b/src/main/java/com/facebook/ads/sdk/HomeListing.java index b4d5cc34..5ccc43db 100644 --- a/src/main/java/com/facebook/ads/sdk/HomeListing.java +++ b/src/main/java/com/facebook/ads/sdk/HomeListing.java @@ -342,14 +342,14 @@ public String toString() { return getGson().toJson(this); } - public APIRequestGetAugmentedRealitiesMetadata getAugmentedRealitiesMetadata() { - return new APIRequestGetAugmentedRealitiesMetadata(this.getPrefixedId().toString(), context); - } - public APIRequestGetChannelsToIntegrityStatus getChannelsToIntegrityStatus() { return new APIRequestGetChannelsToIntegrityStatus(this.getPrefixedId().toString(), context); } + public APIRequestGetOverrideDetails getOverrideDetails() { + return new APIRequestGetOverrideDetails(this.getPrefixedId().toString(), context); + } + public APIRequestGetVideosMetadata getVideosMetadata() { return new APIRequestGetVideosMetadata(this.getPrefixedId().toString(), context); } @@ -556,59 +556,49 @@ public Long getFieldYearBuilt() { - public static class APIRequestGetAugmentedRealitiesMetadata extends APIRequest { + public static class APIRequestGetChannelsToIntegrityStatus extends APIRequest { - APINodeList lastResponse = null; + APINodeList lastResponse = null; @Override - public APINodeList getLastResponse() { + public APINodeList getLastResponse() { return lastResponse; } public static final String[] PARAMS = { }; public static final String[] FIELDS = { - "anchor_point", - "container_effect_enum", - "effect_icon_url", - "effect_id", - "id", - "platforms", - "scale_factor", - "shadow_texture_url", - "source_url", - "state", - "tags", - "variant_picker_url", + "channels", + "rejection_information", }; @Override - public APINodeList parseResponse(String response, String header) throws APIException { - return DynamicARMetadata.parseResponse(response, getContext(), this, header); + public APINodeList parseResponse(String response, String header) throws APIException { + return CatalogItemChannelsToIntegrityStatus.parseResponse(response, getContext(), this, header); } @Override - public APINodeList execute() throws APIException { + public APINodeList execute() throws APIException { return execute(new HashMap()); } @Override - public APINodeList execute(Map extraParams) throws APIException { + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + new Function>() { + public APINodeList apply(ResponseWrapper result) { try { - return APIRequestGetAugmentedRealitiesMetadata.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestGetChannelsToIntegrityStatus.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -618,28 +608,28 @@ public APINodeList apply(ResponseWrapper result) { ); }; - public APIRequestGetAugmentedRealitiesMetadata(String nodeId, APIContext context) { - super(context, nodeId, "/augmented_realities_metadata", "GET", Arrays.asList(PARAMS)); + public APIRequestGetChannelsToIntegrityStatus(String nodeId, APIContext context) { + super(context, nodeId, "/channels_to_integrity_status", "GET", Arrays.asList(PARAMS)); } @Override - public APIRequestGetAugmentedRealitiesMetadata setParam(String param, Object value) { + public APIRequestGetChannelsToIntegrityStatus setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestGetAugmentedRealitiesMetadata setParams(Map params) { + public APIRequestGetChannelsToIntegrityStatus setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestGetAugmentedRealitiesMetadata requestAllFields () { + public APIRequestGetChannelsToIntegrityStatus requestAllFields () { return this.requestAllFields(true); } - public APIRequestGetAugmentedRealitiesMetadata requestAllFields (boolean value) { + public APIRequestGetChannelsToIntegrityStatus requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -647,12 +637,12 @@ public APIRequestGetAugmentedRealitiesMetadata requestAllFields (boolean value) } @Override - public APIRequestGetAugmentedRealitiesMetadata requestFields (List fields) { + public APIRequestGetChannelsToIntegrityStatus requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestGetAugmentedRealitiesMetadata requestFields (List fields, boolean value) { + public APIRequestGetChannelsToIntegrityStatus requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -660,146 +650,79 @@ public APIRequestGetAugmentedRealitiesMetadata requestFields (List field } @Override - public APIRequestGetAugmentedRealitiesMetadata requestField (String field) { + public APIRequestGetChannelsToIntegrityStatus requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestGetAugmentedRealitiesMetadata requestField (String field, boolean value) { + public APIRequestGetChannelsToIntegrityStatus requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } - public APIRequestGetAugmentedRealitiesMetadata requestAnchorPointField () { - return this.requestAnchorPointField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestAnchorPointField (boolean value) { - this.requestField("anchor_point", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestContainerEffectEnumField () { - return this.requestContainerEffectEnumField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestContainerEffectEnumField (boolean value) { - this.requestField("container_effect_enum", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIconUrlField () { - return this.requestEffectIconUrlField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIconUrlField (boolean value) { - this.requestField("effect_icon_url", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIdField () { - return this.requestEffectIdField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIdField (boolean value) { - this.requestField("effect_id", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestIdField () { - return this.requestIdField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestIdField (boolean value) { - this.requestField("id", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestPlatformsField () { - return this.requestPlatformsField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestPlatformsField (boolean value) { - this.requestField("platforms", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestScaleFactorField () { - return this.requestScaleFactorField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestScaleFactorField (boolean value) { - this.requestField("scale_factor", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestShadowTextureUrlField () { - return this.requestShadowTextureUrlField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestShadowTextureUrlField (boolean value) { - this.requestField("shadow_texture_url", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestSourceUrlField () { - return this.requestSourceUrlField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestSourceUrlField (boolean value) { - this.requestField("source_url", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestStateField () { - return this.requestStateField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestStateField (boolean value) { - this.requestField("state", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestTagsField () { - return this.requestTagsField(true); + public APIRequestGetChannelsToIntegrityStatus requestChannelsField () { + return this.requestChannelsField(true); } - public APIRequestGetAugmentedRealitiesMetadata requestTagsField (boolean value) { - this.requestField("tags", value); + public APIRequestGetChannelsToIntegrityStatus requestChannelsField (boolean value) { + this.requestField("channels", value); return this; } - public APIRequestGetAugmentedRealitiesMetadata requestVariantPickerUrlField () { - return this.requestVariantPickerUrlField(true); + public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField () { + return this.requestRejectionInformationField(true); } - public APIRequestGetAugmentedRealitiesMetadata requestVariantPickerUrlField (boolean value) { - this.requestField("variant_picker_url", value); + public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField (boolean value) { + this.requestField("rejection_information", value); return this; } } - public static class APIRequestGetChannelsToIntegrityStatus extends APIRequest { + public static class APIRequestGetOverrideDetails extends APIRequest { - APINodeList lastResponse = null; + APINodeList lastResponse = null; @Override - public APINodeList getLastResponse() { + public APINodeList getLastResponse() { return lastResponse; } public static final String[] PARAMS = { + "keys", + "type", }; public static final String[] FIELDS = { - "channels", - "rejection_information", + "key", + "type", + "values", }; @Override - public APINodeList parseResponse(String response, String header) throws APIException { - return CatalogItemChannelsToIntegrityStatus.parseResponse(response, getContext(), this, header); + public APINodeList parseResponse(String response, String header) throws APIException { + return OverrideDetails.parseResponse(response, getContext(), this, header); } @Override - public APINodeList execute() throws APIException { + public APINodeList execute() throws APIException { return execute(new HashMap()); } @Override - public APINodeList execute(Map extraParams) throws APIException { + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + new Function>() { + public APINodeList apply(ResponseWrapper result) { try { - return APIRequestGetChannelsToIntegrityStatus.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestGetOverrideDetails.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -809,28 +732,46 @@ public APINodeList apply(ResponseWrapper r ); }; - public APIRequestGetChannelsToIntegrityStatus(String nodeId, APIContext context) { - super(context, nodeId, "/channels_to_integrity_status", "GET", Arrays.asList(PARAMS)); + public APIRequestGetOverrideDetails(String nodeId, APIContext context) { + super(context, nodeId, "/override_details", "GET", Arrays.asList(PARAMS)); } @Override - public APIRequestGetChannelsToIntegrityStatus setParam(String param, Object value) { + public APIRequestGetOverrideDetails setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestGetChannelsToIntegrityStatus setParams(Map params) { + public APIRequestGetOverrideDetails setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestGetChannelsToIntegrityStatus requestAllFields () { + public APIRequestGetOverrideDetails setKeys (List keys) { + this.setParam("keys", keys); + return this; + } + public APIRequestGetOverrideDetails setKeys (String keys) { + this.setParam("keys", keys); + return this; + } + + public APIRequestGetOverrideDetails setType (OverrideDetails.EnumType type) { + this.setParam("type", type); + return this; + } + public APIRequestGetOverrideDetails setType (String type) { + this.setParam("type", type); + return this; + } + + public APIRequestGetOverrideDetails requestAllFields () { return this.requestAllFields(true); } - public APIRequestGetChannelsToIntegrityStatus requestAllFields (boolean value) { + public APIRequestGetOverrideDetails requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -838,12 +779,12 @@ public APIRequestGetChannelsToIntegrityStatus requestAllFields (boolean value) { } @Override - public APIRequestGetChannelsToIntegrityStatus requestFields (List fields) { + public APIRequestGetOverrideDetails requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestGetChannelsToIntegrityStatus requestFields (List fields, boolean value) { + public APIRequestGetOverrideDetails requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -851,29 +792,36 @@ public APIRequestGetChannelsToIntegrityStatus requestFields (List fields } @Override - public APIRequestGetChannelsToIntegrityStatus requestField (String field) { + public APIRequestGetOverrideDetails requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestGetChannelsToIntegrityStatus requestField (String field, boolean value) { + public APIRequestGetOverrideDetails requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } - public APIRequestGetChannelsToIntegrityStatus requestChannelsField () { - return this.requestChannelsField(true); + public APIRequestGetOverrideDetails requestKeyField () { + return this.requestKeyField(true); } - public APIRequestGetChannelsToIntegrityStatus requestChannelsField (boolean value) { - this.requestField("channels", value); + public APIRequestGetOverrideDetails requestKeyField (boolean value) { + this.requestField("key", value); return this; } - public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField () { - return this.requestRejectionInformationField(true); + public APIRequestGetOverrideDetails requestTypeField () { + return this.requestTypeField(true); } - public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField (boolean value) { - this.requestField("rejection_information", value); + public APIRequestGetOverrideDetails requestTypeField (boolean value) { + this.requestField("type", value); + return this; + } + public APIRequestGetOverrideDetails requestValuesField () { + return this.requestValuesField(true); + } + public APIRequestGetOverrideDetails requestValuesField (boolean value) { + this.requestField("values", value); return this; } } diff --git a/src/main/java/com/facebook/ads/sdk/Hotel.java b/src/main/java/com/facebook/ads/sdk/Hotel.java index 15fe73a6..694a56b9 100644 --- a/src/main/java/com/facebook/ads/sdk/Hotel.java +++ b/src/main/java/com/facebook/ads/sdk/Hotel.java @@ -298,10 +298,6 @@ public String toString() { return getGson().toJson(this); } - public APIRequestGetAugmentedRealitiesMetadata getAugmentedRealitiesMetadata() { - return new APIRequestGetAugmentedRealitiesMetadata(this.getPrefixedId().toString(), context); - } - public APIRequestGetChannelsToIntegrityStatus getChannelsToIntegrityStatus() { return new APIRequestGetChannelsToIntegrityStatus(this.getPrefixedId().toString(), context); } @@ -310,6 +306,10 @@ public APIRequestGetHotelRooms getHotelRooms() { return new APIRequestGetHotelRooms(this.getPrefixedId().toString(), context); } + public APIRequestGetOverrideDetails getOverrideDetails() { + return new APIRequestGetOverrideDetails(this.getPrefixedId().toString(), context); + } + public APIRequestGetVideosMetadata getVideosMetadata() { return new APIRequestGetVideosMetadata(this.getPrefixedId().toString(), context); } @@ -425,207 +425,6 @@ public EnumVisibility getFieldVisibility() { - public static class APIRequestGetAugmentedRealitiesMetadata extends APIRequest { - - APINodeList lastResponse = null; - @Override - public APINodeList getLastResponse() { - return lastResponse; - } - public static final String[] PARAMS = { - }; - - public static final String[] FIELDS = { - "anchor_point", - "container_effect_enum", - "effect_icon_url", - "effect_id", - "id", - "platforms", - "scale_factor", - "shadow_texture_url", - "source_url", - "state", - "tags", - "variant_picker_url", - }; - - @Override - public APINodeList parseResponse(String response, String header) throws APIException { - return DynamicARMetadata.parseResponse(response, getContext(), this, header); - } - - @Override - public APINodeList execute() throws APIException { - return execute(new HashMap()); - } - - @Override - public APINodeList 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 APINodeList apply(ResponseWrapper result) { - try { - return APIRequestGetAugmentedRealitiesMetadata.this.parseResponse(result.getBody(), result.getHeader()); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - }, - MoreExecutors.directExecutor() - ); - }; - - public APIRequestGetAugmentedRealitiesMetadata(String nodeId, APIContext context) { - super(context, nodeId, "/augmented_realities_metadata", "GET", Arrays.asList(PARAMS)); - } - - @Override - public APIRequestGetAugmentedRealitiesMetadata setParam(String param, Object value) { - setParamInternal(param, value); - return this; - } - - @Override - public APIRequestGetAugmentedRealitiesMetadata setParams(Map params) { - setParamsInternal(params); - return this; - } - - - public APIRequestGetAugmentedRealitiesMetadata requestAllFields () { - return this.requestAllFields(true); - } - - public APIRequestGetAugmentedRealitiesMetadata requestAllFields (boolean value) { - for (String field : FIELDS) { - this.requestField(field, value); - } - return this; - } - - @Override - public APIRequestGetAugmentedRealitiesMetadata requestFields (List fields) { - return this.requestFields(fields, true); - } - - @Override - public APIRequestGetAugmentedRealitiesMetadata requestFields (List fields, boolean value) { - for (String field : fields) { - this.requestField(field, value); - } - return this; - } - - @Override - public APIRequestGetAugmentedRealitiesMetadata requestField (String field) { - this.requestField(field, true); - return this; - } - - @Override - public APIRequestGetAugmentedRealitiesMetadata requestField (String field, boolean value) { - this.requestFieldInternal(field, value); - return this; - } - - public APIRequestGetAugmentedRealitiesMetadata requestAnchorPointField () { - return this.requestAnchorPointField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestAnchorPointField (boolean value) { - this.requestField("anchor_point", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestContainerEffectEnumField () { - return this.requestContainerEffectEnumField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestContainerEffectEnumField (boolean value) { - this.requestField("container_effect_enum", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIconUrlField () { - return this.requestEffectIconUrlField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIconUrlField (boolean value) { - this.requestField("effect_icon_url", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIdField () { - return this.requestEffectIdField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIdField (boolean value) { - this.requestField("effect_id", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestIdField () { - return this.requestIdField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestIdField (boolean value) { - this.requestField("id", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestPlatformsField () { - return this.requestPlatformsField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestPlatformsField (boolean value) { - this.requestField("platforms", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestScaleFactorField () { - return this.requestScaleFactorField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestScaleFactorField (boolean value) { - this.requestField("scale_factor", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestShadowTextureUrlField () { - return this.requestShadowTextureUrlField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestShadowTextureUrlField (boolean value) { - this.requestField("shadow_texture_url", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestSourceUrlField () { - return this.requestSourceUrlField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestSourceUrlField (boolean value) { - this.requestField("source_url", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestStateField () { - return this.requestStateField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestStateField (boolean value) { - this.requestField("state", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestTagsField () { - return this.requestTagsField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestTagsField (boolean value) { - this.requestField("tags", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestVariantPickerUrlField () { - return this.requestVariantPickerUrlField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestVariantPickerUrlField (boolean value) { - this.requestField("variant_picker_url", value); - return this; - } - } - public static class APIRequestGetChannelsToIntegrityStatus extends APIRequest { APINodeList lastResponse = null; @@ -940,6 +739,155 @@ public APIRequestGetHotelRooms requestUrlField (boolean value) { } } + public static class APIRequestGetOverrideDetails extends APIRequest { + + APINodeList lastResponse = null; + @Override + public APINodeList getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "keys", + "type", + }; + + public static final String[] FIELDS = { + "key", + "type", + "values", + }; + + @Override + public APINodeList parseResponse(String response, String header) throws APIException { + return OverrideDetails.parseResponse(response, getContext(), this, header); + } + + @Override + public APINodeList execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + try { + return APIRequestGetOverrideDetails.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestGetOverrideDetails(String nodeId, APIContext context) { + super(context, nodeId, "/override_details", "GET", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestGetOverrideDetails setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestGetOverrideDetails setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestGetOverrideDetails setKeys (List keys) { + this.setParam("keys", keys); + return this; + } + public APIRequestGetOverrideDetails setKeys (String keys) { + this.setParam("keys", keys); + return this; + } + + public APIRequestGetOverrideDetails setType (OverrideDetails.EnumType type) { + this.setParam("type", type); + return this; + } + public APIRequestGetOverrideDetails setType (String type) { + this.setParam("type", type); + return this; + } + + public APIRequestGetOverrideDetails requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestGetOverrideDetails requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetOverrideDetails requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestGetOverrideDetails requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetOverrideDetails requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestGetOverrideDetails requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + public APIRequestGetOverrideDetails requestKeyField () { + return this.requestKeyField(true); + } + public APIRequestGetOverrideDetails requestKeyField (boolean value) { + this.requestField("key", value); + return this; + } + public APIRequestGetOverrideDetails requestTypeField () { + return this.requestTypeField(true); + } + public APIRequestGetOverrideDetails requestTypeField (boolean value) { + this.requestField("type", value); + return this; + } + public APIRequestGetOverrideDetails requestValuesField () { + return this.requestValuesField(true); + } + public APIRequestGetOverrideDetails requestValuesField (boolean value) { + this.requestField("values", value); + return this; + } + } + public static class APIRequestGetVideosMetadata extends APIRequest { APINodeList lastResponse = null; diff --git a/src/main/java/com/facebook/ads/sdk/IGMedia.java b/src/main/java/com/facebook/ads/sdk/IGMedia.java index 994e1a47..5f1f91b9 100644 --- a/src/main/java/com/facebook/ads/sdk/IGMedia.java +++ b/src/main/java/com/facebook/ads/sdk/IGMedia.java @@ -318,8 +318,12 @@ public APIRequestGetInsights getInsights() { return new APIRequestGetInsights(this.getPrefixedId().toString(), context); } - public APIRequestDeleteProductTags deleteProductTags() { - return new APIRequestDeleteProductTags(this.getPrefixedId().toString(), context); + public APIRequestDeletePartnershipAdCode deletePartnershipAdCode() { + return new APIRequestDeletePartnershipAdCode(this.getPrefixedId().toString(), context); + } + + public APIRequestCreatePartnershipAdCode createPartnershipAdCode() { + return new APIRequestCreatePartnershipAdCode(this.getPrefixedId().toString(), context); } public APIRequestGetProductTags getProductTags() { @@ -1651,7 +1655,7 @@ public APIRequestGetInsights requestValuesField (boolean value) { } } - public static class APIRequestDeleteProductTags extends APIRequest { + public static class APIRequestDeletePartnershipAdCode extends APIRequest { APINodeList lastResponse = null; @Override @@ -1659,8 +1663,6 @@ public APINodeList getLastResponse() { return lastResponse; } public static final String[] PARAMS = { - "child_index", - "deleted_tags", }; public static final String[] FIELDS = { @@ -1693,7 +1695,7 @@ public ListenableFuture> executeAsync(Map e new Function>() { public APINodeList apply(ResponseWrapper result) { try { - return APIRequestDeleteProductTags.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestDeletePartnershipAdCode.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -1703,46 +1705,133 @@ public APINodeList apply(ResponseWrapper result) { ); }; - public APIRequestDeleteProductTags(String nodeId, APIContext context) { - super(context, nodeId, "/product_tags", "DELETE", Arrays.asList(PARAMS)); + public APIRequestDeletePartnershipAdCode(String nodeId, APIContext context) { + super(context, nodeId, "/partnership_ad_code", "DELETE", Arrays.asList(PARAMS)); } @Override - public APIRequestDeleteProductTags setParam(String param, Object value) { + public APIRequestDeletePartnershipAdCode setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestDeleteProductTags setParams(Map params) { + public APIRequestDeletePartnershipAdCode setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestDeleteProductTags setChildIndex (Long childIndex) { - this.setParam("child_index", childIndex); + public APIRequestDeletePartnershipAdCode requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestDeletePartnershipAdCode requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } return this; } - public APIRequestDeleteProductTags setChildIndex (String childIndex) { - this.setParam("child_index", childIndex); + + @Override + public APIRequestDeletePartnershipAdCode requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestDeletePartnershipAdCode requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } return this; } - public APIRequestDeleteProductTags setDeletedTags (List> deletedTags) { - this.setParam("deleted_tags", deletedTags); + @Override + public APIRequestDeletePartnershipAdCode requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestDeletePartnershipAdCode requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + + public static class APIRequestCreatePartnershipAdCode extends APIRequest { + + APINode lastResponse = null; + @Override + public APINode getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + }; + + public static final String[] FIELDS = { + }; + + @Override + public APINode parseResponse(String response, String header) throws APIException { + return APINode.parseResponse(response, getContext(), this, header).head(); + } + + @Override + public APINode execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINode 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 APINode apply(ResponseWrapper result) { + try { + return APIRequestCreatePartnershipAdCode.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestCreatePartnershipAdCode(String nodeId, APIContext context) { + super(context, nodeId, "/partnership_ad_code", "POST", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestCreatePartnershipAdCode setParam(String param, Object value) { + setParamInternal(param, value); return this; } - public APIRequestDeleteProductTags setDeletedTags (String deletedTags) { - this.setParam("deleted_tags", deletedTags); + + @Override + public APIRequestCreatePartnershipAdCode setParams(Map params) { + setParamsInternal(params); return this; } - public APIRequestDeleteProductTags requestAllFields () { + + public APIRequestCreatePartnershipAdCode requestAllFields () { return this.requestAllFields(true); } - public APIRequestDeleteProductTags requestAllFields (boolean value) { + public APIRequestCreatePartnershipAdCode requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -1750,12 +1839,12 @@ public APIRequestDeleteProductTags requestAllFields (boolean value) { } @Override - public APIRequestDeleteProductTags requestFields (List fields) { + public APIRequestCreatePartnershipAdCode requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestDeleteProductTags requestFields (List fields, boolean value) { + public APIRequestCreatePartnershipAdCode requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -1763,13 +1852,13 @@ public APIRequestDeleteProductTags requestFields (List fields, boolean v } @Override - public APIRequestDeleteProductTags requestField (String field) { + public APIRequestCreatePartnershipAdCode requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestDeleteProductTags requestField (String field, boolean value) { + public APIRequestCreatePartnershipAdCode requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } diff --git a/src/main/java/com/facebook/ads/sdk/IGMediaForIGOnlyAPI.java b/src/main/java/com/facebook/ads/sdk/IGMediaForIGOnlyAPI.java index 333745c7..d99dfffe 100644 --- a/src/main/java/com/facebook/ads/sdk/IGMediaForIGOnlyAPI.java +++ b/src/main/java/com/facebook/ads/sdk/IGMediaForIGOnlyAPI.java @@ -43,8 +43,12 @@ public class IGMediaForIGOnlyAPI extends APINode { @SerializedName("caption") private String mCaption = null; + @SerializedName("comments_count") + private Long mCommentsCount = null; @SerializedName("id") private String mId = null; + @SerializedName("is_comment_enabled") + private Boolean mIsCommentEnabled = null; @SerializedName("is_shared_to_feed") private Boolean mIsSharedToFeed = null; @SerializedName("like_count") @@ -280,19 +284,39 @@ public APIRequestGetChildren getChildren() { return new APIRequestGetChildren(this.getPrefixedId().toString(), context); } + public APIRequestGetComments getComments() { + return new APIRequestGetComments(this.getPrefixedId().toString(), context); + } + + public APIRequestCreateComment createComment() { + return new APIRequestCreateComment(this.getPrefixedId().toString(), context); + } + public APIRequestGet get() { return new APIRequestGet(this.getPrefixedId().toString(), context); } + public APIRequestUpdate update() { + return new APIRequestUpdate(this.getPrefixedId().toString(), context); + } + public String getFieldCaption() { return mCaption; } + public Long getFieldCommentsCount() { + return mCommentsCount; + } + public String getFieldId() { return mId; } + public Boolean getFieldIsCommentEnabled() { + return mIsCommentEnabled; + } + public Boolean getFieldIsSharedToFeed() { return mIsSharedToFeed; } @@ -447,6 +471,406 @@ public APIRequestGetChildren requestField (String field, boolean value) { } + public static class APIRequestGetComments extends APIRequest { + + APINodeList lastResponse = null; + @Override + public APINodeList getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + }; + + public static final String[] FIELDS = { + "admin_creator", + "application", + "attachment", + "can_comment", + "can_hide", + "can_like", + "can_remove", + "can_reply_privately", + "comment_count", + "created_time", + "from", + "id", + "is_hidden", + "is_private", + "like_count", + "live_broadcast_timestamp", + "message", + "message_tags", + "object", + "parent", + "permalink_url", + "private_reply_conversation", + "user_likes", + }; + + @Override + public APINodeList parseResponse(String response, String header) throws APIException { + return Comment.parseResponse(response, getContext(), this, header); + } + + @Override + public APINodeList execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + try { + return APIRequestGetComments.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestGetComments(String nodeId, APIContext context) { + super(context, nodeId, "/comments", "GET", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestGetComments setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestGetComments setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestGetComments requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestGetComments requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetComments requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestGetComments requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetComments requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestGetComments requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + public APIRequestGetComments requestAdminCreatorField () { + return this.requestAdminCreatorField(true); + } + public APIRequestGetComments requestAdminCreatorField (boolean value) { + this.requestField("admin_creator", value); + return this; + } + public APIRequestGetComments requestApplicationField () { + return this.requestApplicationField(true); + } + public APIRequestGetComments requestApplicationField (boolean value) { + this.requestField("application", value); + return this; + } + public APIRequestGetComments requestAttachmentField () { + return this.requestAttachmentField(true); + } + public APIRequestGetComments requestAttachmentField (boolean value) { + this.requestField("attachment", value); + return this; + } + public APIRequestGetComments requestCanCommentField () { + return this.requestCanCommentField(true); + } + public APIRequestGetComments requestCanCommentField (boolean value) { + this.requestField("can_comment", value); + return this; + } + public APIRequestGetComments requestCanHideField () { + return this.requestCanHideField(true); + } + public APIRequestGetComments requestCanHideField (boolean value) { + this.requestField("can_hide", value); + return this; + } + public APIRequestGetComments requestCanLikeField () { + return this.requestCanLikeField(true); + } + public APIRequestGetComments requestCanLikeField (boolean value) { + this.requestField("can_like", value); + return this; + } + public APIRequestGetComments requestCanRemoveField () { + return this.requestCanRemoveField(true); + } + public APIRequestGetComments requestCanRemoveField (boolean value) { + this.requestField("can_remove", value); + return this; + } + public APIRequestGetComments requestCanReplyPrivatelyField () { + return this.requestCanReplyPrivatelyField(true); + } + public APIRequestGetComments requestCanReplyPrivatelyField (boolean value) { + this.requestField("can_reply_privately", value); + return this; + } + public APIRequestGetComments requestCommentCountField () { + return this.requestCommentCountField(true); + } + public APIRequestGetComments requestCommentCountField (boolean value) { + this.requestField("comment_count", value); + return this; + } + public APIRequestGetComments requestCreatedTimeField () { + return this.requestCreatedTimeField(true); + } + public APIRequestGetComments requestCreatedTimeField (boolean value) { + this.requestField("created_time", value); + return this; + } + public APIRequestGetComments requestFromField () { + return this.requestFromField(true); + } + public APIRequestGetComments requestFromField (boolean value) { + this.requestField("from", value); + return this; + } + public APIRequestGetComments requestIdField () { + return this.requestIdField(true); + } + public APIRequestGetComments requestIdField (boolean value) { + this.requestField("id", value); + return this; + } + public APIRequestGetComments requestIsHiddenField () { + return this.requestIsHiddenField(true); + } + public APIRequestGetComments requestIsHiddenField (boolean value) { + this.requestField("is_hidden", value); + return this; + } + public APIRequestGetComments requestIsPrivateField () { + return this.requestIsPrivateField(true); + } + public APIRequestGetComments requestIsPrivateField (boolean value) { + this.requestField("is_private", value); + return this; + } + public APIRequestGetComments requestLikeCountField () { + return this.requestLikeCountField(true); + } + public APIRequestGetComments requestLikeCountField (boolean value) { + this.requestField("like_count", value); + return this; + } + public APIRequestGetComments requestLiveBroadcastTimestampField () { + return this.requestLiveBroadcastTimestampField(true); + } + public APIRequestGetComments requestLiveBroadcastTimestampField (boolean value) { + this.requestField("live_broadcast_timestamp", value); + return this; + } + public APIRequestGetComments requestMessageField () { + return this.requestMessageField(true); + } + public APIRequestGetComments requestMessageField (boolean value) { + this.requestField("message", value); + return this; + } + public APIRequestGetComments requestMessageTagsField () { + return this.requestMessageTagsField(true); + } + public APIRequestGetComments requestMessageTagsField (boolean value) { + this.requestField("message_tags", value); + return this; + } + public APIRequestGetComments requestObjectField () { + return this.requestObjectField(true); + } + public APIRequestGetComments requestObjectField (boolean value) { + this.requestField("object", value); + return this; + } + public APIRequestGetComments requestParentField () { + return this.requestParentField(true); + } + public APIRequestGetComments requestParentField (boolean value) { + this.requestField("parent", value); + return this; + } + public APIRequestGetComments requestPermalinkUrlField () { + return this.requestPermalinkUrlField(true); + } + public APIRequestGetComments requestPermalinkUrlField (boolean value) { + this.requestField("permalink_url", value); + return this; + } + public APIRequestGetComments requestPrivateReplyConversationField () { + return this.requestPrivateReplyConversationField(true); + } + public APIRequestGetComments requestPrivateReplyConversationField (boolean value) { + this.requestField("private_reply_conversation", value); + return this; + } + public APIRequestGetComments requestUserLikesField () { + return this.requestUserLikesField(true); + } + public APIRequestGetComments requestUserLikesField (boolean value) { + this.requestField("user_likes", value); + return this; + } + } + + public static class APIRequestCreateComment extends APIRequest { + + APINode lastResponse = null; + @Override + public APINode getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "message", + }; + + public static final String[] FIELDS = { + }; + + @Override + public APINode parseResponse(String response, String header) throws APIException { + return APINode.parseResponse(response, getContext(), this, header).head(); + } + + @Override + public APINode execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINode 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 APINode apply(ResponseWrapper result) { + try { + return APIRequestCreateComment.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestCreateComment(String nodeId, APIContext context) { + super(context, nodeId, "/comments", "POST", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestCreateComment setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestCreateComment setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestCreateComment setMessage (String message) { + this.setParam("message", message); + return this; + } + + public APIRequestCreateComment requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestCreateComment requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestCreateComment requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestCreateComment requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestCreateComment requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestCreateComment requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + public static class APIRequestGet extends APIRequest { IGMediaForIGOnlyAPI lastResponse = null; @@ -459,7 +883,9 @@ public IGMediaForIGOnlyAPI getLastResponse() { public static final String[] FIELDS = { "caption", + "comments_count", "id", + "is_comment_enabled", "is_shared_to_feed", "like_count", "media_product_type", @@ -570,6 +996,13 @@ public APIRequestGet requestCaptionField (boolean value) { this.requestField("caption", value); return this; } + public APIRequestGet requestCommentsCountField () { + return this.requestCommentsCountField(true); + } + public APIRequestGet requestCommentsCountField (boolean value) { + this.requestField("comments_count", value); + return this; + } public APIRequestGet requestIdField () { return this.requestIdField(true); } @@ -577,6 +1010,13 @@ public APIRequestGet requestIdField (boolean value) { this.requestField("id", value); return this; } + public APIRequestGet requestIsCommentEnabledField () { + return this.requestIsCommentEnabledField(true); + } + public APIRequestGet requestIsCommentEnabledField (boolean value) { + this.requestField("is_comment_enabled", value); + return this; + } public APIRequestGet requestIsSharedToFeedField () { return this.requestIsSharedToFeedField(true); } @@ -656,6 +1096,121 @@ public APIRequestGet requestUsernameField (boolean value) { } } + public static class APIRequestUpdate extends APIRequest { + + APINode lastResponse = null; + @Override + public APINode getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "comment_enabled", + }; + + public static final String[] FIELDS = { + }; + + @Override + public APINode parseResponse(String response, String header) throws APIException { + return APINode.parseResponse(response, getContext(), this, header).head(); + } + + @Override + public APINode execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINode 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 APINode apply(ResponseWrapper result) { + try { + return APIRequestUpdate.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestUpdate(String nodeId, APIContext context) { + super(context, nodeId, "/", "POST", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestUpdate setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestUpdate setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestUpdate setCommentEnabled (Boolean commentEnabled) { + this.setParam("comment_enabled", commentEnabled); + return this; + } + public APIRequestUpdate setCommentEnabled (String commentEnabled) { + this.setParam("comment_enabled", commentEnabled); + return this; + } + + public APIRequestUpdate requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestUpdate requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestUpdate requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestUpdate requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestUpdate requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestUpdate requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + synchronized /*package*/ static Gson getGson() { if (gson != null) { @@ -672,7 +1227,9 @@ public APIRequestGet requestUsernameField (boolean value) { public IGMediaForIGOnlyAPI copyFrom(IGMediaForIGOnlyAPI instance) { this.mCaption = instance.mCaption; + this.mCommentsCount = instance.mCommentsCount; this.mId = instance.mId; + this.mIsCommentEnabled = instance.mIsCommentEnabled; this.mIsSharedToFeed = instance.mIsSharedToFeed; this.mLikeCount = instance.mLikeCount; this.mMediaProductType = instance.mMediaProductType; diff --git a/src/main/java/com/facebook/ads/sdk/IGRefreshAccessTokenForIGOnlyAPI.java b/src/main/java/com/facebook/ads/sdk/IGRefreshAccessTokenForIGOnlyAPI.java index 2486f923..c300cd0c 100644 --- a/src/main/java/com/facebook/ads/sdk/IGRefreshAccessTokenForIGOnlyAPI.java +++ b/src/main/java/com/facebook/ads/sdk/IGRefreshAccessTokenForIGOnlyAPI.java @@ -45,6 +45,8 @@ public class IGRefreshAccessTokenForIGOnlyAPI extends APINode { private String mAccessToken = null; @SerializedName("expires_in") private Long mExpiresIn = null; + @SerializedName("permissions") + private String mPermissions = null; @SerializedName("token_type") private String mTokenType = null; @SerializedName("id") @@ -271,6 +273,10 @@ public Long getFieldExpiresIn() { return mExpiresIn; } + public String getFieldPermissions() { + return mPermissions; + } + public String getFieldTokenType() { return mTokenType; } @@ -296,6 +302,7 @@ public IGRefreshAccessTokenForIGOnlyAPI getLastResponse() { public static final String[] FIELDS = { "access_token", "expires_in", + "permissions", "token_type", "id", }; @@ -414,6 +421,13 @@ public APIRequestGet requestExpiresInField (boolean value) { this.requestField("expires_in", value); return this; } + public APIRequestGet requestPermissionsField () { + return this.requestPermissionsField(true); + } + public APIRequestGet requestPermissionsField (boolean value) { + this.requestField("permissions", value); + return this; + } public APIRequestGet requestTokenTypeField () { return this.requestTokenTypeField(true); } @@ -447,6 +461,7 @@ public APIRequestGet requestIdField (boolean value) { public IGRefreshAccessTokenForIGOnlyAPI copyFrom(IGRefreshAccessTokenForIGOnlyAPI instance) { this.mAccessToken = instance.mAccessToken; this.mExpiresIn = instance.mExpiresIn; + this.mPermissions = instance.mPermissions; this.mTokenType = instance.mTokenType; this.mId = instance.mId; this.context = instance.context; diff --git a/src/main/java/com/facebook/ads/sdk/IGUpcomingEvent.java b/src/main/java/com/facebook/ads/sdk/IGUpcomingEvent.java index 86b42c11..2eff354a 100644 --- a/src/main/java/com/facebook/ads/sdk/IGUpcomingEvent.java +++ b/src/main/java/com/facebook/ads/sdk/IGUpcomingEvent.java @@ -45,6 +45,10 @@ public class IGUpcomingEvent extends APINode { private String mEndTime = null; @SerializedName("id") private String mId = null; + @SerializedName("notification_subtypes") + private List mNotificationSubtypes = null; + @SerializedName("notification_target_time") + private String mNotificationTargetTime = null; @SerializedName("start_time") private String mStartTime = null; @SerializedName("title") @@ -275,6 +279,14 @@ public String getFieldId() { return mId; } + public List getFieldNotificationSubtypes() { + return mNotificationSubtypes; + } + + public String getFieldNotificationTargetTime() { + return mNotificationTargetTime; + } + public String getFieldStartTime() { return mStartTime; } @@ -298,6 +310,8 @@ public IGUpcomingEvent getLastResponse() { public static final String[] FIELDS = { "end_time", "id", + "notification_subtypes", + "notification_target_time", "start_time", "title", }; @@ -406,6 +420,20 @@ public APIRequestGet requestIdField (boolean value) { this.requestField("id", value); return this; } + public APIRequestGet requestNotificationSubtypesField () { + return this.requestNotificationSubtypesField(true); + } + public APIRequestGet requestNotificationSubtypesField (boolean value) { + this.requestField("notification_subtypes", value); + return this; + } + public APIRequestGet requestNotificationTargetTimeField () { + return this.requestNotificationTargetTimeField(true); + } + public APIRequestGet requestNotificationTargetTimeField (boolean value) { + this.requestField("notification_target_time", value); + return this; + } public APIRequestGet requestStartTimeField () { return this.requestStartTimeField(true); } @@ -431,6 +459,8 @@ public IGUpcomingEvent getLastResponse() { } public static final String[] PARAMS = { "end_time", + "notification_subtypes", + "notification_target_time", "start_time", "title", }; @@ -497,6 +527,24 @@ public APIRequestUpdate setEndTime (String endTime) { return this; } + public APIRequestUpdate setNotificationSubtypes (List notificationSubtypes) { + this.setParam("notification_subtypes", notificationSubtypes); + return this; + } + public APIRequestUpdate setNotificationSubtypes (String notificationSubtypes) { + this.setParam("notification_subtypes", notificationSubtypes); + return this; + } + + public APIRequestUpdate setNotificationTargetTime (IGUpcomingEvent.EnumNotificationTargetTime notificationTargetTime) { + this.setParam("notification_target_time", notificationTargetTime); + return this; + } + public APIRequestUpdate setNotificationTargetTime (String notificationTargetTime) { + this.setParam("notification_target_time", notificationTargetTime); + return this; + } + public APIRequestUpdate setStartTime (String startTime) { this.setParam("start_time", startTime); return this; @@ -545,6 +593,66 @@ public APIRequestUpdate requestField (String field, boolean value) { } + public static enum EnumNotificationSubtypes { + @SerializedName("AFTER_EVENT_1DAY") + VALUE_AFTER_EVENT_1DAY("AFTER_EVENT_1DAY"), + @SerializedName("AFTER_EVENT_2DAY") + VALUE_AFTER_EVENT_2DAY("AFTER_EVENT_2DAY"), + @SerializedName("AFTER_EVENT_3DAY") + VALUE_AFTER_EVENT_3DAY("AFTER_EVENT_3DAY"), + @SerializedName("AFTER_EVENT_4DAY") + VALUE_AFTER_EVENT_4DAY("AFTER_EVENT_4DAY"), + @SerializedName("AFTER_EVENT_5DAY") + VALUE_AFTER_EVENT_5DAY("AFTER_EVENT_5DAY"), + @SerializedName("AFTER_EVENT_6DAY") + VALUE_AFTER_EVENT_6DAY("AFTER_EVENT_6DAY"), + @SerializedName("AFTER_EVENT_7DAY") + VALUE_AFTER_EVENT_7DAY("AFTER_EVENT_7DAY"), + @SerializedName("BEFORE_EVENT_15MIN") + VALUE_BEFORE_EVENT_15MIN("BEFORE_EVENT_15MIN"), + @SerializedName("BEFORE_EVENT_1DAY") + VALUE_BEFORE_EVENT_1DAY("BEFORE_EVENT_1DAY"), + @SerializedName("BEFORE_EVENT_1HOUR") + VALUE_BEFORE_EVENT_1HOUR("BEFORE_EVENT_1HOUR"), + @SerializedName("BEFORE_EVENT_2DAY") + VALUE_BEFORE_EVENT_2DAY("BEFORE_EVENT_2DAY"), + @SerializedName("EVENT_START") + VALUE_EVENT_START("EVENT_START"), + @SerializedName("RESCHEDULED") + VALUE_RESCHEDULED("RESCHEDULED"), + ; + + private String value; + + private EnumNotificationSubtypes(String value) { + this.value = value; + } + + @Override + public String toString() { + return value; + } + } + + public static enum EnumNotificationTargetTime { + @SerializedName("EVENT_END") + VALUE_EVENT_END("EVENT_END"), + @SerializedName("EVENT_START") + VALUE_EVENT_START("EVENT_START"), + ; + + private String value; + + private EnumNotificationTargetTime(String value) { + this.value = value; + } + + @Override + public String toString() { + return value; + } + } + synchronized /*package*/ static Gson getGson() { if (gson != null) { @@ -562,6 +670,8 @@ public APIRequestUpdate requestField (String field, boolean value) { public IGUpcomingEvent copyFrom(IGUpcomingEvent instance) { this.mEndTime = instance.mEndTime; this.mId = instance.mId; + this.mNotificationSubtypes = instance.mNotificationSubtypes; + this.mNotificationTargetTime = instance.mNotificationTargetTime; this.mStartTime = instance.mStartTime; this.mTitle = instance.mTitle; this.context = instance.context; diff --git a/src/main/java/com/facebook/ads/sdk/IGUser.java b/src/main/java/com/facebook/ads/sdk/IGUser.java index db3d7188..ac03f371 100644 --- a/src/main/java/com/facebook/ads/sdk/IGUser.java +++ b/src/main/java/com/facebook/ads/sdk/IGUser.java @@ -318,12 +318,12 @@ public APIRequestGetContentPublishingLimit getContentPublishingLimit() { return new APIRequestGetContentPublishingLimit(this.getPrefixedId().toString(), context); } - public APIRequestGetDataSet getDataSet() { - return new APIRequestGetDataSet(this.getPrefixedId().toString(), context); + public APIRequestGetDataset getDataset() { + return new APIRequestGetDataset(this.getPrefixedId().toString(), context); } - public APIRequestCreateDataSet createDataSet() { - return new APIRequestCreateDataSet(this.getPrefixedId().toString(), context); + public APIRequestCreateDataset createDataset() { + return new APIRequestCreateDataset(this.getPrefixedId().toString(), context); } public APIRequestGetInsights getInsights() { @@ -858,6 +858,7 @@ public APINodeList getLastResponse() { return lastResponse; } public static final String[] PARAMS = { + "ad_code", "creator_username", "only_fetch_allowlisted", "permalinks", @@ -925,6 +926,11 @@ public APIRequestGetBrandedContentAdvertisableMedias setParams(Map { + public static class APIRequestGetDataset extends APIRequest { - APINodeList lastResponse = null; + APINodeList lastResponse = null; @Override - public APINodeList getLastResponse() { + public APINodeList getLastResponse() { return lastResponse; } public static final String[] PARAMS = { }; public static final String[] FIELDS = { - "automatic_matching_fields", - "can_proxy", - "code", - "config", - "creation_time", - "creator", - "data_use_setting", - "description", - "duplicate_entries", - "enable_auto_assign_to_accounts", - "enable_automatic_matching", - "event_stats", - "event_time_max", - "event_time_min", - "first_party_cookie_status", - "has_1p_pixel_event", "id", - "is_consolidated_container", - "is_created_by_business", - "is_crm", - "is_mta_use", - "is_restricted_use", - "is_unavailable", - "last_fired_time", - "last_upload_app", - "last_upload_app_changed_time", - "match_rate_approx", - "matched_entries", "name", - "owner_ad_account", - "owner_business", - "usage", - "user_access_expire_time", - "valid_entries", }; @Override - public APINodeList parseResponse(String response, String header) throws APIException { - return AdsPixel.parseResponse(response, getContext(), this, header); + public APINodeList parseResponse(String response, String header) throws APIException { + return Dataset.parseResponse(response, getContext(), this, header); } @Override - public APINodeList execute() throws APIException { + public APINodeList execute() throws APIException { return execute(new HashMap()); } @Override - public APINodeList execute(Map extraParams) throws APIException { + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + new Function>() { + public APINodeList apply(ResponseWrapper result) { try { - return APIRequestGetDataSet.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestGetDataset.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -1766,28 +1740,28 @@ public APINodeList apply(ResponseWrapper result) { ); }; - public APIRequestGetDataSet(String nodeId, APIContext context) { + public APIRequestGetDataset(String nodeId, APIContext context) { super(context, nodeId, "/dataset", "GET", Arrays.asList(PARAMS)); } @Override - public APIRequestGetDataSet setParam(String param, Object value) { + public APIRequestGetDataset setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestGetDataSet setParams(Map params) { + public APIRequestGetDataset setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestGetDataSet requestAllFields () { + public APIRequestGetDataset requestAllFields () { return this.requestAllFields(true); } - public APIRequestGetDataSet requestAllFields (boolean value) { + public APIRequestGetDataset requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -1795,12 +1769,12 @@ public APIRequestGetDataSet requestAllFields (boolean value) { } @Override - public APIRequestGetDataSet requestFields (List fields) { + public APIRequestGetDataset requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestGetDataSet requestFields (List fields, boolean value) { + public APIRequestGetDataset requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -1808,298 +1782,75 @@ public APIRequestGetDataSet requestFields (List fields, boolean value) { } @Override - public APIRequestGetDataSet requestField (String field) { + public APIRequestGetDataset requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestGetDataSet requestField (String field, boolean value) { + public APIRequestGetDataset requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } - public APIRequestGetDataSet requestAutomaticMatchingFieldsField () { - return this.requestAutomaticMatchingFieldsField(true); - } - public APIRequestGetDataSet requestAutomaticMatchingFieldsField (boolean value) { - this.requestField("automatic_matching_fields", value); - return this; - } - public APIRequestGetDataSet requestCanProxyField () { - return this.requestCanProxyField(true); - } - public APIRequestGetDataSet requestCanProxyField (boolean value) { - this.requestField("can_proxy", value); - return this; - } - public APIRequestGetDataSet requestCodeField () { - return this.requestCodeField(true); - } - public APIRequestGetDataSet requestCodeField (boolean value) { - this.requestField("code", value); - return this; - } - public APIRequestGetDataSet requestConfigField () { - return this.requestConfigField(true); - } - public APIRequestGetDataSet requestConfigField (boolean value) { - this.requestField("config", value); - return this; - } - public APIRequestGetDataSet requestCreationTimeField () { - return this.requestCreationTimeField(true); - } - public APIRequestGetDataSet requestCreationTimeField (boolean value) { - this.requestField("creation_time", value); - return this; - } - public APIRequestGetDataSet requestCreatorField () { - return this.requestCreatorField(true); - } - public APIRequestGetDataSet requestCreatorField (boolean value) { - this.requestField("creator", value); - return this; - } - public APIRequestGetDataSet requestDataUseSettingField () { - return this.requestDataUseSettingField(true); - } - public APIRequestGetDataSet requestDataUseSettingField (boolean value) { - this.requestField("data_use_setting", value); - return this; - } - public APIRequestGetDataSet requestDescriptionField () { - return this.requestDescriptionField(true); - } - public APIRequestGetDataSet requestDescriptionField (boolean value) { - this.requestField("description", value); - return this; - } - public APIRequestGetDataSet requestDuplicateEntriesField () { - return this.requestDuplicateEntriesField(true); - } - public APIRequestGetDataSet requestDuplicateEntriesField (boolean value) { - this.requestField("duplicate_entries", value); - return this; - } - public APIRequestGetDataSet requestEnableAutoAssignToAccountsField () { - return this.requestEnableAutoAssignToAccountsField(true); - } - public APIRequestGetDataSet requestEnableAutoAssignToAccountsField (boolean value) { - this.requestField("enable_auto_assign_to_accounts", value); - return this; - } - public APIRequestGetDataSet requestEnableAutomaticMatchingField () { - return this.requestEnableAutomaticMatchingField(true); - } - public APIRequestGetDataSet requestEnableAutomaticMatchingField (boolean value) { - this.requestField("enable_automatic_matching", value); - return this; - } - public APIRequestGetDataSet requestEventStatsField () { - return this.requestEventStatsField(true); - } - public APIRequestGetDataSet requestEventStatsField (boolean value) { - this.requestField("event_stats", value); - return this; - } - public APIRequestGetDataSet requestEventTimeMaxField () { - return this.requestEventTimeMaxField(true); - } - public APIRequestGetDataSet requestEventTimeMaxField (boolean value) { - this.requestField("event_time_max", value); - return this; - } - public APIRequestGetDataSet requestEventTimeMinField () { - return this.requestEventTimeMinField(true); - } - public APIRequestGetDataSet requestEventTimeMinField (boolean value) { - this.requestField("event_time_min", value); - return this; - } - public APIRequestGetDataSet requestFirstPartyCookieStatusField () { - return this.requestFirstPartyCookieStatusField(true); - } - public APIRequestGetDataSet requestFirstPartyCookieStatusField (boolean value) { - this.requestField("first_party_cookie_status", value); - return this; - } - public APIRequestGetDataSet requestHas1pPixelEventField () { - return this.requestHas1pPixelEventField(true); - } - public APIRequestGetDataSet requestHas1pPixelEventField (boolean value) { - this.requestField("has_1p_pixel_event", value); - return this; - } - public APIRequestGetDataSet requestIdField () { + public APIRequestGetDataset requestIdField () { return this.requestIdField(true); } - public APIRequestGetDataSet requestIdField (boolean value) { + public APIRequestGetDataset requestIdField (boolean value) { this.requestField("id", value); return this; } - public APIRequestGetDataSet requestIsConsolidatedContainerField () { - return this.requestIsConsolidatedContainerField(true); - } - public APIRequestGetDataSet requestIsConsolidatedContainerField (boolean value) { - this.requestField("is_consolidated_container", value); - return this; - } - public APIRequestGetDataSet requestIsCreatedByBusinessField () { - return this.requestIsCreatedByBusinessField(true); - } - public APIRequestGetDataSet requestIsCreatedByBusinessField (boolean value) { - this.requestField("is_created_by_business", value); - return this; - } - public APIRequestGetDataSet requestIsCrmField () { - return this.requestIsCrmField(true); - } - public APIRequestGetDataSet requestIsCrmField (boolean value) { - this.requestField("is_crm", value); - return this; - } - public APIRequestGetDataSet requestIsMtaUseField () { - return this.requestIsMtaUseField(true); - } - public APIRequestGetDataSet requestIsMtaUseField (boolean value) { - this.requestField("is_mta_use", value); - return this; - } - public APIRequestGetDataSet requestIsRestrictedUseField () { - return this.requestIsRestrictedUseField(true); - } - public APIRequestGetDataSet requestIsRestrictedUseField (boolean value) { - this.requestField("is_restricted_use", value); - return this; - } - public APIRequestGetDataSet requestIsUnavailableField () { - return this.requestIsUnavailableField(true); - } - public APIRequestGetDataSet requestIsUnavailableField (boolean value) { - this.requestField("is_unavailable", value); - return this; - } - public APIRequestGetDataSet requestLastFiredTimeField () { - return this.requestLastFiredTimeField(true); - } - public APIRequestGetDataSet requestLastFiredTimeField (boolean value) { - this.requestField("last_fired_time", value); - return this; - } - public APIRequestGetDataSet requestLastUploadAppField () { - return this.requestLastUploadAppField(true); - } - public APIRequestGetDataSet requestLastUploadAppField (boolean value) { - this.requestField("last_upload_app", value); - return this; - } - public APIRequestGetDataSet requestLastUploadAppChangedTimeField () { - return this.requestLastUploadAppChangedTimeField(true); - } - public APIRequestGetDataSet requestLastUploadAppChangedTimeField (boolean value) { - this.requestField("last_upload_app_changed_time", value); - return this; - } - public APIRequestGetDataSet requestMatchRateApproxField () { - return this.requestMatchRateApproxField(true); - } - public APIRequestGetDataSet requestMatchRateApproxField (boolean value) { - this.requestField("match_rate_approx", value); - return this; - } - public APIRequestGetDataSet requestMatchedEntriesField () { - return this.requestMatchedEntriesField(true); - } - public APIRequestGetDataSet requestMatchedEntriesField (boolean value) { - this.requestField("matched_entries", value); - return this; - } - public APIRequestGetDataSet requestNameField () { + public APIRequestGetDataset requestNameField () { return this.requestNameField(true); } - public APIRequestGetDataSet requestNameField (boolean value) { + public APIRequestGetDataset requestNameField (boolean value) { this.requestField("name", value); return this; } - public APIRequestGetDataSet requestOwnerAdAccountField () { - return this.requestOwnerAdAccountField(true); - } - public APIRequestGetDataSet requestOwnerAdAccountField (boolean value) { - this.requestField("owner_ad_account", value); - return this; - } - public APIRequestGetDataSet requestOwnerBusinessField () { - return this.requestOwnerBusinessField(true); - } - public APIRequestGetDataSet requestOwnerBusinessField (boolean value) { - this.requestField("owner_business", value); - return this; - } - public APIRequestGetDataSet requestUsageField () { - return this.requestUsageField(true); - } - public APIRequestGetDataSet requestUsageField (boolean value) { - this.requestField("usage", value); - return this; - } - public APIRequestGetDataSet requestUserAccessExpireTimeField () { - return this.requestUserAccessExpireTimeField(true); - } - public APIRequestGetDataSet requestUserAccessExpireTimeField (boolean value) { - this.requestField("user_access_expire_time", value); - return this; - } - public APIRequestGetDataSet requestValidEntriesField () { - return this.requestValidEntriesField(true); - } - public APIRequestGetDataSet requestValidEntriesField (boolean value) { - this.requestField("valid_entries", value); - return this; - } } - public static class APIRequestCreateDataSet extends APIRequest { + public static class APIRequestCreateDataset extends APIRequest { - AdsPixel lastResponse = null; + Dataset lastResponse = null; @Override - public AdsPixel getLastResponse() { + public Dataset getLastResponse() { return lastResponse; } public static final String[] PARAMS = { + "dataset_name", }; public static final String[] FIELDS = { }; @Override - public AdsPixel parseResponse(String response, String header) throws APIException { - return AdsPixel.parseResponse(response, getContext(), this, header).head(); + public Dataset parseResponse(String response, String header) throws APIException { + return Dataset.parseResponse(response, getContext(), this, header).head(); } @Override - public AdsPixel execute() throws APIException { + public Dataset execute() throws APIException { return execute(new HashMap()); } @Override - public AdsPixel execute(Map extraParams) throws APIException { + public Dataset 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 AdsPixel apply(ResponseWrapper result) { + new Function() { + public Dataset apply(ResponseWrapper result) { try { - return APIRequestCreateDataSet.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestCreateDataset.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -2109,28 +1860,33 @@ public AdsPixel apply(ResponseWrapper result) { ); }; - public APIRequestCreateDataSet(String nodeId, APIContext context) { + public APIRequestCreateDataset(String nodeId, APIContext context) { super(context, nodeId, "/dataset", "POST", Arrays.asList(PARAMS)); } @Override - public APIRequestCreateDataSet setParam(String param, Object value) { + public APIRequestCreateDataset setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestCreateDataSet setParams(Map params) { + public APIRequestCreateDataset setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestCreateDataSet requestAllFields () { + public APIRequestCreateDataset setDatasetName (String datasetName) { + this.setParam("dataset_name", datasetName); + return this; + } + + public APIRequestCreateDataset requestAllFields () { return this.requestAllFields(true); } - public APIRequestCreateDataSet requestAllFields (boolean value) { + public APIRequestCreateDataset requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -2138,12 +1894,12 @@ public APIRequestCreateDataSet requestAllFields (boolean value) { } @Override - public APIRequestCreateDataSet requestFields (List fields) { + public APIRequestCreateDataset requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestCreateDataSet requestFields (List fields, boolean value) { + public APIRequestCreateDataset requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -2151,13 +1907,13 @@ public APIRequestCreateDataSet requestFields (List fields, boolean value } @Override - public APIRequestCreateDataSet requestField (String field) { + public APIRequestCreateDataset requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestCreateDataSet requestField (String field, boolean value) { + public APIRequestCreateDataset requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } diff --git a/src/main/java/com/facebook/ads/sdk/BCPCreatorIgUser.java b/src/main/java/com/facebook/ads/sdk/IGUserExportForCAM.java similarity index 73% rename from src/main/java/com/facebook/ads/sdk/BCPCreatorIgUser.java rename to src/main/java/com/facebook/ads/sdk/IGUserExportForCAM.java index d1ee8ccf..250e6175 100644 --- a/src/main/java/com/facebook/ads/sdk/BCPCreatorIgUser.java +++ b/src/main/java/com/facebook/ads/sdk/IGUserExportForCAM.java @@ -40,7 +40,7 @@ * pull request for this class. * */ -public class BCPCreatorIgUser extends APINode { +public class IGUserExportForCAM extends APINode { @SerializedName("email") private String mEmail = null; @SerializedName("id") @@ -55,59 +55,59 @@ public class BCPCreatorIgUser extends APINode { private String mUsername = null; protected static Gson gson = null; - BCPCreatorIgUser() { + IGUserExportForCAM() { } - public BCPCreatorIgUser(Long id, APIContext context) { + public IGUserExportForCAM(Long id, APIContext context) { this(id.toString(), context); } - public BCPCreatorIgUser(String id, APIContext context) { + public IGUserExportForCAM(String id, APIContext context) { this.mId = id; this.context = context; } - public BCPCreatorIgUser fetch() throws APIException{ - BCPCreatorIgUser newInstance = fetchById(this.getPrefixedId().toString(), this.context); + public IGUserExportForCAM fetch() throws APIException{ + IGUserExportForCAM newInstance = fetchById(this.getPrefixedId().toString(), this.context); this.copyFrom(newInstance); return this; } - public static BCPCreatorIgUser fetchById(Long id, APIContext context) throws APIException { + public static IGUserExportForCAM 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 BCPCreatorIgUser fetchById(String id, APIContext context) throws APIException { + public static IGUserExportForCAM 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", BCPCreatorIgUser.getParser()) + public static APINodeList fetchByIds(List ids, List fields, APIContext context) throws APIException { + return (APINodeList)( + new APIRequest(context, "", "/", "GET", IGUserExportForCAM.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", BCPCreatorIgUser.getParser()) + new APIRequest(context, "", "/", "GET", IGUserExportForCAM.getParser()) .setParam("ids", APIRequest.joinStringList(ids)) .requestFields(fields) .executeAsyncBase(); @@ -120,12 +120,12 @@ private String getPrefixedId() { public String getId() { return getFieldId().toString(); } - public static BCPCreatorIgUser loadJSON(String json, APIContext context, String header) { - BCPCreatorIgUser bcpCreatorIgUser = getGson().fromJson(json, BCPCreatorIgUser.class); + public static IGUserExportForCAM loadJSON(String json, APIContext context, String header) { + IGUserExportForCAM igUserExportForCAM = getGson().fromJson(json, IGUserExportForCAM.class); if (context.isDebug()) { JsonParser parser = new JsonParser(); JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(bcpCreatorIgUser.toString()); + JsonElement o2 = parser.parse(igUserExportForCAM.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -135,14 +135,14 @@ public static BCPCreatorIgUser loadJSON(String json, APIContext context, String context.log("[Object]" + o2); } } - bcpCreatorIgUser.context = context; - bcpCreatorIgUser.rawValue = json; - bcpCreatorIgUser.header = header; - return bcpCreatorIgUser; + igUserExportForCAM.context = context; + igUserExportForCAM.rawValue = json; + igUserExportForCAM.header = header; + return igUserExportForCAM; } - public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { - APINodeList bcpCreatorIgUsers = new APINodeList(request, json, header); + public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { + APINodeList igUserExportForCAMs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; JsonParser parser = new JsonParser(); @@ -153,9 +153,9 @@ public static APINodeList parseResponse(String json, APIContex // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); for (int i = 0; i < arr.size(); i++) { - bcpCreatorIgUsers.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); + igUserExportForCAMs.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); }; - return bcpCreatorIgUsers; + return igUserExportForCAMs; } else if (result.isJsonObject()) { obj = result.getAsJsonObject(); if (obj.has("data")) { @@ -165,20 +165,20 @@ public static APINodeList parseResponse(String json, APIContex 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; - bcpCreatorIgUsers.setCursors(before, after); + igUserExportForCAMs.setCursors(before, after); } String previous = paging.has("previous") ? paging.get("previous").getAsString() : null; String next = paging.has("next") ? paging.get("next").getAsString() : null; - bcpCreatorIgUsers.setPaging(previous, next); + igUserExportForCAMs.setPaging(previous, next); if (context.hasAppSecret()) { - bcpCreatorIgUsers.setAppSecret(context.getAppSecretProof()); + igUserExportForCAMs.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++) { - bcpCreatorIgUsers.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); + igUserExportForCAMs.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" @@ -189,23 +189,23 @@ public static APINodeList parseResponse(String json, APIContex isRedownload = true; obj = obj.getAsJsonObject(s); for (Map.Entry entry : obj.entrySet()) { - bcpCreatorIgUsers.add(loadJSON(entry.getValue().toString(), context, header)); + igUserExportForCAMs.add(loadJSON(entry.getValue().toString(), context, header)); } break; } } if (!isRedownload) { - bcpCreatorIgUsers.add(loadJSON(obj.toString(), context, header)); + igUserExportForCAMs.add(loadJSON(obj.toString(), context, header)); } } - return bcpCreatorIgUsers; + return igUserExportForCAMs; } 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()) { - bcpCreatorIgUsers.add(loadJSON(entry.getValue().toString(), context, header)); + igUserExportForCAMs.add(loadJSON(entry.getValue().toString(), context, header)); } - return bcpCreatorIgUsers; + return igUserExportForCAMs; } else { // Fifth, check if it's an array of objects indexed by id boolean isIdIndexedArray = true; @@ -222,20 +222,20 @@ public static APINodeList parseResponse(String json, APIContex value.getAsJsonObject().get("id") != null && value.getAsJsonObject().get("id").getAsString().equals(key) ) { - bcpCreatorIgUsers.add(loadJSON(value.toString(), context, header)); + igUserExportForCAMs.add(loadJSON(value.toString(), context, header)); } else { isIdIndexedArray = false; break; } } if (isIdIndexedArray) { - return bcpCreatorIgUsers; + return igUserExportForCAMs; } // Sixth, check if it's pure JsonObject - bcpCreatorIgUsers.clear(); - bcpCreatorIgUsers.add(loadJSON(json, context, header)); - return bcpCreatorIgUsers; + igUserExportForCAMs.clear(); + igUserExportForCAMs.add(loadJSON(json, context, header)); + return igUserExportForCAMs; } } } catch (Exception e) { @@ -293,11 +293,11 @@ public String getFieldUsername() { - public static class APIRequestGet extends APIRequest { + public static class APIRequestGet extends APIRequest { - BCPCreatorIgUser lastResponse = null; + IGUserExportForCAM lastResponse = null; @Override - public BCPCreatorIgUser getLastResponse() { + public IGUserExportForCAM getLastResponse() { return lastResponse; } public static final String[] PARAMS = { @@ -313,31 +313,31 @@ public BCPCreatorIgUser getLastResponse() { }; @Override - public BCPCreatorIgUser parseResponse(String response, String header) throws APIException { - return BCPCreatorIgUser.parseResponse(response, getContext(), this, header).head(); + public IGUserExportForCAM parseResponse(String response, String header) throws APIException { + return IGUserExportForCAM.parseResponse(response, getContext(), this, header).head(); } @Override - public BCPCreatorIgUser execute() throws APIException { + public IGUserExportForCAM execute() throws APIException { return execute(new HashMap()); } @Override - public BCPCreatorIgUser execute(Map extraParams) throws APIException { + public IGUserExportForCAM 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 BCPCreatorIgUser apply(ResponseWrapper result) { + new Function() { + public IGUserExportForCAM apply(ResponseWrapper result) { try { return APIRequestGet.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { @@ -460,7 +460,7 @@ public APIRequestGet requestUsernameField (boolean value) { return gson; } - public BCPCreatorIgUser copyFrom(BCPCreatorIgUser instance) { + public IGUserExportForCAM copyFrom(IGUserExportForCAM instance) { this.mEmail = instance.mEmail; this.mId = instance.mId; this.mIsPaidPartnershipMessagesEnabled = instance.mIsPaidPartnershipMessagesEnabled; @@ -472,10 +472,10 @@ public BCPCreatorIgUser copyFrom(BCPCreatorIgUser instance) { 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 BCPCreatorIgUser.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 IGUserExportForCAM.parseResponse(response, context, request, header); } }; } diff --git a/src/main/java/com/facebook/ads/sdk/IGUserForIGOnlyAPI.java b/src/main/java/com/facebook/ads/sdk/IGUserForIGOnlyAPI.java index e06891a1..59ad3509 100644 --- a/src/main/java/com/facebook/ads/sdk/IGUserForIGOnlyAPI.java +++ b/src/main/java/com/facebook/ads/sdk/IGUserForIGOnlyAPI.java @@ -43,12 +43,26 @@ public class IGUserForIGOnlyAPI extends APINode { @SerializedName("account_type") private String mAccountType = null; + @SerializedName("biography") + private String mBiography = null; + @SerializedName("followers_count") + private Long mFollowersCount = null; + @SerializedName("follows_count") + private Long mFollowsCount = null; @SerializedName("id") private String mId = null; @SerializedName("media_count") private Long mMediaCount = null; + @SerializedName("name") + private String mName = null; + @SerializedName("profile_picture_url") + private String mProfilePictureUrl = null; + @SerializedName("user_id") + private Long mUserId = null; @SerializedName("username") private String mUsername = null; + @SerializedName("website") + private String mWebsite = null; protected static Gson gson = null; IGUserForIGOnlyAPI() { @@ -258,6 +272,14 @@ public String toString() { return getGson().toJson(this); } + public APIRequestGetContentPublishingLimit getContentPublishingLimit() { + return new APIRequestGetContentPublishingLimit(this.getPrefixedId().toString(), context); + } + + public APIRequestGetConversations getConversations() { + return new APIRequestGetConversations(this.getPrefixedId().toString(), context); + } + public APIRequestGetLiveMedia getLiveMedia() { return new APIRequestGetLiveMedia(this.getPrefixedId().toString(), context); } @@ -266,34 +288,2034 @@ public APIRequestGetMedia getMedia() { return new APIRequestGetMedia(this.getPrefixedId().toString(), context); } + public APIRequestCreateMedia createMedia() { + return new APIRequestCreateMedia(this.getPrefixedId().toString(), context); + } + + public APIRequestCreateMediaPublish createMediaPublish() { + return new APIRequestCreateMediaPublish(this.getPrefixedId().toString(), context); + } + + public APIRequestCreateMention createMention() { + return new APIRequestCreateMention(this.getPrefixedId().toString(), context); + } + + public APIRequestCreateMessageAttachment createMessageAttachment() { + return new APIRequestCreateMessageAttachment(this.getPrefixedId().toString(), context); + } + + public APIRequestCreateMessage createMessage() { + return new APIRequestCreateMessage(this.getPrefixedId().toString(), context); + } + + public APIRequestDeleteMessengerProfile deleteMessengerProfile() { + return new APIRequestDeleteMessengerProfile(this.getPrefixedId().toString(), context); + } + + public APIRequestGetMessengerProfile getMessengerProfile() { + return new APIRequestGetMessengerProfile(this.getPrefixedId().toString(), context); + } + + public APIRequestCreateMessengerProfile createMessengerProfile() { + return new APIRequestCreateMessengerProfile(this.getPrefixedId().toString(), context); + } + public APIRequestGetStories getStories() { return new APIRequestGetStories(this.getPrefixedId().toString(), context); } - public APIRequestGet get() { - return new APIRequestGet(this.getPrefixedId().toString(), context); - } + public APIRequestDeleteSubscribedApps deleteSubscribedApps() { + return new APIRequestDeleteSubscribedApps(this.getPrefixedId().toString(), context); + } + + public APIRequestGetSubscribedApps getSubscribedApps() { + return new APIRequestGetSubscribedApps(this.getPrefixedId().toString(), context); + } + + public APIRequestCreateSubscribedApp createSubscribedApp() { + return new APIRequestCreateSubscribedApp(this.getPrefixedId().toString(), context); + } + + public APIRequestGetTags getTags() { + return new APIRequestGetTags(this.getPrefixedId().toString(), context); + } + + public APIRequestGetWelcomeMessageFlows getWelcomeMessageFlows() { + return new APIRequestGetWelcomeMessageFlows(this.getPrefixedId().toString(), context); + } + + public APIRequestGet get() { + return new APIRequestGet(this.getPrefixedId().toString(), context); + } + + + public String getFieldAccountType() { + return mAccountType; + } + + public String getFieldBiography() { + return mBiography; + } + + public Long getFieldFollowersCount() { + return mFollowersCount; + } + + public Long getFieldFollowsCount() { + return mFollowsCount; + } + + public String getFieldId() { + return mId; + } + + public Long getFieldMediaCount() { + return mMediaCount; + } + + public String getFieldName() { + return mName; + } + + public String getFieldProfilePictureUrl() { + return mProfilePictureUrl; + } + + public Long getFieldUserId() { + return mUserId; + } + + public String getFieldUsername() { + return mUsername; + } + + public String getFieldWebsite() { + return mWebsite; + } + + + + public static class APIRequestGetContentPublishingLimit extends APIRequest { + + APINodeList lastResponse = null; + @Override + public APINodeList getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "since", + }; + + public static final String[] FIELDS = { + "config", + "quota_usage", + }; + + @Override + public APINodeList parseResponse(String response, String header) throws APIException { + return ContentPublishingLimitResponse.parseResponse(response, getContext(), this, header); + } + + @Override + public APINodeList execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + try { + return APIRequestGetContentPublishingLimit.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestGetContentPublishingLimit(String nodeId, APIContext context) { + super(context, nodeId, "/content_publishing_limit", "GET", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestGetContentPublishingLimit setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestGetContentPublishingLimit setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestGetContentPublishingLimit setSince (String since) { + this.setParam("since", since); + return this; + } + + public APIRequestGetContentPublishingLimit requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestGetContentPublishingLimit requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetContentPublishingLimit requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestGetContentPublishingLimit requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetContentPublishingLimit requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestGetContentPublishingLimit requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + public APIRequestGetContentPublishingLimit requestConfigField () { + return this.requestConfigField(true); + } + public APIRequestGetContentPublishingLimit requestConfigField (boolean value) { + this.requestField("config", value); + return this; + } + public APIRequestGetContentPublishingLimit requestQuotaUsageField () { + return this.requestQuotaUsageField(true); + } + public APIRequestGetContentPublishingLimit requestQuotaUsageField (boolean value) { + this.requestField("quota_usage", value); + return this; + } + } + + public static class APIRequestGetConversations extends APIRequest { + + APINodeList lastResponse = null; + @Override + public APINodeList getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "folder", + "platform", + "tags", + "user_id", + }; + + public static final String[] FIELDS = { + "can_reply", + "folder", + "former_participants", + "id", + "is_subscribed", + "link", + "linked_group", + "message_count", + "name", + "participants", + "scoped_thread_key", + "senders", + "snippet", + "subject", + "unread_count", + "updated_time", + "wallpaper", + }; + + @Override + public APINodeList parseResponse(String response, String header) throws APIException { + return UnifiedThread.parseResponse(response, getContext(), this, header); + } + + @Override + public APINodeList execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + try { + return APIRequestGetConversations.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestGetConversations(String nodeId, APIContext context) { + super(context, nodeId, "/conversations", "GET", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestGetConversations setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestGetConversations setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestGetConversations setFolder (String folder) { + this.setParam("folder", folder); + return this; + } + + public APIRequestGetConversations setPlatform (UnifiedThread.EnumPlatform platform) { + this.setParam("platform", platform); + return this; + } + public APIRequestGetConversations setPlatform (String platform) { + this.setParam("platform", platform); + return this; + } + + public APIRequestGetConversations setTags (List tags) { + this.setParam("tags", tags); + return this; + } + public APIRequestGetConversations setTags (String tags) { + this.setParam("tags", tags); + return this; + } + + public APIRequestGetConversations setUserId (String userId) { + this.setParam("user_id", userId); + return this; + } + + public APIRequestGetConversations requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestGetConversations requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetConversations requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestGetConversations requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetConversations requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestGetConversations requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + public APIRequestGetConversations requestCanReplyField () { + return this.requestCanReplyField(true); + } + public APIRequestGetConversations requestCanReplyField (boolean value) { + this.requestField("can_reply", value); + return this; + } + public APIRequestGetConversations requestFolderField () { + return this.requestFolderField(true); + } + public APIRequestGetConversations requestFolderField (boolean value) { + this.requestField("folder", value); + return this; + } + public APIRequestGetConversations requestFormerParticipantsField () { + return this.requestFormerParticipantsField(true); + } + public APIRequestGetConversations requestFormerParticipantsField (boolean value) { + this.requestField("former_participants", value); + return this; + } + public APIRequestGetConversations requestIdField () { + return this.requestIdField(true); + } + public APIRequestGetConversations requestIdField (boolean value) { + this.requestField("id", value); + return this; + } + public APIRequestGetConversations requestIsSubscribedField () { + return this.requestIsSubscribedField(true); + } + public APIRequestGetConversations requestIsSubscribedField (boolean value) { + this.requestField("is_subscribed", value); + return this; + } + public APIRequestGetConversations requestLinkField () { + return this.requestLinkField(true); + } + public APIRequestGetConversations requestLinkField (boolean value) { + this.requestField("link", value); + return this; + } + public APIRequestGetConversations requestLinkedGroupField () { + return this.requestLinkedGroupField(true); + } + public APIRequestGetConversations requestLinkedGroupField (boolean value) { + this.requestField("linked_group", value); + return this; + } + public APIRequestGetConversations requestMessageCountField () { + return this.requestMessageCountField(true); + } + public APIRequestGetConversations requestMessageCountField (boolean value) { + this.requestField("message_count", value); + return this; + } + public APIRequestGetConversations requestNameField () { + return this.requestNameField(true); + } + public APIRequestGetConversations requestNameField (boolean value) { + this.requestField("name", value); + return this; + } + public APIRequestGetConversations requestParticipantsField () { + return this.requestParticipantsField(true); + } + public APIRequestGetConversations requestParticipantsField (boolean value) { + this.requestField("participants", value); + return this; + } + public APIRequestGetConversations requestScopedThreadKeyField () { + return this.requestScopedThreadKeyField(true); + } + public APIRequestGetConversations requestScopedThreadKeyField (boolean value) { + this.requestField("scoped_thread_key", value); + return this; + } + public APIRequestGetConversations requestSendersField () { + return this.requestSendersField(true); + } + public APIRequestGetConversations requestSendersField (boolean value) { + this.requestField("senders", value); + return this; + } + public APIRequestGetConversations requestSnippetField () { + return this.requestSnippetField(true); + } + public APIRequestGetConversations requestSnippetField (boolean value) { + this.requestField("snippet", value); + return this; + } + public APIRequestGetConversations requestSubjectField () { + return this.requestSubjectField(true); + } + public APIRequestGetConversations requestSubjectField (boolean value) { + this.requestField("subject", value); + return this; + } + public APIRequestGetConversations requestUnreadCountField () { + return this.requestUnreadCountField(true); + } + public APIRequestGetConversations requestUnreadCountField (boolean value) { + this.requestField("unread_count", value); + return this; + } + public APIRequestGetConversations requestUpdatedTimeField () { + return this.requestUpdatedTimeField(true); + } + public APIRequestGetConversations requestUpdatedTimeField (boolean value) { + this.requestField("updated_time", value); + return this; + } + public APIRequestGetConversations requestWallpaperField () { + return this.requestWallpaperField(true); + } + public APIRequestGetConversations requestWallpaperField (boolean value) { + this.requestField("wallpaper", value); + return this; + } + } + + public static class APIRequestGetLiveMedia extends APIRequest { + + APINodeList lastResponse = null; + @Override + public APINodeList getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + }; + + public static final String[] FIELDS = { + }; + + @Override + public APINodeList parseResponse(String response, String header) throws APIException { + return APINode.parseResponse(response, getContext(), this, header); + } + + @Override + public APINodeList execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + try { + return APIRequestGetLiveMedia.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestGetLiveMedia(String nodeId, APIContext context) { + super(context, nodeId, "/live_media", "GET", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestGetLiveMedia setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestGetLiveMedia setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestGetLiveMedia requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestGetLiveMedia requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetLiveMedia requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestGetLiveMedia requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetLiveMedia requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestGetLiveMedia requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + + public static class APIRequestGetMedia extends APIRequest { + + APINodeList lastResponse = null; + @Override + public APINodeList getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "since", + "until", + }; + + public static final String[] FIELDS = { + }; + + @Override + public APINodeList parseResponse(String response, String header) throws APIException { + return APINode.parseResponse(response, getContext(), this, header); + } + + @Override + public APINodeList execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + try { + return APIRequestGetMedia.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestGetMedia(String nodeId, APIContext context) { + super(context, nodeId, "/media", "GET", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestGetMedia setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestGetMedia setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestGetMedia setSince (String since) { + this.setParam("since", since); + return this; + } + + public APIRequestGetMedia setUntil (String until) { + this.setParam("until", until); + return this; + } + + public APIRequestGetMedia requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestGetMedia requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetMedia requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestGetMedia requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetMedia requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestGetMedia requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + + public static class APIRequestCreateMedia extends APIRequest { + + APINode lastResponse = null; + @Override + public APINode getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "audio_name", + "caption", + "children", + "collaborators", + "cover_url", + "image_url", + "is_carousel_item", + "location_id", + "media_type", + "product_tags", + "share_to_feed", + "thumb_offset", + "upload_type", + "user_tags", + "video_url", + }; + + public static final String[] FIELDS = { + }; + + @Override + public APINode parseResponse(String response, String header) throws APIException { + return APINode.parseResponse(response, getContext(), this, header).head(); + } + + @Override + public APINode execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINode 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 APINode apply(ResponseWrapper result) { + try { + return APIRequestCreateMedia.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestCreateMedia(String nodeId, APIContext context) { + super(context, nodeId, "/media", "POST", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestCreateMedia setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestCreateMedia setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestCreateMedia setAudioName (String audioName) { + this.setParam("audio_name", audioName); + return this; + } + + public APIRequestCreateMedia setCaption (String caption) { + this.setParam("caption", caption); + return this; + } + + public APIRequestCreateMedia setChildren (List children) { + this.setParam("children", children); + return this; + } + public APIRequestCreateMedia setChildren (String children) { + this.setParam("children", children); + return this; + } + + public APIRequestCreateMedia setCollaborators (List collaborators) { + this.setParam("collaborators", collaborators); + return this; + } + public APIRequestCreateMedia setCollaborators (String collaborators) { + this.setParam("collaborators", collaborators); + return this; + } + + public APIRequestCreateMedia setCoverUrl (String coverUrl) { + this.setParam("cover_url", coverUrl); + return this; + } + + public APIRequestCreateMedia setImageUrl (String imageUrl) { + this.setParam("image_url", imageUrl); + return this; + } + + public APIRequestCreateMedia setIsCarouselItem (Boolean isCarouselItem) { + this.setParam("is_carousel_item", isCarouselItem); + return this; + } + public APIRequestCreateMedia setIsCarouselItem (String isCarouselItem) { + this.setParam("is_carousel_item", isCarouselItem); + return this; + } + + public APIRequestCreateMedia setLocationId (String locationId) { + this.setParam("location_id", locationId); + return this; + } + + public APIRequestCreateMedia setMediaType (String mediaType) { + this.setParam("media_type", mediaType); + return this; + } + + public APIRequestCreateMedia setProductTags (List> productTags) { + this.setParam("product_tags", productTags); + return this; + } + public APIRequestCreateMedia setProductTags (String productTags) { + this.setParam("product_tags", productTags); + return this; + } + + public APIRequestCreateMedia setShareToFeed (Boolean shareToFeed) { + this.setParam("share_to_feed", shareToFeed); + return this; + } + public APIRequestCreateMedia setShareToFeed (String shareToFeed) { + this.setParam("share_to_feed", shareToFeed); + return this; + } + + public APIRequestCreateMedia setThumbOffset (String thumbOffset) { + this.setParam("thumb_offset", thumbOffset); + return this; + } + + public APIRequestCreateMedia setUploadType (String uploadType) { + this.setParam("upload_type", uploadType); + return this; + } + + public APIRequestCreateMedia setUserTags (List> userTags) { + this.setParam("user_tags", userTags); + return this; + } + public APIRequestCreateMedia setUserTags (String userTags) { + this.setParam("user_tags", userTags); + return this; + } + + public APIRequestCreateMedia setVideoUrl (String videoUrl) { + this.setParam("video_url", videoUrl); + return this; + } + + public APIRequestCreateMedia requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestCreateMedia requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestCreateMedia requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestCreateMedia requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestCreateMedia requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestCreateMedia requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + + public static class APIRequestCreateMediaPublish extends APIRequest { + + APINode lastResponse = null; + @Override + public APINode getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "creation_id", + }; + + public static final String[] FIELDS = { + }; + + @Override + public APINode parseResponse(String response, String header) throws APIException { + return APINode.parseResponse(response, getContext(), this, header).head(); + } + + @Override + public APINode execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINode 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 APINode apply(ResponseWrapper result) { + try { + return APIRequestCreateMediaPublish.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestCreateMediaPublish(String nodeId, APIContext context) { + super(context, nodeId, "/mediapublish", "POST", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestCreateMediaPublish setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestCreateMediaPublish setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestCreateMediaPublish setCreationId (Long creationId) { + this.setParam("creation_id", creationId); + return this; + } + public APIRequestCreateMediaPublish setCreationId (String creationId) { + this.setParam("creation_id", creationId); + return this; + } + + public APIRequestCreateMediaPublish requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestCreateMediaPublish requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestCreateMediaPublish requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestCreateMediaPublish requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestCreateMediaPublish requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestCreateMediaPublish requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + + public static class APIRequestCreateMention extends APIRequest { + + APINode lastResponse = null; + @Override + public APINode getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "comment_id", + "media_id", + "message", + }; + + public static final String[] FIELDS = { + }; + + @Override + public APINode parseResponse(String response, String header) throws APIException { + return APINode.parseResponse(response, getContext(), this, header).head(); + } + + @Override + public APINode execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINode 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 APINode apply(ResponseWrapper result) { + try { + return APIRequestCreateMention.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestCreateMention(String nodeId, APIContext context) { + super(context, nodeId, "/mentions", "POST", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestCreateMention setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestCreateMention setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestCreateMention setCommentId (String commentId) { + this.setParam("comment_id", commentId); + return this; + } + + public APIRequestCreateMention setMediaId (String mediaId) { + this.setParam("media_id", mediaId); + return this; + } + + public APIRequestCreateMention setMessage (String message) { + this.setParam("message", message); + return this; + } + + public APIRequestCreateMention requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestCreateMention requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestCreateMention requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestCreateMention requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestCreateMention requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestCreateMention requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + + public static class APIRequestCreateMessageAttachment extends APIRequest { + + APINode lastResponse = null; + @Override + public APINode getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "message", + }; + + public static final String[] FIELDS = { + }; + + @Override + public APINode parseResponse(String response, String header) throws APIException { + return APINode.parseResponse(response, getContext(), this, header).head(); + } + + @Override + public APINode execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINode 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 APINode apply(ResponseWrapper result) { + try { + return APIRequestCreateMessageAttachment.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestCreateMessageAttachment(String nodeId, APIContext context) { + super(context, nodeId, "/messageattachments", "POST", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestCreateMessageAttachment setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestCreateMessageAttachment setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestCreateMessageAttachment setMessage (Object message) { + this.setParam("message", message); + return this; + } + public APIRequestCreateMessageAttachment setMessage (String message) { + this.setParam("message", message); + return this; + } + + public APIRequestCreateMessageAttachment requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestCreateMessageAttachment requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestCreateMessageAttachment requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestCreateMessageAttachment requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestCreateMessageAttachment requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestCreateMessageAttachment requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + + public static class APIRequestCreateMessage extends APIRequest { + + APINode lastResponse = null; + @Override + public APINode getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "message", + "messaging_type", + "payload", + "recipient", + "sender_action", + "tag", + "thread_control", + }; + + public static final String[] FIELDS = { + }; + + @Override + public APINode parseResponse(String response, String header) throws APIException { + return APINode.parseResponse(response, getContext(), this, header).head(); + } + + @Override + public APINode execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINode 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 APINode apply(ResponseWrapper result) { + try { + return APIRequestCreateMessage.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestCreateMessage(String nodeId, APIContext context) { + super(context, nodeId, "/messages", "POST", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestCreateMessage setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestCreateMessage setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestCreateMessage setMessage (Object message) { + this.setParam("message", message); + return this; + } + public APIRequestCreateMessage setMessage (String message) { + this.setParam("message", message); + return this; + } + + public APIRequestCreateMessage setMessagingType (EnumMessagingType messagingType) { + this.setParam("messaging_type", messagingType); + return this; + } + public APIRequestCreateMessage setMessagingType (String messagingType) { + this.setParam("messaging_type", messagingType); + return this; + } + + public APIRequestCreateMessage setPayload (String payload) { + this.setParam("payload", payload); + return this; + } + + public APIRequestCreateMessage setRecipient (Object recipient) { + this.setParam("recipient", recipient); + return this; + } + public APIRequestCreateMessage setRecipient (String recipient) { + this.setParam("recipient", recipient); + return this; + } + + public APIRequestCreateMessage setSenderAction (EnumSenderAction senderAction) { + this.setParam("sender_action", senderAction); + return this; + } + public APIRequestCreateMessage setSenderAction (String senderAction) { + this.setParam("sender_action", senderAction); + return this; + } + + public APIRequestCreateMessage setTag (Object tag) { + this.setParam("tag", tag); + return this; + } + public APIRequestCreateMessage setTag (String tag) { + this.setParam("tag", tag); + return this; + } + + public APIRequestCreateMessage setThreadControl (Object threadControl) { + this.setParam("thread_control", threadControl); + return this; + } + public APIRequestCreateMessage setThreadControl (String threadControl) { + this.setParam("thread_control", threadControl); + return this; + } + + public APIRequestCreateMessage requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestCreateMessage requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestCreateMessage requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestCreateMessage requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestCreateMessage requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestCreateMessage requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + + public static class APIRequestDeleteMessengerProfile extends APIRequest { + + APINodeList lastResponse = null; + @Override + public APINodeList getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "fields", + }; + + public static final String[] FIELDS = { + }; + + @Override + public APINodeList parseResponse(String response, String header) throws APIException { + return APINode.parseResponse(response, getContext(), this, header); + } + + @Override + public APINodeList execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + try { + return APIRequestDeleteMessengerProfile.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestDeleteMessengerProfile(String nodeId, APIContext context) { + super(context, nodeId, "/messenger_profile", "DELETE", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestDeleteMessengerProfile setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestDeleteMessengerProfile setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestDeleteMessengerProfile setFields (List fields) { + this.setParam("fields", fields); + return this; + } + public APIRequestDeleteMessengerProfile setFields (String fields) { + this.setParam("fields", fields); + return this; + } + + public APIRequestDeleteMessengerProfile requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestDeleteMessengerProfile requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestDeleteMessengerProfile requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestDeleteMessengerProfile requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestDeleteMessengerProfile requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestDeleteMessengerProfile requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + + public static class APIRequestGetMessengerProfile extends APIRequest { + + APINodeList lastResponse = null; + @Override + public APINodeList getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + }; + + public static final String[] FIELDS = { + }; + + @Override + public APINodeList parseResponse(String response, String header) throws APIException { + return APINode.parseResponse(response, getContext(), this, header); + } + + @Override + public APINodeList execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + try { + return APIRequestGetMessengerProfile.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestGetMessengerProfile(String nodeId, APIContext context) { + super(context, nodeId, "/messenger_profile", "GET", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestGetMessengerProfile setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestGetMessengerProfile setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestGetMessengerProfile requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestGetMessengerProfile requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetMessengerProfile requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestGetMessengerProfile requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetMessengerProfile requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestGetMessengerProfile requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + + public static class APIRequestCreateMessengerProfile extends APIRequest { + + APINode lastResponse = null; + @Override + public APINode getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "ice_breakers", + "persistent_menu", + }; + + public static final String[] FIELDS = { + }; + + @Override + public APINode parseResponse(String response, String header) throws APIException { + return APINode.parseResponse(response, getContext(), this, header).head(); + } + + @Override + public APINode execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINode 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 APINode apply(ResponseWrapper result) { + try { + return APIRequestCreateMessengerProfile.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestCreateMessengerProfile(String nodeId, APIContext context) { + super(context, nodeId, "/messenger_profile", "POST", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestCreateMessengerProfile setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestCreateMessengerProfile setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestCreateMessengerProfile setIceBreakers (List> iceBreakers) { + this.setParam("ice_breakers", iceBreakers); + return this; + } + public APIRequestCreateMessengerProfile setIceBreakers (String iceBreakers) { + this.setParam("ice_breakers", iceBreakers); + return this; + } + + public APIRequestCreateMessengerProfile setPersistentMenu (List persistentMenu) { + this.setParam("persistent_menu", persistentMenu); + return this; + } + public APIRequestCreateMessengerProfile setPersistentMenu (String persistentMenu) { + this.setParam("persistent_menu", persistentMenu); + return this; + } + + public APIRequestCreateMessengerProfile requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestCreateMessengerProfile requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestCreateMessengerProfile requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestCreateMessengerProfile requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestCreateMessengerProfile requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestCreateMessengerProfile requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + + public static class APIRequestGetStories extends APIRequest { + + APINodeList lastResponse = null; + @Override + public APINodeList getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + }; + + public static final String[] FIELDS = { + }; + + @Override + public APINodeList parseResponse(String response, String header) throws APIException { + return APINode.parseResponse(response, getContext(), this, header); + } + + @Override + public APINodeList execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + try { + return APIRequestGetStories.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestGetStories(String nodeId, APIContext context) { + super(context, nodeId, "/stories", "GET", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestGetStories setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestGetStories setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestGetStories requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestGetStories requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetStories requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestGetStories requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetStories requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestGetStories requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + + public static class APIRequestDeleteSubscribedApps extends APIRequest { + + APINodeList lastResponse = null; + @Override + public APINodeList getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + }; + + public static final String[] FIELDS = { + }; + + @Override + public APINodeList parseResponse(String response, String header) throws APIException { + return APINode.parseResponse(response, getContext(), this, header); + } + + @Override + public APINodeList execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + try { + return APIRequestDeleteSubscribedApps.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestDeleteSubscribedApps(String nodeId, APIContext context) { + super(context, nodeId, "/subscribed_apps", "DELETE", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestDeleteSubscribedApps setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestDeleteSubscribedApps setParams(Map params) { + setParamsInternal(params); + return this; + } + + public APIRequestDeleteSubscribedApps requestAllFields () { + return this.requestAllFields(true); + } - public String getFieldAccountType() { - return mAccountType; - } + public APIRequestDeleteSubscribedApps requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } - public String getFieldId() { - return mId; - } + @Override + public APIRequestDeleteSubscribedApps requestFields (List fields) { + return this.requestFields(fields, true); + } - public Long getFieldMediaCount() { - return mMediaCount; - } + @Override + public APIRequestDeleteSubscribedApps requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } - public String getFieldUsername() { - return mUsername; - } + @Override + public APIRequestDeleteSubscribedApps requestField (String field) { + this.requestField(field, true); + return this; + } + @Override + public APIRequestDeleteSubscribedApps requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + } - public static class APIRequestGetLiveMedia extends APIRequest { + public static class APIRequestGetSubscribedApps extends APIRequest { APINodeList lastResponse = null; @Override @@ -333,7 +2355,7 @@ public ListenableFuture> executeAsync(Map e new Function>() { public APINodeList apply(ResponseWrapper result) { try { - return APIRequestGetLiveMedia.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestGetSubscribedApps.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -343,28 +2365,28 @@ public APINodeList apply(ResponseWrapper result) { ); }; - public APIRequestGetLiveMedia(String nodeId, APIContext context) { - super(context, nodeId, "/live_media", "GET", Arrays.asList(PARAMS)); + public APIRequestGetSubscribedApps(String nodeId, APIContext context) { + super(context, nodeId, "/subscribed_apps", "GET", Arrays.asList(PARAMS)); } @Override - public APIRequestGetLiveMedia setParam(String param, Object value) { + public APIRequestGetSubscribedApps setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestGetLiveMedia setParams(Map params) { + public APIRequestGetSubscribedApps setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestGetLiveMedia requestAllFields () { + public APIRequestGetSubscribedApps requestAllFields () { return this.requestAllFields(true); } - public APIRequestGetLiveMedia requestAllFields (boolean value) { + public APIRequestGetSubscribedApps requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -372,12 +2394,12 @@ public APIRequestGetLiveMedia requestAllFields (boolean value) { } @Override - public APIRequestGetLiveMedia requestFields (List fields) { + public APIRequestGetSubscribedApps requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestGetLiveMedia requestFields (List fields, boolean value) { + public APIRequestGetSubscribedApps requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -385,62 +2407,61 @@ public APIRequestGetLiveMedia requestFields (List fields, boolean value) } @Override - public APIRequestGetLiveMedia requestField (String field) { + public APIRequestGetSubscribedApps requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestGetLiveMedia requestField (String field, boolean value) { + public APIRequestGetSubscribedApps requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } } - public static class APIRequestGetMedia extends APIRequest { + public static class APIRequestCreateSubscribedApp extends APIRequest { - APINodeList lastResponse = null; + APINode lastResponse = null; @Override - public APINodeList getLastResponse() { + public APINode getLastResponse() { return lastResponse; } public static final String[] PARAMS = { - "since", - "until", + "subscribed_fields", }; public static final String[] FIELDS = { }; @Override - public APINodeList parseResponse(String response, String header) throws APIException { - return APINode.parseResponse(response, getContext(), this, header); + public APINode parseResponse(String response, String header) throws APIException { + return APINode.parseResponse(response, getContext(), this, header).head(); } @Override - public APINodeList execute() throws APIException { + public APINode execute() throws APIException { return execute(new HashMap()); } @Override - public APINodeList execute(Map extraParams) throws APIException { + public APINode execute(Map extraParams) throws APIException { ResponseWrapper rw = executeInternal(extraParams); - lastResponse = parseResponse(rw.getBody(),rw.getHeader()); + 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 APINodeList apply(ResponseWrapper result) { + new Function() { + public APINode apply(ResponseWrapper result) { try { - return APIRequestGetMedia.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestCreateSubscribedApp.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -450,38 +2471,37 @@ public APINodeList apply(ResponseWrapper result) { ); }; - public APIRequestGetMedia(String nodeId, APIContext context) { - super(context, nodeId, "/media", "GET", Arrays.asList(PARAMS)); + public APIRequestCreateSubscribedApp(String nodeId, APIContext context) { + super(context, nodeId, "/subscribed_apps", "POST", Arrays.asList(PARAMS)); } @Override - public APIRequestGetMedia setParam(String param, Object value) { + public APIRequestCreateSubscribedApp setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestGetMedia setParams(Map params) { + public APIRequestCreateSubscribedApp setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestGetMedia setSince (String since) { - this.setParam("since", since); + public APIRequestCreateSubscribedApp setSubscribedFields (List subscribedFields) { + this.setParam("subscribed_fields", subscribedFields); return this; } - - public APIRequestGetMedia setUntil (String until) { - this.setParam("until", until); + public APIRequestCreateSubscribedApp setSubscribedFields (String subscribedFields) { + this.setParam("subscribed_fields", subscribedFields); return this; } - public APIRequestGetMedia requestAllFields () { + public APIRequestCreateSubscribedApp requestAllFields () { return this.requestAllFields(true); } - public APIRequestGetMedia requestAllFields (boolean value) { + public APIRequestCreateSubscribedApp requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -489,12 +2509,12 @@ public APIRequestGetMedia requestAllFields (boolean value) { } @Override - public APIRequestGetMedia requestFields (List fields) { + public APIRequestCreateSubscribedApp requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestGetMedia requestFields (List fields, boolean value) { + public APIRequestCreateSubscribedApp requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -502,20 +2522,20 @@ public APIRequestGetMedia requestFields (List fields, boolean value) { } @Override - public APIRequestGetMedia requestField (String field) { + public APIRequestCreateSubscribedApp requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestGetMedia requestField (String field, boolean value) { + public APIRequestCreateSubscribedApp requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } } - public static class APIRequestGetStories extends APIRequest { + public static class APIRequestGetTags extends APIRequest { APINodeList lastResponse = null; @Override @@ -555,7 +2575,7 @@ public ListenableFuture> executeAsync(Map e new Function>() { public APINodeList apply(ResponseWrapper result) { try { - return APIRequestGetStories.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestGetTags.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -565,28 +2585,28 @@ public APINodeList apply(ResponseWrapper result) { ); }; - public APIRequestGetStories(String nodeId, APIContext context) { - super(context, nodeId, "/stories", "GET", Arrays.asList(PARAMS)); + public APIRequestGetTags(String nodeId, APIContext context) { + super(context, nodeId, "/tags", "GET", Arrays.asList(PARAMS)); } @Override - public APIRequestGetStories setParam(String param, Object value) { + public APIRequestGetTags setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestGetStories setParams(Map params) { + public APIRequestGetTags setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestGetStories requestAllFields () { + public APIRequestGetTags requestAllFields () { return this.requestAllFields(true); } - public APIRequestGetStories requestAllFields (boolean value) { + public APIRequestGetTags requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -594,12 +2614,12 @@ public APIRequestGetStories requestAllFields (boolean value) { } @Override - public APIRequestGetStories requestFields (List fields) { + public APIRequestGetTags requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestGetStories requestFields (List fields, boolean value) { + public APIRequestGetTags requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -607,17 +2627,206 @@ public APIRequestGetStories requestFields (List fields, boolean value) { } @Override - public APIRequestGetStories requestField (String field) { + public APIRequestGetTags requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestGetStories requestField (String field, boolean value) { + public APIRequestGetTags requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + + public static class APIRequestGetWelcomeMessageFlows extends APIRequest { + + APINodeList lastResponse = null; + @Override + public APINodeList getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "app_id", + "flow_id", + }; + + public static final String[] FIELDS = { + "compatible_platforms", + "eligible_platforms", + "id", + "is_ig_only_flow", + "is_used_in_ad", + "last_update_time", + "name", + "welcome_message_flow", + "welcome_message_sequence", + }; + + @Override + public APINodeList parseResponse(String response, String header) throws APIException { + return CTXPartnerAppWelcomeMessageFlow.parseResponse(response, getContext(), this, header); + } + + @Override + public APINodeList execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + try { + return APIRequestGetWelcomeMessageFlows.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestGetWelcomeMessageFlows(String nodeId, APIContext context) { + super(context, nodeId, "/welcome_message_flows", "GET", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestGetWelcomeMessageFlows setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestGetWelcomeMessageFlows setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestGetWelcomeMessageFlows setAppId (String appId) { + this.setParam("app_id", appId); + return this; + } + + public APIRequestGetWelcomeMessageFlows setFlowId (String flowId) { + this.setParam("flow_id", flowId); + return this; + } + + public APIRequestGetWelcomeMessageFlows requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestGetWelcomeMessageFlows requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetWelcomeMessageFlows requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestGetWelcomeMessageFlows requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetWelcomeMessageFlows requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestGetWelcomeMessageFlows requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } + public APIRequestGetWelcomeMessageFlows requestCompatiblePlatformsField () { + return this.requestCompatiblePlatformsField(true); + } + public APIRequestGetWelcomeMessageFlows requestCompatiblePlatformsField (boolean value) { + this.requestField("compatible_platforms", value); + return this; + } + public APIRequestGetWelcomeMessageFlows requestEligiblePlatformsField () { + return this.requestEligiblePlatformsField(true); + } + public APIRequestGetWelcomeMessageFlows requestEligiblePlatformsField (boolean value) { + this.requestField("eligible_platforms", value); + return this; + } + public APIRequestGetWelcomeMessageFlows requestIdField () { + return this.requestIdField(true); + } + public APIRequestGetWelcomeMessageFlows requestIdField (boolean value) { + this.requestField("id", value); + return this; + } + public APIRequestGetWelcomeMessageFlows requestIsIgOnlyFlowField () { + return this.requestIsIgOnlyFlowField(true); + } + public APIRequestGetWelcomeMessageFlows requestIsIgOnlyFlowField (boolean value) { + this.requestField("is_ig_only_flow", value); + return this; + } + public APIRequestGetWelcomeMessageFlows requestIsUsedInAdField () { + return this.requestIsUsedInAdField(true); + } + public APIRequestGetWelcomeMessageFlows requestIsUsedInAdField (boolean value) { + this.requestField("is_used_in_ad", value); + return this; + } + public APIRequestGetWelcomeMessageFlows requestLastUpdateTimeField () { + return this.requestLastUpdateTimeField(true); + } + public APIRequestGetWelcomeMessageFlows requestLastUpdateTimeField (boolean value) { + this.requestField("last_update_time", value); + return this; + } + public APIRequestGetWelcomeMessageFlows requestNameField () { + return this.requestNameField(true); + } + public APIRequestGetWelcomeMessageFlows requestNameField (boolean value) { + this.requestField("name", value); + return this; + } + public APIRequestGetWelcomeMessageFlows requestWelcomeMessageFlowField () { + return this.requestWelcomeMessageFlowField(true); + } + public APIRequestGetWelcomeMessageFlows requestWelcomeMessageFlowField (boolean value) { + this.requestField("welcome_message_flow", value); + return this; + } + public APIRequestGetWelcomeMessageFlows requestWelcomeMessageSequenceField () { + return this.requestWelcomeMessageSequenceField(true); + } + public APIRequestGetWelcomeMessageFlows requestWelcomeMessageSequenceField (boolean value) { + this.requestField("welcome_message_sequence", value); + return this; + } } public static class APIRequestGet extends APIRequest { @@ -632,9 +2841,16 @@ public IGUserForIGOnlyAPI getLastResponse() { public static final String[] FIELDS = { "account_type", + "biography", + "followers_count", + "follows_count", "id", "media_count", + "name", + "profile_picture_url", + "user_id", "username", + "website", }; @Override @@ -734,6 +2950,27 @@ public APIRequestGet requestAccountTypeField (boolean value) { this.requestField("account_type", value); return this; } + public APIRequestGet requestBiographyField () { + return this.requestBiographyField(true); + } + public APIRequestGet requestBiographyField (boolean value) { + this.requestField("biography", value); + return this; + } + public APIRequestGet requestFollowersCountField () { + return this.requestFollowersCountField(true); + } + public APIRequestGet requestFollowersCountField (boolean value) { + this.requestField("followers_count", value); + return this; + } + public APIRequestGet requestFollowsCountField () { + return this.requestFollowsCountField(true); + } + public APIRequestGet requestFollowsCountField (boolean value) { + this.requestField("follows_count", value); + return this; + } public APIRequestGet requestIdField () { return this.requestIdField(true); } @@ -748,6 +2985,27 @@ public APIRequestGet requestMediaCountField (boolean value) { this.requestField("media_count", value); return this; } + public APIRequestGet requestNameField () { + return this.requestNameField(true); + } + public APIRequestGet requestNameField (boolean value) { + this.requestField("name", value); + return this; + } + public APIRequestGet requestProfilePictureUrlField () { + return this.requestProfilePictureUrlField(true); + } + public APIRequestGet requestProfilePictureUrlField (boolean value) { + this.requestField("profile_picture_url", value); + return this; + } + public APIRequestGet requestUserIdField () { + return this.requestUserIdField(true); + } + public APIRequestGet requestUserIdField (boolean value) { + this.requestField("user_id", value); + return this; + } public APIRequestGet requestUsernameField () { return this.requestUsernameField(true); } @@ -755,6 +3013,149 @@ public APIRequestGet requestUsernameField (boolean value) { this.requestField("username", value); return this; } + public APIRequestGet requestWebsiteField () { + return this.requestWebsiteField(true); + } + public APIRequestGet requestWebsiteField (boolean value) { + this.requestField("website", value); + return this; + } + } + + public static enum EnumMessagingType { + @SerializedName("MESSAGE_TAG") + VALUE_MESSAGE_TAG("MESSAGE_TAG"), + @SerializedName("RESPONSE") + VALUE_RESPONSE("RESPONSE"), + @SerializedName("UPDATE") + VALUE_UPDATE("UPDATE"), + @SerializedName("UTILITY") + VALUE_UTILITY("UTILITY"), + ; + + private String value; + + private EnumMessagingType(String value) { + this.value = value; + } + + @Override + public String toString() { + return value; + } + } + + public static enum EnumSenderAction { + @SerializedName("MARK_SEEN") + VALUE_MARK_SEEN("MARK_SEEN"), + @SerializedName("REACT") + VALUE_REACT("REACT"), + @SerializedName("TYPING_OFF") + VALUE_TYPING_OFF("TYPING_OFF"), + @SerializedName("TYPING_ON") + VALUE_TYPING_ON("TYPING_ON"), + @SerializedName("UNREACT") + VALUE_UNREACT("UNREACT"), + ; + + private String value; + + private EnumSenderAction(String value) { + this.value = value; + } + + @Override + public String toString() { + return value; + } + } + + public static enum EnumFields { + @SerializedName("ACCOUNT_LINKING_URL") + VALUE_ACCOUNT_LINKING_URL("ACCOUNT_LINKING_URL"), + @SerializedName("COMMANDS") + VALUE_COMMANDS("COMMANDS"), + @SerializedName("DESCRIPTION") + VALUE_DESCRIPTION("DESCRIPTION"), + @SerializedName("GET_STARTED") + VALUE_GET_STARTED("GET_STARTED"), + @SerializedName("GREETING") + VALUE_GREETING("GREETING"), + @SerializedName("HOME_URL") + VALUE_HOME_URL("HOME_URL"), + @SerializedName("ICE_BREAKERS") + VALUE_ICE_BREAKERS("ICE_BREAKERS"), + @SerializedName("PAYMENT_SETTINGS") + VALUE_PAYMENT_SETTINGS("PAYMENT_SETTINGS"), + @SerializedName("PERSISTENT_MENU") + VALUE_PERSISTENT_MENU("PERSISTENT_MENU"), + @SerializedName("PLATFORM") + VALUE_PLATFORM("PLATFORM"), + @SerializedName("SUBJECT_TO_NEW_EU_PRIVACY_RULES") + VALUE_SUBJECT_TO_NEW_EU_PRIVACY_RULES("SUBJECT_TO_NEW_EU_PRIVACY_RULES"), + @SerializedName("TARGET_AUDIENCE") + VALUE_TARGET_AUDIENCE("TARGET_AUDIENCE"), + @SerializedName("TITLE") + VALUE_TITLE("TITLE"), + @SerializedName("WHITELISTED_DOMAINS") + VALUE_WHITELISTED_DOMAINS("WHITELISTED_DOMAINS"), + ; + + private String value; + + private EnumFields(String value) { + this.value = value; + } + + @Override + public String toString() { + return value; + } + } + + public static enum EnumSubscribedFields { + @SerializedName("comments") + VALUE_COMMENTS("comments"), + @SerializedName("creator_marketplace_invited_creator_onboarding") + VALUE_CREATOR_MARKETPLACE_INVITED_CREATOR_ONBOARDING("creator_marketplace_invited_creator_onboarding"), + @SerializedName("creator_marketplace_projects") + VALUE_CREATOR_MARKETPLACE_PROJECTS("creator_marketplace_projects"), + @SerializedName("delta") + VALUE_DELTA("delta"), + @SerializedName("live_comments") + VALUE_LIVE_COMMENTS("live_comments"), + @SerializedName("mentions") + VALUE_MENTIONS("mentions"), + @SerializedName("message_reactions") + VALUE_MESSAGE_REACTIONS("message_reactions"), + @SerializedName("messages") + VALUE_MESSAGES("messages"), + @SerializedName("messaging_handover") + VALUE_MESSAGING_HANDOVER("messaging_handover"), + @SerializedName("messaging_optins") + VALUE_MESSAGING_OPTINS("messaging_optins"), + @SerializedName("messaging_postbacks") + VALUE_MESSAGING_POSTBACKS("messaging_postbacks"), + @SerializedName("messaging_referral") + VALUE_MESSAGING_REFERRAL("messaging_referral"), + @SerializedName("messaging_seen") + VALUE_MESSAGING_SEEN("messaging_seen"), + @SerializedName("standby") + VALUE_STANDBY("standby"), + @SerializedName("story_insights") + VALUE_STORY_INSIGHTS("story_insights"), + ; + + private String value; + + private EnumSubscribedFields(String value) { + this.value = value; + } + + @Override + public String toString() { + return value; + } } @@ -773,9 +3174,16 @@ public APIRequestGet requestUsernameField (boolean value) { public IGUserForIGOnlyAPI copyFrom(IGUserForIGOnlyAPI instance) { this.mAccountType = instance.mAccountType; + this.mBiography = instance.mBiography; + this.mFollowersCount = instance.mFollowersCount; + this.mFollowsCount = instance.mFollowsCount; this.mId = instance.mId; this.mMediaCount = instance.mMediaCount; + this.mName = instance.mName; + this.mProfilePictureUrl = instance.mProfilePictureUrl; + this.mUserId = instance.mUserId; this.mUsername = instance.mUsername; + this.mWebsite = instance.mWebsite; this.context = instance.context; this.rawValue = instance.rawValue; return this; diff --git a/src/main/java/com/facebook/ads/sdk/InsightsResult.java b/src/main/java/com/facebook/ads/sdk/InsightsResult.java index 8d090d4a..fd9090dd 100644 --- a/src/main/java/com/facebook/ads/sdk/InsightsResult.java +++ b/src/main/java/com/facebook/ads/sdk/InsightsResult.java @@ -359,386 +359,20 @@ public String toString() { } public static enum EnumMetric { - @SerializedName("blue_reels_play_count") - VALUE_BLUE_REELS_PLAY_COUNT("blue_reels_play_count"), - @SerializedName("creator_monetization_qualified_views") - VALUE_CREATOR_MONETIZATION_QUALIFIED_VIEWS("creator_monetization_qualified_views"), - @SerializedName("fb_media_matching_copyright_comment_count") - VALUE_FB_MEDIA_MATCHING_COPYRIGHT_COMMENT_COUNT("fb_media_matching_copyright_comment_count"), - @SerializedName("fb_media_matching_copyright_daily_comment_count") - VALUE_FB_MEDIA_MATCHING_COPYRIGHT_DAILY_COMMENT_COUNT("fb_media_matching_copyright_daily_comment_count"), - @SerializedName("fb_media_matching_copyright_daily_like_count") - VALUE_FB_MEDIA_MATCHING_COPYRIGHT_DAILY_LIKE_COUNT("fb_media_matching_copyright_daily_like_count"), - @SerializedName("fb_media_matching_copyright_daily_post_impressions") - VALUE_FB_MEDIA_MATCHING_COPYRIGHT_DAILY_POST_IMPRESSIONS("fb_media_matching_copyright_daily_post_impressions"), - @SerializedName("fb_media_matching_copyright_daily_post_impressions_by_age_bucket_and_gender") - VALUE_FB_MEDIA_MATCHING_COPYRIGHT_DAILY_POST_IMPRESSIONS_BY_AGE_BUCKET_AND_GENDER("fb_media_matching_copyright_daily_post_impressions_by_age_bucket_and_gender"), - @SerializedName("fb_media_matching_copyright_daily_post_impressions_by_country") - VALUE_FB_MEDIA_MATCHING_COPYRIGHT_DAILY_POST_IMPRESSIONS_BY_COUNTRY("fb_media_matching_copyright_daily_post_impressions_by_country"), - @SerializedName("fb_media_matching_copyright_daily_post_impressions_by_locale") - VALUE_FB_MEDIA_MATCHING_COPYRIGHT_DAILY_POST_IMPRESSIONS_BY_LOCALE("fb_media_matching_copyright_daily_post_impressions_by_locale"), - @SerializedName("fb_media_matching_copyright_daily_post_impressions_by_matching_post_id") - VALUE_FB_MEDIA_MATCHING_COPYRIGHT_DAILY_POST_IMPRESSIONS_BY_MATCHING_POST_ID("fb_media_matching_copyright_daily_post_impressions_by_matching_post_id"), - @SerializedName("fb_media_matching_copyright_daily_post_impressions_by_matching_post_owner_id") - VALUE_FB_MEDIA_MATCHING_COPYRIGHT_DAILY_POST_IMPRESSIONS_BY_MATCHING_POST_OWNER_ID("fb_media_matching_copyright_daily_post_impressions_by_matching_post_owner_id"), - @SerializedName("fb_media_matching_copyright_daily_post_reactions_anger_count") - VALUE_FB_MEDIA_MATCHING_COPYRIGHT_DAILY_POST_REACTIONS_ANGER_COUNT("fb_media_matching_copyright_daily_post_reactions_anger_count"), - @SerializedName("fb_media_matching_copyright_daily_post_reactions_haha_count") - VALUE_FB_MEDIA_MATCHING_COPYRIGHT_DAILY_POST_REACTIONS_HAHA_COUNT("fb_media_matching_copyright_daily_post_reactions_haha_count"), - @SerializedName("fb_media_matching_copyright_daily_post_reactions_like_count") - VALUE_FB_MEDIA_MATCHING_COPYRIGHT_DAILY_POST_REACTIONS_LIKE_COUNT("fb_media_matching_copyright_daily_post_reactions_like_count"), - @SerializedName("fb_media_matching_copyright_daily_post_reactions_love_count") - VALUE_FB_MEDIA_MATCHING_COPYRIGHT_DAILY_POST_REACTIONS_LOVE_COUNT("fb_media_matching_copyright_daily_post_reactions_love_count"), - @SerializedName("fb_media_matching_copyright_daily_post_reactions_sorry_count") - VALUE_FB_MEDIA_MATCHING_COPYRIGHT_DAILY_POST_REACTIONS_SORRY_COUNT("fb_media_matching_copyright_daily_post_reactions_sorry_count"), - @SerializedName("fb_media_matching_copyright_daily_post_reactions_wow_count") - VALUE_FB_MEDIA_MATCHING_COPYRIGHT_DAILY_POST_REACTIONS_WOW_COUNT("fb_media_matching_copyright_daily_post_reactions_wow_count"), - @SerializedName("fb_media_matching_copyright_daily_post_share_count") - VALUE_FB_MEDIA_MATCHING_COPYRIGHT_DAILY_POST_SHARE_COUNT("fb_media_matching_copyright_daily_post_share_count"), - @SerializedName("fb_media_matching_copyright_like_count") - VALUE_FB_MEDIA_MATCHING_COPYRIGHT_LIKE_COUNT("fb_media_matching_copyright_like_count"), - @SerializedName("fb_media_matching_copyright_post_impressions") - VALUE_FB_MEDIA_MATCHING_COPYRIGHT_POST_IMPRESSIONS("fb_media_matching_copyright_post_impressions"), - @SerializedName("fb_media_matching_copyright_post_impressions_by_age_bucket_and_gender") - VALUE_FB_MEDIA_MATCHING_COPYRIGHT_POST_IMPRESSIONS_BY_AGE_BUCKET_AND_GENDER("fb_media_matching_copyright_post_impressions_by_age_bucket_and_gender"), - @SerializedName("fb_media_matching_copyright_post_impressions_by_country") - VALUE_FB_MEDIA_MATCHING_COPYRIGHT_POST_IMPRESSIONS_BY_COUNTRY("fb_media_matching_copyright_post_impressions_by_country"), - @SerializedName("fb_media_matching_copyright_post_impressions_by_locale") - VALUE_FB_MEDIA_MATCHING_COPYRIGHT_POST_IMPRESSIONS_BY_LOCALE("fb_media_matching_copyright_post_impressions_by_locale"), - @SerializedName("fb_media_matching_copyright_post_impressions_by_matching_post_id") - VALUE_FB_MEDIA_MATCHING_COPYRIGHT_POST_IMPRESSIONS_BY_MATCHING_POST_ID("fb_media_matching_copyright_post_impressions_by_matching_post_id"), - @SerializedName("fb_media_matching_copyright_post_impressions_by_matching_post_owner_id") - VALUE_FB_MEDIA_MATCHING_COPYRIGHT_POST_IMPRESSIONS_BY_MATCHING_POST_OWNER_ID("fb_media_matching_copyright_post_impressions_by_matching_post_owner_id"), - @SerializedName("fb_media_matching_copyright_post_reactions_anger_count") - VALUE_FB_MEDIA_MATCHING_COPYRIGHT_POST_REACTIONS_ANGER_COUNT("fb_media_matching_copyright_post_reactions_anger_count"), - @SerializedName("fb_media_matching_copyright_post_reactions_haha_count") - VALUE_FB_MEDIA_MATCHING_COPYRIGHT_POST_REACTIONS_HAHA_COUNT("fb_media_matching_copyright_post_reactions_haha_count"), - @SerializedName("fb_media_matching_copyright_post_reactions_like_count") - VALUE_FB_MEDIA_MATCHING_COPYRIGHT_POST_REACTIONS_LIKE_COUNT("fb_media_matching_copyright_post_reactions_like_count"), - @SerializedName("fb_media_matching_copyright_post_reactions_love_count") - VALUE_FB_MEDIA_MATCHING_COPYRIGHT_POST_REACTIONS_LOVE_COUNT("fb_media_matching_copyright_post_reactions_love_count"), - @SerializedName("fb_media_matching_copyright_post_reactions_sorry_count") - VALUE_FB_MEDIA_MATCHING_COPYRIGHT_POST_REACTIONS_SORRY_COUNT("fb_media_matching_copyright_post_reactions_sorry_count"), - @SerializedName("fb_media_matching_copyright_post_reactions_wow_count") - VALUE_FB_MEDIA_MATCHING_COPYRIGHT_POST_REACTIONS_WOW_COUNT("fb_media_matching_copyright_post_reactions_wow_count"), - @SerializedName("fb_media_matching_copyright_post_share_count") - VALUE_FB_MEDIA_MATCHING_COPYRIGHT_POST_SHARE_COUNT("fb_media_matching_copyright_post_share_count"), - @SerializedName("fb_reels_replay_count") - VALUE_FB_REELS_REPLAY_COUNT("fb_reels_replay_count"), - @SerializedName("fb_reels_total_plays") - VALUE_FB_REELS_TOTAL_PLAYS("fb_reels_total_plays"), - @SerializedName("has_total_video_views_by_publisher_platform_type") - VALUE_HAS_TOTAL_VIDEO_VIEWS_BY_PUBLISHER_PLATFORM_TYPE("has_total_video_views_by_publisher_platform_type"), - @SerializedName("post_impressions_unique") - VALUE_POST_IMPRESSIONS_UNIQUE("post_impressions_unique"), - @SerializedName("post_video_avg_time_watched") - VALUE_POST_VIDEO_AVG_TIME_WATCHED("post_video_avg_time_watched"), - @SerializedName("post_video_followers") - VALUE_POST_VIDEO_FOLLOWERS("post_video_followers"), - @SerializedName("post_video_likes_by_reaction_type") - VALUE_POST_VIDEO_LIKES_BY_REACTION_TYPE("post_video_likes_by_reaction_type"), - @SerializedName("post_video_retention_graph") - VALUE_POST_VIDEO_RETENTION_GRAPH("post_video_retention_graph"), - @SerializedName("post_video_social_actions") - VALUE_POST_VIDEO_SOCIAL_ACTIONS("post_video_social_actions"), - @SerializedName("post_video_view_time") - VALUE_POST_VIDEO_VIEW_TIME("post_video_view_time"), - @SerializedName("rights_manager_matching_copyright_matching_page_or_profile_view_count") - VALUE_RIGHTS_MANAGER_MATCHING_COPYRIGHT_MATCHING_PAGE_OR_PROFILE_VIEW_COUNT("rights_manager_matching_copyright_matching_page_or_profile_view_count"), - @SerializedName("rights_manager_matching_copyright_matching_video_view_count") - VALUE_RIGHTS_MANAGER_MATCHING_COPYRIGHT_MATCHING_VIDEO_VIEW_COUNT("rights_manager_matching_copyright_matching_video_view_count"), - @SerializedName("rights_manager_matching_copyright_video_view_count") - VALUE_RIGHTS_MANAGER_MATCHING_COPYRIGHT_VIDEO_VIEW_COUNT("rights_manager_matching_copyright_video_view_count"), - @SerializedName("rights_manager_matching_copyright_video_view_count_60s") - VALUE_RIGHTS_MANAGER_MATCHING_COPYRIGHT_VIDEO_VIEW_COUNT_60S("rights_manager_matching_copyright_video_view_count_60s"), - @SerializedName("rights_manager_matching_copyright_video_view_count_60s_by_age_bucket_and_gender") - VALUE_RIGHTS_MANAGER_MATCHING_COPYRIGHT_VIDEO_VIEW_COUNT_60S_BY_AGE_BUCKET_AND_GENDER("rights_manager_matching_copyright_video_view_count_60s_by_age_bucket_and_gender"), - @SerializedName("rights_manager_matching_copyright_video_view_count_60s_by_country_id") - VALUE_RIGHTS_MANAGER_MATCHING_COPYRIGHT_VIDEO_VIEW_COUNT_60S_BY_COUNTRY_ID("rights_manager_matching_copyright_video_view_count_60s_by_country_id"), - @SerializedName("rights_manager_matching_copyright_video_view_count_60s_by_locale") - VALUE_RIGHTS_MANAGER_MATCHING_COPYRIGHT_VIDEO_VIEW_COUNT_60S_BY_LOCALE("rights_manager_matching_copyright_video_view_count_60s_by_locale"), - @SerializedName("total_audio_only_product_listen_count") - VALUE_TOTAL_AUDIO_ONLY_PRODUCT_LISTEN_COUNT("total_audio_only_product_listen_count"), - @SerializedName("total_video_10s_views") - VALUE_TOTAL_VIDEO_10S_VIEWS("total_video_10s_views"), - @SerializedName("total_video_10s_views_auto_played") - VALUE_TOTAL_VIDEO_10S_VIEWS_AUTO_PLAYED("total_video_10s_views_auto_played"), - @SerializedName("total_video_10s_views_clicked_to_play") - VALUE_TOTAL_VIDEO_10S_VIEWS_CLICKED_TO_PLAY("total_video_10s_views_clicked_to_play"), - @SerializedName("total_video_10s_views_organic") - VALUE_TOTAL_VIDEO_10S_VIEWS_ORGANIC("total_video_10s_views_organic"), - @SerializedName("total_video_10s_views_paid") - VALUE_TOTAL_VIDEO_10S_VIEWS_PAID("total_video_10s_views_paid"), - @SerializedName("total_video_10s_views_sound_on") - VALUE_TOTAL_VIDEO_10S_VIEWS_SOUND_ON("total_video_10s_views_sound_on"), - @SerializedName("total_video_10s_views_unique") - VALUE_TOTAL_VIDEO_10S_VIEWS_UNIQUE("total_video_10s_views_unique"), - @SerializedName("total_video_15s_views") - VALUE_TOTAL_VIDEO_15S_VIEWS("total_video_15s_views"), - @SerializedName("total_video_30s_views") - VALUE_TOTAL_VIDEO_30S_VIEWS("total_video_30s_views"), - @SerializedName("total_video_30s_views_auto_played") - VALUE_TOTAL_VIDEO_30S_VIEWS_AUTO_PLAYED("total_video_30s_views_auto_played"), - @SerializedName("total_video_30s_views_clicked_to_play") - VALUE_TOTAL_VIDEO_30S_VIEWS_CLICKED_TO_PLAY("total_video_30s_views_clicked_to_play"), - @SerializedName("total_video_30s_views_organic") - VALUE_TOTAL_VIDEO_30S_VIEWS_ORGANIC("total_video_30s_views_organic"), - @SerializedName("total_video_30s_views_paid") - VALUE_TOTAL_VIDEO_30S_VIEWS_PAID("total_video_30s_views_paid"), - @SerializedName("total_video_30s_views_unique") - VALUE_TOTAL_VIDEO_30S_VIEWS_UNIQUE("total_video_30s_views_unique"), - @SerializedName("total_video_60s_excludes_shorter_views") - VALUE_TOTAL_VIDEO_60S_EXCLUDES_SHORTER_VIEWS("total_video_60s_excludes_shorter_views"), - @SerializedName("total_video_60s_excludes_shorter_views_by_age_bucket_and_gender") - VALUE_TOTAL_VIDEO_60S_EXCLUDES_SHORTER_VIEWS_BY_AGE_BUCKET_AND_GENDER("total_video_60s_excludes_shorter_views_by_age_bucket_and_gender"), - @SerializedName("total_video_60s_excludes_shorter_views_by_distribution_source") - VALUE_TOTAL_VIDEO_60S_EXCLUDES_SHORTER_VIEWS_BY_DISTRIBUTION_SOURCE("total_video_60s_excludes_shorter_views_by_distribution_source"), - @SerializedName("total_video_60s_excludes_shorter_views_by_growth_accounting_bucket") - VALUE_TOTAL_VIDEO_60S_EXCLUDES_SHORTER_VIEWS_BY_GROWTH_ACCOUNTING_BUCKET("total_video_60s_excludes_shorter_views_by_growth_accounting_bucket"), - @SerializedName("total_video_60s_excludes_shorter_views_by_growth_accounting_bucket_and_time_since_creation_bucket") - VALUE_TOTAL_VIDEO_60S_EXCLUDES_SHORTER_VIEWS_BY_GROWTH_ACCOUNTING_BUCKET_AND_TIME_SINCE_CREATION_BUCKET("total_video_60s_excludes_shorter_views_by_growth_accounting_bucket_and_time_since_creation_bucket"), - @SerializedName("total_video_60s_excludes_shorter_views_by_is_60s_returning_viewer") - VALUE_TOTAL_VIDEO_60S_EXCLUDES_SHORTER_VIEWS_BY_IS_60S_RETURNING_VIEWER("total_video_60s_excludes_shorter_views_by_is_60s_returning_viewer"), - @SerializedName("total_video_60s_excludes_shorter_views_by_is_60s_returning_viewer_and_time_since_creation_bucket") - VALUE_TOTAL_VIDEO_60S_EXCLUDES_SHORTER_VIEWS_BY_IS_60S_RETURNING_VIEWER_AND_TIME_SINCE_CREATION_BUCKET("total_video_60s_excludes_shorter_views_by_is_60s_returning_viewer_and_time_since_creation_bucket"), - @SerializedName("total_video_60s_excludes_shorter_views_live") - VALUE_TOTAL_VIDEO_60S_EXCLUDES_SHORTER_VIEWS_LIVE("total_video_60s_excludes_shorter_views_live"), - @SerializedName("total_video_60s_excludes_shorter_views_unique") - VALUE_TOTAL_VIDEO_60S_EXCLUDES_SHORTER_VIEWS_UNIQUE("total_video_60s_excludes_shorter_views_unique"), - @SerializedName("total_video_60s_excludes_shorter_views_unique_by_age_bucket_and_gender") - VALUE_TOTAL_VIDEO_60S_EXCLUDES_SHORTER_VIEWS_UNIQUE_BY_AGE_BUCKET_AND_GENDER("total_video_60s_excludes_shorter_views_unique_by_age_bucket_and_gender"), - @SerializedName("total_video_60s_excludes_shorter_views_unique_by_growth_accounting_bucket") - VALUE_TOTAL_VIDEO_60S_EXCLUDES_SHORTER_VIEWS_UNIQUE_BY_GROWTH_ACCOUNTING_BUCKET("total_video_60s_excludes_shorter_views_unique_by_growth_accounting_bucket"), - @SerializedName("total_video_60s_excludes_shorter_views_unique_by_growth_accounting_bucket_and_time_since_creation_bucket") - VALUE_TOTAL_VIDEO_60S_EXCLUDES_SHORTER_VIEWS_UNIQUE_BY_GROWTH_ACCOUNTING_BUCKET_AND_TIME_SINCE_CREATION_BUCKET("total_video_60s_excludes_shorter_views_unique_by_growth_accounting_bucket_and_time_since_creation_bucket"), - @SerializedName("total_video_60s_excludes_shorter_views_unique_by_is_60s_returning_viewer") - VALUE_TOTAL_VIDEO_60S_EXCLUDES_SHORTER_VIEWS_UNIQUE_BY_IS_60S_RETURNING_VIEWER("total_video_60s_excludes_shorter_views_unique_by_is_60s_returning_viewer"), - @SerializedName("total_video_60s_excludes_shorter_views_unique_by_is_60s_returning_viewer_and_time_since_creation_bucket") - VALUE_TOTAL_VIDEO_60S_EXCLUDES_SHORTER_VIEWS_UNIQUE_BY_IS_60S_RETURNING_VIEWER_AND_TIME_SINCE_CREATION_BUCKET("total_video_60s_excludes_shorter_views_unique_by_is_60s_returning_viewer_and_time_since_creation_bucket"), - @SerializedName("total_video_ad_break_ad_cpm") - VALUE_TOTAL_VIDEO_AD_BREAK_AD_CPM("total_video_ad_break_ad_cpm"), - @SerializedName("total_video_ad_break_ad_impressions") - VALUE_TOTAL_VIDEO_AD_BREAK_AD_IMPRESSIONS("total_video_ad_break_ad_impressions"), - @SerializedName("total_video_ad_break_earnings") - VALUE_TOTAL_VIDEO_AD_BREAK_EARNINGS("total_video_ad_break_earnings"), - @SerializedName("total_video_ad_break_earnings_with_subsidy") - VALUE_TOTAL_VIDEO_AD_BREAK_EARNINGS_WITH_SUBSIDY("total_video_ad_break_earnings_with_subsidy"), - @SerializedName("total_video_ad_impressions_by_monetization_type") - VALUE_TOTAL_VIDEO_AD_IMPRESSIONS_BY_MONETIZATION_TYPE("total_video_ad_impressions_by_monetization_type"), - @SerializedName("total_video_avg_time_watched") - VALUE_TOTAL_VIDEO_AVG_TIME_WATCHED("total_video_avg_time_watched"), - @SerializedName("total_video_avg_time_watched_by_distribution_source") - VALUE_TOTAL_VIDEO_AVG_TIME_WATCHED_BY_DISTRIBUTION_SOURCE("total_video_avg_time_watched_by_distribution_source"), - @SerializedName("total_video_avg_time_watched_by_is_60s_returning_viewer") - VALUE_TOTAL_VIDEO_AVG_TIME_WATCHED_BY_IS_60S_RETURNING_VIEWER("total_video_avg_time_watched_by_is_60s_returning_viewer"), - @SerializedName("total_video_avg_time_watched_by_time_since_creation_bucket") - VALUE_TOTAL_VIDEO_AVG_TIME_WATCHED_BY_TIME_SINCE_CREATION_BUCKET("total_video_avg_time_watched_by_time_since_creation_bucket"), - @SerializedName("total_video_avg_time_watched_followers") - VALUE_TOTAL_VIDEO_AVG_TIME_WATCHED_FOLLOWERS("total_video_avg_time_watched_followers"), - @SerializedName("total_video_avg_time_watched_live") - VALUE_TOTAL_VIDEO_AVG_TIME_WATCHED_LIVE("total_video_avg_time_watched_live"), - @SerializedName("total_video_comment_sentiment") - VALUE_TOTAL_VIDEO_COMMENT_SENTIMENT("total_video_comment_sentiment"), - @SerializedName("total_video_comment_sentiment_by_factors") - VALUE_TOTAL_VIDEO_COMMENT_SENTIMENT_BY_FACTORS("total_video_comment_sentiment_by_factors"), - @SerializedName("total_video_complete_views") - VALUE_TOTAL_VIDEO_COMPLETE_VIEWS("total_video_complete_views"), - @SerializedName("total_video_complete_views_auto_played") - VALUE_TOTAL_VIDEO_COMPLETE_VIEWS_AUTO_PLAYED("total_video_complete_views_auto_played"), - @SerializedName("total_video_complete_views_clicked_to_play") - VALUE_TOTAL_VIDEO_COMPLETE_VIEWS_CLICKED_TO_PLAY("total_video_complete_views_clicked_to_play"), - @SerializedName("total_video_complete_views_organic") - VALUE_TOTAL_VIDEO_COMPLETE_VIEWS_ORGANIC("total_video_complete_views_organic"), - @SerializedName("total_video_complete_views_organic_unique") - VALUE_TOTAL_VIDEO_COMPLETE_VIEWS_ORGANIC_UNIQUE("total_video_complete_views_organic_unique"), - @SerializedName("total_video_complete_views_paid") - VALUE_TOTAL_VIDEO_COMPLETE_VIEWS_PAID("total_video_complete_views_paid"), - @SerializedName("total_video_complete_views_paid_unique") - VALUE_TOTAL_VIDEO_COMPLETE_VIEWS_PAID_UNIQUE("total_video_complete_views_paid_unique"), - @SerializedName("total_video_complete_views_unique") - VALUE_TOTAL_VIDEO_COMPLETE_VIEWS_UNIQUE("total_video_complete_views_unique"), - @SerializedName("total_video_consumption_rate") - VALUE_TOTAL_VIDEO_CONSUMPTION_RATE("total_video_consumption_rate"), - @SerializedName("total_video_followers_unique") - VALUE_TOTAL_VIDEO_FOLLOWERS_UNIQUE("total_video_followers_unique"), - @SerializedName("total_video_growth_score") - VALUE_TOTAL_VIDEO_GROWTH_SCORE("total_video_growth_score"), - @SerializedName("total_video_growth_score_by_factors") - VALUE_TOTAL_VIDEO_GROWTH_SCORE_BY_FACTORS("total_video_growth_score_by_factors"), - @SerializedName("total_video_impressions") - VALUE_TOTAL_VIDEO_IMPRESSIONS("total_video_impressions"), - @SerializedName("total_video_impressions_fan") - VALUE_TOTAL_VIDEO_IMPRESSIONS_FAN("total_video_impressions_fan"), - @SerializedName("total_video_impressions_fan_paid") - VALUE_TOTAL_VIDEO_IMPRESSIONS_FAN_PAID("total_video_impressions_fan_paid"), - @SerializedName("total_video_impressions_fan_paid_unique") - VALUE_TOTAL_VIDEO_IMPRESSIONS_FAN_PAID_UNIQUE("total_video_impressions_fan_paid_unique"), - @SerializedName("total_video_impressions_fan_unique") - VALUE_TOTAL_VIDEO_IMPRESSIONS_FAN_UNIQUE("total_video_impressions_fan_unique"), - @SerializedName("total_video_impressions_organic") - VALUE_TOTAL_VIDEO_IMPRESSIONS_ORGANIC("total_video_impressions_organic"), - @SerializedName("total_video_impressions_organic_unique") - VALUE_TOTAL_VIDEO_IMPRESSIONS_ORGANIC_UNIQUE("total_video_impressions_organic_unique"), - @SerializedName("total_video_impressions_paid") - VALUE_TOTAL_VIDEO_IMPRESSIONS_PAID("total_video_impressions_paid"), - @SerializedName("total_video_impressions_paid_unique") - VALUE_TOTAL_VIDEO_IMPRESSIONS_PAID_UNIQUE("total_video_impressions_paid_unique"), - @SerializedName("total_video_impressions_unique") - VALUE_TOTAL_VIDEO_IMPRESSIONS_UNIQUE("total_video_impressions_unique"), - @SerializedName("total_video_impressions_viral") - VALUE_TOTAL_VIDEO_IMPRESSIONS_VIRAL("total_video_impressions_viral"), - @SerializedName("total_video_impressions_viral_unique") - VALUE_TOTAL_VIDEO_IMPRESSIONS_VIRAL_UNIQUE("total_video_impressions_viral_unique"), - @SerializedName("total_video_imps_count_unique_by_age_bucket") - VALUE_TOTAL_VIDEO_IMPS_COUNT_UNIQUE_BY_AGE_BUCKET("total_video_imps_count_unique_by_age_bucket"), - @SerializedName("total_video_imps_count_unique_by_age_bucket_and_gender") - VALUE_TOTAL_VIDEO_IMPS_COUNT_UNIQUE_BY_AGE_BUCKET_AND_GENDER("total_video_imps_count_unique_by_age_bucket_and_gender"), - @SerializedName("total_video_imps_count_unique_by_gender") - VALUE_TOTAL_VIDEO_IMPS_COUNT_UNIQUE_BY_GENDER("total_video_imps_count_unique_by_gender"), - @SerializedName("total_video_likes_by_reaction_type") - VALUE_TOTAL_VIDEO_LIKES_BY_REACTION_TYPE("total_video_likes_by_reaction_type"), - @SerializedName("total_video_negative_feedback") - VALUE_TOTAL_VIDEO_NEGATIVE_FEEDBACK("total_video_negative_feedback"), - @SerializedName("total_video_net_followers") - VALUE_TOTAL_VIDEO_NET_FOLLOWERS("total_video_net_followers"), - @SerializedName("total_video_net_followers_unique") - VALUE_TOTAL_VIDEO_NET_FOLLOWERS_UNIQUE("total_video_net_followers_unique"), - @SerializedName("total_video_net_followers_unique_by_time_since_creation_bucket") - VALUE_TOTAL_VIDEO_NET_FOLLOWERS_UNIQUE_BY_TIME_SINCE_CREATION_BUCKET("total_video_net_followers_unique_by_time_since_creation_bucket"), - @SerializedName("total_video_play_count") - VALUE_TOTAL_VIDEO_PLAY_COUNT("total_video_play_count"), - @SerializedName("total_video_play_count_by_is_60s_returning_viewer_and_time_since_creation_bucket") - VALUE_TOTAL_VIDEO_PLAY_COUNT_BY_IS_60S_RETURNING_VIEWER_AND_TIME_SINCE_CREATION_BUCKET("total_video_play_count_by_is_60s_returning_viewer_and_time_since_creation_bucket"), - @SerializedName("total_video_play_count_by_time_since_creation_bucket") - VALUE_TOTAL_VIDEO_PLAY_COUNT_BY_TIME_SINCE_CREATION_BUCKET("total_video_play_count_by_time_since_creation_bucket"), - @SerializedName("total_video_reactions_by_type_total") - VALUE_TOTAL_VIDEO_REACTIONS_BY_TYPE_TOTAL("total_video_reactions_by_type_total"), - @SerializedName("total_video_relative_retention_graph") - VALUE_TOTAL_VIDEO_RELATIVE_RETENTION_GRAPH("total_video_relative_retention_graph"), - @SerializedName("total_video_retention_graph") - VALUE_TOTAL_VIDEO_RETENTION_GRAPH("total_video_retention_graph"), - @SerializedName("total_video_retention_graph_15s") - VALUE_TOTAL_VIDEO_RETENTION_GRAPH_15S("total_video_retention_graph_15s"), - @SerializedName("total_video_retention_graph_15s_followers") - VALUE_TOTAL_VIDEO_RETENTION_GRAPH_15S_FOLLOWERS("total_video_retention_graph_15s_followers"), - @SerializedName("total_video_retention_graph_15s_newsfeed") - VALUE_TOTAL_VIDEO_RETENTION_GRAPH_15S_NEWSFEED("total_video_retention_graph_15s_newsfeed"), - @SerializedName("total_video_retention_graph_15s_recommended") - VALUE_TOTAL_VIDEO_RETENTION_GRAPH_15S_RECOMMENDED("total_video_retention_graph_15s_recommended"), - @SerializedName("total_video_retention_graph_15s_shares") - VALUE_TOTAL_VIDEO_RETENTION_GRAPH_15S_SHARES("total_video_retention_graph_15s_shares"), - @SerializedName("total_video_retention_graph_15s_watch") - VALUE_TOTAL_VIDEO_RETENTION_GRAPH_15S_WATCH("total_video_retention_graph_15s_watch"), - @SerializedName("total_video_retention_graph_autoplayed") - VALUE_TOTAL_VIDEO_RETENTION_GRAPH_AUTOPLAYED("total_video_retention_graph_autoplayed"), - @SerializedName("total_video_retention_graph_clicked_to_play") - VALUE_TOTAL_VIDEO_RETENTION_GRAPH_CLICKED_TO_PLAY("total_video_retention_graph_clicked_to_play"), - @SerializedName("total_video_retention_graph_gender_female") - VALUE_TOTAL_VIDEO_RETENTION_GRAPH_GENDER_FEMALE("total_video_retention_graph_gender_female"), - @SerializedName("total_video_retention_graph_gender_male") - VALUE_TOTAL_VIDEO_RETENTION_GRAPH_GENDER_MALE("total_video_retention_graph_gender_male"), - @SerializedName("total_video_social_actions") - VALUE_TOTAL_VIDEO_SOCIAL_ACTIONS("total_video_social_actions"), - @SerializedName("total_video_social_actions_comment_by_distribution_type") - VALUE_TOTAL_VIDEO_SOCIAL_ACTIONS_COMMENT_BY_DISTRIBUTION_TYPE("total_video_social_actions_comment_by_distribution_type"), - @SerializedName("total_video_social_actions_count_unique") - VALUE_TOTAL_VIDEO_SOCIAL_ACTIONS_COUNT_UNIQUE("total_video_social_actions_count_unique"), - @SerializedName("total_video_social_actions_count_unique_by_age_bucket") - VALUE_TOTAL_VIDEO_SOCIAL_ACTIONS_COUNT_UNIQUE_BY_AGE_BUCKET("total_video_social_actions_count_unique_by_age_bucket"), - @SerializedName("total_video_social_actions_count_unique_by_age_bucket_and_gender") - VALUE_TOTAL_VIDEO_SOCIAL_ACTIONS_COUNT_UNIQUE_BY_AGE_BUCKET_AND_GENDER("total_video_social_actions_count_unique_by_age_bucket_and_gender"), - @SerializedName("total_video_social_actions_count_unique_by_gender") - VALUE_TOTAL_VIDEO_SOCIAL_ACTIONS_COUNT_UNIQUE_BY_GENDER("total_video_social_actions_count_unique_by_gender"), - @SerializedName("total_video_social_actions_reaction_by_distribution_type") - VALUE_TOTAL_VIDEO_SOCIAL_ACTIONS_REACTION_BY_DISTRIBUTION_TYPE("total_video_social_actions_reaction_by_distribution_type"), - @SerializedName("total_video_stories_by_action_type") - VALUE_TOTAL_VIDEO_STORIES_BY_ACTION_TYPE("total_video_stories_by_action_type"), - @SerializedName("total_video_unfollowers") - VALUE_TOTAL_VIDEO_UNFOLLOWERS("total_video_unfollowers"), - @SerializedName("total_video_unfollowers_unique") - VALUE_TOTAL_VIDEO_UNFOLLOWERS_UNIQUE("total_video_unfollowers_unique"), - @SerializedName("total_video_view_count_unique_by_age_bucket") - VALUE_TOTAL_VIDEO_VIEW_COUNT_UNIQUE_BY_AGE_BUCKET("total_video_view_count_unique_by_age_bucket"), - @SerializedName("total_video_view_count_unique_by_age_bucket_and_gender") - VALUE_TOTAL_VIDEO_VIEW_COUNT_UNIQUE_BY_AGE_BUCKET_AND_GENDER("total_video_view_count_unique_by_age_bucket_and_gender"), - @SerializedName("total_video_view_count_unique_by_gender") - VALUE_TOTAL_VIDEO_VIEW_COUNT_UNIQUE_BY_GENDER("total_video_view_count_unique_by_gender"), - @SerializedName("total_video_view_time_by_age_bucket_and_gender") - VALUE_TOTAL_VIDEO_VIEW_TIME_BY_AGE_BUCKET_AND_GENDER("total_video_view_time_by_age_bucket_and_gender"), - @SerializedName("total_video_view_time_by_country_id") - VALUE_TOTAL_VIDEO_VIEW_TIME_BY_COUNTRY_ID("total_video_view_time_by_country_id"), - @SerializedName("total_video_view_time_by_distribution_source") - VALUE_TOTAL_VIDEO_VIEW_TIME_BY_DISTRIBUTION_SOURCE("total_video_view_time_by_distribution_source"), - @SerializedName("total_video_view_time_by_distribution_type") - VALUE_TOTAL_VIDEO_VIEW_TIME_BY_DISTRIBUTION_TYPE("total_video_view_time_by_distribution_type"), - @SerializedName("total_video_view_time_by_is_60s_returning_viewer_and_time_since_creation_bucket") - VALUE_TOTAL_VIDEO_VIEW_TIME_BY_IS_60S_RETURNING_VIEWER_AND_TIME_SINCE_CREATION_BUCKET("total_video_view_time_by_is_60s_returning_viewer_and_time_since_creation_bucket"), - @SerializedName("total_video_view_time_by_region_id") - VALUE_TOTAL_VIDEO_VIEW_TIME_BY_REGION_ID("total_video_view_time_by_region_id"), - @SerializedName("total_video_view_time_by_time_since_creation_bucket") - VALUE_TOTAL_VIDEO_VIEW_TIME_BY_TIME_SINCE_CREATION_BUCKET("total_video_view_time_by_time_since_creation_bucket"), - @SerializedName("total_video_view_total_time") - VALUE_TOTAL_VIDEO_VIEW_TOTAL_TIME("total_video_view_total_time"), - @SerializedName("total_video_view_total_time_by_is_60s_returning_viewer") - VALUE_TOTAL_VIDEO_VIEW_TOTAL_TIME_BY_IS_60S_RETURNING_VIEWER("total_video_view_total_time_by_is_60s_returning_viewer"), - @SerializedName("total_video_view_total_time_by_paid_non_paid") - VALUE_TOTAL_VIDEO_VIEW_TOTAL_TIME_BY_PAID_NON_PAID("total_video_view_total_time_by_paid_non_paid"), - @SerializedName("total_video_view_total_time_live") - VALUE_TOTAL_VIDEO_VIEW_TOTAL_TIME_LIVE("total_video_view_total_time_live"), - @SerializedName("total_video_view_total_time_organic") - VALUE_TOTAL_VIDEO_VIEW_TOTAL_TIME_ORGANIC("total_video_view_total_time_organic"), - @SerializedName("total_video_view_total_time_paid") - VALUE_TOTAL_VIDEO_VIEW_TOTAL_TIME_PAID("total_video_view_total_time_paid"), - @SerializedName("total_video_view_total_time_vod") - VALUE_TOTAL_VIDEO_VIEW_TOTAL_TIME_VOD("total_video_view_total_time_vod"), - @SerializedName("total_video_views") - VALUE_TOTAL_VIDEO_VIEWS("total_video_views"), - @SerializedName("total_video_views_autoplayed") - VALUE_TOTAL_VIDEO_VIEWS_AUTOPLAYED("total_video_views_autoplayed"), - @SerializedName("total_video_views_by_age_bucket_and_gender") - VALUE_TOTAL_VIDEO_VIEWS_BY_AGE_BUCKET_AND_GENDER("total_video_views_by_age_bucket_and_gender"), - @SerializedName("total_video_views_by_country_id") - VALUE_TOTAL_VIDEO_VIEWS_BY_COUNTRY_ID("total_video_views_by_country_id"), - @SerializedName("total_video_views_by_distribution_type") - VALUE_TOTAL_VIDEO_VIEWS_BY_DISTRIBUTION_TYPE("total_video_views_by_distribution_type"), - @SerializedName("total_video_views_by_paid_non_paid") - VALUE_TOTAL_VIDEO_VIEWS_BY_PAID_NON_PAID("total_video_views_by_paid_non_paid"), - @SerializedName("total_video_views_by_region_id") - VALUE_TOTAL_VIDEO_VIEWS_BY_REGION_ID("total_video_views_by_region_id"), - @SerializedName("total_video_views_by_region_id_proper") - VALUE_TOTAL_VIDEO_VIEWS_BY_REGION_ID_PROPER("total_video_views_by_region_id_proper"), - @SerializedName("total_video_views_clicked_to_play") - VALUE_TOTAL_VIDEO_VIEWS_CLICKED_TO_PLAY("total_video_views_clicked_to_play"), - @SerializedName("total_video_views_gender_female") - VALUE_TOTAL_VIDEO_VIEWS_GENDER_FEMALE("total_video_views_gender_female"), - @SerializedName("total_video_views_gender_female_live") - VALUE_TOTAL_VIDEO_VIEWS_GENDER_FEMALE_LIVE("total_video_views_gender_female_live"), - @SerializedName("total_video_views_gender_male") - VALUE_TOTAL_VIDEO_VIEWS_GENDER_MALE("total_video_views_gender_male"), - @SerializedName("total_video_views_gender_male_live") - VALUE_TOTAL_VIDEO_VIEWS_GENDER_MALE_LIVE("total_video_views_gender_male_live"), - @SerializedName("total_video_views_live") - VALUE_TOTAL_VIDEO_VIEWS_LIVE("total_video_views_live"), - @SerializedName("total_video_views_live_autoplayed") - VALUE_TOTAL_VIDEO_VIEWS_LIVE_AUTOPLAYED("total_video_views_live_autoplayed"), - @SerializedName("total_video_views_live_clicked_to_play") - VALUE_TOTAL_VIDEO_VIEWS_LIVE_CLICKED_TO_PLAY("total_video_views_live_clicked_to_play"), - @SerializedName("total_video_views_organic") - VALUE_TOTAL_VIDEO_VIEWS_ORGANIC("total_video_views_organic"), - @SerializedName("total_video_views_organic_unique") - VALUE_TOTAL_VIDEO_VIEWS_ORGANIC_UNIQUE("total_video_views_organic_unique"), - @SerializedName("total_video_views_paid") - VALUE_TOTAL_VIDEO_VIEWS_PAID("total_video_views_paid"), - @SerializedName("total_video_views_paid_unique") - VALUE_TOTAL_VIDEO_VIEWS_PAID_UNIQUE("total_video_views_paid_unique"), - @SerializedName("total_video_views_sound_on") - VALUE_TOTAL_VIDEO_VIEWS_SOUND_ON("total_video_views_sound_on"), - @SerializedName("total_video_views_unique") - VALUE_TOTAL_VIDEO_VIEWS_UNIQUE("total_video_views_unique"), - @SerializedName("total_video_views_vod") - VALUE_TOTAL_VIDEO_VIEWS_VOD("total_video_views_vod"), - @SerializedName("video_asset_60s_video_view_total_count_by_is_monetizable") - VALUE_VIDEO_ASSET_60S_VIDEO_VIEW_TOTAL_COUNT_BY_IS_MONETIZABLE("video_asset_60s_video_view_total_count_by_is_monetizable"), + @SerializedName("PAGES_FB_STORY_REPLIES") + VALUE_PAGES_FB_STORY_REPLIES("PAGES_FB_STORY_REPLIES"), + @SerializedName("PAGES_FB_STORY_SHARES") + VALUE_PAGES_FB_STORY_SHARES("PAGES_FB_STORY_SHARES"), + @SerializedName("PAGES_FB_STORY_STICKER_INTERACTIONS") + VALUE_PAGES_FB_STORY_STICKER_INTERACTIONS("PAGES_FB_STORY_STICKER_INTERACTIONS"), + @SerializedName("PAGES_FB_STORY_THREAD_LIGHTWEIGHT_REACTIONS") + VALUE_PAGES_FB_STORY_THREAD_LIGHTWEIGHT_REACTIONS("PAGES_FB_STORY_THREAD_LIGHTWEIGHT_REACTIONS"), + @SerializedName("PAGE_STORY_IMPRESSIONS_BY_STORY_ID") + VALUE_PAGE_STORY_IMPRESSIONS_BY_STORY_ID("PAGE_STORY_IMPRESSIONS_BY_STORY_ID"), + @SerializedName("PAGE_STORY_IMPRESSIONS_BY_STORY_ID_UNIQUE") + VALUE_PAGE_STORY_IMPRESSIONS_BY_STORY_ID_UNIQUE("PAGE_STORY_IMPRESSIONS_BY_STORY_ID_UNIQUE"), + @SerializedName("STORY_INTERACTION") + VALUE_STORY_INTERACTION("STORY_INTERACTION"), ; private String value; diff --git a/src/main/java/com/facebook/ads/sdk/InstagramInsightsResult.java b/src/main/java/com/facebook/ads/sdk/InstagramInsightsResult.java index 186f64d8..fd072df7 100644 --- a/src/main/java/com/facebook/ads/sdk/InstagramInsightsResult.java +++ b/src/main/java/com/facebook/ads/sdk/InstagramInsightsResult.java @@ -318,24 +318,34 @@ public static enum EnumMetric { VALUE_LIKES("likes"), @SerializedName("navigation") VALUE_NAVIGATION("navigation"), + @SerializedName("peak_concurrent_viewers") + VALUE_PEAK_CONCURRENT_VIEWERS("peak_concurrent_viewers"), @SerializedName("plays") VALUE_PLAYS("plays"), @SerializedName("profile_activity") VALUE_PROFILE_ACTIVITY("profile_activity"), @SerializedName("profile_visits") VALUE_PROFILE_VISITS("profile_visits"), + @SerializedName("quotes") + VALUE_QUOTES("quotes"), @SerializedName("reach") VALUE_REACH("reach"), @SerializedName("replies") VALUE_REPLIES("replies"), + @SerializedName("reposts") + VALUE_REPOSTS("reposts"), @SerializedName("saved") VALUE_SAVED("saved"), @SerializedName("shares") VALUE_SHARES("shares"), + @SerializedName("thread_replies") + VALUE_THREAD_REPLIES("thread_replies"), @SerializedName("total_interactions") VALUE_TOTAL_INTERACTIONS("total_interactions"), @SerializedName("video_views") VALUE_VIDEO_VIEWS("video_views"), + @SerializedName("views") + VALUE_VIEWS("views"), ; private String value; diff --git a/src/main/java/com/facebook/ads/sdk/InstagramUser.java b/src/main/java/com/facebook/ads/sdk/InstagramUser.java index 42cf7804..72180abd 100644 --- a/src/main/java/com/facebook/ads/sdk/InstagramUser.java +++ b/src/main/java/com/facebook/ads/sdk/InstagramUser.java @@ -1580,6 +1580,8 @@ public APINodeList getLastResponse() { public static final String[] FIELDS = { "end_time", "id", + "notification_subtypes", + "notification_target_time", "start_time", "title", }; @@ -1688,6 +1690,20 @@ public APIRequestGetUpcomingEvents requestIdField (boolean value) { this.requestField("id", value); return this; } + public APIRequestGetUpcomingEvents requestNotificationSubtypesField () { + return this.requestNotificationSubtypesField(true); + } + public APIRequestGetUpcomingEvents requestNotificationSubtypesField (boolean value) { + this.requestField("notification_subtypes", value); + return this; + } + public APIRequestGetUpcomingEvents requestNotificationTargetTimeField () { + return this.requestNotificationTargetTimeField(true); + } + public APIRequestGetUpcomingEvents requestNotificationTargetTimeField (boolean value) { + this.requestField("notification_target_time", value); + return this; + } public APIRequestGetUpcomingEvents requestStartTimeField () { return this.requestStartTimeField(true); } @@ -1713,6 +1729,8 @@ public IGUpcomingEvent getLastResponse() { } public static final String[] PARAMS = { "end_time", + "notification_subtypes", + "notification_target_time", "start_time", "title", }; @@ -1779,6 +1797,24 @@ public APIRequestCreateUpcomingEvent setEndTime (String endTime) { return this; } + public APIRequestCreateUpcomingEvent setNotificationSubtypes (List notificationSubtypes) { + this.setParam("notification_subtypes", notificationSubtypes); + return this; + } + public APIRequestCreateUpcomingEvent setNotificationSubtypes (String notificationSubtypes) { + this.setParam("notification_subtypes", notificationSubtypes); + return this; + } + + public APIRequestCreateUpcomingEvent setNotificationTargetTime (IGUpcomingEvent.EnumNotificationTargetTime notificationTargetTime) { + this.setParam("notification_target_time", notificationTargetTime); + return this; + } + public APIRequestCreateUpcomingEvent setNotificationTargetTime (String notificationTargetTime) { + this.setParam("notification_target_time", notificationTargetTime); + return this; + } + public APIRequestCreateUpcomingEvent setStartTime (String startTime) { this.setParam("start_time", startTime); return this; diff --git a/src/main/java/com/facebook/ads/sdk/LeadGenFormPreviewDetails.java b/src/main/java/com/facebook/ads/sdk/LeadGenFormPreviewDetails.java index ac65d148..6c7ff8b2 100644 --- a/src/main/java/com/facebook/ads/sdk/LeadGenFormPreviewDetails.java +++ b/src/main/java/com/facebook/ads/sdk/LeadGenFormPreviewDetails.java @@ -41,6 +41,8 @@ * */ public class LeadGenFormPreviewDetails extends APINode { + @SerializedName("call_business_text") + private String mCallBusinessText = null; @SerializedName("call_to_action_title") private String mCallToActionTitle = null; @SerializedName("contact_information_text") @@ -89,6 +91,8 @@ public class LeadGenFormPreviewDetails extends APINode { private String mPersonalInfoText = null; @SerializedName("phone_number_inline_context_text") private String mPhoneNumberInlineContextText = null; + @SerializedName("privacy_policy_link_text") + private String mPrivacyPolicyLinkText = null; @SerializedName("privacy_policy_title_section_title_text") private String mPrivacyPolicyTitleSectionTitleText = null; @SerializedName("privacy_setting_description") @@ -97,6 +101,8 @@ public class LeadGenFormPreviewDetails extends APINode { private List> mProductsSectionHeaders = null; @SerializedName("qualified_thank_you_card_transparency_info_text") private String mQualifiedThankYouCardTransparencyInfoText = null; + @SerializedName("redeem_promo_code_text") + private String mRedeemPromoCodeText = null; @SerializedName("review_your_info_text") private String mReviewYourInfoText = null; @SerializedName("secure_sharing_text") @@ -107,6 +113,8 @@ public class LeadGenFormPreviewDetails extends APINode { private List> mSocialProofSectionHeaders = null; @SerializedName("submit_button_text") private String mSubmitButtonText = null; + @SerializedName("view_file_text") + private String mViewFileText = null; protected static Gson gson = null; public LeadGenFormPreviewDetails() { @@ -258,6 +266,15 @@ public String toString() { } + public String getFieldCallBusinessText() { + return mCallBusinessText; + } + + public LeadGenFormPreviewDetails setFieldCallBusinessText(String value) { + this.mCallBusinessText = value; + return this; + } + public String getFieldCallToActionTitle() { return mCallToActionTitle; } @@ -474,6 +491,15 @@ public LeadGenFormPreviewDetails setFieldPhoneNumberInlineContextText(String val return this; } + public String getFieldPrivacyPolicyLinkText() { + return mPrivacyPolicyLinkText; + } + + public LeadGenFormPreviewDetails setFieldPrivacyPolicyLinkText(String value) { + this.mPrivacyPolicyLinkText = value; + return this; + } + public String getFieldPrivacyPolicyTitleSectionTitleText() { return mPrivacyPolicyTitleSectionTitleText; } @@ -510,6 +536,15 @@ public LeadGenFormPreviewDetails setFieldQualifiedThankYouCardTransparencyInfoTe return this; } + public String getFieldRedeemPromoCodeText() { + return mRedeemPromoCodeText; + } + + public LeadGenFormPreviewDetails setFieldRedeemPromoCodeText(String value) { + this.mRedeemPromoCodeText = value; + return this; + } + public String getFieldReviewYourInfoText() { return mReviewYourInfoText; } @@ -555,6 +590,15 @@ public LeadGenFormPreviewDetails setFieldSubmitButtonText(String value) { return this; } + public String getFieldViewFileText() { + return mViewFileText; + } + + public LeadGenFormPreviewDetails setFieldViewFileText(String value) { + this.mViewFileText = value; + return this; + } + @@ -572,6 +616,7 @@ public LeadGenFormPreviewDetails setFieldSubmitButtonText(String value) { } public LeadGenFormPreviewDetails copyFrom(LeadGenFormPreviewDetails instance) { + this.mCallBusinessText = instance.mCallBusinessText; this.mCallToActionTitle = instance.mCallToActionTitle; this.mContactInformationText = instance.mContactInformationText; this.mCreativesOverviewDefaultText = instance.mCreativesOverviewDefaultText; @@ -596,15 +641,18 @@ public LeadGenFormPreviewDetails copyFrom(LeadGenFormPreviewDetails instance) { this.mOptionalQuestionText = instance.mOptionalQuestionText; this.mPersonalInfoText = instance.mPersonalInfoText; this.mPhoneNumberInlineContextText = instance.mPhoneNumberInlineContextText; + this.mPrivacyPolicyLinkText = instance.mPrivacyPolicyLinkText; this.mPrivacyPolicyTitleSectionTitleText = instance.mPrivacyPolicyTitleSectionTitleText; this.mPrivacySettingDescription = instance.mPrivacySettingDescription; this.mProductsSectionHeaders = instance.mProductsSectionHeaders; this.mQualifiedThankYouCardTransparencyInfoText = instance.mQualifiedThankYouCardTransparencyInfoText; + this.mRedeemPromoCodeText = instance.mRedeemPromoCodeText; this.mReviewYourInfoText = instance.mReviewYourInfoText; this.mSecureSharingText = instance.mSecureSharingText; this.mSlideToSubmitText = instance.mSlideToSubmitText; this.mSocialProofSectionHeaders = instance.mSocialProofSectionHeaders; this.mSubmitButtonText = instance.mSubmitButtonText; + this.mViewFileText = instance.mViewFileText; this.context = instance.context; this.rawValue = instance.rawValue; return this; diff --git a/src/main/java/com/facebook/ads/sdk/LocalServiceBusiness.java b/src/main/java/com/facebook/ads/sdk/LocalServiceBusiness.java index dc45a870..5f2be3cd 100644 --- a/src/main/java/com/facebook/ads/sdk/LocalServiceBusiness.java +++ b/src/main/java/com/facebook/ads/sdk/LocalServiceBusiness.java @@ -334,6 +334,10 @@ public APIRequestGetChannelsToIntegrityStatus getChannelsToIntegrityStatus() { return new APIRequestGetChannelsToIntegrityStatus(this.getPrefixedId().toString(), context); } + public APIRequestGetOverrideDetails getOverrideDetails() { + return new APIRequestGetOverrideDetails(this.getPrefixedId().toString(), context); + } + public APIRequestGet get() { return new APIRequestGet(this.getPrefixedId().toString(), context); } @@ -628,6 +632,155 @@ public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField ( } } + public static class APIRequestGetOverrideDetails extends APIRequest { + + APINodeList lastResponse = null; + @Override + public APINodeList getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "keys", + "type", + }; + + public static final String[] FIELDS = { + "key", + "type", + "values", + }; + + @Override + public APINodeList parseResponse(String response, String header) throws APIException { + return OverrideDetails.parseResponse(response, getContext(), this, header); + } + + @Override + public APINodeList execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + try { + return APIRequestGetOverrideDetails.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestGetOverrideDetails(String nodeId, APIContext context) { + super(context, nodeId, "/override_details", "GET", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestGetOverrideDetails setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestGetOverrideDetails setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestGetOverrideDetails setKeys (List keys) { + this.setParam("keys", keys); + return this; + } + public APIRequestGetOverrideDetails setKeys (String keys) { + this.setParam("keys", keys); + return this; + } + + public APIRequestGetOverrideDetails setType (OverrideDetails.EnumType type) { + this.setParam("type", type); + return this; + } + public APIRequestGetOverrideDetails setType (String type) { + this.setParam("type", type); + return this; + } + + public APIRequestGetOverrideDetails requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestGetOverrideDetails requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetOverrideDetails requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestGetOverrideDetails requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetOverrideDetails requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestGetOverrideDetails requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + public APIRequestGetOverrideDetails requestKeyField () { + return this.requestKeyField(true); + } + public APIRequestGetOverrideDetails requestKeyField (boolean value) { + this.requestField("key", value); + return this; + } + public APIRequestGetOverrideDetails requestTypeField () { + return this.requestTypeField(true); + } + public APIRequestGetOverrideDetails requestTypeField (boolean value) { + this.requestField("type", value); + return this; + } + public APIRequestGetOverrideDetails requestValuesField () { + return this.requestValuesField(true); + } + public APIRequestGetOverrideDetails requestValuesField (boolean value) { + this.requestField("values", value); + return this; + } + } + public static class APIRequestGet extends APIRequest { LocalServiceBusiness lastResponse = null; diff --git a/src/main/java/com/facebook/ads/sdk/LocationBasedItem.java b/src/main/java/com/facebook/ads/sdk/LocationBasedItem.java deleted file mode 100644 index 81cb2ea4..00000000 --- a/src/main/java/com/facebook/ads/sdk/LocationBasedItem.java +++ /dev/null @@ -1,758 +0,0 @@ -/* - * 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 LocationBasedItem extends APINode { - @SerializedName("applinks") - private CatalogItemAppLinks mApplinks = null; - @SerializedName("category_specific_fields") - private CatalogSubVerticalList mCategorySpecificFields = null; - @SerializedName("currency") - private String mCurrency = null; - @SerializedName("description") - private String mDescription = null; - @SerializedName("id") - private String mId = null; - @SerializedName("image_fetch_status") - private EnumImageFetchStatus mImageFetchStatus = null; - @SerializedName("images") - private List mImages = null; - @SerializedName("location_based_item_id") - private String mLocationBasedItemId = null; - @SerializedName("name") - private String mName = null; - @SerializedName("price") - private String mPrice = null; - @SerializedName("sanitized_images") - private List mSanitizedImages = null; - @SerializedName("url") - private String mUrl = null; - @SerializedName("visibility") - private EnumVisibility mVisibility = null; - protected static Gson gson = null; - - LocationBasedItem() { - } - - public LocationBasedItem(Long id, APIContext context) { - this(id.toString(), context); - } - - public LocationBasedItem(String id, APIContext context) { - this.mId = id; - - this.context = context; - } - - public LocationBasedItem fetch() throws APIException{ - LocationBasedItem newInstance = fetchById(this.getPrefixedId().toString(), this.context); - this.copyFrom(newInstance); - return this; - } - - public static LocationBasedItem 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 LocationBasedItem 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", LocationBasedItem.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", LocationBasedItem.getParser()) - .setParam("ids", APIRequest.joinStringList(ids)) - .requestFields(fields) - .executeAsyncBase(); - } - - private String getPrefixedId() { - return getId(); - } - - public String getId() { - return getFieldId().toString(); - } - public static LocationBasedItem loadJSON(String json, APIContext context, String header) { - LocationBasedItem locationBasedItem = getGson().fromJson(json, LocationBasedItem.class); - if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(locationBasedItem.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); - } - } - locationBasedItem.context = context; - locationBasedItem.rawValue = json; - locationBasedItem.header = header; - return locationBasedItem; - } - - public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { - APINodeList locationBasedItems = 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++) { - locationBasedItems.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); - }; - return locationBasedItems; - } 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; - locationBasedItems.setCursors(before, after); - } - String previous = paging.has("previous") ? paging.get("previous").getAsString() : null; - String next = paging.has("next") ? paging.get("next").getAsString() : null; - locationBasedItems.setPaging(previous, next); - if (context.hasAppSecret()) { - locationBasedItems.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++) { - locationBasedItems.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()) { - locationBasedItems.add(loadJSON(entry.getValue().toString(), context, header)); - } - break; - } - } - if (!isRedownload) { - locationBasedItems.add(loadJSON(obj.toString(), context, header)); - } - } - return locationBasedItems; - } 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()) { - locationBasedItems.add(loadJSON(entry.getValue().toString(), context, header)); - } - return locationBasedItems; - } 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) - ) { - locationBasedItems.add(loadJSON(value.toString(), context, header)); - } else { - isIdIndexedArray = false; - break; - } - } - if (isIdIndexedArray) { - return locationBasedItems; - } - - // Sixth, check if it's pure JsonObject - locationBasedItems.clear(); - locationBasedItems.add(loadJSON(json, context, header)); - return locationBasedItems; - } - } - } 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 APIRequestGetChannelsToIntegrityStatus getChannelsToIntegrityStatus() { - return new APIRequestGetChannelsToIntegrityStatus(this.getPrefixedId().toString(), context); - } - - public APIRequestGet get() { - return new APIRequestGet(this.getPrefixedId().toString(), context); - } - - - public CatalogItemAppLinks getFieldApplinks() { - return mApplinks; - } - - public CatalogSubVerticalList getFieldCategorySpecificFields() { - return mCategorySpecificFields; - } - - public String getFieldCurrency() { - return mCurrency; - } - - public String getFieldDescription() { - return mDescription; - } - - public String getFieldId() { - return mId; - } - - public EnumImageFetchStatus getFieldImageFetchStatus() { - return mImageFetchStatus; - } - - public List getFieldImages() { - return mImages; - } - - public String getFieldLocationBasedItemId() { - return mLocationBasedItemId; - } - - public String getFieldName() { - return mName; - } - - public String getFieldPrice() { - return mPrice; - } - - public List getFieldSanitizedImages() { - return mSanitizedImages; - } - - public String getFieldUrl() { - return mUrl; - } - - public EnumVisibility getFieldVisibility() { - return mVisibility; - } - - - - public static class APIRequestGetChannelsToIntegrityStatus extends APIRequest { - - APINodeList lastResponse = null; - @Override - public APINodeList getLastResponse() { - return lastResponse; - } - public static final String[] PARAMS = { - }; - - public static final String[] FIELDS = { - "channels", - "rejection_information", - }; - - @Override - public APINodeList parseResponse(String response, String header) throws APIException { - return CatalogItemChannelsToIntegrityStatus.parseResponse(response, getContext(), this, header); - } - - @Override - public APINodeList execute() throws APIException { - return execute(new HashMap()); - } - - @Override - public APINodeList 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 APINodeList apply(ResponseWrapper result) { - try { - return APIRequestGetChannelsToIntegrityStatus.this.parseResponse(result.getBody(), result.getHeader()); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - }, - MoreExecutors.directExecutor() - ); - }; - - public APIRequestGetChannelsToIntegrityStatus(String nodeId, APIContext context) { - super(context, nodeId, "/channels_to_integrity_status", "GET", Arrays.asList(PARAMS)); - } - - @Override - public APIRequestGetChannelsToIntegrityStatus setParam(String param, Object value) { - setParamInternal(param, value); - return this; - } - - @Override - public APIRequestGetChannelsToIntegrityStatus setParams(Map params) { - setParamsInternal(params); - return this; - } - - - public APIRequestGetChannelsToIntegrityStatus requestAllFields () { - return this.requestAllFields(true); - } - - public APIRequestGetChannelsToIntegrityStatus requestAllFields (boolean value) { - for (String field : FIELDS) { - this.requestField(field, value); - } - return this; - } - - @Override - public APIRequestGetChannelsToIntegrityStatus requestFields (List fields) { - return this.requestFields(fields, true); - } - - @Override - public APIRequestGetChannelsToIntegrityStatus requestFields (List fields, boolean value) { - for (String field : fields) { - this.requestField(field, value); - } - return this; - } - - @Override - public APIRequestGetChannelsToIntegrityStatus requestField (String field) { - this.requestField(field, true); - return this; - } - - @Override - public APIRequestGetChannelsToIntegrityStatus requestField (String field, boolean value) { - this.requestFieldInternal(field, value); - return this; - } - - public APIRequestGetChannelsToIntegrityStatus requestChannelsField () { - return this.requestChannelsField(true); - } - public APIRequestGetChannelsToIntegrityStatus requestChannelsField (boolean value) { - this.requestField("channels", value); - return this; - } - public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField () { - return this.requestRejectionInformationField(true); - } - public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField (boolean value) { - this.requestField("rejection_information", value); - return this; - } - } - - public static class APIRequestGet extends APIRequest { - - LocationBasedItem lastResponse = null; - @Override - public LocationBasedItem getLastResponse() { - return lastResponse; - } - public static final String[] PARAMS = { - }; - - public static final String[] FIELDS = { - "applinks", - "category_specific_fields", - "currency", - "description", - "id", - "image_fetch_status", - "images", - "location_based_item_id", - "name", - "price", - "sanitized_images", - "url", - "visibility", - }; - - @Override - public LocationBasedItem parseResponse(String response, String header) throws APIException { - return LocationBasedItem.parseResponse(response, getContext(), this, header).head(); - } - - @Override - public LocationBasedItem execute() throws APIException { - return execute(new HashMap()); - } - - @Override - public LocationBasedItem 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 LocationBasedItem 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 requestApplinksField () { - return this.requestApplinksField(true); - } - public APIRequestGet requestApplinksField (boolean value) { - this.requestField("applinks", value); - return this; - } - public APIRequestGet requestCategorySpecificFieldsField () { - return this.requestCategorySpecificFieldsField(true); - } - public APIRequestGet requestCategorySpecificFieldsField (boolean value) { - this.requestField("category_specific_fields", value); - return this; - } - public APIRequestGet requestCurrencyField () { - return this.requestCurrencyField(true); - } - public APIRequestGet requestCurrencyField (boolean value) { - this.requestField("currency", value); - return this; - } - public APIRequestGet requestDescriptionField () { - return this.requestDescriptionField(true); - } - public APIRequestGet requestDescriptionField (boolean value) { - this.requestField("description", value); - return this; - } - public APIRequestGet requestIdField () { - return this.requestIdField(true); - } - public APIRequestGet requestIdField (boolean value) { - this.requestField("id", value); - return this; - } - public APIRequestGet requestImageFetchStatusField () { - return this.requestImageFetchStatusField(true); - } - public APIRequestGet requestImageFetchStatusField (boolean value) { - this.requestField("image_fetch_status", value); - return this; - } - public APIRequestGet requestImagesField () { - return this.requestImagesField(true); - } - public APIRequestGet requestImagesField (boolean value) { - this.requestField("images", value); - return this; - } - public APIRequestGet requestLocationBasedItemIdField () { - return this.requestLocationBasedItemIdField(true); - } - public APIRequestGet requestLocationBasedItemIdField (boolean value) { - this.requestField("location_based_item_id", value); - return this; - } - public APIRequestGet requestNameField () { - return this.requestNameField(true); - } - public APIRequestGet requestNameField (boolean value) { - this.requestField("name", value); - return this; - } - public APIRequestGet requestPriceField () { - return this.requestPriceField(true); - } - public APIRequestGet requestPriceField (boolean value) { - this.requestField("price", value); - return this; - } - public APIRequestGet requestSanitizedImagesField () { - return this.requestSanitizedImagesField(true); - } - public APIRequestGet requestSanitizedImagesField (boolean value) { - this.requestField("sanitized_images", value); - return this; - } - public APIRequestGet requestUrlField () { - return this.requestUrlField(true); - } - public APIRequestGet requestUrlField (boolean value) { - this.requestField("url", value); - return this; - } - public APIRequestGet requestVisibilityField () { - return this.requestVisibilityField(true); - } - public APIRequestGet requestVisibilityField (boolean value) { - this.requestField("visibility", value); - return this; - } - } - - public static enum EnumImageFetchStatus { - @SerializedName("DIRECT_UPLOAD") - VALUE_DIRECT_UPLOAD("DIRECT_UPLOAD"), - @SerializedName("FETCHED") - VALUE_FETCHED("FETCHED"), - @SerializedName("FETCH_FAILED") - VALUE_FETCH_FAILED("FETCH_FAILED"), - @SerializedName("NO_STATUS") - VALUE_NO_STATUS("NO_STATUS"), - @SerializedName("OUTDATED") - VALUE_OUTDATED("OUTDATED"), - @SerializedName("PARTIAL_FETCH") - VALUE_PARTIAL_FETCH("PARTIAL_FETCH"), - ; - - private String value; - - private EnumImageFetchStatus(String value) { - this.value = value; - } - - @Override - public String toString() { - return value; - } - } - - public static enum EnumVisibility { - @SerializedName("PUBLISHED") - VALUE_PUBLISHED("PUBLISHED"), - @SerializedName("STAGING") - VALUE_STAGING("STAGING"), - ; - - private String value; - - private EnumVisibility(String value) { - this.value = value; - } - - @Override - public String toString() { - return value; - } - } - - - 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 LocationBasedItem copyFrom(LocationBasedItem instance) { - this.mApplinks = instance.mApplinks; - this.mCategorySpecificFields = instance.mCategorySpecificFields; - this.mCurrency = instance.mCurrency; - this.mDescription = instance.mDescription; - this.mId = instance.mId; - this.mImageFetchStatus = instance.mImageFetchStatus; - this.mImages = instance.mImages; - this.mLocationBasedItemId = instance.mLocationBasedItemId; - this.mName = instance.mName; - this.mPrice = instance.mPrice; - this.mSanitizedImages = instance.mSanitizedImages; - this.mUrl = instance.mUrl; - this.mVisibility = instance.mVisibility; - 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 LocationBasedItem.parseResponse(response, context, request, header); - } - }; - } -} diff --git a/src/main/java/com/facebook/ads/sdk/MediaTitle.java b/src/main/java/com/facebook/ads/sdk/MediaTitle.java index 8580dd4e..29db266f 100644 --- a/src/main/java/com/facebook/ads/sdk/MediaTitle.java +++ b/src/main/java/com/facebook/ads/sdk/MediaTitle.java @@ -292,14 +292,14 @@ public String toString() { return getGson().toJson(this); } - public APIRequestGetAugmentedRealitiesMetadata getAugmentedRealitiesMetadata() { - return new APIRequestGetAugmentedRealitiesMetadata(this.getPrefixedId().toString(), context); - } - public APIRequestGetChannelsToIntegrityStatus getChannelsToIntegrityStatus() { return new APIRequestGetChannelsToIntegrityStatus(this.getPrefixedId().toString(), context); } + public APIRequestGetOverrideDetails getOverrideDetails() { + return new APIRequestGetOverrideDetails(this.getPrefixedId().toString(), context); + } + public APIRequestGetVideosMetadata getVideosMetadata() { return new APIRequestGetVideosMetadata(this.getPrefixedId().toString(), context); } @@ -406,59 +406,49 @@ public String getFieldWikiDataItem() { - public static class APIRequestGetAugmentedRealitiesMetadata extends APIRequest { + public static class APIRequestGetChannelsToIntegrityStatus extends APIRequest { - APINodeList lastResponse = null; + APINodeList lastResponse = null; @Override - public APINodeList getLastResponse() { + public APINodeList getLastResponse() { return lastResponse; } public static final String[] PARAMS = { }; public static final String[] FIELDS = { - "anchor_point", - "container_effect_enum", - "effect_icon_url", - "effect_id", - "id", - "platforms", - "scale_factor", - "shadow_texture_url", - "source_url", - "state", - "tags", - "variant_picker_url", + "channels", + "rejection_information", }; @Override - public APINodeList parseResponse(String response, String header) throws APIException { - return DynamicARMetadata.parseResponse(response, getContext(), this, header); + public APINodeList parseResponse(String response, String header) throws APIException { + return CatalogItemChannelsToIntegrityStatus.parseResponse(response, getContext(), this, header); } @Override - public APINodeList execute() throws APIException { + public APINodeList execute() throws APIException { return execute(new HashMap()); } @Override - public APINodeList execute(Map extraParams) throws APIException { + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + new Function>() { + public APINodeList apply(ResponseWrapper result) { try { - return APIRequestGetAugmentedRealitiesMetadata.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestGetChannelsToIntegrityStatus.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -468,28 +458,28 @@ public APINodeList apply(ResponseWrapper result) { ); }; - public APIRequestGetAugmentedRealitiesMetadata(String nodeId, APIContext context) { - super(context, nodeId, "/augmented_realities_metadata", "GET", Arrays.asList(PARAMS)); + public APIRequestGetChannelsToIntegrityStatus(String nodeId, APIContext context) { + super(context, nodeId, "/channels_to_integrity_status", "GET", Arrays.asList(PARAMS)); } @Override - public APIRequestGetAugmentedRealitiesMetadata setParam(String param, Object value) { + public APIRequestGetChannelsToIntegrityStatus setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestGetAugmentedRealitiesMetadata setParams(Map params) { + public APIRequestGetChannelsToIntegrityStatus setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestGetAugmentedRealitiesMetadata requestAllFields () { + public APIRequestGetChannelsToIntegrityStatus requestAllFields () { return this.requestAllFields(true); } - public APIRequestGetAugmentedRealitiesMetadata requestAllFields (boolean value) { + public APIRequestGetChannelsToIntegrityStatus requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -497,12 +487,12 @@ public APIRequestGetAugmentedRealitiesMetadata requestAllFields (boolean value) } @Override - public APIRequestGetAugmentedRealitiesMetadata requestFields (List fields) { + public APIRequestGetChannelsToIntegrityStatus requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestGetAugmentedRealitiesMetadata requestFields (List fields, boolean value) { + public APIRequestGetChannelsToIntegrityStatus requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -510,146 +500,79 @@ public APIRequestGetAugmentedRealitiesMetadata requestFields (List field } @Override - public APIRequestGetAugmentedRealitiesMetadata requestField (String field) { + public APIRequestGetChannelsToIntegrityStatus requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestGetAugmentedRealitiesMetadata requestField (String field, boolean value) { + public APIRequestGetChannelsToIntegrityStatus requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } - public APIRequestGetAugmentedRealitiesMetadata requestAnchorPointField () { - return this.requestAnchorPointField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestAnchorPointField (boolean value) { - this.requestField("anchor_point", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestContainerEffectEnumField () { - return this.requestContainerEffectEnumField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestContainerEffectEnumField (boolean value) { - this.requestField("container_effect_enum", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIconUrlField () { - return this.requestEffectIconUrlField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIconUrlField (boolean value) { - this.requestField("effect_icon_url", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIdField () { - return this.requestEffectIdField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIdField (boolean value) { - this.requestField("effect_id", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestIdField () { - return this.requestIdField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestIdField (boolean value) { - this.requestField("id", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestPlatformsField () { - return this.requestPlatformsField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestPlatformsField (boolean value) { - this.requestField("platforms", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestScaleFactorField () { - return this.requestScaleFactorField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestScaleFactorField (boolean value) { - this.requestField("scale_factor", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestShadowTextureUrlField () { - return this.requestShadowTextureUrlField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestShadowTextureUrlField (boolean value) { - this.requestField("shadow_texture_url", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestSourceUrlField () { - return this.requestSourceUrlField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestSourceUrlField (boolean value) { - this.requestField("source_url", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestStateField () { - return this.requestStateField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestStateField (boolean value) { - this.requestField("state", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestTagsField () { - return this.requestTagsField(true); + public APIRequestGetChannelsToIntegrityStatus requestChannelsField () { + return this.requestChannelsField(true); } - public APIRequestGetAugmentedRealitiesMetadata requestTagsField (boolean value) { - this.requestField("tags", value); + public APIRequestGetChannelsToIntegrityStatus requestChannelsField (boolean value) { + this.requestField("channels", value); return this; } - public APIRequestGetAugmentedRealitiesMetadata requestVariantPickerUrlField () { - return this.requestVariantPickerUrlField(true); + public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField () { + return this.requestRejectionInformationField(true); } - public APIRequestGetAugmentedRealitiesMetadata requestVariantPickerUrlField (boolean value) { - this.requestField("variant_picker_url", value); + public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField (boolean value) { + this.requestField("rejection_information", value); return this; } } - public static class APIRequestGetChannelsToIntegrityStatus extends APIRequest { + public static class APIRequestGetOverrideDetails extends APIRequest { - APINodeList lastResponse = null; + APINodeList lastResponse = null; @Override - public APINodeList getLastResponse() { + public APINodeList getLastResponse() { return lastResponse; } public static final String[] PARAMS = { + "keys", + "type", }; public static final String[] FIELDS = { - "channels", - "rejection_information", + "key", + "type", + "values", }; @Override - public APINodeList parseResponse(String response, String header) throws APIException { - return CatalogItemChannelsToIntegrityStatus.parseResponse(response, getContext(), this, header); + public APINodeList parseResponse(String response, String header) throws APIException { + return OverrideDetails.parseResponse(response, getContext(), this, header); } @Override - public APINodeList execute() throws APIException { + public APINodeList execute() throws APIException { return execute(new HashMap()); } @Override - public APINodeList execute(Map extraParams) throws APIException { + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + new Function>() { + public APINodeList apply(ResponseWrapper result) { try { - return APIRequestGetChannelsToIntegrityStatus.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestGetOverrideDetails.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -659,28 +582,46 @@ public APINodeList apply(ResponseWrapper r ); }; - public APIRequestGetChannelsToIntegrityStatus(String nodeId, APIContext context) { - super(context, nodeId, "/channels_to_integrity_status", "GET", Arrays.asList(PARAMS)); + public APIRequestGetOverrideDetails(String nodeId, APIContext context) { + super(context, nodeId, "/override_details", "GET", Arrays.asList(PARAMS)); } @Override - public APIRequestGetChannelsToIntegrityStatus setParam(String param, Object value) { + public APIRequestGetOverrideDetails setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestGetChannelsToIntegrityStatus setParams(Map params) { + public APIRequestGetOverrideDetails setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestGetChannelsToIntegrityStatus requestAllFields () { + public APIRequestGetOverrideDetails setKeys (List keys) { + this.setParam("keys", keys); + return this; + } + public APIRequestGetOverrideDetails setKeys (String keys) { + this.setParam("keys", keys); + return this; + } + + public APIRequestGetOverrideDetails setType (OverrideDetails.EnumType type) { + this.setParam("type", type); + return this; + } + public APIRequestGetOverrideDetails setType (String type) { + this.setParam("type", type); + return this; + } + + public APIRequestGetOverrideDetails requestAllFields () { return this.requestAllFields(true); } - public APIRequestGetChannelsToIntegrityStatus requestAllFields (boolean value) { + public APIRequestGetOverrideDetails requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -688,12 +629,12 @@ public APIRequestGetChannelsToIntegrityStatus requestAllFields (boolean value) { } @Override - public APIRequestGetChannelsToIntegrityStatus requestFields (List fields) { + public APIRequestGetOverrideDetails requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestGetChannelsToIntegrityStatus requestFields (List fields, boolean value) { + public APIRequestGetOverrideDetails requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -701,29 +642,36 @@ public APIRequestGetChannelsToIntegrityStatus requestFields (List fields } @Override - public APIRequestGetChannelsToIntegrityStatus requestField (String field) { + public APIRequestGetOverrideDetails requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestGetChannelsToIntegrityStatus requestField (String field, boolean value) { + public APIRequestGetOverrideDetails requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } - public APIRequestGetChannelsToIntegrityStatus requestChannelsField () { - return this.requestChannelsField(true); + public APIRequestGetOverrideDetails requestKeyField () { + return this.requestKeyField(true); } - public APIRequestGetChannelsToIntegrityStatus requestChannelsField (boolean value) { - this.requestField("channels", value); + public APIRequestGetOverrideDetails requestKeyField (boolean value) { + this.requestField("key", value); return this; } - public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField () { - return this.requestRejectionInformationField(true); + public APIRequestGetOverrideDetails requestTypeField () { + return this.requestTypeField(true); } - public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField (boolean value) { - this.requestField("rejection_information", value); + public APIRequestGetOverrideDetails requestTypeField (boolean value) { + this.requestField("type", value); + return this; + } + public APIRequestGetOverrideDetails requestValuesField () { + return this.requestValuesField(true); + } + public APIRequestGetOverrideDetails requestValuesField (boolean value) { + this.requestField("values", value); return this; } } diff --git a/src/main/java/com/facebook/ads/sdk/MessageDeliveryEstimate.java b/src/main/java/com/facebook/ads/sdk/MessageDeliveryEstimate.java new file mode 100644 index 00000000..80b479fe --- /dev/null +++ b/src/main/java/com/facebook/ads/sdk/MessageDeliveryEstimate.java @@ -0,0 +1,430 @@ +/* + * 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 MessageDeliveryEstimate extends APINode { + @SerializedName("estimate_cost") + private Double mEstimateCost = null; + @SerializedName("estimate_cost_lower_bound") + private Double mEstimateCostLowerBound = null; + @SerializedName("estimate_cost_upper_bound") + private Double mEstimateCostUpperBound = null; + @SerializedName("estimate_coverage_lower_bound") + private Long mEstimateCoverageLowerBound = null; + @SerializedName("estimate_coverage_upper_bound") + private Long mEstimateCoverageUpperBound = null; + @SerializedName("estimate_delivery") + private Long mEstimateDelivery = null; + @SerializedName("estimate_delivery_lower_bound") + private Long mEstimateDeliveryLowerBound = null; + @SerializedName("estimate_delivery_upper_bound") + private Long mEstimateDeliveryUpperBound = null; + @SerializedName("estimate_status") + private String mEstimateStatus = null; + protected static Gson gson = null; + + public MessageDeliveryEstimate() { + } + + public String getId() { + return null; + } + public static MessageDeliveryEstimate loadJSON(String json, APIContext context, String header) { + MessageDeliveryEstimate messageDeliveryEstimate = getGson().fromJson(json, MessageDeliveryEstimate.class); + if (context.isDebug()) { + JsonParser parser = new JsonParser(); + JsonElement o1 = parser.parse(json); + JsonElement o2 = parser.parse(messageDeliveryEstimate.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); + } + } + messageDeliveryEstimate.context = context; + messageDeliveryEstimate.rawValue = json; + messageDeliveryEstimate.header = header; + return messageDeliveryEstimate; + } + + public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { + APINodeList messageDeliveryEstimates = 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++) { + messageDeliveryEstimates.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); + }; + return messageDeliveryEstimates; + } 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; + messageDeliveryEstimates.setCursors(before, after); + } + String previous = paging.has("previous") ? paging.get("previous").getAsString() : null; + String next = paging.has("next") ? paging.get("next").getAsString() : null; + messageDeliveryEstimates.setPaging(previous, next); + if (context.hasAppSecret()) { + messageDeliveryEstimates.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++) { + messageDeliveryEstimates.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()) { + messageDeliveryEstimates.add(loadJSON(entry.getValue().toString(), context, header)); + } + break; + } + } + if (!isRedownload) { + messageDeliveryEstimates.add(loadJSON(obj.toString(), context, header)); + } + } + return messageDeliveryEstimates; + } 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()) { + messageDeliveryEstimates.add(loadJSON(entry.getValue().toString(), context, header)); + } + return messageDeliveryEstimates; + } 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) + ) { + messageDeliveryEstimates.add(loadJSON(value.toString(), context, header)); + } else { + isIdIndexedArray = false; + break; + } + } + if (isIdIndexedArray) { + return messageDeliveryEstimates; + } + + // Sixth, check if it's pure JsonObject + messageDeliveryEstimates.clear(); + messageDeliveryEstimates.add(loadJSON(json, context, header)); + return messageDeliveryEstimates; + } + } + } 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 Double getFieldEstimateCost() { + return mEstimateCost; + } + + public MessageDeliveryEstimate setFieldEstimateCost(Double value) { + this.mEstimateCost = value; + return this; + } + + public Double getFieldEstimateCostLowerBound() { + return mEstimateCostLowerBound; + } + + public MessageDeliveryEstimate setFieldEstimateCostLowerBound(Double value) { + this.mEstimateCostLowerBound = value; + return this; + } + + public Double getFieldEstimateCostUpperBound() { + return mEstimateCostUpperBound; + } + + public MessageDeliveryEstimate setFieldEstimateCostUpperBound(Double value) { + this.mEstimateCostUpperBound = value; + return this; + } + + public Long getFieldEstimateCoverageLowerBound() { + return mEstimateCoverageLowerBound; + } + + public MessageDeliveryEstimate setFieldEstimateCoverageLowerBound(Long value) { + this.mEstimateCoverageLowerBound = value; + return this; + } + + public Long getFieldEstimateCoverageUpperBound() { + return mEstimateCoverageUpperBound; + } + + public MessageDeliveryEstimate setFieldEstimateCoverageUpperBound(Long value) { + this.mEstimateCoverageUpperBound = value; + return this; + } + + public Long getFieldEstimateDelivery() { + return mEstimateDelivery; + } + + public MessageDeliveryEstimate setFieldEstimateDelivery(Long value) { + this.mEstimateDelivery = value; + return this; + } + + public Long getFieldEstimateDeliveryLowerBound() { + return mEstimateDeliveryLowerBound; + } + + public MessageDeliveryEstimate setFieldEstimateDeliveryLowerBound(Long value) { + this.mEstimateDeliveryLowerBound = value; + return this; + } + + public Long getFieldEstimateDeliveryUpperBound() { + return mEstimateDeliveryUpperBound; + } + + public MessageDeliveryEstimate setFieldEstimateDeliveryUpperBound(Long value) { + this.mEstimateDeliveryUpperBound = value; + return this; + } + + public String getFieldEstimateStatus() { + return mEstimateStatus; + } + + public MessageDeliveryEstimate setFieldEstimateStatus(String value) { + this.mEstimateStatus = value; + return this; + } + + + + public static enum EnumOptimizationGoal { + @SerializedName("AD_RECALL_LIFT") + VALUE_AD_RECALL_LIFT("AD_RECALL_LIFT"), + @SerializedName("APP_INSTALLS") + VALUE_APP_INSTALLS("APP_INSTALLS"), + @SerializedName("APP_INSTALLS_AND_OFFSITE_CONVERSIONS") + VALUE_APP_INSTALLS_AND_OFFSITE_CONVERSIONS("APP_INSTALLS_AND_OFFSITE_CONVERSIONS"), + @SerializedName("CONVERSATIONS") + VALUE_CONVERSATIONS("CONVERSATIONS"), + @SerializedName("DERIVED_EVENTS") + VALUE_DERIVED_EVENTS("DERIVED_EVENTS"), + @SerializedName("ENGAGED_USERS") + VALUE_ENGAGED_USERS("ENGAGED_USERS"), + @SerializedName("EVENT_RESPONSES") + VALUE_EVENT_RESPONSES("EVENT_RESPONSES"), + @SerializedName("IMPRESSIONS") + VALUE_IMPRESSIONS("IMPRESSIONS"), + @SerializedName("IN_APP_VALUE") + VALUE_IN_APP_VALUE("IN_APP_VALUE"), + @SerializedName("LANDING_PAGE_VIEWS") + VALUE_LANDING_PAGE_VIEWS("LANDING_PAGE_VIEWS"), + @SerializedName("LEAD_GENERATION") + VALUE_LEAD_GENERATION("LEAD_GENERATION"), + @SerializedName("LINK_CLICKS") + VALUE_LINK_CLICKS("LINK_CLICKS"), + @SerializedName("MEANINGFUL_CALL_ATTEMPT") + VALUE_MEANINGFUL_CALL_ATTEMPT("MEANINGFUL_CALL_ATTEMPT"), + @SerializedName("MESSAGING_APPOINTMENT_CONVERSION") + VALUE_MESSAGING_APPOINTMENT_CONVERSION("MESSAGING_APPOINTMENT_CONVERSION"), + @SerializedName("MESSAGING_PURCHASE_CONVERSION") + VALUE_MESSAGING_PURCHASE_CONVERSION("MESSAGING_PURCHASE_CONVERSION"), + @SerializedName("NONE") + VALUE_NONE("NONE"), + @SerializedName("OFFSITE_CONVERSIONS") + VALUE_OFFSITE_CONVERSIONS("OFFSITE_CONVERSIONS"), + @SerializedName("PAGE_LIKES") + VALUE_PAGE_LIKES("PAGE_LIKES"), + @SerializedName("POST_ENGAGEMENT") + VALUE_POST_ENGAGEMENT("POST_ENGAGEMENT"), + @SerializedName("PROFILE_VISIT") + VALUE_PROFILE_VISIT("PROFILE_VISIT"), + @SerializedName("QUALITY_CALL") + VALUE_QUALITY_CALL("QUALITY_CALL"), + @SerializedName("QUALITY_LEAD") + VALUE_QUALITY_LEAD("QUALITY_LEAD"), + @SerializedName("REACH") + VALUE_REACH("REACH"), + @SerializedName("REMINDERS_SET") + VALUE_REMINDERS_SET("REMINDERS_SET"), + @SerializedName("SUBSCRIBERS") + VALUE_SUBSCRIBERS("SUBSCRIBERS"), + @SerializedName("THRUPLAY") + VALUE_THRUPLAY("THRUPLAY"), + @SerializedName("VALUE") + VALUE_VALUE("VALUE"), + @SerializedName("VISIT_INSTAGRAM_PROFILE") + VALUE_VISIT_INSTAGRAM_PROFILE("VISIT_INSTAGRAM_PROFILE"), + ; + + private String value; + + private EnumOptimizationGoal(String value) { + this.value = value; + } + + @Override + public String toString() { + return value; + } + } + + public static enum EnumPacingType { + @SerializedName("DAY_PARTING") + VALUE_DAY_PARTING("DAY_PARTING"), + @SerializedName("DISABLED") + VALUE_DISABLED("DISABLED"), + @SerializedName("NO_PACING") + VALUE_NO_PACING("NO_PACING"), + @SerializedName("PROBABILISTIC_PACING") + VALUE_PROBABILISTIC_PACING("PROBABILISTIC_PACING"), + @SerializedName("PROBABILISTIC_PACING_V2") + VALUE_PROBABILISTIC_PACING_V2("PROBABILISTIC_PACING_V2"), + @SerializedName("STANDARD") + VALUE_STANDARD("STANDARD"), + ; + + private String value; + + private EnumPacingType(String value) { + this.value = value; + } + + @Override + public String toString() { + return value; + } + } + + + 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 MessageDeliveryEstimate copyFrom(MessageDeliveryEstimate instance) { + this.mEstimateCost = instance.mEstimateCost; + this.mEstimateCostLowerBound = instance.mEstimateCostLowerBound; + this.mEstimateCostUpperBound = instance.mEstimateCostUpperBound; + this.mEstimateCoverageLowerBound = instance.mEstimateCoverageLowerBound; + this.mEstimateCoverageUpperBound = instance.mEstimateCoverageUpperBound; + this.mEstimateDelivery = instance.mEstimateDelivery; + this.mEstimateDeliveryLowerBound = instance.mEstimateDeliveryLowerBound; + this.mEstimateDeliveryUpperBound = instance.mEstimateDeliveryUpperBound; + this.mEstimateStatus = instance.mEstimateStatus; + 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 MessageDeliveryEstimate.parseResponse(response, context, request, header); + } + }; + } +} diff --git a/src/main/java/com/facebook/ads/sdk/MessagingAppsInfo.java b/src/main/java/com/facebook/ads/sdk/MessagingAppsInfo.java index 68b093ef..bb45611c 100644 --- a/src/main/java/com/facebook/ads/sdk/MessagingAppsInfo.java +++ b/src/main/java/com/facebook/ads/sdk/MessagingAppsInfo.java @@ -41,6 +41,8 @@ * */ public class MessagingAppsInfo extends APINode { + @SerializedName("ctd_support_only_for_ig_app") + private Boolean mCtdSupportOnlyForIgApp = null; @SerializedName("has_instagram_messaging_permission") private Boolean mHasInstagramMessagingPermission = null; @SerializedName("has_messenger_messaging_permission") @@ -200,6 +202,15 @@ public String toString() { } + public Boolean getFieldCtdSupportOnlyForIgApp() { + return mCtdSupportOnlyForIgApp; + } + + public MessagingAppsInfo setFieldCtdSupportOnlyForIgApp(Boolean value) { + this.mCtdSupportOnlyForIgApp = value; + return this; + } + public Boolean getFieldHasInstagramMessagingPermission() { return mHasInstagramMessagingPermission; } @@ -253,6 +264,7 @@ public MessagingAppsInfo setFieldName(String value) { } public MessagingAppsInfo copyFrom(MessagingAppsInfo instance) { + this.mCtdSupportOnlyForIgApp = instance.mCtdSupportOnlyForIgApp; this.mHasInstagramMessagingPermission = instance.mHasInstagramMessagingPermission; this.mHasMessengerMessagingPermission = instance.mHasMessengerMessagingPermission; this.mId = instance.mId; diff --git a/src/main/java/com/facebook/ads/sdk/OfflineProductItem.java b/src/main/java/com/facebook/ads/sdk/OfflineProductItem.java index d2cfd507..bc720b56 100644 --- a/src/main/java/com/facebook/ads/sdk/OfflineProductItem.java +++ b/src/main/java/com/facebook/ads/sdk/OfflineProductItem.java @@ -286,6 +286,10 @@ public APIRequestGetChannelsToIntegrityStatus getChannelsToIntegrityStatus() { return new APIRequestGetChannelsToIntegrityStatus(this.getPrefixedId().toString(), context); } + public APIRequestGetOverrideDetails getOverrideDetails() { + return new APIRequestGetOverrideDetails(this.getPrefixedId().toString(), context); + } + public APIRequestGet get() { return new APIRequestGet(this.getPrefixedId().toString(), context); } @@ -478,6 +482,155 @@ public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField ( } } + public static class APIRequestGetOverrideDetails extends APIRequest { + + APINodeList lastResponse = null; + @Override + public APINodeList getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "keys", + "type", + }; + + public static final String[] FIELDS = { + "key", + "type", + "values", + }; + + @Override + public APINodeList parseResponse(String response, String header) throws APIException { + return OverrideDetails.parseResponse(response, getContext(), this, header); + } + + @Override + public APINodeList execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + try { + return APIRequestGetOverrideDetails.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestGetOverrideDetails(String nodeId, APIContext context) { + super(context, nodeId, "/override_details", "GET", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestGetOverrideDetails setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestGetOverrideDetails setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestGetOverrideDetails setKeys (List keys) { + this.setParam("keys", keys); + return this; + } + public APIRequestGetOverrideDetails setKeys (String keys) { + this.setParam("keys", keys); + return this; + } + + public APIRequestGetOverrideDetails setType (OverrideDetails.EnumType type) { + this.setParam("type", type); + return this; + } + public APIRequestGetOverrideDetails setType (String type) { + this.setParam("type", type); + return this; + } + + public APIRequestGetOverrideDetails requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestGetOverrideDetails requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetOverrideDetails requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestGetOverrideDetails requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetOverrideDetails requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestGetOverrideDetails requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + public APIRequestGetOverrideDetails requestKeyField () { + return this.requestKeyField(true); + } + public APIRequestGetOverrideDetails requestKeyField (boolean value) { + this.requestField("key", value); + return this; + } + public APIRequestGetOverrideDetails requestTypeField () { + return this.requestTypeField(true); + } + public APIRequestGetOverrideDetails requestTypeField (boolean value) { + this.requestField("type", value); + return this; + } + public APIRequestGetOverrideDetails requestValuesField () { + return this.requestValuesField(true); + } + public APIRequestGetOverrideDetails requestValuesField (boolean value) { + this.requestField("values", value); + return this; + } + } + public static class APIRequestGet extends APIRequest { OfflineProductItem lastResponse = null; diff --git a/src/main/java/com/facebook/ads/sdk/InstantArticleCTA.java b/src/main/java/com/facebook/ads/sdk/OverrideDetails.java similarity index 63% rename from src/main/java/com/facebook/ads/sdk/InstantArticleCTA.java rename to src/main/java/com/facebook/ads/sdk/OverrideDetails.java index f4df04ae..878f2e1c 100644 --- a/src/main/java/com/facebook/ads/sdk/InstantArticleCTA.java +++ b/src/main/java/com/facebook/ads/sdk/OverrideDetails.java @@ -40,31 +40,27 @@ * pull request for this class. * */ -public class InstantArticleCTA extends APINode { - @SerializedName("id") - private String mId = null; - @SerializedName("is_enabled") - private Boolean mIsEnabled = null; - @SerializedName("publisher_defined_value") - private Double mPublisherDefinedValue = null; +public class OverrideDetails extends APINode { + @SerializedName("key") + private String mKey = null; @SerializedName("type") private String mType = null; - @SerializedName("update_time") - private String mUpdateTime = null; + @SerializedName("values") + private Object mValues = null; protected static Gson gson = null; - public InstantArticleCTA() { + public OverrideDetails() { } public String getId() { - return getFieldId().toString(); + return null; } - public static InstantArticleCTA loadJSON(String json, APIContext context, String header) { - InstantArticleCTA instantArticleCTA = getGson().fromJson(json, InstantArticleCTA.class); + public static OverrideDetails loadJSON(String json, APIContext context, String header) { + OverrideDetails overrideDetails = getGson().fromJson(json, OverrideDetails.class); if (context.isDebug()) { JsonParser parser = new JsonParser(); JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(instantArticleCTA.toString()); + JsonElement o2 = parser.parse(overrideDetails.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -74,14 +70,14 @@ public static InstantArticleCTA loadJSON(String json, APIContext context, String context.log("[Object]" + o2); } } - instantArticleCTA.context = context; - instantArticleCTA.rawValue = json; - instantArticleCTA.header = header; - return instantArticleCTA; + overrideDetails.context = context; + overrideDetails.rawValue = json; + overrideDetails.header = header; + return overrideDetails; } - public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { - APINodeList instantArticleCTAs = new APINodeList(request, json, header); + public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { + APINodeList overrideDetailss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; JsonParser parser = new JsonParser(); @@ -92,9 +88,9 @@ public static APINodeList parseResponse(String json, APIConte // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); for (int i = 0; i < arr.size(); i++) { - instantArticleCTAs.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); + overrideDetailss.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); }; - return instantArticleCTAs; + return overrideDetailss; } else if (result.isJsonObject()) { obj = result.getAsJsonObject(); if (obj.has("data")) { @@ -104,20 +100,20 @@ public static APINodeList parseResponse(String json, APIConte 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; - instantArticleCTAs.setCursors(before, after); + overrideDetailss.setCursors(before, after); } String previous = paging.has("previous") ? paging.get("previous").getAsString() : null; String next = paging.has("next") ? paging.get("next").getAsString() : null; - instantArticleCTAs.setPaging(previous, next); + overrideDetailss.setPaging(previous, next); if (context.hasAppSecret()) { - instantArticleCTAs.setAppSecret(context.getAppSecretProof()); + overrideDetailss.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++) { - instantArticleCTAs.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); + overrideDetailss.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" @@ -128,23 +124,23 @@ public static APINodeList parseResponse(String json, APIConte isRedownload = true; obj = obj.getAsJsonObject(s); for (Map.Entry entry : obj.entrySet()) { - instantArticleCTAs.add(loadJSON(entry.getValue().toString(), context, header)); + overrideDetailss.add(loadJSON(entry.getValue().toString(), context, header)); } break; } } if (!isRedownload) { - instantArticleCTAs.add(loadJSON(obj.toString(), context, header)); + overrideDetailss.add(loadJSON(obj.toString(), context, header)); } } - return instantArticleCTAs; + return overrideDetailss; } 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()) { - instantArticleCTAs.add(loadJSON(entry.getValue().toString(), context, header)); + overrideDetailss.add(loadJSON(entry.getValue().toString(), context, header)); } - return instantArticleCTAs; + return overrideDetailss; } else { // Fifth, check if it's an array of objects indexed by id boolean isIdIndexedArray = true; @@ -161,20 +157,20 @@ public static APINodeList parseResponse(String json, APIConte value.getAsJsonObject().get("id") != null && value.getAsJsonObject().get("id").getAsString().equals(key) ) { - instantArticleCTAs.add(loadJSON(value.toString(), context, header)); + overrideDetailss.add(loadJSON(value.toString(), context, header)); } else { isIdIndexedArray = false; break; } } if (isIdIndexedArray) { - return instantArticleCTAs; + return overrideDetailss; } // Sixth, check if it's pure JsonObject - instantArticleCTAs.clear(); - instantArticleCTAs.add(loadJSON(json, context, header)); - return instantArticleCTAs; + overrideDetailss.clear(); + overrideDetailss.add(loadJSON(json, context, header)); + return overrideDetailss; } } } catch (Exception e) { @@ -202,52 +198,55 @@ public String toString() { } - public String getFieldId() { - return mId; + public String getFieldKey() { + return mKey; } - public InstantArticleCTA setFieldId(String value) { - this.mId = value; + public OverrideDetails setFieldKey(String value) { + this.mKey = value; return this; } - public Boolean getFieldIsEnabled() { - return mIsEnabled; + public String getFieldType() { + return mType; } - public InstantArticleCTA setFieldIsEnabled(Boolean value) { - this.mIsEnabled = value; + public OverrideDetails setFieldType(String value) { + this.mType = value; return this; } - public Double getFieldPublisherDefinedValue() { - return mPublisherDefinedValue; + public Object getFieldValues() { + return mValues; } - public InstantArticleCTA setFieldPublisherDefinedValue(Double value) { - this.mPublisherDefinedValue = value; + public OverrideDetails setFieldValues(Object value) { + this.mValues = value; return this; } - public String getFieldType() { - return mType; - } - public InstantArticleCTA setFieldType(String value) { - this.mType = value; - return this; - } - public String getFieldUpdateTime() { - return mUpdateTime; - } + public static enum EnumType { + @SerializedName("COUNTRY") + VALUE_COUNTRY("COUNTRY"), + @SerializedName("LANGUAGE") + VALUE_LANGUAGE("LANGUAGE"), + @SerializedName("LANGUAGE_AND_COUNTRY") + VALUE_LANGUAGE_AND_COUNTRY("LANGUAGE_AND_COUNTRY"), + ; - public InstantArticleCTA setFieldUpdateTime(String value) { - this.mUpdateTime = value; - return this; - } + private String value; + private EnumType(String value) { + this.value = value; + } + @Override + public String toString() { + return value; + } + } synchronized /*package*/ static Gson getGson() { @@ -263,21 +262,19 @@ public InstantArticleCTA setFieldUpdateTime(String value) { return gson; } - public InstantArticleCTA copyFrom(InstantArticleCTA instance) { - this.mId = instance.mId; - this.mIsEnabled = instance.mIsEnabled; - this.mPublisherDefinedValue = instance.mPublisherDefinedValue; + public OverrideDetails copyFrom(OverrideDetails instance) { + this.mKey = instance.mKey; this.mType = instance.mType; - this.mUpdateTime = instance.mUpdateTime; + this.mValues = instance.mValues; 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 InstantArticleCTA.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 OverrideDetails.parseResponse(response, context, request, header); } }; } diff --git a/src/main/java/com/facebook/ads/sdk/Page.java b/src/main/java/com/facebook/ads/sdk/Page.java index 8e8a0505..0b6f34a2 100644 --- a/src/main/java/com/facebook/ads/sdk/Page.java +++ b/src/main/java/com/facebook/ads/sdk/Page.java @@ -700,12 +700,12 @@ public APIRequestCreateCustomUserSetting createCustomUserSetting() { return new APIRequestCreateCustomUserSetting(this.getPrefixedId().toString(), context); } - public APIRequestGetDataSet getDataSet() { - return new APIRequestGetDataSet(this.getPrefixedId().toString(), context); + public APIRequestGetDataset getDataset() { + return new APIRequestGetDataset(this.getPrefixedId().toString(), context); } - public APIRequestCreateDataSet createDataSet() { - return new APIRequestCreateDataSet(this.getPrefixedId().toString(), context); + public APIRequestCreateDataset createDataset() { + return new APIRequestCreateDataset(this.getPrefixedId().toString(), context); } public APIRequestGetEvents getEvents() { @@ -732,10 +732,6 @@ public APIRequestGetGlobalBrandChildren getGlobalBrandChildren() { return new APIRequestGetGlobalBrandChildren(this.getPrefixedId().toString(), context); } - public APIRequestGetGroups getGroups() { - return new APIRequestGetGroups(this.getPrefixedId().toString(), context); - } - public APIRequestGetImageCopyrights getImageCopyrights() { return new APIRequestGetImageCopyrights(this.getPrefixedId().toString(), context); } @@ -6808,6 +6804,7 @@ public APINodeList getLastResponse() { "last_updated", "merchant_order_id", "order_status", + "pre_order_details", "selected_shipping_option", "ship_by_date", "shipping_address", @@ -7008,6 +7005,13 @@ public APIRequestGetCommerceOrders requestOrderStatusField (boolean value) { this.requestField("order_status", value); return this; } + public APIRequestGetCommerceOrders requestPreOrderDetailsField () { + return this.requestPreOrderDetailsField(true); + } + public APIRequestGetCommerceOrders requestPreOrderDetailsField (boolean value) { + this.requestField("pre_order_details", value); + return this; + } public APIRequestGetCommerceOrders requestSelectedShippingOptionField () { return this.requestSelectedShippingOptionField(true); } @@ -7202,10 +7206,15 @@ public APINodeList getLastResponse() { }; public static final String[] FIELDS = { + "merchant_order_id", "net_payment_amount", + "order_created", "order_details", + "order_id", "payout_reference_id", + "postal_code", "processing_fee", + "state", "tax_rate", "transaction_date", "transaction_type", @@ -7318,6 +7327,13 @@ public APIRequestGetCommerceTransactions requestField (String field, boolean val return this; } + public APIRequestGetCommerceTransactions requestMerchantOrderIdField () { + return this.requestMerchantOrderIdField(true); + } + public APIRequestGetCommerceTransactions requestMerchantOrderIdField (boolean value) { + this.requestField("merchant_order_id", value); + return this; + } public APIRequestGetCommerceTransactions requestNetPaymentAmountField () { return this.requestNetPaymentAmountField(true); } @@ -7325,6 +7341,13 @@ public APIRequestGetCommerceTransactions requestNetPaymentAmountField (boolean v this.requestField("net_payment_amount", value); return this; } + public APIRequestGetCommerceTransactions requestOrderCreatedField () { + return this.requestOrderCreatedField(true); + } + public APIRequestGetCommerceTransactions requestOrderCreatedField (boolean value) { + this.requestField("order_created", value); + return this; + } public APIRequestGetCommerceTransactions requestOrderDetailsField () { return this.requestOrderDetailsField(true); } @@ -7332,6 +7355,13 @@ public APIRequestGetCommerceTransactions requestOrderDetailsField (boolean value this.requestField("order_details", value); return this; } + public APIRequestGetCommerceTransactions requestOrderIdField () { + return this.requestOrderIdField(true); + } + public APIRequestGetCommerceTransactions requestOrderIdField (boolean value) { + this.requestField("order_id", value); + return this; + } public APIRequestGetCommerceTransactions requestPayoutReferenceIdField () { return this.requestPayoutReferenceIdField(true); } @@ -7339,6 +7369,13 @@ public APIRequestGetCommerceTransactions requestPayoutReferenceIdField (boolean this.requestField("payout_reference_id", value); return this; } + public APIRequestGetCommerceTransactions requestPostalCodeField () { + return this.requestPostalCodeField(true); + } + public APIRequestGetCommerceTransactions requestPostalCodeField (boolean value) { + this.requestField("postal_code", value); + return this; + } public APIRequestGetCommerceTransactions requestProcessingFeeField () { return this.requestProcessingFeeField(true); } @@ -7346,6 +7383,13 @@ public APIRequestGetCommerceTransactions requestProcessingFeeField (boolean valu this.requestField("processing_fee", value); return this; } + public APIRequestGetCommerceTransactions requestStateField () { + return this.requestStateField(true); + } + public APIRequestGetCommerceTransactions requestStateField (boolean value) { + this.requestField("state", value); + return this; + } public APIRequestGetCommerceTransactions requestTaxRateField () { return this.requestTaxRateField(true); } @@ -9743,81 +9787,49 @@ public APIRequestCreateCustomUserSetting requestField (String field, boolean val } - public static class APIRequestGetDataSet extends APIRequest { + public static class APIRequestGetDataset extends APIRequest { - APINodeList lastResponse = null; + APINodeList lastResponse = null; @Override - public APINodeList getLastResponse() { + public APINodeList getLastResponse() { return lastResponse; } public static final String[] PARAMS = { }; public static final String[] FIELDS = { - "automatic_matching_fields", - "can_proxy", - "code", - "config", - "creation_time", - "creator", - "data_use_setting", - "description", - "duplicate_entries", - "enable_auto_assign_to_accounts", - "enable_automatic_matching", - "event_stats", - "event_time_max", - "event_time_min", - "first_party_cookie_status", - "has_1p_pixel_event", "id", - "is_consolidated_container", - "is_created_by_business", - "is_crm", - "is_mta_use", - "is_restricted_use", - "is_unavailable", - "last_fired_time", - "last_upload_app", - "last_upload_app_changed_time", - "match_rate_approx", - "matched_entries", "name", - "owner_ad_account", - "owner_business", - "usage", - "user_access_expire_time", - "valid_entries", }; @Override - public APINodeList parseResponse(String response, String header) throws APIException { - return AdsPixel.parseResponse(response, getContext(), this, header); + public APINodeList parseResponse(String response, String header) throws APIException { + return Dataset.parseResponse(response, getContext(), this, header); } @Override - public APINodeList execute() throws APIException { + public APINodeList execute() throws APIException { return execute(new HashMap()); } @Override - public APINodeList execute(Map extraParams) throws APIException { + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + new Function>() { + public APINodeList apply(ResponseWrapper result) { try { - return APIRequestGetDataSet.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestGetDataset.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -9827,28 +9839,28 @@ public APINodeList apply(ResponseWrapper result) { ); }; - public APIRequestGetDataSet(String nodeId, APIContext context) { + public APIRequestGetDataset(String nodeId, APIContext context) { super(context, nodeId, "/dataset", "GET", Arrays.asList(PARAMS)); } @Override - public APIRequestGetDataSet setParam(String param, Object value) { + public APIRequestGetDataset setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestGetDataSet setParams(Map params) { + public APIRequestGetDataset setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestGetDataSet requestAllFields () { + public APIRequestGetDataset requestAllFields () { return this.requestAllFields(true); } - public APIRequestGetDataSet requestAllFields (boolean value) { + public APIRequestGetDataset requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -9856,12 +9868,12 @@ public APIRequestGetDataSet requestAllFields (boolean value) { } @Override - public APIRequestGetDataSet requestFields (List fields) { + public APIRequestGetDataset requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestGetDataSet requestFields (List fields, boolean value) { + public APIRequestGetDataset requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -9869,298 +9881,75 @@ public APIRequestGetDataSet requestFields (List fields, boolean value) { } @Override - public APIRequestGetDataSet requestField (String field) { + public APIRequestGetDataset requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestGetDataSet requestField (String field, boolean value) { + public APIRequestGetDataset requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } - public APIRequestGetDataSet requestAutomaticMatchingFieldsField () { - return this.requestAutomaticMatchingFieldsField(true); - } - public APIRequestGetDataSet requestAutomaticMatchingFieldsField (boolean value) { - this.requestField("automatic_matching_fields", value); - return this; - } - public APIRequestGetDataSet requestCanProxyField () { - return this.requestCanProxyField(true); - } - public APIRequestGetDataSet requestCanProxyField (boolean value) { - this.requestField("can_proxy", value); - return this; - } - public APIRequestGetDataSet requestCodeField () { - return this.requestCodeField(true); - } - public APIRequestGetDataSet requestCodeField (boolean value) { - this.requestField("code", value); - return this; - } - public APIRequestGetDataSet requestConfigField () { - return this.requestConfigField(true); - } - public APIRequestGetDataSet requestConfigField (boolean value) { - this.requestField("config", value); - return this; - } - public APIRequestGetDataSet requestCreationTimeField () { - return this.requestCreationTimeField(true); - } - public APIRequestGetDataSet requestCreationTimeField (boolean value) { - this.requestField("creation_time", value); - return this; - } - public APIRequestGetDataSet requestCreatorField () { - return this.requestCreatorField(true); - } - public APIRequestGetDataSet requestCreatorField (boolean value) { - this.requestField("creator", value); - return this; - } - public APIRequestGetDataSet requestDataUseSettingField () { - return this.requestDataUseSettingField(true); - } - public APIRequestGetDataSet requestDataUseSettingField (boolean value) { - this.requestField("data_use_setting", value); - return this; - } - public APIRequestGetDataSet requestDescriptionField () { - return this.requestDescriptionField(true); - } - public APIRequestGetDataSet requestDescriptionField (boolean value) { - this.requestField("description", value); - return this; - } - public APIRequestGetDataSet requestDuplicateEntriesField () { - return this.requestDuplicateEntriesField(true); - } - public APIRequestGetDataSet requestDuplicateEntriesField (boolean value) { - this.requestField("duplicate_entries", value); - return this; - } - public APIRequestGetDataSet requestEnableAutoAssignToAccountsField () { - return this.requestEnableAutoAssignToAccountsField(true); - } - public APIRequestGetDataSet requestEnableAutoAssignToAccountsField (boolean value) { - this.requestField("enable_auto_assign_to_accounts", value); - return this; - } - public APIRequestGetDataSet requestEnableAutomaticMatchingField () { - return this.requestEnableAutomaticMatchingField(true); - } - public APIRequestGetDataSet requestEnableAutomaticMatchingField (boolean value) { - this.requestField("enable_automatic_matching", value); - return this; - } - public APIRequestGetDataSet requestEventStatsField () { - return this.requestEventStatsField(true); - } - public APIRequestGetDataSet requestEventStatsField (boolean value) { - this.requestField("event_stats", value); - return this; - } - public APIRequestGetDataSet requestEventTimeMaxField () { - return this.requestEventTimeMaxField(true); - } - public APIRequestGetDataSet requestEventTimeMaxField (boolean value) { - this.requestField("event_time_max", value); - return this; - } - public APIRequestGetDataSet requestEventTimeMinField () { - return this.requestEventTimeMinField(true); - } - public APIRequestGetDataSet requestEventTimeMinField (boolean value) { - this.requestField("event_time_min", value); - return this; - } - public APIRequestGetDataSet requestFirstPartyCookieStatusField () { - return this.requestFirstPartyCookieStatusField(true); - } - public APIRequestGetDataSet requestFirstPartyCookieStatusField (boolean value) { - this.requestField("first_party_cookie_status", value); - return this; - } - public APIRequestGetDataSet requestHas1pPixelEventField () { - return this.requestHas1pPixelEventField(true); - } - public APIRequestGetDataSet requestHas1pPixelEventField (boolean value) { - this.requestField("has_1p_pixel_event", value); - return this; - } - public APIRequestGetDataSet requestIdField () { + public APIRequestGetDataset requestIdField () { return this.requestIdField(true); } - public APIRequestGetDataSet requestIdField (boolean value) { + public APIRequestGetDataset requestIdField (boolean value) { this.requestField("id", value); return this; } - public APIRequestGetDataSet requestIsConsolidatedContainerField () { - return this.requestIsConsolidatedContainerField(true); - } - public APIRequestGetDataSet requestIsConsolidatedContainerField (boolean value) { - this.requestField("is_consolidated_container", value); - return this; - } - public APIRequestGetDataSet requestIsCreatedByBusinessField () { - return this.requestIsCreatedByBusinessField(true); - } - public APIRequestGetDataSet requestIsCreatedByBusinessField (boolean value) { - this.requestField("is_created_by_business", value); - return this; - } - public APIRequestGetDataSet requestIsCrmField () { - return this.requestIsCrmField(true); - } - public APIRequestGetDataSet requestIsCrmField (boolean value) { - this.requestField("is_crm", value); - return this; - } - public APIRequestGetDataSet requestIsMtaUseField () { - return this.requestIsMtaUseField(true); - } - public APIRequestGetDataSet requestIsMtaUseField (boolean value) { - this.requestField("is_mta_use", value); - return this; - } - public APIRequestGetDataSet requestIsRestrictedUseField () { - return this.requestIsRestrictedUseField(true); - } - public APIRequestGetDataSet requestIsRestrictedUseField (boolean value) { - this.requestField("is_restricted_use", value); - return this; - } - public APIRequestGetDataSet requestIsUnavailableField () { - return this.requestIsUnavailableField(true); - } - public APIRequestGetDataSet requestIsUnavailableField (boolean value) { - this.requestField("is_unavailable", value); - return this; - } - public APIRequestGetDataSet requestLastFiredTimeField () { - return this.requestLastFiredTimeField(true); - } - public APIRequestGetDataSet requestLastFiredTimeField (boolean value) { - this.requestField("last_fired_time", value); - return this; - } - public APIRequestGetDataSet requestLastUploadAppField () { - return this.requestLastUploadAppField(true); - } - public APIRequestGetDataSet requestLastUploadAppField (boolean value) { - this.requestField("last_upload_app", value); - return this; - } - public APIRequestGetDataSet requestLastUploadAppChangedTimeField () { - return this.requestLastUploadAppChangedTimeField(true); - } - public APIRequestGetDataSet requestLastUploadAppChangedTimeField (boolean value) { - this.requestField("last_upload_app_changed_time", value); - return this; - } - public APIRequestGetDataSet requestMatchRateApproxField () { - return this.requestMatchRateApproxField(true); - } - public APIRequestGetDataSet requestMatchRateApproxField (boolean value) { - this.requestField("match_rate_approx", value); - return this; - } - public APIRequestGetDataSet requestMatchedEntriesField () { - return this.requestMatchedEntriesField(true); - } - public APIRequestGetDataSet requestMatchedEntriesField (boolean value) { - this.requestField("matched_entries", value); - return this; - } - public APIRequestGetDataSet requestNameField () { + public APIRequestGetDataset requestNameField () { return this.requestNameField(true); } - public APIRequestGetDataSet requestNameField (boolean value) { + public APIRequestGetDataset requestNameField (boolean value) { this.requestField("name", value); return this; } - public APIRequestGetDataSet requestOwnerAdAccountField () { - return this.requestOwnerAdAccountField(true); - } - public APIRequestGetDataSet requestOwnerAdAccountField (boolean value) { - this.requestField("owner_ad_account", value); - return this; - } - public APIRequestGetDataSet requestOwnerBusinessField () { - return this.requestOwnerBusinessField(true); - } - public APIRequestGetDataSet requestOwnerBusinessField (boolean value) { - this.requestField("owner_business", value); - return this; - } - public APIRequestGetDataSet requestUsageField () { - return this.requestUsageField(true); - } - public APIRequestGetDataSet requestUsageField (boolean value) { - this.requestField("usage", value); - return this; - } - public APIRequestGetDataSet requestUserAccessExpireTimeField () { - return this.requestUserAccessExpireTimeField(true); - } - public APIRequestGetDataSet requestUserAccessExpireTimeField (boolean value) { - this.requestField("user_access_expire_time", value); - return this; - } - public APIRequestGetDataSet requestValidEntriesField () { - return this.requestValidEntriesField(true); - } - public APIRequestGetDataSet requestValidEntriesField (boolean value) { - this.requestField("valid_entries", value); - return this; - } } - public static class APIRequestCreateDataSet extends APIRequest { + public static class APIRequestCreateDataset extends APIRequest { - AdsPixel lastResponse = null; + Dataset lastResponse = null; @Override - public AdsPixel getLastResponse() { + public Dataset getLastResponse() { return lastResponse; } public static final String[] PARAMS = { + "dataset_name", }; public static final String[] FIELDS = { }; @Override - public AdsPixel parseResponse(String response, String header) throws APIException { - return AdsPixel.parseResponse(response, getContext(), this, header).head(); + public Dataset parseResponse(String response, String header) throws APIException { + return Dataset.parseResponse(response, getContext(), this, header).head(); } @Override - public AdsPixel execute() throws APIException { + public Dataset execute() throws APIException { return execute(new HashMap()); } @Override - public AdsPixel execute(Map extraParams) throws APIException { + public Dataset 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 AdsPixel apply(ResponseWrapper result) { + new Function() { + public Dataset apply(ResponseWrapper result) { try { - return APIRequestCreateDataSet.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestCreateDataset.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -10170,28 +9959,33 @@ public AdsPixel apply(ResponseWrapper result) { ); }; - public APIRequestCreateDataSet(String nodeId, APIContext context) { + public APIRequestCreateDataset(String nodeId, APIContext context) { super(context, nodeId, "/dataset", "POST", Arrays.asList(PARAMS)); } @Override - public APIRequestCreateDataSet setParam(String param, Object value) { + public APIRequestCreateDataset setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestCreateDataSet setParams(Map params) { + public APIRequestCreateDataset setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestCreateDataSet requestAllFields () { + public APIRequestCreateDataset setDatasetName (String datasetName) { + this.setParam("dataset_name", datasetName); + return this; + } + + public APIRequestCreateDataset requestAllFields () { return this.requestAllFields(true); } - public APIRequestCreateDataSet requestAllFields (boolean value) { + public APIRequestCreateDataset requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -10199,12 +9993,12 @@ public APIRequestCreateDataSet requestAllFields (boolean value) { } @Override - public APIRequestCreateDataSet requestFields (List fields) { + public APIRequestCreateDataset requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestCreateDataSet requestFields (List fields, boolean value) { + public APIRequestCreateDataset requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -10212,13 +10006,13 @@ public APIRequestCreateDataSet requestFields (List fields, boolean value } @Override - public APIRequestCreateDataSet requestField (String field) { + public APIRequestCreateDataset requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestCreateDataSet requestField (String field, boolean value) { + public APIRequestCreateDataset requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } @@ -11500,7 +11294,6 @@ public Page getLastResponse() { "actions", "album_id", "android_key_hash", - "animated_effect_id", "application_id", "asked_fun_fact_prompt_id", "asset3d_id", @@ -11685,15 +11478,6 @@ public APIRequestCreateFeed setAndroidKeyHash (String androidKeyHash) { return this; } - public APIRequestCreateFeed setAnimatedEffectId (Long animatedEffectId) { - this.setParam("animated_effect_id", animatedEffectId); - return this; - } - public APIRequestCreateFeed setAnimatedEffectId (String animatedEffectId) { - this.setParam("animated_effect_id", animatedEffectId); - return this; - } - public APIRequestCreateFeed setApplicationId (String applicationId) { this.setParam("application_id", applicationId); return this; @@ -13807,279 +13591,6 @@ public APIRequestGetGlobalBrandChildren requestWrittenByField (boolean value) { } } - public static class APIRequestGetGroups extends APIRequest { - - APINodeList lastResponse = null; - @Override - public APINodeList getLastResponse() { - return lastResponse; - } - public static final String[] PARAMS = { - "admin_only", - "parent", - }; - - public static final String[] FIELDS = { - "archived", - "cover", - "created_time", - "description", - "email", - "icon", - "id", - "install", - "link", - "member_count", - "member_request_count", - "name", - "parent", - "permissions", - "privacy", - "purpose", - "subdomain", - "updated_time", - "venue", - }; - - @Override - public APINodeList parseResponse(String response, String header) throws APIException { - return Group.parseResponse(response, getContext(), this, header); - } - - @Override - public APINodeList execute() throws APIException { - return execute(new HashMap()); - } - - @Override - public APINodeList 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 APINodeList apply(ResponseWrapper result) { - try { - return APIRequestGetGroups.this.parseResponse(result.getBody(), result.getHeader()); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - }, - MoreExecutors.directExecutor() - ); - }; - - public APIRequestGetGroups(String nodeId, APIContext context) { - super(context, nodeId, "/groups", "GET", Arrays.asList(PARAMS)); - } - - @Override - public APIRequestGetGroups setParam(String param, Object value) { - setParamInternal(param, value); - return this; - } - - @Override - public APIRequestGetGroups setParams(Map params) { - setParamsInternal(params); - return this; - } - - - public APIRequestGetGroups setAdminOnly (Boolean adminOnly) { - this.setParam("admin_only", adminOnly); - return this; - } - public APIRequestGetGroups setAdminOnly (String adminOnly) { - this.setParam("admin_only", adminOnly); - return this; - } - - public APIRequestGetGroups setParent (String parent) { - this.setParam("parent", parent); - return this; - } - - public APIRequestGetGroups requestAllFields () { - return this.requestAllFields(true); - } - - public APIRequestGetGroups requestAllFields (boolean value) { - for (String field : FIELDS) { - this.requestField(field, value); - } - return this; - } - - @Override - public APIRequestGetGroups requestFields (List fields) { - return this.requestFields(fields, true); - } - - @Override - public APIRequestGetGroups requestFields (List fields, boolean value) { - for (String field : fields) { - this.requestField(field, value); - } - return this; - } - - @Override - public APIRequestGetGroups requestField (String field) { - this.requestField(field, true); - return this; - } - - @Override - public APIRequestGetGroups requestField (String field, boolean value) { - this.requestFieldInternal(field, value); - return this; - } - - public APIRequestGetGroups requestArchivedField () { - return this.requestArchivedField(true); - } - public APIRequestGetGroups requestArchivedField (boolean value) { - this.requestField("archived", value); - return this; - } - public APIRequestGetGroups requestCoverField () { - return this.requestCoverField(true); - } - public APIRequestGetGroups requestCoverField (boolean value) { - this.requestField("cover", value); - return this; - } - public APIRequestGetGroups requestCreatedTimeField () { - return this.requestCreatedTimeField(true); - } - public APIRequestGetGroups requestCreatedTimeField (boolean value) { - this.requestField("created_time", value); - return this; - } - public APIRequestGetGroups requestDescriptionField () { - return this.requestDescriptionField(true); - } - public APIRequestGetGroups requestDescriptionField (boolean value) { - this.requestField("description", value); - return this; - } - public APIRequestGetGroups requestEmailField () { - return this.requestEmailField(true); - } - public APIRequestGetGroups requestEmailField (boolean value) { - this.requestField("email", value); - return this; - } - public APIRequestGetGroups requestIconField () { - return this.requestIconField(true); - } - public APIRequestGetGroups requestIconField (boolean value) { - this.requestField("icon", value); - return this; - } - public APIRequestGetGroups requestIdField () { - return this.requestIdField(true); - } - public APIRequestGetGroups requestIdField (boolean value) { - this.requestField("id", value); - return this; - } - public APIRequestGetGroups requestInstallField () { - return this.requestInstallField(true); - } - public APIRequestGetGroups requestInstallField (boolean value) { - this.requestField("install", value); - return this; - } - public APIRequestGetGroups requestLinkField () { - return this.requestLinkField(true); - } - public APIRequestGetGroups requestLinkField (boolean value) { - this.requestField("link", value); - return this; - } - public APIRequestGetGroups requestMemberCountField () { - return this.requestMemberCountField(true); - } - public APIRequestGetGroups requestMemberCountField (boolean value) { - this.requestField("member_count", value); - return this; - } - public APIRequestGetGroups requestMemberRequestCountField () { - return this.requestMemberRequestCountField(true); - } - public APIRequestGetGroups requestMemberRequestCountField (boolean value) { - this.requestField("member_request_count", value); - return this; - } - public APIRequestGetGroups requestNameField () { - return this.requestNameField(true); - } - public APIRequestGetGroups requestNameField (boolean value) { - this.requestField("name", value); - return this; - } - public APIRequestGetGroups requestParentField () { - return this.requestParentField(true); - } - public APIRequestGetGroups requestParentField (boolean value) { - this.requestField("parent", value); - return this; - } - public APIRequestGetGroups requestPermissionsField () { - return this.requestPermissionsField(true); - } - public APIRequestGetGroups requestPermissionsField (boolean value) { - this.requestField("permissions", value); - return this; - } - public APIRequestGetGroups requestPrivacyField () { - return this.requestPrivacyField(true); - } - public APIRequestGetGroups requestPrivacyField (boolean value) { - this.requestField("privacy", value); - return this; - } - public APIRequestGetGroups requestPurposeField () { - return this.requestPurposeField(true); - } - public APIRequestGetGroups requestPurposeField (boolean value) { - this.requestField("purpose", value); - return this; - } - public APIRequestGetGroups requestSubdomainField () { - return this.requestSubdomainField(true); - } - public APIRequestGetGroups requestSubdomainField (boolean value) { - this.requestField("subdomain", value); - return this; - } - public APIRequestGetGroups requestUpdatedTimeField () { - return this.requestUpdatedTimeField(true); - } - public APIRequestGetGroups requestUpdatedTimeField (boolean value) { - this.requestField("updated_time", value); - return this; - } - public APIRequestGetGroups requestVenueField () { - return this.requestVenueField(true); - } - public APIRequestGetGroups requestVenueField (boolean value) { - this.requestField("venue", value); - return this; - } - } - public static class APIRequestGetImageCopyrights extends APIRequest { APINodeList lastResponse = null; @@ -22465,10 +21976,6 @@ public APIRequestCreatePassThreadControl setRecipient (String recipient) { return this; } - public APIRequestCreatePassThreadControl setTargetAppId (Long targetAppId) { - this.setParam("target_app_id", targetAppId); - return this; - } public APIRequestCreatePassThreadControl setTargetAppId (String targetAppId) { this.setParam("target_app_id", targetAppId); return this; @@ -28901,6 +28408,7 @@ public APINodeList getLastResponse() { "post_id", "status", "url", + "id", }; @Override @@ -29054,6 +28562,13 @@ public APIRequestGetStories requestUrlField (boolean value) { this.requestField("url", value); return this; } + public APIRequestGetStories requestIdField () { + return this.requestIdField(true); + } + public APIRequestGetStories requestIdField (boolean value) { + this.requestField("id", value); + return this; + } } public static class APIRequestDeleteSubscribedApps extends APIRequest { @@ -33745,7 +33260,6 @@ public AdVideo getLastResponse() { } public static final String[] PARAMS = { "ad_breaks", - "animated_effect_id", "application_id", "asked_fun_fact_prompt_id", "audio_story_wave_animation_handle", @@ -33903,15 +33417,6 @@ public APIRequestCreateVideo setAdBreaks (String adBreaks) { return this; } - public APIRequestCreateVideo setAnimatedEffectId (Long animatedEffectId) { - this.setParam("animated_effect_id", animatedEffectId); - return this; - } - public APIRequestCreateVideo setAnimatedEffectId (String animatedEffectId) { - this.setParam("animated_effect_id", animatedEffectId); - return this; - } - public APIRequestCreateVideo setApplicationId (String applicationId) { this.setParam("application_id", applicationId); return this; @@ -35311,10 +34816,12 @@ public APINodeList getLastResponse() { "compatible_platforms", "eligible_platforms", "id", + "is_ig_only_flow", "is_used_in_ad", "last_update_time", "name", "welcome_message_flow", + "welcome_message_sequence", }; @Override @@ -35438,6 +34945,13 @@ public APIRequestGetWelcomeMessageFlows requestIdField (boolean value) { this.requestField("id", value); return this; } + public APIRequestGetWelcomeMessageFlows requestIsIgOnlyFlowField () { + return this.requestIsIgOnlyFlowField(true); + } + public APIRequestGetWelcomeMessageFlows requestIsIgOnlyFlowField (boolean value) { + this.requestField("is_ig_only_flow", value); + return this; + } public APIRequestGetWelcomeMessageFlows requestIsUsedInAdField () { return this.requestIsUsedInAdField(true); } @@ -35466,6 +34980,13 @@ public APIRequestGetWelcomeMessageFlows requestWelcomeMessageFlowField (boolean this.requestField("welcome_message_flow", value); return this; } + public APIRequestGetWelcomeMessageFlows requestWelcomeMessageSequenceField () { + return this.requestWelcomeMessageSequenceField(true); + } + public APIRequestGetWelcomeMessageFlows requestWelcomeMessageSequenceField (boolean value) { + this.requestField("welcome_message_sequence", value); + return this; + } } public static class APIRequestCreateWelcomeMessageFlow extends APIRequest { @@ -38107,6 +37628,8 @@ public static enum EnumMessagingType { VALUE_RESPONSE("RESPONSE"), @SerializedName("UPDATE") VALUE_UPDATE("UPDATE"), + @SerializedName("UTILITY") + VALUE_UTILITY("UTILITY"), ; private String value; @@ -38296,6 +37819,8 @@ public static enum EnumSubscribedFields { VALUE_BIO("bio"), @SerializedName("birthday") VALUE_BIRTHDAY("birthday"), + @SerializedName("call_permission_reply") + VALUE_CALL_PERMISSION_REPLY("call_permission_reply"), @SerializedName("calls") VALUE_CALLS("calls"), @SerializedName("category") @@ -38396,6 +37921,8 @@ public static enum EnumSubscribedFields { VALUE_MESSAGING_HANDOVERS("messaging_handovers"), @SerializedName("messaging_in_thread_lead_form_submit") VALUE_MESSAGING_IN_THREAD_LEAD_FORM_SUBMIT("messaging_in_thread_lead_form_submit"), + @SerializedName("messaging_integrity") + VALUE_MESSAGING_INTEGRITY("messaging_integrity"), @SerializedName("messaging_optins") VALUE_MESSAGING_OPTINS("messaging_optins"), @SerializedName("messaging_optouts") @@ -38617,6 +38144,8 @@ public static enum EnumEligiblePlatforms { VALUE_INSTAGRAM("INSTAGRAM"), @SerializedName("MESSENGER") VALUE_MESSENGER("MESSENGER"), + @SerializedName("WHATSAPP") + VALUE_WHATSAPP("WHATSAPP"), ; private String value; diff --git a/src/main/java/com/facebook/ads/sdk/CPASSetupCatalogProgress.java b/src/main/java/com/facebook/ads/sdk/PageCTXMessagingFeatureLimit.java similarity index 60% rename from src/main/java/com/facebook/ads/sdk/CPASSetupCatalogProgress.java rename to src/main/java/com/facebook/ads/sdk/PageCTXMessagingFeatureLimit.java index 34a0205f..f52a5680 100644 --- a/src/main/java/com/facebook/ads/sdk/CPASSetupCatalogProgress.java +++ b/src/main/java/com/facebook/ads/sdk/PageCTXMessagingFeatureLimit.java @@ -40,31 +40,27 @@ * pull request for this class. * */ -public class CPASSetupCatalogProgress extends APINode { - @SerializedName("child_catalog_count") - private Long mChildCatalogCount = null; - @SerializedName("child_catalog_issues") - private List mChildCatalogIssues = null; - @SerializedName("id") - private String mId = null; - @SerializedName("issues") - private List mIssues = null; - @SerializedName("name") - private String mName = null; +public class PageCTXMessagingFeatureLimit extends APINode { + @SerializedName("messaging_feature_limit_duration") + private Long mMessagingFeatureLimitDuration = null; + @SerializedName("messaging_feature_limit_type") + private String mMessagingFeatureLimitType = null; + @SerializedName("messaging_violation_type") + private String mMessagingViolationType = null; protected static Gson gson = null; - public CPASSetupCatalogProgress() { + public PageCTXMessagingFeatureLimit() { } public String getId() { - return getFieldId().toString(); + return null; } - public static CPASSetupCatalogProgress loadJSON(String json, APIContext context, String header) { - CPASSetupCatalogProgress cpasSetupCatalogProgress = getGson().fromJson(json, CPASSetupCatalogProgress.class); + public static PageCTXMessagingFeatureLimit loadJSON(String json, APIContext context, String header) { + PageCTXMessagingFeatureLimit pageCTXMessagingFeatureLimit = getGson().fromJson(json, PageCTXMessagingFeatureLimit.class); if (context.isDebug()) { JsonParser parser = new JsonParser(); JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(cpasSetupCatalogProgress.toString()); + JsonElement o2 = parser.parse(pageCTXMessagingFeatureLimit.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -74,14 +70,14 @@ public static CPASSetupCatalogProgress loadJSON(String json, APIContext context, context.log("[Object]" + o2); } } - cpasSetupCatalogProgress.context = context; - cpasSetupCatalogProgress.rawValue = json; - cpasSetupCatalogProgress.header = header; - return cpasSetupCatalogProgress; + pageCTXMessagingFeatureLimit.context = context; + pageCTXMessagingFeatureLimit.rawValue = json; + pageCTXMessagingFeatureLimit.header = header; + return pageCTXMessagingFeatureLimit; } - public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { - APINodeList cpasSetupCatalogProgresss = new APINodeList(request, json, header); + public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { + APINodeList pageCTXMessagingFeatureLimits = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; JsonParser parser = new JsonParser(); @@ -92,9 +88,9 @@ public static APINodeList parseResponse(String json, A // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); for (int i = 0; i < arr.size(); i++) { - cpasSetupCatalogProgresss.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); + pageCTXMessagingFeatureLimits.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); }; - return cpasSetupCatalogProgresss; + return pageCTXMessagingFeatureLimits; } else if (result.isJsonObject()) { obj = result.getAsJsonObject(); if (obj.has("data")) { @@ -104,20 +100,20 @@ public static APINodeList parseResponse(String json, A 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; - cpasSetupCatalogProgresss.setCursors(before, after); + pageCTXMessagingFeatureLimits.setCursors(before, after); } String previous = paging.has("previous") ? paging.get("previous").getAsString() : null; String next = paging.has("next") ? paging.get("next").getAsString() : null; - cpasSetupCatalogProgresss.setPaging(previous, next); + pageCTXMessagingFeatureLimits.setPaging(previous, next); if (context.hasAppSecret()) { - cpasSetupCatalogProgresss.setAppSecret(context.getAppSecretProof()); + pageCTXMessagingFeatureLimits.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++) { - cpasSetupCatalogProgresss.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); + pageCTXMessagingFeatureLimits.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" @@ -128,23 +124,23 @@ public static APINodeList parseResponse(String json, A isRedownload = true; obj = obj.getAsJsonObject(s); for (Map.Entry entry : obj.entrySet()) { - cpasSetupCatalogProgresss.add(loadJSON(entry.getValue().toString(), context, header)); + pageCTXMessagingFeatureLimits.add(loadJSON(entry.getValue().toString(), context, header)); } break; } } if (!isRedownload) { - cpasSetupCatalogProgresss.add(loadJSON(obj.toString(), context, header)); + pageCTXMessagingFeatureLimits.add(loadJSON(obj.toString(), context, header)); } } - return cpasSetupCatalogProgresss; + return pageCTXMessagingFeatureLimits; } 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()) { - cpasSetupCatalogProgresss.add(loadJSON(entry.getValue().toString(), context, header)); + pageCTXMessagingFeatureLimits.add(loadJSON(entry.getValue().toString(), context, header)); } - return cpasSetupCatalogProgresss; + return pageCTXMessagingFeatureLimits; } else { // Fifth, check if it's an array of objects indexed by id boolean isIdIndexedArray = true; @@ -161,20 +157,20 @@ public static APINodeList parseResponse(String json, A value.getAsJsonObject().get("id") != null && value.getAsJsonObject().get("id").getAsString().equals(key) ) { - cpasSetupCatalogProgresss.add(loadJSON(value.toString(), context, header)); + pageCTXMessagingFeatureLimits.add(loadJSON(value.toString(), context, header)); } else { isIdIndexedArray = false; break; } } if (isIdIndexedArray) { - return cpasSetupCatalogProgresss; + return pageCTXMessagingFeatureLimits; } // Sixth, check if it's pure JsonObject - cpasSetupCatalogProgresss.clear(); - cpasSetupCatalogProgresss.add(loadJSON(json, context, header)); - return cpasSetupCatalogProgresss; + pageCTXMessagingFeatureLimits.clear(); + pageCTXMessagingFeatureLimits.add(loadJSON(json, context, header)); + return pageCTXMessagingFeatureLimits; } } } catch (Exception e) { @@ -202,48 +198,30 @@ public String toString() { } - public Long getFieldChildCatalogCount() { - return mChildCatalogCount; + public Long getFieldMessagingFeatureLimitDuration() { + return mMessagingFeatureLimitDuration; } - public CPASSetupCatalogProgress setFieldChildCatalogCount(Long value) { - this.mChildCatalogCount = value; + public PageCTXMessagingFeatureLimit setFieldMessagingFeatureLimitDuration(Long value) { + this.mMessagingFeatureLimitDuration = value; return this; } - public List getFieldChildCatalogIssues() { - return mChildCatalogIssues; + public String getFieldMessagingFeatureLimitType() { + return mMessagingFeatureLimitType; } - public CPASSetupCatalogProgress setFieldChildCatalogIssues(List value) { - this.mChildCatalogIssues = value; + public PageCTXMessagingFeatureLimit setFieldMessagingFeatureLimitType(String value) { + this.mMessagingFeatureLimitType = value; return this; } - public String getFieldId() { - return mId; + public String getFieldMessagingViolationType() { + return mMessagingViolationType; } - public CPASSetupCatalogProgress setFieldId(String value) { - this.mId = value; - return this; - } - - public List getFieldIssues() { - return mIssues; - } - - public CPASSetupCatalogProgress setFieldIssues(List value) { - this.mIssues = value; - return this; - } - - public String getFieldName() { - return mName; - } - - public CPASSetupCatalogProgress setFieldName(String value) { - this.mName = value; + public PageCTXMessagingFeatureLimit setFieldMessagingViolationType(String value) { + this.mMessagingViolationType = value; return this; } @@ -263,21 +241,19 @@ public CPASSetupCatalogProgress setFieldName(String value) { return gson; } - public CPASSetupCatalogProgress copyFrom(CPASSetupCatalogProgress instance) { - this.mChildCatalogCount = instance.mChildCatalogCount; - this.mChildCatalogIssues = instance.mChildCatalogIssues; - this.mId = instance.mId; - this.mIssues = instance.mIssues; - this.mName = instance.mName; + public PageCTXMessagingFeatureLimit copyFrom(PageCTXMessagingFeatureLimit instance) { + this.mMessagingFeatureLimitDuration = instance.mMessagingFeatureLimitDuration; + this.mMessagingFeatureLimitType = instance.mMessagingFeatureLimitType; + this.mMessagingViolationType = instance.mMessagingViolationType; 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 CPASSetupCatalogProgress.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 PageCTXMessagingFeatureLimit.parseResponse(response, context, request, header); } }; } diff --git a/src/main/java/com/facebook/ads/sdk/ProductCatalog.java b/src/main/java/com/facebook/ads/sdk/ProductCatalog.java index a1b2362c..6163db12 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductCatalog.java +++ b/src/main/java/com/facebook/ads/sdk/ProductCatalog.java @@ -986,7 +986,7 @@ public ProductCatalog getLastResponse() { "business", "permitted_roles", "permitted_tasks", - "skip_default_utms", + "skip_defaults", "utm_settings", }; @@ -1070,12 +1070,12 @@ public APIRequestCreateAgency setPermittedTasks (String permittedTasks) { return this; } - public APIRequestCreateAgency setSkipDefaultUtms (Boolean skipDefaultUtms) { - this.setParam("skip_default_utms", skipDefaultUtms); + public APIRequestCreateAgency setSkipDefaults (Boolean skipDefaults) { + this.setParam("skip_defaults", skipDefaults); return this; } - public APIRequestCreateAgency setSkipDefaultUtms (String skipDefaultUtms) { - this.setParam("skip_default_utms", skipDefaultUtms); + public APIRequestCreateAgency setSkipDefaults (String skipDefaults) { + this.setParam("skip_defaults", skipDefaults); return this; } @@ -8157,6 +8157,8 @@ public APINodeList getLastResponse() { "applinks", "availability", "brand", + "bundle_items", + "bundle_retailer_ids", "capability_to_review_status", "category", "category_specific_fields", @@ -8190,6 +8192,7 @@ public APINodeList getLastResponse() { "importer_name", "invalidation_errors", "inventory", + "is_bundle_hero", "manufacturer_info", "manufacturer_part_number", "marked_for_product_launch", @@ -8411,6 +8414,20 @@ public APIRequestGetProducts requestBrandField (boolean value) { this.requestField("brand", value); return this; } + public APIRequestGetProducts requestBundleItemsField () { + return this.requestBundleItemsField(true); + } + public APIRequestGetProducts requestBundleItemsField (boolean value) { + this.requestField("bundle_items", value); + return this; + } + public APIRequestGetProducts requestBundleRetailerIdsField () { + return this.requestBundleRetailerIdsField(true); + } + public APIRequestGetProducts requestBundleRetailerIdsField (boolean value) { + this.requestField("bundle_retailer_ids", value); + return this; + } public APIRequestGetProducts requestCapabilityToReviewStatusField () { return this.requestCapabilityToReviewStatusField(true); } @@ -8642,6 +8659,13 @@ public APIRequestGetProducts requestInventoryField (boolean value) { this.requestField("inventory", value); return this; } + public APIRequestGetProducts requestIsBundleHeroField () { + return this.requestIsBundleHeroField(true); + } + public APIRequestGetProducts requestIsBundleHeroField (boolean value) { + this.requestField("is_bundle_hero", value); + return this; + } public APIRequestGetProducts requestManufacturerInfoField () { return this.requestManufacturerInfoField(true); } @@ -8898,7 +8922,6 @@ public ProductItem getLastResponse() { } public static final String[] PARAMS = { "additional_image_urls", - "additional_uploaded_image_ids", "additional_variant_attributes", "android_app_name", "android_class", @@ -8953,6 +8976,11 @@ public ProductItem getLastResponse() { "origin_country", "pattern", "price", + "product_priority_0", + "product_priority_1", + "product_priority_2", + "product_priority_3", + "product_priority_4", "product_type", "quantity_to_sell_on_facebook", "retailer_id", @@ -9038,15 +9066,6 @@ public APIRequestCreateProduct setAdditionalImageUrls (String additionalImageUrl return this; } - public APIRequestCreateProduct setAdditionalUploadedImageIds (List additionalUploadedImageIds) { - this.setParam("additional_uploaded_image_ids", additionalUploadedImageIds); - return this; - } - public APIRequestCreateProduct setAdditionalUploadedImageIds (String additionalUploadedImageIds) { - this.setParam("additional_uploaded_image_ids", additionalUploadedImageIds); - return this; - } - public APIRequestCreateProduct setAdditionalVariantAttributes (Map additionalVariantAttributes) { this.setParam("additional_variant_attributes", additionalVariantAttributes); return this; @@ -9401,6 +9420,51 @@ public APIRequestCreateProduct setPrice (String price) { return this; } + public APIRequestCreateProduct setProductPriority0 (Double productPriority0) { + this.setParam("product_priority_0", productPriority0); + return this; + } + public APIRequestCreateProduct setProductPriority0 (String productPriority0) { + this.setParam("product_priority_0", productPriority0); + return this; + } + + public APIRequestCreateProduct setProductPriority1 (Double productPriority1) { + this.setParam("product_priority_1", productPriority1); + return this; + } + public APIRequestCreateProduct setProductPriority1 (String productPriority1) { + this.setParam("product_priority_1", productPriority1); + return this; + } + + public APIRequestCreateProduct setProductPriority2 (Double productPriority2) { + this.setParam("product_priority_2", productPriority2); + return this; + } + public APIRequestCreateProduct setProductPriority2 (String productPriority2) { + this.setParam("product_priority_2", productPriority2); + return this; + } + + public APIRequestCreateProduct setProductPriority3 (Double productPriority3) { + this.setParam("product_priority_3", productPriority3); + return this; + } + public APIRequestCreateProduct setProductPriority3 (String productPriority3) { + this.setParam("product_priority_3", productPriority3); + return this; + } + + public APIRequestCreateProduct setProductPriority4 (Double productPriority4) { + this.setParam("product_priority_4", productPriority4); + return this; + } + public APIRequestCreateProduct setProductPriority4 (String productPriority4) { + this.setParam("product_priority_4", productPriority4); + return this; + } + public APIRequestCreateProduct setProductType (String productType) { this.setParam("product_type", productType); return this; diff --git a/src/main/java/com/facebook/ads/sdk/VidwallaBroadcast.java b/src/main/java/com/facebook/ads/sdk/ProductDeliveryPreference.java similarity index 59% rename from src/main/java/com/facebook/ads/sdk/VidwallaBroadcast.java rename to src/main/java/com/facebook/ads/sdk/ProductDeliveryPreference.java index 5f99862a..8c014da1 100644 --- a/src/main/java/com/facebook/ads/sdk/VidwallaBroadcast.java +++ b/src/main/java/com/facebook/ads/sdk/ProductDeliveryPreference.java @@ -40,66 +40,70 @@ * pull request for this class. * */ -public class VidwallaBroadcast extends APINode { +public class ProductDeliveryPreference extends APINode { + @SerializedName("ad_object_id") + private String mAdObjectId = null; @SerializedName("id") private String mId = null; - @SerializedName("overlay_url") - private String mOverlayUrl = null; + @SerializedName("product_priority") + private String mProductPriority = null; + @SerializedName("product_priority_category") + private List mProductPriorityCategory = null; protected static Gson gson = null; - VidwallaBroadcast() { + ProductDeliveryPreference() { } - public VidwallaBroadcast(Long id, APIContext context) { + public ProductDeliveryPreference(Long id, APIContext context) { this(id.toString(), context); } - public VidwallaBroadcast(String id, APIContext context) { + public ProductDeliveryPreference(String id, APIContext context) { this.mId = id; this.context = context; } - public VidwallaBroadcast fetch() throws APIException{ - VidwallaBroadcast newInstance = fetchById(this.getPrefixedId().toString(), this.context); + public ProductDeliveryPreference fetch() throws APIException{ + ProductDeliveryPreference newInstance = fetchById(this.getPrefixedId().toString(), this.context); this.copyFrom(newInstance); return this; } - public static VidwallaBroadcast fetchById(Long id, APIContext context) throws APIException { + public static ProductDeliveryPreference 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 VidwallaBroadcast fetchById(String id, APIContext context) throws APIException { + public static ProductDeliveryPreference 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", VidwallaBroadcast.getParser()) + public static APINodeList fetchByIds(List ids, List fields, APIContext context) throws APIException { + return (APINodeList)( + new APIRequest(context, "", "/", "GET", ProductDeliveryPreference.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", VidwallaBroadcast.getParser()) + new APIRequest(context, "", "/", "GET", ProductDeliveryPreference.getParser()) .setParam("ids", APIRequest.joinStringList(ids)) .requestFields(fields) .executeAsyncBase(); @@ -112,12 +116,12 @@ private String getPrefixedId() { public String getId() { return getFieldId().toString(); } - public static VidwallaBroadcast loadJSON(String json, APIContext context, String header) { - VidwallaBroadcast vidwallaBroadcast = getGson().fromJson(json, VidwallaBroadcast.class); + public static ProductDeliveryPreference loadJSON(String json, APIContext context, String header) { + ProductDeliveryPreference productDeliveryPreference = getGson().fromJson(json, ProductDeliveryPreference.class); if (context.isDebug()) { JsonParser parser = new JsonParser(); JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(vidwallaBroadcast.toString()); + JsonElement o2 = parser.parse(productDeliveryPreference.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -127,14 +131,14 @@ public static VidwallaBroadcast loadJSON(String json, APIContext context, String context.log("[Object]" + o2); } } - vidwallaBroadcast.context = context; - vidwallaBroadcast.rawValue = json; - vidwallaBroadcast.header = header; - return vidwallaBroadcast; + productDeliveryPreference.context = context; + productDeliveryPreference.rawValue = json; + productDeliveryPreference.header = header; + return productDeliveryPreference; } - public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { - APINodeList vidwallaBroadcasts = new APINodeList(request, json, header); + public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { + APINodeList productDeliveryPreferences = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; JsonParser parser = new JsonParser(); @@ -145,9 +149,9 @@ public static APINodeList parseResponse(String json, APIConte // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); for (int i = 0; i < arr.size(); i++) { - vidwallaBroadcasts.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); + productDeliveryPreferences.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); }; - return vidwallaBroadcasts; + return productDeliveryPreferences; } else if (result.isJsonObject()) { obj = result.getAsJsonObject(); if (obj.has("data")) { @@ -157,20 +161,20 @@ public static APINodeList parseResponse(String json, APIConte 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; - vidwallaBroadcasts.setCursors(before, after); + productDeliveryPreferences.setCursors(before, after); } String previous = paging.has("previous") ? paging.get("previous").getAsString() : null; String next = paging.has("next") ? paging.get("next").getAsString() : null; - vidwallaBroadcasts.setPaging(previous, next); + productDeliveryPreferences.setPaging(previous, next); if (context.hasAppSecret()) { - vidwallaBroadcasts.setAppSecret(context.getAppSecretProof()); + productDeliveryPreferences.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++) { - vidwallaBroadcasts.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); + productDeliveryPreferences.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" @@ -181,23 +185,23 @@ public static APINodeList parseResponse(String json, APIConte isRedownload = true; obj = obj.getAsJsonObject(s); for (Map.Entry entry : obj.entrySet()) { - vidwallaBroadcasts.add(loadJSON(entry.getValue().toString(), context, header)); + productDeliveryPreferences.add(loadJSON(entry.getValue().toString(), context, header)); } break; } } if (!isRedownload) { - vidwallaBroadcasts.add(loadJSON(obj.toString(), context, header)); + productDeliveryPreferences.add(loadJSON(obj.toString(), context, header)); } } - return vidwallaBroadcasts; + return productDeliveryPreferences; } 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()) { - vidwallaBroadcasts.add(loadJSON(entry.getValue().toString(), context, header)); + productDeliveryPreferences.add(loadJSON(entry.getValue().toString(), context, header)); } - return vidwallaBroadcasts; + return productDeliveryPreferences; } else { // Fifth, check if it's an array of objects indexed by id boolean isIdIndexedArray = true; @@ -214,20 +218,20 @@ public static APINodeList parseResponse(String json, APIConte value.getAsJsonObject().get("id") != null && value.getAsJsonObject().get("id").getAsString().equals(key) ) { - vidwallaBroadcasts.add(loadJSON(value.toString(), context, header)); + productDeliveryPreferences.add(loadJSON(value.toString(), context, header)); } else { isIdIndexedArray = false; break; } } if (isIdIndexedArray) { - return vidwallaBroadcasts; + return productDeliveryPreferences; } // Sixth, check if it's pure JsonObject - vidwallaBroadcasts.clear(); - vidwallaBroadcasts.add(loadJSON(json, context, header)); - return vidwallaBroadcasts; + productDeliveryPreferences.clear(); + productDeliveryPreferences.add(loadJSON(json, context, header)); + return productDeliveryPreferences; } } } catch (Exception e) { @@ -259,57 +263,67 @@ public APIRequestGet get() { } + public String getFieldAdObjectId() { + return mAdObjectId; + } + public String getFieldId() { return mId; } - public String getFieldOverlayUrl() { - return mOverlayUrl; + public String getFieldProductPriority() { + return mProductPriority; } + public List getFieldProductPriorityCategory() { + return mProductPriorityCategory; + } - public static class APIRequestGet extends APIRequest { - VidwallaBroadcast lastResponse = null; + public static class APIRequestGet extends APIRequest { + + ProductDeliveryPreference lastResponse = null; @Override - public VidwallaBroadcast getLastResponse() { + public ProductDeliveryPreference getLastResponse() { return lastResponse; } public static final String[] PARAMS = { }; public static final String[] FIELDS = { + "ad_object_id", "id", - "overlay_url", + "product_priority", + "product_priority_category", }; @Override - public VidwallaBroadcast parseResponse(String response, String header) throws APIException { - return VidwallaBroadcast.parseResponse(response, getContext(), this, header).head(); + public ProductDeliveryPreference parseResponse(String response, String header) throws APIException { + return ProductDeliveryPreference.parseResponse(response, getContext(), this, header).head(); } @Override - public VidwallaBroadcast execute() throws APIException { + public ProductDeliveryPreference execute() throws APIException { return execute(new HashMap()); } @Override - public VidwallaBroadcast execute(Map extraParams) throws APIException { + public ProductDeliveryPreference 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 VidwallaBroadcast apply(ResponseWrapper result) { + new Function() { + public ProductDeliveryPreference apply(ResponseWrapper result) { try { return APIRequestGet.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { @@ -374,6 +388,13 @@ public APIRequestGet requestField (String field, boolean value) { return this; } + public APIRequestGet requestAdObjectIdField () { + return this.requestAdObjectIdField(true); + } + public APIRequestGet requestAdObjectIdField (boolean value) { + this.requestField("ad_object_id", value); + return this; + } public APIRequestGet requestIdField () { return this.requestIdField(true); } @@ -381,11 +402,18 @@ public APIRequestGet requestIdField (boolean value) { this.requestField("id", value); return this; } - public APIRequestGet requestOverlayUrlField () { - return this.requestOverlayUrlField(true); + public APIRequestGet requestProductPriorityField () { + return this.requestProductPriorityField(true); + } + public APIRequestGet requestProductPriorityField (boolean value) { + this.requestField("product_priority", value); + return this; + } + public APIRequestGet requestProductPriorityCategoryField () { + return this.requestProductPriorityCategoryField(true); } - public APIRequestGet requestOverlayUrlField (boolean value) { - this.requestField("overlay_url", value); + public APIRequestGet requestProductPriorityCategoryField (boolean value) { + this.requestField("product_priority_category", value); return this; } } @@ -404,18 +432,20 @@ public APIRequestGet requestOverlayUrlField (boolean value) { return gson; } - public VidwallaBroadcast copyFrom(VidwallaBroadcast instance) { + public ProductDeliveryPreference copyFrom(ProductDeliveryPreference instance) { + this.mAdObjectId = instance.mAdObjectId; this.mId = instance.mId; - this.mOverlayUrl = instance.mOverlayUrl; + this.mProductPriority = instance.mProductPriority; + this.mProductPriorityCategory = instance.mProductPriorityCategory; 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 VidwallaBroadcast.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 ProductDeliveryPreference.parseResponse(response, context, request, header); } }; } diff --git a/src/main/java/com/facebook/ads/sdk/ProductFeed.java b/src/main/java/com/facebook/ads/sdk/ProductFeed.java index 1921bf1f..730e95ef 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductFeed.java +++ b/src/main/java/com/facebook/ads/sdk/ProductFeed.java @@ -2502,6 +2502,8 @@ public APINodeList getLastResponse() { "applinks", "availability", "brand", + "bundle_items", + "bundle_retailer_ids", "capability_to_review_status", "category", "category_specific_fields", @@ -2535,6 +2537,7 @@ public APINodeList getLastResponse() { "importer_name", "invalidation_errors", "inventory", + "is_bundle_hero", "manufacturer_info", "manufacturer_part_number", "marked_for_product_launch", @@ -2747,6 +2750,20 @@ public APIRequestGetProducts requestBrandField (boolean value) { this.requestField("brand", value); return this; } + public APIRequestGetProducts requestBundleItemsField () { + return this.requestBundleItemsField(true); + } + public APIRequestGetProducts requestBundleItemsField (boolean value) { + this.requestField("bundle_items", value); + return this; + } + public APIRequestGetProducts requestBundleRetailerIdsField () { + return this.requestBundleRetailerIdsField(true); + } + public APIRequestGetProducts requestBundleRetailerIdsField (boolean value) { + this.requestField("bundle_retailer_ids", value); + return this; + } public APIRequestGetProducts requestCapabilityToReviewStatusField () { return this.requestCapabilityToReviewStatusField(true); } @@ -2978,6 +2995,13 @@ public APIRequestGetProducts requestInventoryField (boolean value) { this.requestField("inventory", value); return this; } + public APIRequestGetProducts requestIsBundleHeroField () { + return this.requestIsBundleHeroField(true); + } + public APIRequestGetProducts requestIsBundleHeroField (boolean value) { + this.requestField("is_bundle_hero", value); + return this; + } public APIRequestGetProducts requestManufacturerInfoField () { return this.requestManufacturerInfoField(true); } diff --git a/src/main/java/com/facebook/ads/sdk/ProductGroup.java b/src/main/java/com/facebook/ads/sdk/ProductGroup.java index be506fec..e96aa431 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductGroup.java +++ b/src/main/java/com/facebook/ads/sdk/ProductGroup.java @@ -318,6 +318,8 @@ public APINodeList getLastResponse() { "applinks", "availability", "brand", + "bundle_items", + "bundle_retailer_ids", "capability_to_review_status", "category", "category_specific_fields", @@ -351,6 +353,7 @@ public APINodeList getLastResponse() { "importer_name", "invalidation_errors", "inventory", + "is_bundle_hero", "manufacturer_info", "manufacturer_part_number", "marked_for_product_launch", @@ -527,6 +530,20 @@ public APIRequestGetProducts requestBrandField (boolean value) { this.requestField("brand", value); return this; } + public APIRequestGetProducts requestBundleItemsField () { + return this.requestBundleItemsField(true); + } + public APIRequestGetProducts requestBundleItemsField (boolean value) { + this.requestField("bundle_items", value); + return this; + } + public APIRequestGetProducts requestBundleRetailerIdsField () { + return this.requestBundleRetailerIdsField(true); + } + public APIRequestGetProducts requestBundleRetailerIdsField (boolean value) { + this.requestField("bundle_retailer_ids", value); + return this; + } public APIRequestGetProducts requestCapabilityToReviewStatusField () { return this.requestCapabilityToReviewStatusField(true); } @@ -758,6 +775,13 @@ public APIRequestGetProducts requestInventoryField (boolean value) { this.requestField("inventory", value); return this; } + public APIRequestGetProducts requestIsBundleHeroField () { + return this.requestIsBundleHeroField(true); + } + public APIRequestGetProducts requestIsBundleHeroField (boolean value) { + this.requestField("is_bundle_hero", value); + return this; + } public APIRequestGetProducts requestManufacturerInfoField () { return this.requestManufacturerInfoField(true); } @@ -1063,6 +1087,11 @@ public ProductItem getLastResponse() { "ordering_index", "pattern", "price", + "product_priority_0", + "product_priority_1", + "product_priority_2", + "product_priority_3", + "product_priority_4", "product_type", "quantity_to_sell_on_facebook", "retailer_id", @@ -1463,6 +1492,51 @@ public APIRequestCreateProduct setPrice (String price) { return this; } + public APIRequestCreateProduct setProductPriority0 (Double productPriority0) { + this.setParam("product_priority_0", productPriority0); + return this; + } + public APIRequestCreateProduct setProductPriority0 (String productPriority0) { + this.setParam("product_priority_0", productPriority0); + return this; + } + + public APIRequestCreateProduct setProductPriority1 (Double productPriority1) { + this.setParam("product_priority_1", productPriority1); + return this; + } + public APIRequestCreateProduct setProductPriority1 (String productPriority1) { + this.setParam("product_priority_1", productPriority1); + return this; + } + + public APIRequestCreateProduct setProductPriority2 (Double productPriority2) { + this.setParam("product_priority_2", productPriority2); + return this; + } + public APIRequestCreateProduct setProductPriority2 (String productPriority2) { + this.setParam("product_priority_2", productPriority2); + return this; + } + + public APIRequestCreateProduct setProductPriority3 (Double productPriority3) { + this.setParam("product_priority_3", productPriority3); + return this; + } + public APIRequestCreateProduct setProductPriority3 (String productPriority3) { + this.setParam("product_priority_3", productPriority3); + return this; + } + + public APIRequestCreateProduct setProductPriority4 (Double productPriority4) { + this.setParam("product_priority_4", productPriority4); + return this; + } + public APIRequestCreateProduct setProductPriority4 (String productPriority4) { + this.setParam("product_priority_4", productPriority4); + return this; + } + public APIRequestCreateProduct setProductType (String productType) { this.setParam("product_type", productType); return this; diff --git a/src/main/java/com/facebook/ads/sdk/ProductItem.java b/src/main/java/com/facebook/ads/sdk/ProductItem.java index 0562564e..5f485237 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductItem.java +++ b/src/main/java/com/facebook/ads/sdk/ProductItem.java @@ -55,6 +55,10 @@ public class ProductItem extends APINode { private EnumAvailability mAvailability = null; @SerializedName("brand") private String mBrand = null; + @SerializedName("bundle_items") + private List mBundleItems = null; + @SerializedName("bundle_retailer_ids") + private List mBundleRetailerIds = null; @SerializedName("capability_to_review_status") private List> mCapabilityToReviewStatus = null; @SerializedName("category") @@ -121,6 +125,8 @@ public class ProductItem extends APINode { private List mInvalidationErrors = null; @SerializedName("inventory") private Long mInventory = null; + @SerializedName("is_bundle_hero") + private Boolean mIsBundleHero = null; @SerializedName("manufacturer_info") private String mManufacturerInfo = null; @SerializedName("manufacturer_part_number") @@ -404,6 +410,10 @@ public APIRequestGetChannelsToIntegrityStatus getChannelsToIntegrityStatus() { return new APIRequestGetChannelsToIntegrityStatus(this.getPrefixedId().toString(), context); } + public APIRequestGetOverrideDetails getOverrideDetails() { + return new APIRequestGetOverrideDetails(this.getPrefixedId().toString(), context); + } + public APIRequestGetProductSets getProductSets() { return new APIRequestGetProductSets(this.getPrefixedId().toString(), context); } @@ -453,6 +463,14 @@ public String getFieldBrand() { return mBrand; } + public List getFieldBundleItems() { + return mBundleItems; + } + + public List getFieldBundleRetailerIds() { + return mBundleRetailerIds; + } + public List> getFieldCapabilityToReviewStatus() { return mCapabilityToReviewStatus; } @@ -585,6 +603,10 @@ public Long getFieldInventory() { return mInventory; } + public Boolean getFieldIsBundleHero() { + return mIsBundleHero; + } + public String getFieldManufacturerInfo() { return mManufacturerInfo; } @@ -860,6 +882,155 @@ public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField ( } } + public static class APIRequestGetOverrideDetails extends APIRequest { + + APINodeList lastResponse = null; + @Override + public APINodeList getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "keys", + "type", + }; + + public static final String[] FIELDS = { + "key", + "type", + "values", + }; + + @Override + public APINodeList parseResponse(String response, String header) throws APIException { + return OverrideDetails.parseResponse(response, getContext(), this, header); + } + + @Override + public APINodeList execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + try { + return APIRequestGetOverrideDetails.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestGetOverrideDetails(String nodeId, APIContext context) { + super(context, nodeId, "/override_details", "GET", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestGetOverrideDetails setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestGetOverrideDetails setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestGetOverrideDetails setKeys (List keys) { + this.setParam("keys", keys); + return this; + } + public APIRequestGetOverrideDetails setKeys (String keys) { + this.setParam("keys", keys); + return this; + } + + public APIRequestGetOverrideDetails setType (OverrideDetails.EnumType type) { + this.setParam("type", type); + return this; + } + public APIRequestGetOverrideDetails setType (String type) { + this.setParam("type", type); + return this; + } + + public APIRequestGetOverrideDetails requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestGetOverrideDetails requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetOverrideDetails requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestGetOverrideDetails requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetOverrideDetails requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestGetOverrideDetails requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + public APIRequestGetOverrideDetails requestKeyField () { + return this.requestKeyField(true); + } + public APIRequestGetOverrideDetails requestKeyField (boolean value) { + this.requestField("key", value); + return this; + } + public APIRequestGetOverrideDetails requestTypeField () { + return this.requestTypeField(true); + } + public APIRequestGetOverrideDetails requestTypeField (boolean value) { + this.requestField("type", value); + return this; + } + public APIRequestGetOverrideDetails requestValuesField () { + return this.requestValuesField(true); + } + public APIRequestGetOverrideDetails requestValuesField (boolean value) { + this.requestField("values", value); + return this; + } + } + public static class APIRequestGetProductSets extends APIRequest { APINodeList lastResponse = null; @@ -1310,6 +1481,8 @@ public ProductItem getLastResponse() { "applinks", "availability", "brand", + "bundle_items", + "bundle_retailer_ids", "capability_to_review_status", "category", "category_specific_fields", @@ -1343,6 +1516,7 @@ public ProductItem getLastResponse() { "importer_name", "invalidation_errors", "inventory", + "is_bundle_hero", "manufacturer_info", "manufacturer_part_number", "marked_for_product_launch", @@ -1552,6 +1726,20 @@ public APIRequestGet requestBrandField (boolean value) { this.requestField("brand", value); return this; } + public APIRequestGet requestBundleItemsField () { + return this.requestBundleItemsField(true); + } + public APIRequestGet requestBundleItemsField (boolean value) { + this.requestField("bundle_items", value); + return this; + } + public APIRequestGet requestBundleRetailerIdsField () { + return this.requestBundleRetailerIdsField(true); + } + public APIRequestGet requestBundleRetailerIdsField (boolean value) { + this.requestField("bundle_retailer_ids", value); + return this; + } public APIRequestGet requestCapabilityToReviewStatusField () { return this.requestCapabilityToReviewStatusField(true); } @@ -1783,6 +1971,13 @@ public APIRequestGet requestInventoryField (boolean value) { this.requestField("inventory", value); return this; } + public APIRequestGet requestIsBundleHeroField () { + return this.requestIsBundleHeroField(true); + } + public APIRequestGet requestIsBundleHeroField (boolean value) { + this.requestField("is_bundle_hero", value); + return this; + } public APIRequestGet requestManufacturerInfoField () { return this.requestManufacturerInfoField(true); } @@ -2039,7 +2234,6 @@ public ProductItem getLastResponse() { } public static final String[] PARAMS = { "additional_image_urls", - "additional_uploaded_image_ids", "additional_variant_attributes", "android_app_name", "android_class", @@ -2094,6 +2288,11 @@ public ProductItem getLastResponse() { "origin_country", "pattern", "price", + "product_priority_0", + "product_priority_1", + "product_priority_2", + "product_priority_3", + "product_priority_4", "product_type", "quantity_to_sell_on_facebook", "retailer_id", @@ -2178,15 +2377,6 @@ public APIRequestUpdate setAdditionalImageUrls (String additionalImageUrls) { return this; } - public APIRequestUpdate setAdditionalUploadedImageIds (List additionalUploadedImageIds) { - this.setParam("additional_uploaded_image_ids", additionalUploadedImageIds); - return this; - } - public APIRequestUpdate setAdditionalUploadedImageIds (String additionalUploadedImageIds) { - this.setParam("additional_uploaded_image_ids", additionalUploadedImageIds); - return this; - } - public APIRequestUpdate setAdditionalVariantAttributes (Map additionalVariantAttributes) { this.setParam("additional_variant_attributes", additionalVariantAttributes); return this; @@ -2541,6 +2731,51 @@ public APIRequestUpdate setPrice (String price) { return this; } + public APIRequestUpdate setProductPriority0 (Double productPriority0) { + this.setParam("product_priority_0", productPriority0); + return this; + } + public APIRequestUpdate setProductPriority0 (String productPriority0) { + this.setParam("product_priority_0", productPriority0); + return this; + } + + public APIRequestUpdate setProductPriority1 (Double productPriority1) { + this.setParam("product_priority_1", productPriority1); + return this; + } + public APIRequestUpdate setProductPriority1 (String productPriority1) { + this.setParam("product_priority_1", productPriority1); + return this; + } + + public APIRequestUpdate setProductPriority2 (Double productPriority2) { + this.setParam("product_priority_2", productPriority2); + return this; + } + public APIRequestUpdate setProductPriority2 (String productPriority2) { + this.setParam("product_priority_2", productPriority2); + return this; + } + + public APIRequestUpdate setProductPriority3 (Double productPriority3) { + this.setParam("product_priority_3", productPriority3); + return this; + } + public APIRequestUpdate setProductPriority3 (String productPriority3) { + this.setParam("product_priority_3", productPriority3); + return this; + } + + public APIRequestUpdate setProductPriority4 (Double productPriority4) { + this.setParam("product_priority_4", productPriority4); + return this; + } + public APIRequestUpdate setProductPriority4 (String productPriority4) { + this.setParam("product_priority_4", productPriority4); + return this; + } + public APIRequestUpdate setProductType (String productType) { this.setParam("product_type", productType); return this; @@ -3373,6 +3608,8 @@ public static enum EnumErrorType { VALUE_BIG_CATALOG_WITH_ALL_ITEMS_IN_STOCK("BIG_CATALOG_WITH_ALL_ITEMS_IN_STOCK"), @SerializedName("BIZ_MSG_AI_AGENT_DISABLED_BY_USER") VALUE_BIZ_MSG_AI_AGENT_DISABLED_BY_USER("BIZ_MSG_AI_AGENT_DISABLED_BY_USER"), + @SerializedName("BIZ_MSG_GEN_AI_POLICY_VIOLATED") + VALUE_BIZ_MSG_GEN_AI_POLICY_VIOLATED("BIZ_MSG_GEN_AI_POLICY_VIOLATED"), @SerializedName("CANNOT_EDIT_SUBSCRIPTION_PRODUCTS") VALUE_CANNOT_EDIT_SUBSCRIPTION_PRODUCTS("CANNOT_EDIT_SUBSCRIPTION_PRODUCTS"), @SerializedName("CATALOG_NOT_CONNECTED_TO_EVENT_SOURCE") @@ -3637,6 +3874,10 @@ public static enum EnumErrorType { VALUE_VIDEO_NOT_DOWNLOADABLE("VIDEO_NOT_DOWNLOADABLE"), @SerializedName("WHATSAPP_DISABLED_BY_USER") VALUE_WHATSAPP_DISABLED_BY_USER("WHATSAPP_DISABLED_BY_USER"), + @SerializedName("WHATSAPP_MARKETING_MESSAGE_DISABLED_BY_USER") + VALUE_WHATSAPP_MARKETING_MESSAGE_DISABLED_BY_USER("WHATSAPP_MARKETING_MESSAGE_DISABLED_BY_USER"), + @SerializedName("WHATSAPP_MARKETING_MESSAGE_POLICY_VIOLATION") + VALUE_WHATSAPP_MARKETING_MESSAGE_POLICY_VIOLATION("WHATSAPP_MARKETING_MESSAGE_POLICY_VIOLATION"), @SerializedName("WHATSAPP_POLICY_VIOLATION") VALUE_WHATSAPP_POLICY_VIOLATION("WHATSAPP_POLICY_VIOLATION"), ; @@ -4232,6 +4473,8 @@ public ProductItem copyFrom(ProductItem instance) { this.mApplinks = instance.mApplinks; this.mAvailability = instance.mAvailability; this.mBrand = instance.mBrand; + this.mBundleItems = instance.mBundleItems; + this.mBundleRetailerIds = instance.mBundleRetailerIds; this.mCapabilityToReviewStatus = instance.mCapabilityToReviewStatus; this.mCategory = instance.mCategory; this.mCategorySpecificFields = instance.mCategorySpecificFields; @@ -4265,6 +4508,7 @@ public ProductItem copyFrom(ProductItem instance) { this.mImporterName = instance.mImporterName; this.mInvalidationErrors = instance.mInvalidationErrors; this.mInventory = instance.mInventory; + this.mIsBundleHero = instance.mIsBundleHero; this.mManufacturerInfo = instance.mManufacturerInfo; this.mManufacturerPartNumber = instance.mManufacturerPartNumber; this.mMarkedForProductLaunch = instance.mMarkedForProductLaunch; diff --git a/src/main/java/com/facebook/ads/sdk/ProductSet.java b/src/main/java/com/facebook/ads/sdk/ProductSet.java index aaa23148..8362e988 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductSet.java +++ b/src/main/java/com/facebook/ads/sdk/ProductSet.java @@ -2408,6 +2408,8 @@ public APINodeList getLastResponse() { "applinks", "availability", "brand", + "bundle_items", + "bundle_retailer_ids", "capability_to_review_status", "category", "category_specific_fields", @@ -2441,6 +2443,7 @@ public APINodeList getLastResponse() { "importer_name", "invalidation_errors", "inventory", + "is_bundle_hero", "manufacturer_info", "manufacturer_part_number", "marked_for_product_launch", @@ -2653,6 +2656,20 @@ public APIRequestGetProducts requestBrandField (boolean value) { this.requestField("brand", value); return this; } + public APIRequestGetProducts requestBundleItemsField () { + return this.requestBundleItemsField(true); + } + public APIRequestGetProducts requestBundleItemsField (boolean value) { + this.requestField("bundle_items", value); + return this; + } + public APIRequestGetProducts requestBundleRetailerIdsField () { + return this.requestBundleRetailerIdsField(true); + } + public APIRequestGetProducts requestBundleRetailerIdsField (boolean value) { + this.requestField("bundle_retailer_ids", value); + return this; + } public APIRequestGetProducts requestCapabilityToReviewStatusField () { return this.requestCapabilityToReviewStatusField(true); } @@ -2884,6 +2901,13 @@ public APIRequestGetProducts requestInventoryField (boolean value) { this.requestField("inventory", value); return this; } + public APIRequestGetProducts requestIsBundleHeroField () { + return this.requestIsBundleHeroField(true); + } + public APIRequestGetProducts requestIsBundleHeroField (boolean value) { + this.requestField("is_bundle_hero", value); + return this; + } public APIRequestGetProducts requestManufacturerInfoField () { return this.requestManufacturerInfoField(true); } diff --git a/src/main/java/com/facebook/ads/sdk/ResellerGuidance.java b/src/main/java/com/facebook/ads/sdk/ResellerGuidance.java index dd1a00cd..8ec7acb1 100644 --- a/src/main/java/com/facebook/ads/sdk/ResellerGuidance.java +++ b/src/main/java/com/facebook/ads/sdk/ResellerGuidance.java @@ -53,14 +53,8 @@ public class ResellerGuidance extends APINode { private Boolean mAttributedToResellerL7d = null; @SerializedName("available_guidance") private List mAvailableGuidance = null; - @SerializedName("benchmark_report_link") - private String mBenchmarkReportLink = null; @SerializedName("guidance_adoption_rate_l7d") private Double mGuidanceAdoptionRateL7d = null; - @SerializedName("no_adsets_gte_benchmark") - private Long mNoAdsetsGteBenchmark = null; - @SerializedName("no_adsets_lt_benchmark") - private Long mNoAdsetsLtBenchmark = null; @SerializedName("nurtured_by_reseller_l7d") private Boolean mNurturedByResellerL7d = null; @SerializedName("planning_agency_name") @@ -280,15 +274,6 @@ public ResellerGuidance setFieldAvailableGuidance(List value) { return this; } - public String getFieldBenchmarkReportLink() { - return mBenchmarkReportLink; - } - - public ResellerGuidance setFieldBenchmarkReportLink(String value) { - this.mBenchmarkReportLink = value; - return this; - } - public Double getFieldGuidanceAdoptionRateL7d() { return mGuidanceAdoptionRateL7d; } @@ -298,24 +283,6 @@ public ResellerGuidance setFieldGuidanceAdoptionRateL7d(Double value) { return this; } - public Long getFieldNoAdsetsGteBenchmark() { - return mNoAdsetsGteBenchmark; - } - - public ResellerGuidance setFieldNoAdsetsGteBenchmark(Long value) { - this.mNoAdsetsGteBenchmark = value; - return this; - } - - public Long getFieldNoAdsetsLtBenchmark() { - return mNoAdsetsLtBenchmark; - } - - public ResellerGuidance setFieldNoAdsetsLtBenchmark(Long value) { - this.mNoAdsetsLtBenchmark = value; - return this; - } - public Boolean getFieldNurturedByResellerL7d() { return mNurturedByResellerL7d; } @@ -410,10 +377,7 @@ public ResellerGuidance copyFrom(ResellerGuidance instance) { this.mAdvertiserName = instance.mAdvertiserName; this.mAttributedToResellerL7d = instance.mAttributedToResellerL7d; this.mAvailableGuidance = instance.mAvailableGuidance; - this.mBenchmarkReportLink = instance.mBenchmarkReportLink; this.mGuidanceAdoptionRateL7d = instance.mGuidanceAdoptionRateL7d; - this.mNoAdsetsGteBenchmark = instance.mNoAdsetsGteBenchmark; - this.mNoAdsetsLtBenchmark = instance.mNoAdsetsLtBenchmark; this.mNurturedByResellerL7d = instance.mNurturedByResellerL7d; this.mPlanningAgencyName = instance.mPlanningAgencyName; this.mRecommendationTime = instance.mRecommendationTime; diff --git a/src/main/java/com/facebook/ads/sdk/ProductFeedMissingFeedItemReplacement.java b/src/main/java/com/facebook/ads/sdk/ShadowIGUserPartnershipAdsMediaErrors.java similarity index 64% rename from src/main/java/com/facebook/ads/sdk/ProductFeedMissingFeedItemReplacement.java rename to src/main/java/com/facebook/ads/sdk/ShadowIGUserPartnershipAdsMediaErrors.java index 6c491d7f..a3f2528b 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductFeedMissingFeedItemReplacement.java +++ b/src/main/java/com/facebook/ads/sdk/ShadowIGUserPartnershipAdsMediaErrors.java @@ -40,27 +40,29 @@ * pull request for this class. * */ -public class ProductFeedMissingFeedItemReplacement extends APINode { - @SerializedName("home_listing") - private Object mHomeListing = null; - @SerializedName("product_item") - private Object mProductItem = null; - @SerializedName("vehicle") - private Object mVehicle = null; +public class ShadowIGUserPartnershipAdsMediaErrors extends APINode { + @SerializedName("ad_code") + private String mAdCode = null; + @SerializedName("error_codes") + private String mErrorCodes = null; + @SerializedName("errors") + private List mErrors = null; + @SerializedName("permalink") + private String mPermalink = null; protected static Gson gson = null; - public ProductFeedMissingFeedItemReplacement() { + public ShadowIGUserPartnershipAdsMediaErrors() { } public String getId() { return null; } - public static ProductFeedMissingFeedItemReplacement loadJSON(String json, APIContext context, String header) { - ProductFeedMissingFeedItemReplacement productFeedMissingFeedItemReplacement = getGson().fromJson(json, ProductFeedMissingFeedItemReplacement.class); + public static ShadowIGUserPartnershipAdsMediaErrors loadJSON(String json, APIContext context, String header) { + ShadowIGUserPartnershipAdsMediaErrors shadowIGUserPartnershipAdsMediaErrors = getGson().fromJson(json, ShadowIGUserPartnershipAdsMediaErrors.class); if (context.isDebug()) { JsonParser parser = new JsonParser(); JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productFeedMissingFeedItemReplacement.toString()); + JsonElement o2 = parser.parse(shadowIGUserPartnershipAdsMediaErrors.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -70,14 +72,14 @@ public static ProductFeedMissingFeedItemReplacement loadJSON(String json, APICon context.log("[Object]" + o2); } } - productFeedMissingFeedItemReplacement.context = context; - productFeedMissingFeedItemReplacement.rawValue = json; - productFeedMissingFeedItemReplacement.header = header; - return productFeedMissingFeedItemReplacement; + shadowIGUserPartnershipAdsMediaErrors.context = context; + shadowIGUserPartnershipAdsMediaErrors.rawValue = json; + shadowIGUserPartnershipAdsMediaErrors.header = header; + return shadowIGUserPartnershipAdsMediaErrors; } - public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { - APINodeList productFeedMissingFeedItemReplacements = new APINodeList(request, json, header); + public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { + APINodeList shadowIGUserPartnershipAdsMediaErrorss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; JsonParser parser = new JsonParser(); @@ -88,9 +90,9 @@ public static APINodeList parseResponse(S // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); for (int i = 0; i < arr.size(); i++) { - productFeedMissingFeedItemReplacements.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); + shadowIGUserPartnershipAdsMediaErrorss.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); }; - return productFeedMissingFeedItemReplacements; + return shadowIGUserPartnershipAdsMediaErrorss; } else if (result.isJsonObject()) { obj = result.getAsJsonObject(); if (obj.has("data")) { @@ -100,20 +102,20 @@ public static APINodeList parseResponse(S 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; - productFeedMissingFeedItemReplacements.setCursors(before, after); + shadowIGUserPartnershipAdsMediaErrorss.setCursors(before, after); } String previous = paging.has("previous") ? paging.get("previous").getAsString() : null; String next = paging.has("next") ? paging.get("next").getAsString() : null; - productFeedMissingFeedItemReplacements.setPaging(previous, next); + shadowIGUserPartnershipAdsMediaErrorss.setPaging(previous, next); if (context.hasAppSecret()) { - productFeedMissingFeedItemReplacements.setAppSecret(context.getAppSecretProof()); + shadowIGUserPartnershipAdsMediaErrorss.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++) { - productFeedMissingFeedItemReplacements.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); + shadowIGUserPartnershipAdsMediaErrorss.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" @@ -124,23 +126,23 @@ public static APINodeList parseResponse(S isRedownload = true; obj = obj.getAsJsonObject(s); for (Map.Entry entry : obj.entrySet()) { - productFeedMissingFeedItemReplacements.add(loadJSON(entry.getValue().toString(), context, header)); + shadowIGUserPartnershipAdsMediaErrorss.add(loadJSON(entry.getValue().toString(), context, header)); } break; } } if (!isRedownload) { - productFeedMissingFeedItemReplacements.add(loadJSON(obj.toString(), context, header)); + shadowIGUserPartnershipAdsMediaErrorss.add(loadJSON(obj.toString(), context, header)); } } - return productFeedMissingFeedItemReplacements; + return shadowIGUserPartnershipAdsMediaErrorss; } 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()) { - productFeedMissingFeedItemReplacements.add(loadJSON(entry.getValue().toString(), context, header)); + shadowIGUserPartnershipAdsMediaErrorss.add(loadJSON(entry.getValue().toString(), context, header)); } - return productFeedMissingFeedItemReplacements; + return shadowIGUserPartnershipAdsMediaErrorss; } else { // Fifth, check if it's an array of objects indexed by id boolean isIdIndexedArray = true; @@ -157,20 +159,20 @@ public static APINodeList parseResponse(S value.getAsJsonObject().get("id") != null && value.getAsJsonObject().get("id").getAsString().equals(key) ) { - productFeedMissingFeedItemReplacements.add(loadJSON(value.toString(), context, header)); + shadowIGUserPartnershipAdsMediaErrorss.add(loadJSON(value.toString(), context, header)); } else { isIdIndexedArray = false; break; } } if (isIdIndexedArray) { - return productFeedMissingFeedItemReplacements; + return shadowIGUserPartnershipAdsMediaErrorss; } // Sixth, check if it's pure JsonObject - productFeedMissingFeedItemReplacements.clear(); - productFeedMissingFeedItemReplacements.add(loadJSON(json, context, header)); - return productFeedMissingFeedItemReplacements; + shadowIGUserPartnershipAdsMediaErrorss.clear(); + shadowIGUserPartnershipAdsMediaErrorss.add(loadJSON(json, context, header)); + return shadowIGUserPartnershipAdsMediaErrorss; } } } catch (Exception e) { @@ -198,30 +200,39 @@ public String toString() { } - public Object getFieldHomeListing() { - return mHomeListing; + public String getFieldAdCode() { + return mAdCode; } - public ProductFeedMissingFeedItemReplacement setFieldHomeListing(Object value) { - this.mHomeListing = value; + public ShadowIGUserPartnershipAdsMediaErrors setFieldAdCode(String value) { + this.mAdCode = value; return this; } - public Object getFieldProductItem() { - return mProductItem; + public String getFieldErrorCodes() { + return mErrorCodes; } - public ProductFeedMissingFeedItemReplacement setFieldProductItem(Object value) { - this.mProductItem = value; + public ShadowIGUserPartnershipAdsMediaErrors setFieldErrorCodes(String value) { + this.mErrorCodes = value; return this; } - public Object getFieldVehicle() { - return mVehicle; + public List getFieldErrors() { + return mErrors; } - public ProductFeedMissingFeedItemReplacement setFieldVehicle(Object value) { - this.mVehicle = value; + public ShadowIGUserPartnershipAdsMediaErrors setFieldErrors(List value) { + this.mErrors = value; + return this; + } + + public String getFieldPermalink() { + return mPermalink; + } + + public ShadowIGUserPartnershipAdsMediaErrors setFieldPermalink(String value) { + this.mPermalink = value; return this; } @@ -241,19 +252,20 @@ public ProductFeedMissingFeedItemReplacement setFieldVehicle(Object value) { return gson; } - public ProductFeedMissingFeedItemReplacement copyFrom(ProductFeedMissingFeedItemReplacement instance) { - this.mHomeListing = instance.mHomeListing; - this.mProductItem = instance.mProductItem; - this.mVehicle = instance.mVehicle; + public ShadowIGUserPartnershipAdsMediaErrors copyFrom(ShadowIGUserPartnershipAdsMediaErrors instance) { + this.mAdCode = instance.mAdCode; + this.mErrorCodes = instance.mErrorCodes; + this.mErrors = instance.mErrors; + this.mPermalink = instance.mPermalink; 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 ProductFeedMissingFeedItemReplacement.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 ShadowIGUserPartnershipAdsMediaErrors.parseResponse(response, context, request, header); } }; } diff --git a/src/main/java/com/facebook/ads/sdk/Stories.java b/src/main/java/com/facebook/ads/sdk/Stories.java index 0180746b..a84ab64c 100644 --- a/src/main/java/com/facebook/ads/sdk/Stories.java +++ b/src/main/java/com/facebook/ads/sdk/Stories.java @@ -53,13 +53,74 @@ public class Stories extends APINode { private String mStatus = null; @SerializedName("url") private String mUrl = null; + @SerializedName("id") + private String mId = null; protected static Gson gson = null; - public Stories() { + Stories() { + } + + public Stories(Long id, APIContext context) { + this(id.toString(), context); + } + + public Stories(String id, APIContext context) { + this.mId = id; + + this.context = context; + } + + public Stories fetch() throws APIException{ + Stories newInstance = fetchById(this.getPrefixedId().toString(), this.context); + this.copyFrom(newInstance); + return this; + } + + public static Stories 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 Stories 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", Stories.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", Stories.getParser()) + .setParam("ids", APIRequest.joinStringList(ids)) + .requestFields(fields) + .executeAsyncBase(); + } + + private String getPrefixedId() { + return getId(); } public String getId() { - return null; + return getFieldId().toString(); } public static Stories loadJSON(String json, APIContext context, String header) { Stories stories = getGson().fromJson(json, Stories.class); @@ -203,63 +264,377 @@ public String toString() { return getGson().toJson(this); } + public APIRequestGetInsights getInsights() { + return new APIRequestGetInsights(this.getPrefixedId().toString(), context); + } - public String getFieldCreationTime() { - return mCreationTime; + public APIRequestGet get() { + return new APIRequestGet(this.getPrefixedId().toString(), context); } - public Stories setFieldCreationTime(String value) { - this.mCreationTime = value; - return this; + + public String getFieldCreationTime() { + return mCreationTime; } public String getFieldMediaId() { return mMediaId; } - public Stories setFieldMediaId(String value) { - this.mMediaId = value; - return this; - } - public String getFieldMediaType() { return mMediaType; } - public Stories setFieldMediaType(String value) { - this.mMediaType = value; - return this; - } - public String getFieldPostId() { return mPostId; } - public Stories setFieldPostId(String value) { - this.mPostId = value; - return this; - } - public String getFieldStatus() { return mStatus; } - public Stories setFieldStatus(String value) { - this.mStatus = value; - return this; - } - public String getFieldUrl() { return mUrl; } - public Stories setFieldUrl(String value) { - this.mUrl = value; - return this; + public String getFieldId() { + return mId; } + public static class APIRequestGetInsights extends APIRequest { + + APINodeList lastResponse = null; + @Override + public APINodeList getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "metric", + }; + + public static final String[] FIELDS = { + "description", + "description_from_api_doc", + "id", + "name", + "period", + "title", + "values", + }; + + @Override + public APINodeList parseResponse(String response, String header) throws APIException { + return InsightsResult.parseResponse(response, getContext(), this, header); + } + + @Override + public APINodeList execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + try { + return APIRequestGetInsights.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestGetInsights(String nodeId, APIContext context) { + super(context, nodeId, "/insights", "GET", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestGetInsights setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestGetInsights setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestGetInsights setMetric (List metric) { + this.setParam("metric", metric); + return this; + } + public APIRequestGetInsights setMetric (String metric) { + this.setParam("metric", metric); + return this; + } + + public APIRequestGetInsights requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestGetInsights requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetInsights requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestGetInsights requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetInsights requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestGetInsights requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + public APIRequestGetInsights requestDescriptionField () { + return this.requestDescriptionField(true); + } + public APIRequestGetInsights requestDescriptionField (boolean value) { + this.requestField("description", value); + return this; + } + public APIRequestGetInsights requestDescriptionFromApiDocField () { + return this.requestDescriptionFromApiDocField(true); + } + public APIRequestGetInsights requestDescriptionFromApiDocField (boolean value) { + this.requestField("description_from_api_doc", value); + return this; + } + public APIRequestGetInsights requestIdField () { + return this.requestIdField(true); + } + public APIRequestGetInsights requestIdField (boolean value) { + this.requestField("id", value); + return this; + } + public APIRequestGetInsights requestNameField () { + return this.requestNameField(true); + } + public APIRequestGetInsights requestNameField (boolean value) { + this.requestField("name", value); + return this; + } + public APIRequestGetInsights requestPeriodField () { + return this.requestPeriodField(true); + } + public APIRequestGetInsights requestPeriodField (boolean value) { + this.requestField("period", value); + return this; + } + public APIRequestGetInsights requestTitleField () { + return this.requestTitleField(true); + } + public APIRequestGetInsights requestTitleField (boolean value) { + this.requestField("title", value); + return this; + } + public APIRequestGetInsights requestValuesField () { + return this.requestValuesField(true); + } + public APIRequestGetInsights requestValuesField (boolean value) { + this.requestField("values", value); + return this; + } + } + + public static class APIRequestGet extends APIRequest { + + Stories lastResponse = null; + @Override + public Stories getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + }; + + public static final String[] FIELDS = { + "creation_time", + "media_id", + "media_type", + "post_id", + "status", + "url", + "id", + }; + + @Override + public Stories parseResponse(String response, String header) throws APIException { + return Stories.parseResponse(response, getContext(), this, header).head(); + } + + @Override + public Stories execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public Stories 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 Stories 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 requestCreationTimeField () { + return this.requestCreationTimeField(true); + } + public APIRequestGet requestCreationTimeField (boolean value) { + this.requestField("creation_time", value); + return this; + } + public APIRequestGet requestMediaIdField () { + return this.requestMediaIdField(true); + } + public APIRequestGet requestMediaIdField (boolean value) { + this.requestField("media_id", value); + return this; + } + public APIRequestGet requestMediaTypeField () { + return this.requestMediaTypeField(true); + } + public APIRequestGet requestMediaTypeField (boolean value) { + this.requestField("media_type", value); + return this; + } + public APIRequestGet requestPostIdField () { + return this.requestPostIdField(true); + } + public APIRequestGet requestPostIdField (boolean value) { + this.requestField("post_id", value); + return this; + } + public APIRequestGet requestStatusField () { + return this.requestStatusField(true); + } + public APIRequestGet requestStatusField (boolean value) { + this.requestField("status", value); + return this; + } + public APIRequestGet requestUrlField () { + return this.requestUrlField(true); + } + public APIRequestGet requestUrlField (boolean value) { + this.requestField("url", value); + return this; + } + public APIRequestGet requestIdField () { + return this.requestIdField(true); + } + public APIRequestGet requestIdField (boolean value) { + this.requestField("id", value); + return this; + } + } + public static enum EnumStatus { @SerializedName("ARCHIVED") VALUE_ARCHIVED("ARCHIVED"), @@ -300,6 +675,7 @@ public Stories copyFrom(Stories instance) { this.mPostId = instance.mPostId; this.mStatus = instance.mStatus; this.mUrl = instance.mUrl; + this.mId = instance.mId; this.context = instance.context; this.rawValue = instance.rawValue; return this; diff --git a/src/main/java/com/facebook/ads/sdk/ThirdPartyPartnerViewabilityRequest.java b/src/main/java/com/facebook/ads/sdk/ThirdPartyPartnerViewabilityRequest.java index bb17115a..e8e88a05 100644 --- a/src/main/java/com/facebook/ads/sdk/ThirdPartyPartnerViewabilityRequest.java +++ b/src/main/java/com/facebook/ads/sdk/ThirdPartyPartnerViewabilityRequest.java @@ -50,13 +50,13 @@ public class ThirdPartyPartnerViewabilityRequest extends APINode { @SerializedName("id") private String mId = null; @SerializedName("metric") - private String mMetric = null; + private EnumMetric mMetric = null; @SerializedName("modified_time") private String mModifiedTime = null; @SerializedName("owner_instance_id") private String mOwnerInstanceId = null; @SerializedName("platform") - private String mPlatform = null; + private EnumPlatform mPlatform = null; @SerializedName("status") private EnumStatus mStatus = null; @SerializedName("total_file_count") @@ -291,7 +291,7 @@ public String getFieldId() { return mId; } - public String getFieldMetric() { + public EnumMetric getFieldMetric() { return mMetric; } @@ -303,7 +303,7 @@ public String getFieldOwnerInstanceId() { return mOwnerInstanceId; } - public String getFieldPlatform() { + public EnumPlatform getFieldPlatform() { return mPlatform; } @@ -502,6 +502,48 @@ public APIRequestGet requestTotalFileCountField (boolean value) { } } + public static enum EnumMetric { + @SerializedName("DISPLAY_EVENT") + VALUE_DISPLAY_EVENT("DISPLAY_EVENT"), + @SerializedName("IMPRESSION") + VALUE_IMPRESSION("IMPRESSION"), + @SerializedName("VIDEO_EVENT") + VALUE_VIDEO_EVENT("VIDEO_EVENT"), + ; + + private String value; + + private EnumMetric(String value) { + this.value = value; + } + + @Override + public String toString() { + return value; + } + } + + public static enum EnumPlatform { + @SerializedName("AUDIENCE_NETWORK") + VALUE_AUDIENCE_NETWORK("AUDIENCE_NETWORK"), + @SerializedName("FACEBOOK") + VALUE_FACEBOOK("FACEBOOK"), + @SerializedName("INSTAGRAM") + VALUE_INSTAGRAM("INSTAGRAM"), + ; + + private String value; + + private EnumPlatform(String value) { + this.value = value; + } + + @Override + public String toString() { + return value; + } + } + public static enum EnumStatus { @SerializedName("CREATED") VALUE_CREATED("CREATED"), diff --git a/src/main/java/com/facebook/ads/sdk/TransactableItem.java b/src/main/java/com/facebook/ads/sdk/TransactableItem.java index 2589aa18..c579e0a7 100644 --- a/src/main/java/com/facebook/ads/sdk/TransactableItem.java +++ b/src/main/java/com/facebook/ads/sdk/TransactableItem.java @@ -294,6 +294,10 @@ public APIRequestGetChannelsToIntegrityStatus getChannelsToIntegrityStatus() { return new APIRequestGetChannelsToIntegrityStatus(this.getPrefixedId().toString(), context); } + public APIRequestGetOverrideDetails getOverrideDetails() { + return new APIRequestGetOverrideDetails(this.getPrefixedId().toString(), context); + } + public APIRequestGet get() { return new APIRequestGet(this.getPrefixedId().toString(), context); } @@ -502,6 +506,155 @@ public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField ( } } + public static class APIRequestGetOverrideDetails extends APIRequest { + + APINodeList lastResponse = null; + @Override + public APINodeList getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "keys", + "type", + }; + + public static final String[] FIELDS = { + "key", + "type", + "values", + }; + + @Override + public APINodeList parseResponse(String response, String header) throws APIException { + return OverrideDetails.parseResponse(response, getContext(), this, header); + } + + @Override + public APINodeList execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + try { + return APIRequestGetOverrideDetails.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestGetOverrideDetails(String nodeId, APIContext context) { + super(context, nodeId, "/override_details", "GET", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestGetOverrideDetails setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestGetOverrideDetails setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestGetOverrideDetails setKeys (List keys) { + this.setParam("keys", keys); + return this; + } + public APIRequestGetOverrideDetails setKeys (String keys) { + this.setParam("keys", keys); + return this; + } + + public APIRequestGetOverrideDetails setType (OverrideDetails.EnumType type) { + this.setParam("type", type); + return this; + } + public APIRequestGetOverrideDetails setType (String type) { + this.setParam("type", type); + return this; + } + + public APIRequestGetOverrideDetails requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestGetOverrideDetails requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetOverrideDetails requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestGetOverrideDetails requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetOverrideDetails requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestGetOverrideDetails requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + public APIRequestGetOverrideDetails requestKeyField () { + return this.requestKeyField(true); + } + public APIRequestGetOverrideDetails requestKeyField (boolean value) { + this.requestField("key", value); + return this; + } + public APIRequestGetOverrideDetails requestTypeField () { + return this.requestTypeField(true); + } + public APIRequestGetOverrideDetails requestTypeField (boolean value) { + this.requestField("type", value); + return this; + } + public APIRequestGetOverrideDetails requestValuesField () { + return this.requestValuesField(true); + } + public APIRequestGetOverrideDetails requestValuesField (boolean value) { + this.requestField("values", value); + return this; + } + } + public static class APIRequestGet extends APIRequest { TransactableItem lastResponse = null; diff --git a/src/main/java/com/facebook/ads/sdk/User.java b/src/main/java/com/facebook/ads/sdk/User.java index 29721c4b..4d4633d6 100644 --- a/src/main/java/com/facebook/ads/sdk/User.java +++ b/src/main/java/com/facebook/ads/sdk/User.java @@ -1032,6 +1032,7 @@ public APINodeList getLastResponse() { return lastResponse; } public static final String[] PARAMS = { + "ad_id", "is_place", "is_promotable", }; @@ -1244,6 +1245,11 @@ public APIRequestGetAccounts setParams(Map params) { } + public APIRequestGetAccounts setAdId (String adId) { + this.setParam("ad_id", adId); + return this; + } + public APIRequestGetAccounts setIsPlace (Boolean isPlace) { this.setParam("is_place", isPlace); return this; @@ -10098,7 +10104,6 @@ public Post getLastResponse() { "actions", "album_id", "android_key_hash", - "animated_effect_id", "application_id", "asked_fun_fact_prompt_id", "asset3d_id", @@ -10282,15 +10287,6 @@ public APIRequestCreateFeed setAndroidKeyHash (String androidKeyHash) { return this; } - public APIRequestCreateFeed setAnimatedEffectId (Long animatedEffectId) { - this.setParam("animated_effect_id", animatedEffectId); - return this; - } - public APIRequestCreateFeed setAnimatedEffectId (String animatedEffectId) { - this.setParam("animated_effect_id", animatedEffectId); - return this; - } - public APIRequestCreateFeed setApplicationId (String applicationId) { this.setParam("application_id", applicationId); return this; @@ -20162,7 +20158,6 @@ public AdVideo getLastResponse() { return lastResponse; } public static final String[] PARAMS = { - "animated_effect_id", "application_id", "asked_fun_fact_prompt_id", "audio_story_wave_animation_handle", @@ -20294,15 +20289,6 @@ public APIRequestCreateVideo setParams(Map params) { } - public APIRequestCreateVideo setAnimatedEffectId (Long animatedEffectId) { - this.setParam("animated_effect_id", animatedEffectId); - return this; - } - public APIRequestCreateVideo setAnimatedEffectId (String animatedEffectId) { - this.setParam("animated_effect_id", animatedEffectId); - return this; - } - public APIRequestCreateVideo setApplicationId (String applicationId) { this.setParam("application_id", applicationId); return this; diff --git a/src/main/java/com/facebook/ads/sdk/Vehicle.java b/src/main/java/com/facebook/ads/sdk/Vehicle.java index 3a87efa2..794d433e 100644 --- a/src/main/java/com/facebook/ads/sdk/Vehicle.java +++ b/src/main/java/com/facebook/ads/sdk/Vehicle.java @@ -346,14 +346,14 @@ public String toString() { return getGson().toJson(this); } - public APIRequestGetAugmentedRealitiesMetadata getAugmentedRealitiesMetadata() { - return new APIRequestGetAugmentedRealitiesMetadata(this.getPrefixedId().toString(), context); - } - public APIRequestGetChannelsToIntegrityStatus getChannelsToIntegrityStatus() { return new APIRequestGetChannelsToIntegrityStatus(this.getPrefixedId().toString(), context); } + public APIRequestGetOverrideDetails getOverrideDetails() { + return new APIRequestGetOverrideDetails(this.getPrefixedId().toString(), context); + } + public APIRequestGetVideosMetadata getVideosMetadata() { return new APIRequestGetVideosMetadata(this.getPrefixedId().toString(), context); } @@ -564,59 +564,49 @@ public Long getFieldYear() { - public static class APIRequestGetAugmentedRealitiesMetadata extends APIRequest { + public static class APIRequestGetChannelsToIntegrityStatus extends APIRequest { - APINodeList lastResponse = null; + APINodeList lastResponse = null; @Override - public APINodeList getLastResponse() { + public APINodeList getLastResponse() { return lastResponse; } public static final String[] PARAMS = { }; public static final String[] FIELDS = { - "anchor_point", - "container_effect_enum", - "effect_icon_url", - "effect_id", - "id", - "platforms", - "scale_factor", - "shadow_texture_url", - "source_url", - "state", - "tags", - "variant_picker_url", + "channels", + "rejection_information", }; @Override - public APINodeList parseResponse(String response, String header) throws APIException { - return DynamicARMetadata.parseResponse(response, getContext(), this, header); + public APINodeList parseResponse(String response, String header) throws APIException { + return CatalogItemChannelsToIntegrityStatus.parseResponse(response, getContext(), this, header); } @Override - public APINodeList execute() throws APIException { + public APINodeList execute() throws APIException { return execute(new HashMap()); } @Override - public APINodeList execute(Map extraParams) throws APIException { + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + new Function>() { + public APINodeList apply(ResponseWrapper result) { try { - return APIRequestGetAugmentedRealitiesMetadata.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestGetChannelsToIntegrityStatus.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -626,28 +616,28 @@ public APINodeList apply(ResponseWrapper result) { ); }; - public APIRequestGetAugmentedRealitiesMetadata(String nodeId, APIContext context) { - super(context, nodeId, "/augmented_realities_metadata", "GET", Arrays.asList(PARAMS)); + public APIRequestGetChannelsToIntegrityStatus(String nodeId, APIContext context) { + super(context, nodeId, "/channels_to_integrity_status", "GET", Arrays.asList(PARAMS)); } @Override - public APIRequestGetAugmentedRealitiesMetadata setParam(String param, Object value) { + public APIRequestGetChannelsToIntegrityStatus setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestGetAugmentedRealitiesMetadata setParams(Map params) { + public APIRequestGetChannelsToIntegrityStatus setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestGetAugmentedRealitiesMetadata requestAllFields () { + public APIRequestGetChannelsToIntegrityStatus requestAllFields () { return this.requestAllFields(true); } - public APIRequestGetAugmentedRealitiesMetadata requestAllFields (boolean value) { + public APIRequestGetChannelsToIntegrityStatus requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -655,12 +645,12 @@ public APIRequestGetAugmentedRealitiesMetadata requestAllFields (boolean value) } @Override - public APIRequestGetAugmentedRealitiesMetadata requestFields (List fields) { + public APIRequestGetChannelsToIntegrityStatus requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestGetAugmentedRealitiesMetadata requestFields (List fields, boolean value) { + public APIRequestGetChannelsToIntegrityStatus requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -668,146 +658,79 @@ public APIRequestGetAugmentedRealitiesMetadata requestFields (List field } @Override - public APIRequestGetAugmentedRealitiesMetadata requestField (String field) { + public APIRequestGetChannelsToIntegrityStatus requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestGetAugmentedRealitiesMetadata requestField (String field, boolean value) { + public APIRequestGetChannelsToIntegrityStatus requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } - public APIRequestGetAugmentedRealitiesMetadata requestAnchorPointField () { - return this.requestAnchorPointField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestAnchorPointField (boolean value) { - this.requestField("anchor_point", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestContainerEffectEnumField () { - return this.requestContainerEffectEnumField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestContainerEffectEnumField (boolean value) { - this.requestField("container_effect_enum", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIconUrlField () { - return this.requestEffectIconUrlField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIconUrlField (boolean value) { - this.requestField("effect_icon_url", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIdField () { - return this.requestEffectIdField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIdField (boolean value) { - this.requestField("effect_id", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestIdField () { - return this.requestIdField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestIdField (boolean value) { - this.requestField("id", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestPlatformsField () { - return this.requestPlatformsField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestPlatformsField (boolean value) { - this.requestField("platforms", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestScaleFactorField () { - return this.requestScaleFactorField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestScaleFactorField (boolean value) { - this.requestField("scale_factor", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestShadowTextureUrlField () { - return this.requestShadowTextureUrlField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestShadowTextureUrlField (boolean value) { - this.requestField("shadow_texture_url", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestSourceUrlField () { - return this.requestSourceUrlField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestSourceUrlField (boolean value) { - this.requestField("source_url", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestStateField () { - return this.requestStateField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestStateField (boolean value) { - this.requestField("state", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestTagsField () { - return this.requestTagsField(true); + public APIRequestGetChannelsToIntegrityStatus requestChannelsField () { + return this.requestChannelsField(true); } - public APIRequestGetAugmentedRealitiesMetadata requestTagsField (boolean value) { - this.requestField("tags", value); + public APIRequestGetChannelsToIntegrityStatus requestChannelsField (boolean value) { + this.requestField("channels", value); return this; } - public APIRequestGetAugmentedRealitiesMetadata requestVariantPickerUrlField () { - return this.requestVariantPickerUrlField(true); + public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField () { + return this.requestRejectionInformationField(true); } - public APIRequestGetAugmentedRealitiesMetadata requestVariantPickerUrlField (boolean value) { - this.requestField("variant_picker_url", value); + public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField (boolean value) { + this.requestField("rejection_information", value); return this; } } - public static class APIRequestGetChannelsToIntegrityStatus extends APIRequest { + public static class APIRequestGetOverrideDetails extends APIRequest { - APINodeList lastResponse = null; + APINodeList lastResponse = null; @Override - public APINodeList getLastResponse() { + public APINodeList getLastResponse() { return lastResponse; } public static final String[] PARAMS = { + "keys", + "type", }; public static final String[] FIELDS = { - "channels", - "rejection_information", + "key", + "type", + "values", }; @Override - public APINodeList parseResponse(String response, String header) throws APIException { - return CatalogItemChannelsToIntegrityStatus.parseResponse(response, getContext(), this, header); + public APINodeList parseResponse(String response, String header) throws APIException { + return OverrideDetails.parseResponse(response, getContext(), this, header); } @Override - public APINodeList execute() throws APIException { + public APINodeList execute() throws APIException { return execute(new HashMap()); } @Override - public APINodeList execute(Map extraParams) throws APIException { + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + new Function>() { + public APINodeList apply(ResponseWrapper result) { try { - return APIRequestGetChannelsToIntegrityStatus.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestGetOverrideDetails.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -817,28 +740,46 @@ public APINodeList apply(ResponseWrapper r ); }; - public APIRequestGetChannelsToIntegrityStatus(String nodeId, APIContext context) { - super(context, nodeId, "/channels_to_integrity_status", "GET", Arrays.asList(PARAMS)); + public APIRequestGetOverrideDetails(String nodeId, APIContext context) { + super(context, nodeId, "/override_details", "GET", Arrays.asList(PARAMS)); } @Override - public APIRequestGetChannelsToIntegrityStatus setParam(String param, Object value) { + public APIRequestGetOverrideDetails setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestGetChannelsToIntegrityStatus setParams(Map params) { + public APIRequestGetOverrideDetails setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestGetChannelsToIntegrityStatus requestAllFields () { + public APIRequestGetOverrideDetails setKeys (List keys) { + this.setParam("keys", keys); + return this; + } + public APIRequestGetOverrideDetails setKeys (String keys) { + this.setParam("keys", keys); + return this; + } + + public APIRequestGetOverrideDetails setType (OverrideDetails.EnumType type) { + this.setParam("type", type); + return this; + } + public APIRequestGetOverrideDetails setType (String type) { + this.setParam("type", type); + return this; + } + + public APIRequestGetOverrideDetails requestAllFields () { return this.requestAllFields(true); } - public APIRequestGetChannelsToIntegrityStatus requestAllFields (boolean value) { + public APIRequestGetOverrideDetails requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -846,12 +787,12 @@ public APIRequestGetChannelsToIntegrityStatus requestAllFields (boolean value) { } @Override - public APIRequestGetChannelsToIntegrityStatus requestFields (List fields) { + public APIRequestGetOverrideDetails requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestGetChannelsToIntegrityStatus requestFields (List fields, boolean value) { + public APIRequestGetOverrideDetails requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -859,29 +800,36 @@ public APIRequestGetChannelsToIntegrityStatus requestFields (List fields } @Override - public APIRequestGetChannelsToIntegrityStatus requestField (String field) { + public APIRequestGetOverrideDetails requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestGetChannelsToIntegrityStatus requestField (String field, boolean value) { + public APIRequestGetOverrideDetails requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } - public APIRequestGetChannelsToIntegrityStatus requestChannelsField () { - return this.requestChannelsField(true); + public APIRequestGetOverrideDetails requestKeyField () { + return this.requestKeyField(true); } - public APIRequestGetChannelsToIntegrityStatus requestChannelsField (boolean value) { - this.requestField("channels", value); + public APIRequestGetOverrideDetails requestKeyField (boolean value) { + this.requestField("key", value); return this; } - public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField () { - return this.requestRejectionInformationField(true); + public APIRequestGetOverrideDetails requestTypeField () { + return this.requestTypeField(true); } - public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField (boolean value) { - this.requestField("rejection_information", value); + public APIRequestGetOverrideDetails requestTypeField (boolean value) { + this.requestField("type", value); + return this; + } + public APIRequestGetOverrideDetails requestValuesField () { + return this.requestValuesField(true); + } + public APIRequestGetOverrideDetails requestValuesField (boolean value) { + this.requestField("values", value); return this; } } diff --git a/src/main/java/com/facebook/ads/sdk/VehicleOffer.java b/src/main/java/com/facebook/ads/sdk/VehicleOffer.java index 90de85a0..6a32a4cb 100644 --- a/src/main/java/com/facebook/ads/sdk/VehicleOffer.java +++ b/src/main/java/com/facebook/ads/sdk/VehicleOffer.java @@ -340,14 +340,14 @@ public String toString() { return getGson().toJson(this); } - public APIRequestGetAugmentedRealitiesMetadata getAugmentedRealitiesMetadata() { - return new APIRequestGetAugmentedRealitiesMetadata(this.getPrefixedId().toString(), context); - } - public APIRequestGetChannelsToIntegrityStatus getChannelsToIntegrityStatus() { return new APIRequestGetChannelsToIntegrityStatus(this.getPrefixedId().toString(), context); } + public APIRequestGetOverrideDetails getOverrideDetails() { + return new APIRequestGetOverrideDetails(this.getPrefixedId().toString(), context); + } + public APIRequestGetVideosMetadata getVideosMetadata() { return new APIRequestGetVideosMetadata(this.getPrefixedId().toString(), context); } @@ -539,59 +539,49 @@ public Long getFieldYear() { - public static class APIRequestGetAugmentedRealitiesMetadata extends APIRequest { + public static class APIRequestGetChannelsToIntegrityStatus extends APIRequest { - APINodeList lastResponse = null; + APINodeList lastResponse = null; @Override - public APINodeList getLastResponse() { + public APINodeList getLastResponse() { return lastResponse; } public static final String[] PARAMS = { }; public static final String[] FIELDS = { - "anchor_point", - "container_effect_enum", - "effect_icon_url", - "effect_id", - "id", - "platforms", - "scale_factor", - "shadow_texture_url", - "source_url", - "state", - "tags", - "variant_picker_url", + "channels", + "rejection_information", }; @Override - public APINodeList parseResponse(String response, String header) throws APIException { - return DynamicARMetadata.parseResponse(response, getContext(), this, header); + public APINodeList parseResponse(String response, String header) throws APIException { + return CatalogItemChannelsToIntegrityStatus.parseResponse(response, getContext(), this, header); } @Override - public APINodeList execute() throws APIException { + public APINodeList execute() throws APIException { return execute(new HashMap()); } @Override - public APINodeList execute(Map extraParams) throws APIException { + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + new Function>() { + public APINodeList apply(ResponseWrapper result) { try { - return APIRequestGetAugmentedRealitiesMetadata.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestGetChannelsToIntegrityStatus.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -601,28 +591,28 @@ public APINodeList apply(ResponseWrapper result) { ); }; - public APIRequestGetAugmentedRealitiesMetadata(String nodeId, APIContext context) { - super(context, nodeId, "/augmented_realities_metadata", "GET", Arrays.asList(PARAMS)); + public APIRequestGetChannelsToIntegrityStatus(String nodeId, APIContext context) { + super(context, nodeId, "/channels_to_integrity_status", "GET", Arrays.asList(PARAMS)); } @Override - public APIRequestGetAugmentedRealitiesMetadata setParam(String param, Object value) { + public APIRequestGetChannelsToIntegrityStatus setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestGetAugmentedRealitiesMetadata setParams(Map params) { + public APIRequestGetChannelsToIntegrityStatus setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestGetAugmentedRealitiesMetadata requestAllFields () { + public APIRequestGetChannelsToIntegrityStatus requestAllFields () { return this.requestAllFields(true); } - public APIRequestGetAugmentedRealitiesMetadata requestAllFields (boolean value) { + public APIRequestGetChannelsToIntegrityStatus requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -630,12 +620,12 @@ public APIRequestGetAugmentedRealitiesMetadata requestAllFields (boolean value) } @Override - public APIRequestGetAugmentedRealitiesMetadata requestFields (List fields) { + public APIRequestGetChannelsToIntegrityStatus requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestGetAugmentedRealitiesMetadata requestFields (List fields, boolean value) { + public APIRequestGetChannelsToIntegrityStatus requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -643,146 +633,79 @@ public APIRequestGetAugmentedRealitiesMetadata requestFields (List field } @Override - public APIRequestGetAugmentedRealitiesMetadata requestField (String field) { + public APIRequestGetChannelsToIntegrityStatus requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestGetAugmentedRealitiesMetadata requestField (String field, boolean value) { + public APIRequestGetChannelsToIntegrityStatus requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } - public APIRequestGetAugmentedRealitiesMetadata requestAnchorPointField () { - return this.requestAnchorPointField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestAnchorPointField (boolean value) { - this.requestField("anchor_point", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestContainerEffectEnumField () { - return this.requestContainerEffectEnumField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestContainerEffectEnumField (boolean value) { - this.requestField("container_effect_enum", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIconUrlField () { - return this.requestEffectIconUrlField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIconUrlField (boolean value) { - this.requestField("effect_icon_url", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIdField () { - return this.requestEffectIdField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestEffectIdField (boolean value) { - this.requestField("effect_id", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestIdField () { - return this.requestIdField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestIdField (boolean value) { - this.requestField("id", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestPlatformsField () { - return this.requestPlatformsField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestPlatformsField (boolean value) { - this.requestField("platforms", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestScaleFactorField () { - return this.requestScaleFactorField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestScaleFactorField (boolean value) { - this.requestField("scale_factor", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestShadowTextureUrlField () { - return this.requestShadowTextureUrlField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestShadowTextureUrlField (boolean value) { - this.requestField("shadow_texture_url", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestSourceUrlField () { - return this.requestSourceUrlField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestSourceUrlField (boolean value) { - this.requestField("source_url", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestStateField () { - return this.requestStateField(true); - } - public APIRequestGetAugmentedRealitiesMetadata requestStateField (boolean value) { - this.requestField("state", value); - return this; - } - public APIRequestGetAugmentedRealitiesMetadata requestTagsField () { - return this.requestTagsField(true); + public APIRequestGetChannelsToIntegrityStatus requestChannelsField () { + return this.requestChannelsField(true); } - public APIRequestGetAugmentedRealitiesMetadata requestTagsField (boolean value) { - this.requestField("tags", value); + public APIRequestGetChannelsToIntegrityStatus requestChannelsField (boolean value) { + this.requestField("channels", value); return this; } - public APIRequestGetAugmentedRealitiesMetadata requestVariantPickerUrlField () { - return this.requestVariantPickerUrlField(true); + public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField () { + return this.requestRejectionInformationField(true); } - public APIRequestGetAugmentedRealitiesMetadata requestVariantPickerUrlField (boolean value) { - this.requestField("variant_picker_url", value); + public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField (boolean value) { + this.requestField("rejection_information", value); return this; } } - public static class APIRequestGetChannelsToIntegrityStatus extends APIRequest { + public static class APIRequestGetOverrideDetails extends APIRequest { - APINodeList lastResponse = null; + APINodeList lastResponse = null; @Override - public APINodeList getLastResponse() { + public APINodeList getLastResponse() { return lastResponse; } public static final String[] PARAMS = { + "keys", + "type", }; public static final String[] FIELDS = { - "channels", - "rejection_information", + "key", + "type", + "values", }; @Override - public APINodeList parseResponse(String response, String header) throws APIException { - return CatalogItemChannelsToIntegrityStatus.parseResponse(response, getContext(), this, header); + public APINodeList parseResponse(String response, String header) throws APIException { + return OverrideDetails.parseResponse(response, getContext(), this, header); } @Override - public APINodeList execute() throws APIException { + public APINodeList execute() throws APIException { return execute(new HashMap()); } @Override - public APINodeList execute(Map extraParams) throws APIException { + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + new Function>() { + public APINodeList apply(ResponseWrapper result) { try { - return APIRequestGetChannelsToIntegrityStatus.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestGetOverrideDetails.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -792,28 +715,46 @@ public APINodeList apply(ResponseWrapper r ); }; - public APIRequestGetChannelsToIntegrityStatus(String nodeId, APIContext context) { - super(context, nodeId, "/channels_to_integrity_status", "GET", Arrays.asList(PARAMS)); + public APIRequestGetOverrideDetails(String nodeId, APIContext context) { + super(context, nodeId, "/override_details", "GET", Arrays.asList(PARAMS)); } @Override - public APIRequestGetChannelsToIntegrityStatus setParam(String param, Object value) { + public APIRequestGetOverrideDetails setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestGetChannelsToIntegrityStatus setParams(Map params) { + public APIRequestGetOverrideDetails setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestGetChannelsToIntegrityStatus requestAllFields () { + public APIRequestGetOverrideDetails setKeys (List keys) { + this.setParam("keys", keys); + return this; + } + public APIRequestGetOverrideDetails setKeys (String keys) { + this.setParam("keys", keys); + return this; + } + + public APIRequestGetOverrideDetails setType (OverrideDetails.EnumType type) { + this.setParam("type", type); + return this; + } + public APIRequestGetOverrideDetails setType (String type) { + this.setParam("type", type); + return this; + } + + public APIRequestGetOverrideDetails requestAllFields () { return this.requestAllFields(true); } - public APIRequestGetChannelsToIntegrityStatus requestAllFields (boolean value) { + public APIRequestGetOverrideDetails requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -821,12 +762,12 @@ public APIRequestGetChannelsToIntegrityStatus requestAllFields (boolean value) { } @Override - public APIRequestGetChannelsToIntegrityStatus requestFields (List fields) { + public APIRequestGetOverrideDetails requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestGetChannelsToIntegrityStatus requestFields (List fields, boolean value) { + public APIRequestGetOverrideDetails requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -834,29 +775,36 @@ public APIRequestGetChannelsToIntegrityStatus requestFields (List fields } @Override - public APIRequestGetChannelsToIntegrityStatus requestField (String field) { + public APIRequestGetOverrideDetails requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestGetChannelsToIntegrityStatus requestField (String field, boolean value) { + public APIRequestGetOverrideDetails requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } - public APIRequestGetChannelsToIntegrityStatus requestChannelsField () { - return this.requestChannelsField(true); + public APIRequestGetOverrideDetails requestKeyField () { + return this.requestKeyField(true); } - public APIRequestGetChannelsToIntegrityStatus requestChannelsField (boolean value) { - this.requestField("channels", value); + public APIRequestGetOverrideDetails requestKeyField (boolean value) { + this.requestField("key", value); return this; } - public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField () { - return this.requestRejectionInformationField(true); + public APIRequestGetOverrideDetails requestTypeField () { + return this.requestTypeField(true); } - public APIRequestGetChannelsToIntegrityStatus requestRejectionInformationField (boolean value) { - this.requestField("rejection_information", value); + public APIRequestGetOverrideDetails requestTypeField (boolean value) { + this.requestField("type", value); + return this; + } + public APIRequestGetOverrideDetails requestValuesField () { + return this.requestValuesField(true); + } + public APIRequestGetOverrideDetails requestValuesField (boolean value) { + this.requestField("values", value); return this; } } diff --git a/src/main/java/com/facebook/ads/sdk/VideoAsset.java b/src/main/java/com/facebook/ads/sdk/VideoAsset.java deleted file mode 100644 index 04937672..00000000 --- a/src/main/java/com/facebook/ads/sdk/VideoAsset.java +++ /dev/null @@ -1,1273 +0,0 @@ -/* - * 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 VideoAsset extends APINode { - @SerializedName("broadcast_id") - private String mBroadcastId = null; - @SerializedName("broadcast_planned_start_time") - private String mBroadcastPlannedStartTime = null; - @SerializedName("can_viewer_edit") - private Boolean mCanViewerEdit = null; - @SerializedName("copyright_monitoring_status") - private String mCopyrightMonitoringStatus = null; - @SerializedName("created_time") - private String mCreatedTime = null; - @SerializedName("creator") - private User mCreator = null; - @SerializedName("description") - private String mDescription = null; - @SerializedName("download_hd_url") - private String mDownloadHdUrl = null; - @SerializedName("download_sd_url") - private String mDownloadSdUrl = null; - @SerializedName("embeddable") - private Boolean mEmbeddable = null; - @SerializedName("expiration") - private Object mExpiration = null; - @SerializedName("feed_type") - private String mFeedType = null; - @SerializedName("id") - private String mId = null; - @SerializedName("is_crossposting_eligible") - private Boolean mIsCrosspostingEligible = null; - @SerializedName("is_crossposting_within_bm_eligible") - private Boolean mIsCrosspostingWithinBmEligible = null; - @SerializedName("is_crossposting_within_bm_enabled") - private Boolean mIsCrosspostingWithinBmEnabled = null; - @SerializedName("is_episode") - private Boolean mIsEpisode = null; - @SerializedName("is_featured") - private Boolean mIsFeatured = null; - @SerializedName("is_live_premiere") - private Boolean mIsLivePremiere = null; - @SerializedName("is_video_asset") - private Boolean mIsVideoAsset = null; - @SerializedName("last_added_time") - private String mLastAddedTime = null; - @SerializedName("latest_creator") - private User mLatestCreator = null; - @SerializedName("latest_owned_description") - private String mLatestOwnedDescription = null; - @SerializedName("latest_owned_title") - private String mLatestOwnedTitle = null; - @SerializedName("length") - private Double mLength = null; - @SerializedName("live_status") - private String mLiveStatus = null; - @SerializedName("no_story") - private Boolean mNoStory = null; - @SerializedName("owner_name") - private String mOwnerName = null; - @SerializedName("owner_picture") - private String mOwnerPicture = null; - @SerializedName("owner_post_state") - private String mOwnerPostState = null; - @SerializedName("permalink_url") - private String mPermalinkUrl = null; - @SerializedName("picture") - private String mPicture = null; - @SerializedName("posts_count") - private Long mPostsCount = null; - @SerializedName("posts_ids") - private List mPostsIds = null; - @SerializedName("posts_status") - private Object mPostsStatus = null; - @SerializedName("premiere_living_room_status") - private String mPremiereLivingRoomStatus = null; - @SerializedName("published") - private Boolean mPublished = null; - @SerializedName("scheduled_publish_time") - private String mScheduledPublishTime = null; - @SerializedName("secret") - private Boolean mSecret = null; - @SerializedName("secure_stream_url") - private String mSecureStreamUrl = null; - @SerializedName("social_actions") - private Boolean mSocialActions = null; - @SerializedName("status") - private VideoStatus mStatus = null; - @SerializedName("stream_url") - private String mStreamUrl = null; - @SerializedName("thumbnail_while_encoding") - private String mThumbnailWhileEncoding = null; - @SerializedName("title") - private String mTitle = null; - @SerializedName("views") - private Long mViews = null; - protected static Gson gson = null; - - VideoAsset() { - } - - public VideoAsset(Long id, APIContext context) { - this(id.toString(), context); - } - - public VideoAsset(String id, APIContext context) { - this.mId = id; - - this.context = context; - } - - public VideoAsset fetch() throws APIException{ - VideoAsset newInstance = fetchById(this.getPrefixedId().toString(), this.context); - this.copyFrom(newInstance); - return this; - } - - public static VideoAsset 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 VideoAsset 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", VideoAsset.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", VideoAsset.getParser()) - .setParam("ids", APIRequest.joinStringList(ids)) - .requestFields(fields) - .executeAsyncBase(); - } - - private String getPrefixedId() { - return getId(); - } - - public String getId() { - return getFieldId().toString(); - } - public static VideoAsset loadJSON(String json, APIContext context, String header) { - VideoAsset videoAsset = getGson().fromJson(json, VideoAsset.class); - if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(videoAsset.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); - } - } - videoAsset.context = context; - videoAsset.rawValue = json; - videoAsset.header = header; - return videoAsset; - } - - public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { - APINodeList videoAssets = 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++) { - videoAssets.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); - }; - return videoAssets; - } 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; - videoAssets.setCursors(before, after); - } - String previous = paging.has("previous") ? paging.get("previous").getAsString() : null; - String next = paging.has("next") ? paging.get("next").getAsString() : null; - videoAssets.setPaging(previous, next); - if (context.hasAppSecret()) { - videoAssets.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++) { - videoAssets.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()) { - videoAssets.add(loadJSON(entry.getValue().toString(), context, header)); - } - break; - } - } - if (!isRedownload) { - videoAssets.add(loadJSON(obj.toString(), context, header)); - } - } - return videoAssets; - } 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()) { - videoAssets.add(loadJSON(entry.getValue().toString(), context, header)); - } - return videoAssets; - } 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) - ) { - videoAssets.add(loadJSON(value.toString(), context, header)); - } else { - isIdIndexedArray = false; - break; - } - } - if (isIdIndexedArray) { - return videoAssets; - } - - // Sixth, check if it's pure JsonObject - videoAssets.clear(); - videoAssets.add(loadJSON(json, context, header)); - return videoAssets; - } - } - } 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 APIRequestGetInsights getInsights() { - return new APIRequestGetInsights(this.getPrefixedId().toString(), context); - } - - public APIRequestGet get() { - return new APIRequestGet(this.getPrefixedId().toString(), context); - } - - - public String getFieldBroadcastId() { - return mBroadcastId; - } - - public String getFieldBroadcastPlannedStartTime() { - return mBroadcastPlannedStartTime; - } - - public Boolean getFieldCanViewerEdit() { - return mCanViewerEdit; - } - - public String getFieldCopyrightMonitoringStatus() { - return mCopyrightMonitoringStatus; - } - - public String getFieldCreatedTime() { - return mCreatedTime; - } - - public User getFieldCreator() { - if (mCreator != null) { - mCreator.context = getContext(); - } - return mCreator; - } - - public String getFieldDescription() { - return mDescription; - } - - public String getFieldDownloadHdUrl() { - return mDownloadHdUrl; - } - - public String getFieldDownloadSdUrl() { - return mDownloadSdUrl; - } - - public Boolean getFieldEmbeddable() { - return mEmbeddable; - } - - public Object getFieldExpiration() { - return mExpiration; - } - - public String getFieldFeedType() { - return mFeedType; - } - - public String getFieldId() { - return mId; - } - - public Boolean getFieldIsCrosspostingEligible() { - return mIsCrosspostingEligible; - } - - public Boolean getFieldIsCrosspostingWithinBmEligible() { - return mIsCrosspostingWithinBmEligible; - } - - public Boolean getFieldIsCrosspostingWithinBmEnabled() { - return mIsCrosspostingWithinBmEnabled; - } - - public Boolean getFieldIsEpisode() { - return mIsEpisode; - } - - public Boolean getFieldIsFeatured() { - return mIsFeatured; - } - - public Boolean getFieldIsLivePremiere() { - return mIsLivePremiere; - } - - public Boolean getFieldIsVideoAsset() { - return mIsVideoAsset; - } - - public String getFieldLastAddedTime() { - return mLastAddedTime; - } - - public User getFieldLatestCreator() { - if (mLatestCreator != null) { - mLatestCreator.context = getContext(); - } - return mLatestCreator; - } - - public String getFieldLatestOwnedDescription() { - return mLatestOwnedDescription; - } - - public String getFieldLatestOwnedTitle() { - return mLatestOwnedTitle; - } - - public Double getFieldLength() { - return mLength; - } - - public String getFieldLiveStatus() { - return mLiveStatus; - } - - public Boolean getFieldNoStory() { - return mNoStory; - } - - public String getFieldOwnerName() { - return mOwnerName; - } - - public String getFieldOwnerPicture() { - return mOwnerPicture; - } - - public String getFieldOwnerPostState() { - return mOwnerPostState; - } - - public String getFieldPermalinkUrl() { - return mPermalinkUrl; - } - - public String getFieldPicture() { - return mPicture; - } - - public Long getFieldPostsCount() { - return mPostsCount; - } - - public List getFieldPostsIds() { - return mPostsIds; - } - - public Object getFieldPostsStatus() { - return mPostsStatus; - } - - public String getFieldPremiereLivingRoomStatus() { - return mPremiereLivingRoomStatus; - } - - public Boolean getFieldPublished() { - return mPublished; - } - - public String getFieldScheduledPublishTime() { - return mScheduledPublishTime; - } - - public Boolean getFieldSecret() { - return mSecret; - } - - public String getFieldSecureStreamUrl() { - return mSecureStreamUrl; - } - - public Boolean getFieldSocialActions() { - return mSocialActions; - } - - public VideoStatus getFieldStatus() { - return mStatus; - } - - public String getFieldStreamUrl() { - return mStreamUrl; - } - - public String getFieldThumbnailWhileEncoding() { - return mThumbnailWhileEncoding; - } - - public String getFieldTitle() { - return mTitle; - } - - public Long getFieldViews() { - return mViews; - } - - - - public static class APIRequestGetInsights extends APIRequest { - - APINodeList lastResponse = null; - @Override - public APINodeList getLastResponse() { - return lastResponse; - } - public static final String[] PARAMS = { - "metric", - "period", - }; - - public static final String[] FIELDS = { - "description", - "description_from_api_doc", - "id", - "name", - "period", - "title", - "values", - }; - - @Override - public APINodeList parseResponse(String response, String header) throws APIException { - return InsightsResult.parseResponse(response, getContext(), this, header); - } - - @Override - public APINodeList execute() throws APIException { - return execute(new HashMap()); - } - - @Override - public APINodeList 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 APINodeList apply(ResponseWrapper result) { - try { - return APIRequestGetInsights.this.parseResponse(result.getBody(), result.getHeader()); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - }, - MoreExecutors.directExecutor() - ); - }; - - public APIRequestGetInsights(String nodeId, APIContext context) { - super(context, nodeId, "/insights", "GET", Arrays.asList(PARAMS)); - } - - @Override - public APIRequestGetInsights setParam(String param, Object value) { - setParamInternal(param, value); - return this; - } - - @Override - public APIRequestGetInsights setParams(Map params) { - setParamsInternal(params); - return this; - } - - - public APIRequestGetInsights setMetric (List metric) { - this.setParam("metric", metric); - return this; - } - public APIRequestGetInsights setMetric (String metric) { - this.setParam("metric", metric); - return this; - } - - public APIRequestGetInsights setPeriod (InsightsResult.EnumPeriod period) { - this.setParam("period", period); - return this; - } - public APIRequestGetInsights setPeriod (String period) { - this.setParam("period", period); - return this; - } - - public APIRequestGetInsights requestAllFields () { - return this.requestAllFields(true); - } - - public APIRequestGetInsights requestAllFields (boolean value) { - for (String field : FIELDS) { - this.requestField(field, value); - } - return this; - } - - @Override - public APIRequestGetInsights requestFields (List fields) { - return this.requestFields(fields, true); - } - - @Override - public APIRequestGetInsights requestFields (List fields, boolean value) { - for (String field : fields) { - this.requestField(field, value); - } - return this; - } - - @Override - public APIRequestGetInsights requestField (String field) { - this.requestField(field, true); - return this; - } - - @Override - public APIRequestGetInsights requestField (String field, boolean value) { - this.requestFieldInternal(field, value); - return this; - } - - public APIRequestGetInsights requestDescriptionField () { - return this.requestDescriptionField(true); - } - public APIRequestGetInsights requestDescriptionField (boolean value) { - this.requestField("description", value); - return this; - } - public APIRequestGetInsights requestDescriptionFromApiDocField () { - return this.requestDescriptionFromApiDocField(true); - } - public APIRequestGetInsights requestDescriptionFromApiDocField (boolean value) { - this.requestField("description_from_api_doc", value); - return this; - } - public APIRequestGetInsights requestIdField () { - return this.requestIdField(true); - } - public APIRequestGetInsights requestIdField (boolean value) { - this.requestField("id", value); - return this; - } - public APIRequestGetInsights requestNameField () { - return this.requestNameField(true); - } - public APIRequestGetInsights requestNameField (boolean value) { - this.requestField("name", value); - return this; - } - public APIRequestGetInsights requestPeriodField () { - return this.requestPeriodField(true); - } - public APIRequestGetInsights requestPeriodField (boolean value) { - this.requestField("period", value); - return this; - } - public APIRequestGetInsights requestTitleField () { - return this.requestTitleField(true); - } - public APIRequestGetInsights requestTitleField (boolean value) { - this.requestField("title", value); - return this; - } - public APIRequestGetInsights requestValuesField () { - return this.requestValuesField(true); - } - public APIRequestGetInsights requestValuesField (boolean value) { - this.requestField("values", value); - return this; - } - } - - public static class APIRequestGet extends APIRequest { - - VideoAsset lastResponse = null; - @Override - public VideoAsset getLastResponse() { - return lastResponse; - } - public static final String[] PARAMS = { - }; - - public static final String[] FIELDS = { - "broadcast_id", - "broadcast_planned_start_time", - "can_viewer_edit", - "copyright_monitoring_status", - "created_time", - "creator", - "description", - "download_hd_url", - "download_sd_url", - "embeddable", - "expiration", - "feed_type", - "id", - "is_crossposting_eligible", - "is_crossposting_within_bm_eligible", - "is_crossposting_within_bm_enabled", - "is_episode", - "is_featured", - "is_live_premiere", - "is_video_asset", - "last_added_time", - "latest_creator", - "latest_owned_description", - "latest_owned_title", - "length", - "live_status", - "no_story", - "owner_name", - "owner_picture", - "owner_post_state", - "permalink_url", - "picture", - "posts_count", - "posts_ids", - "posts_status", - "premiere_living_room_status", - "published", - "scheduled_publish_time", - "secret", - "secure_stream_url", - "social_actions", - "status", - "stream_url", - "thumbnail_while_encoding", - "title", - "views", - }; - - @Override - public VideoAsset parseResponse(String response, String header) throws APIException { - return VideoAsset.parseResponse(response, getContext(), this, header).head(); - } - - @Override - public VideoAsset execute() throws APIException { - return execute(new HashMap()); - } - - @Override - public VideoAsset 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 VideoAsset 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 requestBroadcastIdField () { - return this.requestBroadcastIdField(true); - } - public APIRequestGet requestBroadcastIdField (boolean value) { - this.requestField("broadcast_id", value); - return this; - } - public APIRequestGet requestBroadcastPlannedStartTimeField () { - return this.requestBroadcastPlannedStartTimeField(true); - } - public APIRequestGet requestBroadcastPlannedStartTimeField (boolean value) { - this.requestField("broadcast_planned_start_time", value); - return this; - } - public APIRequestGet requestCanViewerEditField () { - return this.requestCanViewerEditField(true); - } - public APIRequestGet requestCanViewerEditField (boolean value) { - this.requestField("can_viewer_edit", value); - return this; - } - public APIRequestGet requestCopyrightMonitoringStatusField () { - return this.requestCopyrightMonitoringStatusField(true); - } - public APIRequestGet requestCopyrightMonitoringStatusField (boolean value) { - this.requestField("copyright_monitoring_status", value); - return this; - } - public APIRequestGet requestCreatedTimeField () { - return this.requestCreatedTimeField(true); - } - public APIRequestGet requestCreatedTimeField (boolean value) { - this.requestField("created_time", value); - return this; - } - public APIRequestGet requestCreatorField () { - return this.requestCreatorField(true); - } - public APIRequestGet requestCreatorField (boolean value) { - this.requestField("creator", value); - return this; - } - public APIRequestGet requestDescriptionField () { - return this.requestDescriptionField(true); - } - public APIRequestGet requestDescriptionField (boolean value) { - this.requestField("description", value); - return this; - } - public APIRequestGet requestDownloadHdUrlField () { - return this.requestDownloadHdUrlField(true); - } - public APIRequestGet requestDownloadHdUrlField (boolean value) { - this.requestField("download_hd_url", value); - return this; - } - public APIRequestGet requestDownloadSdUrlField () { - return this.requestDownloadSdUrlField(true); - } - public APIRequestGet requestDownloadSdUrlField (boolean value) { - this.requestField("download_sd_url", value); - return this; - } - public APIRequestGet requestEmbeddableField () { - return this.requestEmbeddableField(true); - } - public APIRequestGet requestEmbeddableField (boolean value) { - this.requestField("embeddable", value); - return this; - } - public APIRequestGet requestExpirationField () { - return this.requestExpirationField(true); - } - public APIRequestGet requestExpirationField (boolean value) { - this.requestField("expiration", value); - return this; - } - public APIRequestGet requestFeedTypeField () { - return this.requestFeedTypeField(true); - } - public APIRequestGet requestFeedTypeField (boolean value) { - this.requestField("feed_type", value); - return this; - } - public APIRequestGet requestIdField () { - return this.requestIdField(true); - } - public APIRequestGet requestIdField (boolean value) { - this.requestField("id", value); - return this; - } - public APIRequestGet requestIsCrosspostingEligibleField () { - return this.requestIsCrosspostingEligibleField(true); - } - public APIRequestGet requestIsCrosspostingEligibleField (boolean value) { - this.requestField("is_crossposting_eligible", value); - return this; - } - public APIRequestGet requestIsCrosspostingWithinBmEligibleField () { - return this.requestIsCrosspostingWithinBmEligibleField(true); - } - public APIRequestGet requestIsCrosspostingWithinBmEligibleField (boolean value) { - this.requestField("is_crossposting_within_bm_eligible", value); - return this; - } - public APIRequestGet requestIsCrosspostingWithinBmEnabledField () { - return this.requestIsCrosspostingWithinBmEnabledField(true); - } - public APIRequestGet requestIsCrosspostingWithinBmEnabledField (boolean value) { - this.requestField("is_crossposting_within_bm_enabled", value); - return this; - } - public APIRequestGet requestIsEpisodeField () { - return this.requestIsEpisodeField(true); - } - public APIRequestGet requestIsEpisodeField (boolean value) { - this.requestField("is_episode", value); - return this; - } - public APIRequestGet requestIsFeaturedField () { - return this.requestIsFeaturedField(true); - } - public APIRequestGet requestIsFeaturedField (boolean value) { - this.requestField("is_featured", value); - return this; - } - public APIRequestGet requestIsLivePremiereField () { - return this.requestIsLivePremiereField(true); - } - public APIRequestGet requestIsLivePremiereField (boolean value) { - this.requestField("is_live_premiere", value); - return this; - } - public APIRequestGet requestIsVideoAssetField () { - return this.requestIsVideoAssetField(true); - } - public APIRequestGet requestIsVideoAssetField (boolean value) { - this.requestField("is_video_asset", value); - return this; - } - public APIRequestGet requestLastAddedTimeField () { - return this.requestLastAddedTimeField(true); - } - public APIRequestGet requestLastAddedTimeField (boolean value) { - this.requestField("last_added_time", value); - return this; - } - public APIRequestGet requestLatestCreatorField () { - return this.requestLatestCreatorField(true); - } - public APIRequestGet requestLatestCreatorField (boolean value) { - this.requestField("latest_creator", value); - return this; - } - public APIRequestGet requestLatestOwnedDescriptionField () { - return this.requestLatestOwnedDescriptionField(true); - } - public APIRequestGet requestLatestOwnedDescriptionField (boolean value) { - this.requestField("latest_owned_description", value); - return this; - } - public APIRequestGet requestLatestOwnedTitleField () { - return this.requestLatestOwnedTitleField(true); - } - public APIRequestGet requestLatestOwnedTitleField (boolean value) { - this.requestField("latest_owned_title", value); - return this; - } - public APIRequestGet requestLengthField () { - return this.requestLengthField(true); - } - public APIRequestGet requestLengthField (boolean value) { - this.requestField("length", value); - return this; - } - public APIRequestGet requestLiveStatusField () { - return this.requestLiveStatusField(true); - } - public APIRequestGet requestLiveStatusField (boolean value) { - this.requestField("live_status", value); - return this; - } - public APIRequestGet requestNoStoryField () { - return this.requestNoStoryField(true); - } - public APIRequestGet requestNoStoryField (boolean value) { - this.requestField("no_story", value); - return this; - } - public APIRequestGet requestOwnerNameField () { - return this.requestOwnerNameField(true); - } - public APIRequestGet requestOwnerNameField (boolean value) { - this.requestField("owner_name", value); - return this; - } - public APIRequestGet requestOwnerPictureField () { - return this.requestOwnerPictureField(true); - } - public APIRequestGet requestOwnerPictureField (boolean value) { - this.requestField("owner_picture", value); - return this; - } - public APIRequestGet requestOwnerPostStateField () { - return this.requestOwnerPostStateField(true); - } - public APIRequestGet requestOwnerPostStateField (boolean value) { - this.requestField("owner_post_state", value); - return this; - } - public APIRequestGet requestPermalinkUrlField () { - return this.requestPermalinkUrlField(true); - } - public APIRequestGet requestPermalinkUrlField (boolean value) { - this.requestField("permalink_url", value); - return this; - } - public APIRequestGet requestPictureField () { - return this.requestPictureField(true); - } - public APIRequestGet requestPictureField (boolean value) { - this.requestField("picture", value); - return this; - } - public APIRequestGet requestPostsCountField () { - return this.requestPostsCountField(true); - } - public APIRequestGet requestPostsCountField (boolean value) { - this.requestField("posts_count", value); - return this; - } - public APIRequestGet requestPostsIdsField () { - return this.requestPostsIdsField(true); - } - public APIRequestGet requestPostsIdsField (boolean value) { - this.requestField("posts_ids", value); - return this; - } - public APIRequestGet requestPostsStatusField () { - return this.requestPostsStatusField(true); - } - public APIRequestGet requestPostsStatusField (boolean value) { - this.requestField("posts_status", value); - return this; - } - public APIRequestGet requestPremiereLivingRoomStatusField () { - return this.requestPremiereLivingRoomStatusField(true); - } - public APIRequestGet requestPremiereLivingRoomStatusField (boolean value) { - this.requestField("premiere_living_room_status", value); - return this; - } - public APIRequestGet requestPublishedField () { - return this.requestPublishedField(true); - } - public APIRequestGet requestPublishedField (boolean value) { - this.requestField("published", value); - return this; - } - public APIRequestGet requestScheduledPublishTimeField () { - return this.requestScheduledPublishTimeField(true); - } - public APIRequestGet requestScheduledPublishTimeField (boolean value) { - this.requestField("scheduled_publish_time", value); - return this; - } - public APIRequestGet requestSecretField () { - return this.requestSecretField(true); - } - public APIRequestGet requestSecretField (boolean value) { - this.requestField("secret", value); - return this; - } - public APIRequestGet requestSecureStreamUrlField () { - return this.requestSecureStreamUrlField(true); - } - public APIRequestGet requestSecureStreamUrlField (boolean value) { - this.requestField("secure_stream_url", value); - return this; - } - public APIRequestGet requestSocialActionsField () { - return this.requestSocialActionsField(true); - } - public APIRequestGet requestSocialActionsField (boolean value) { - this.requestField("social_actions", value); - return this; - } - public APIRequestGet requestStatusField () { - return this.requestStatusField(true); - } - public APIRequestGet requestStatusField (boolean value) { - this.requestField("status", value); - return this; - } - public APIRequestGet requestStreamUrlField () { - return this.requestStreamUrlField(true); - } - public APIRequestGet requestStreamUrlField (boolean value) { - this.requestField("stream_url", value); - return this; - } - public APIRequestGet requestThumbnailWhileEncodingField () { - return this.requestThumbnailWhileEncodingField(true); - } - public APIRequestGet requestThumbnailWhileEncodingField (boolean value) { - this.requestField("thumbnail_while_encoding", value); - return this; - } - public APIRequestGet requestTitleField () { - return this.requestTitleField(true); - } - public APIRequestGet requestTitleField (boolean value) { - this.requestField("title", value); - return this; - } - public APIRequestGet requestViewsField () { - return this.requestViewsField(true); - } - public APIRequestGet requestViewsField (boolean value) { - this.requestField("views", 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 VideoAsset copyFrom(VideoAsset instance) { - this.mBroadcastId = instance.mBroadcastId; - this.mBroadcastPlannedStartTime = instance.mBroadcastPlannedStartTime; - this.mCanViewerEdit = instance.mCanViewerEdit; - this.mCopyrightMonitoringStatus = instance.mCopyrightMonitoringStatus; - this.mCreatedTime = instance.mCreatedTime; - this.mCreator = instance.mCreator; - this.mDescription = instance.mDescription; - this.mDownloadHdUrl = instance.mDownloadHdUrl; - this.mDownloadSdUrl = instance.mDownloadSdUrl; - this.mEmbeddable = instance.mEmbeddable; - this.mExpiration = instance.mExpiration; - this.mFeedType = instance.mFeedType; - this.mId = instance.mId; - this.mIsCrosspostingEligible = instance.mIsCrosspostingEligible; - this.mIsCrosspostingWithinBmEligible = instance.mIsCrosspostingWithinBmEligible; - this.mIsCrosspostingWithinBmEnabled = instance.mIsCrosspostingWithinBmEnabled; - this.mIsEpisode = instance.mIsEpisode; - this.mIsFeatured = instance.mIsFeatured; - this.mIsLivePremiere = instance.mIsLivePremiere; - this.mIsVideoAsset = instance.mIsVideoAsset; - this.mLastAddedTime = instance.mLastAddedTime; - this.mLatestCreator = instance.mLatestCreator; - this.mLatestOwnedDescription = instance.mLatestOwnedDescription; - this.mLatestOwnedTitle = instance.mLatestOwnedTitle; - this.mLength = instance.mLength; - this.mLiveStatus = instance.mLiveStatus; - this.mNoStory = instance.mNoStory; - this.mOwnerName = instance.mOwnerName; - this.mOwnerPicture = instance.mOwnerPicture; - this.mOwnerPostState = instance.mOwnerPostState; - this.mPermalinkUrl = instance.mPermalinkUrl; - this.mPicture = instance.mPicture; - this.mPostsCount = instance.mPostsCount; - this.mPostsIds = instance.mPostsIds; - this.mPostsStatus = instance.mPostsStatus; - this.mPremiereLivingRoomStatus = instance.mPremiereLivingRoomStatus; - this.mPublished = instance.mPublished; - this.mScheduledPublishTime = instance.mScheduledPublishTime; - this.mSecret = instance.mSecret; - this.mSecureStreamUrl = instance.mSecureStreamUrl; - this.mSocialActions = instance.mSocialActions; - this.mStatus = instance.mStatus; - this.mStreamUrl = instance.mStreamUrl; - this.mThumbnailWhileEncoding = instance.mThumbnailWhileEncoding; - this.mTitle = instance.mTitle; - this.mViews = instance.mViews; - 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 VideoAsset.parseResponse(response, context, request, header); - } - }; - } -} diff --git a/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessAccount.java b/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessAccount.java index 486f8f0b..face3d9f 100644 --- a/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessAccount.java +++ b/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessAccount.java @@ -294,6 +294,10 @@ public String toString() { return getGson().toJson(this); } + public APIRequestGetActivities getActivities() { + return new APIRequestGetActivities(this.getPrefixedId().toString(), context); + } + public APIRequestDeleteAssignedUsers deleteAssignedUsers() { return new APIRequestDeleteAssignedUsers(this.getPrefixedId().toString(), context); } @@ -314,6 +318,14 @@ public APIRequestGetConversationAnalytics getConversationAnalytics() { return new APIRequestGetConversationAnalytics(this.getPrefixedId().toString(), context); } + public APIRequestGetDataset getDataset() { + return new APIRequestGetDataset(this.getPrefixedId().toString(), context); + } + + public APIRequestCreateDataset createDataset() { + return new APIRequestCreateDataset(this.getPrefixedId().toString(), context); + } + public APIRequestGetDccConfig getDccConfig() { return new APIRequestGetDccConfig(this.getPrefixedId().toString(), context); } @@ -326,6 +338,10 @@ public APIRequestCreateFlow createFlow() { return new APIRequestCreateFlow(this.getPrefixedId().toString(), context); } + public APIRequestCreateGeneratePaymentConfigurationOauthLink createGeneratePaymentConfigurationOauthLink() { + return new APIRequestCreateGeneratePaymentConfigurationOauthLink(this.getPrefixedId().toString(), context); + } + public APIRequestGetMessageCampaigns getMessageCampaigns() { return new APIRequestGetMessageCampaigns(this.getPrefixedId().toString(), context); } @@ -346,10 +362,30 @@ public APIRequestCreateMessageTemplate createMessageTemplate() { return new APIRequestCreateMessageTemplate(this.getPrefixedId().toString(), context); } + public APIRequestCreateMigrateFlow createMigrateFlow() { + return new APIRequestCreateMigrateFlow(this.getPrefixedId().toString(), context); + } + public APIRequestCreateMigrateMessageTemplate createMigrateMessageTemplate() { return new APIRequestCreateMigrateMessageTemplate(this.getPrefixedId().toString(), context); } + public APIRequestDeletePaymentConfiguration deletePaymentConfiguration() { + return new APIRequestDeletePaymentConfiguration(this.getPrefixedId().toString(), context); + } + + public APIRequestGetPaymentConfiguration getPaymentConfiguration() { + return new APIRequestGetPaymentConfiguration(this.getPrefixedId().toString(), context); + } + + public APIRequestCreatePaymentConfiguration createPaymentConfiguration() { + return new APIRequestCreatePaymentConfiguration(this.getPrefixedId().toString(), context); + } + + public APIRequestGetPaymentConfigurations getPaymentConfigurations() { + return new APIRequestGetPaymentConfigurations(this.getPrefixedId().toString(), context); + } + public APIRequestGetPhoneNumbers getPhoneNumbers() { return new APIRequestGetPhoneNumbers(this.getPrefixedId().toString(), context); } @@ -378,6 +414,10 @@ public APIRequestCreateSetOboMobilityIntent createSetOboMobilityIntent() { return new APIRequestCreateSetOboMobilityIntent(this.getPrefixedId().toString(), context); } + public APIRequestCreateSetSolutionMigrationInTEnt createSetSolutionMigrationInTEnt() { + return new APIRequestCreateSetSolutionMigrationInTEnt(this.getPrefixedId().toString(), context); + } + public APIRequestGetSolutions getSolutions() { return new APIRequestGetSolutions(this.getPrefixedId().toString(), context); } @@ -406,6 +446,10 @@ public APIRequestCreateUpsertMessageTemplate createUpsertMessageTemplate() { return new APIRequestCreateUpsertMessageTemplate(this.getPrefixedId().toString(), context); } + public APIRequestGetWelcomeMessageSequences getWelcomeMessageSequences() { + return new APIRequestGetWelcomeMessageSequences(this.getPrefixedId().toString(), context); + } + public APIRequestGet get() { return new APIRequestGet(this.getPrefixedId().toString(), context); } @@ -511,6 +555,111 @@ public String getFieldTimezoneId() { + public static class APIRequestGetActivities extends APIRequest { + + APINodeList lastResponse = null; + @Override + public APINodeList getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + }; + + public static final String[] FIELDS = { + }; + + @Override + public APINodeList parseResponse(String response, String header) throws APIException { + return APINode.parseResponse(response, getContext(), this, header); + } + + @Override + public APINodeList execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + try { + return APIRequestGetActivities.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestGetActivities(String nodeId, APIContext context) { + super(context, nodeId, "/activities", "GET", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestGetActivities setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestGetActivities setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestGetActivities requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestGetActivities requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetActivities requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestGetActivities requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetActivities requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestGetActivities requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + public static class APIRequestDeleteAssignedUsers extends APIRequest { APINodeList lastResponse = null; @@ -1204,47 +1353,49 @@ public APIRequestGetConversationAnalytics requestField (String field, boolean va } - public static class APIRequestGetDccConfig extends APIRequest { + public static class APIRequestGetDataset extends APIRequest { - APINodeList lastResponse = null; + APINodeList lastResponse = null; @Override - public APINodeList getLastResponse() { + public APINodeList getLastResponse() { return lastResponse; } public static final String[] PARAMS = { }; public static final String[] FIELDS = { + "id", + "name", }; @Override - public APINodeList parseResponse(String response, String header) throws APIException { - return APINode.parseResponse(response, getContext(), this, header); + public APINodeList parseResponse(String response, String header) throws APIException { + return Dataset.parseResponse(response, getContext(), this, header); } @Override - public APINodeList execute() throws APIException { + public APINodeList execute() throws APIException { return execute(new HashMap()); } @Override - public APINodeList execute(Map extraParams) throws APIException { + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + new Function>() { + public APINodeList apply(ResponseWrapper result) { try { - return APIRequestGetDccConfig.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestGetDataset.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -1254,28 +1405,28 @@ public APINodeList apply(ResponseWrapper result) { ); }; - public APIRequestGetDccConfig(String nodeId, APIContext context) { - super(context, nodeId, "/dcc_config", "GET", Arrays.asList(PARAMS)); + public APIRequestGetDataset(String nodeId, APIContext context) { + super(context, nodeId, "/dataset", "GET", Arrays.asList(PARAMS)); } @Override - public APIRequestGetDccConfig setParam(String param, Object value) { + public APIRequestGetDataset setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestGetDccConfig setParams(Map params) { + public APIRequestGetDataset setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestGetDccConfig requestAllFields () { + public APIRequestGetDataset requestAllFields () { return this.requestAllFields(true); } - public APIRequestGetDccConfig requestAllFields (boolean value) { + public APIRequestGetDataset requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -1283,12 +1434,12 @@ public APIRequestGetDccConfig requestAllFields (boolean value) { } @Override - public APIRequestGetDccConfig requestFields (List fields) { + public APIRequestGetDataset requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestGetDccConfig requestFields (List fields, boolean value) { + public APIRequestGetDataset requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -1296,60 +1447,75 @@ public APIRequestGetDccConfig requestFields (List fields, boolean value) } @Override - public APIRequestGetDccConfig requestField (String field) { + public APIRequestGetDataset requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestGetDccConfig requestField (String field, boolean value) { + public APIRequestGetDataset requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } + public APIRequestGetDataset requestIdField () { + return this.requestIdField(true); + } + public APIRequestGetDataset requestIdField (boolean value) { + this.requestField("id", value); + return this; + } + public APIRequestGetDataset requestNameField () { + return this.requestNameField(true); + } + public APIRequestGetDataset requestNameField (boolean value) { + this.requestField("name", value); + return this; + } } - public static class APIRequestGetFlows extends APIRequest { + public static class APIRequestCreateDataset extends APIRequest { - APINodeList lastResponse = null; + Dataset lastResponse = null; @Override - public APINodeList getLastResponse() { + public Dataset getLastResponse() { return lastResponse; } public static final String[] PARAMS = { + "dataset_name", }; public static final String[] FIELDS = { }; @Override - public APINodeList parseResponse(String response, String header) throws APIException { - return APINode.parseResponse(response, getContext(), this, header); + public Dataset parseResponse(String response, String header) throws APIException { + return Dataset.parseResponse(response, getContext(), this, header).head(); } @Override - public APINodeList execute() throws APIException { + public Dataset execute() throws APIException { return execute(new HashMap()); } @Override - public APINodeList execute(Map extraParams) throws APIException { + public Dataset execute(Map extraParams) throws APIException { ResponseWrapper rw = executeInternal(extraParams); - lastResponse = parseResponse(rw.getBody(),rw.getHeader()); + 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 APINodeList apply(ResponseWrapper result) { + new Function() { + public Dataset apply(ResponseWrapper result) { try { - return APIRequestGetFlows.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestCreateDataset.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -1359,28 +1525,33 @@ public APINodeList apply(ResponseWrapper result) { ); }; - public APIRequestGetFlows(String nodeId, APIContext context) { - super(context, nodeId, "/flows", "GET", Arrays.asList(PARAMS)); + public APIRequestCreateDataset(String nodeId, APIContext context) { + super(context, nodeId, "/dataset", "POST", Arrays.asList(PARAMS)); } @Override - public APIRequestGetFlows setParam(String param, Object value) { + public APIRequestCreateDataset setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestGetFlows setParams(Map params) { + public APIRequestCreateDataset setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestGetFlows requestAllFields () { + public APIRequestCreateDataset setDatasetName (String datasetName) { + this.setParam("dataset_name", datasetName); + return this; + } + + public APIRequestCreateDataset requestAllFields () { return this.requestAllFields(true); } - public APIRequestGetFlows requestAllFields (boolean value) { + public APIRequestCreateDataset requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -1388,12 +1559,12 @@ public APIRequestGetFlows requestAllFields (boolean value) { } @Override - public APIRequestGetFlows requestFields (List fields) { + public APIRequestCreateDataset requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestGetFlows requestFields (List fields, boolean value) { + public APIRequestCreateDataset requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -1401,64 +1572,60 @@ public APIRequestGetFlows requestFields (List fields, boolean value) { } @Override - public APIRequestGetFlows requestField (String field) { + public APIRequestCreateDataset requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestGetFlows requestField (String field, boolean value) { + public APIRequestCreateDataset requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } } - public static class APIRequestCreateFlow extends APIRequest { + public static class APIRequestGetDccConfig extends APIRequest { - APINode lastResponse = null; + APINodeList lastResponse = null; @Override - public APINode getLastResponse() { + public APINodeList getLastResponse() { return lastResponse; } public static final String[] PARAMS = { - "categories", - "clone_flow_id", - "endpoint_uri", - "name", }; public static final String[] FIELDS = { }; @Override - public APINode parseResponse(String response, String header) throws APIException { - return APINode.parseResponse(response, getContext(), this, header).head(); + public APINodeList parseResponse(String response, String header) throws APIException { + return APINode.parseResponse(response, getContext(), this, header); } @Override - public APINode execute() throws APIException { + public APINodeList execute() throws APIException { return execute(new HashMap()); } @Override - public APINode execute(Map extraParams) throws APIException { + public APINodeList execute(Map extraParams) throws APIException { ResponseWrapper rw = executeInternal(extraParams); - lastResponse = parseResponse(rw.getBody(), rw.getHeader()); + 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 APINode apply(ResponseWrapper result) { + new Function>() { + public APINodeList apply(ResponseWrapper result) { try { - return APIRequestCreateFlow.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestGetDccConfig.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -1468,52 +1635,28 @@ public APINode apply(ResponseWrapper result) { ); }; - public APIRequestCreateFlow(String nodeId, APIContext context) { - super(context, nodeId, "/flows", "POST", Arrays.asList(PARAMS)); + public APIRequestGetDccConfig(String nodeId, APIContext context) { + super(context, nodeId, "/dcc_config", "GET", Arrays.asList(PARAMS)); } @Override - public APIRequestCreateFlow setParam(String param, Object value) { + public APIRequestGetDccConfig setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestCreateFlow setParams(Map params) { + public APIRequestGetDccConfig setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestCreateFlow setCategories (List categories) { - this.setParam("categories", categories); - return this; - } - public APIRequestCreateFlow setCategories (String categories) { - this.setParam("categories", categories); - return this; - } - - public APIRequestCreateFlow setCloneFlowId (String cloneFlowId) { - this.setParam("clone_flow_id", cloneFlowId); - return this; - } - - public APIRequestCreateFlow setEndpointUri (String endpointUri) { - this.setParam("endpoint_uri", endpointUri); - return this; - } - - public APIRequestCreateFlow setName (String name) { - this.setParam("name", name); - return this; - } - - public APIRequestCreateFlow requestAllFields () { + public APIRequestGetDccConfig requestAllFields () { return this.requestAllFields(true); } - public APIRequestCreateFlow requestAllFields (boolean value) { + public APIRequestGetDccConfig requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -1521,12 +1664,12 @@ public APIRequestCreateFlow requestAllFields (boolean value) { } @Override - public APIRequestCreateFlow requestFields (List fields) { + public APIRequestGetDccConfig requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestCreateFlow requestFields (List fields, boolean value) { + public APIRequestGetDccConfig requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -1534,20 +1677,20 @@ public APIRequestCreateFlow requestFields (List fields, boolean value) { } @Override - public APIRequestCreateFlow requestField (String field) { + public APIRequestGetDccConfig requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestCreateFlow requestField (String field, boolean value) { + public APIRequestGetDccConfig requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } } - public static class APIRequestGetMessageCampaigns extends APIRequest { + public static class APIRequestGetFlows extends APIRequest { APINodeList lastResponse = null; @Override @@ -1587,7 +1730,7 @@ public ListenableFuture> executeAsync(Map e new Function>() { public APINodeList apply(ResponseWrapper result) { try { - return APIRequestGetMessageCampaigns.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestGetFlows.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -1597,28 +1740,1021 @@ public APINodeList apply(ResponseWrapper result) { ); }; - public APIRequestGetMessageCampaigns(String nodeId, APIContext context) { - super(context, nodeId, "/message_campaigns", "GET", Arrays.asList(PARAMS)); + public APIRequestGetFlows(String nodeId, APIContext context) { + super(context, nodeId, "/flows", "GET", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestGetFlows setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestGetFlows setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestGetFlows requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestGetFlows requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetFlows requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestGetFlows requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetFlows requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestGetFlows requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + + public static class APIRequestCreateFlow extends APIRequest { + + APINode lastResponse = null; + @Override + public APINode getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "categories", + "clone_flow_id", + "endpoint_uri", + "name", + }; + + public static final String[] FIELDS = { + }; + + @Override + public APINode parseResponse(String response, String header) throws APIException { + return APINode.parseResponse(response, getContext(), this, header).head(); + } + + @Override + public APINode execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINode 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 APINode apply(ResponseWrapper result) { + try { + return APIRequestCreateFlow.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestCreateFlow(String nodeId, APIContext context) { + super(context, nodeId, "/flows", "POST", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestCreateFlow setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestCreateFlow setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestCreateFlow setCategories (List categories) { + this.setParam("categories", categories); + return this; + } + public APIRequestCreateFlow setCategories (String categories) { + this.setParam("categories", categories); + return this; + } + + public APIRequestCreateFlow setCloneFlowId (String cloneFlowId) { + this.setParam("clone_flow_id", cloneFlowId); + return this; + } + + public APIRequestCreateFlow setEndpointUri (String endpointUri) { + this.setParam("endpoint_uri", endpointUri); + return this; + } + + public APIRequestCreateFlow setName (String name) { + this.setParam("name", name); + return this; + } + + public APIRequestCreateFlow requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestCreateFlow requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestCreateFlow requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestCreateFlow requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestCreateFlow requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestCreateFlow requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + + public static class APIRequestCreateGeneratePaymentConfigurationOauthLink extends APIRequest { + + WhatsAppBusinessAccount lastResponse = null; + @Override + public WhatsAppBusinessAccount getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "configuration_name", + "redirect_url", + }; + + public static final String[] FIELDS = { + }; + + @Override + public WhatsAppBusinessAccount parseResponse(String response, String header) throws APIException { + return WhatsAppBusinessAccount.parseResponse(response, getContext(), this, header).head(); + } + + @Override + public WhatsAppBusinessAccount execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public WhatsAppBusinessAccount 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 WhatsAppBusinessAccount apply(ResponseWrapper result) { + try { + return APIRequestCreateGeneratePaymentConfigurationOauthLink.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestCreateGeneratePaymentConfigurationOauthLink(String nodeId, APIContext context) { + super(context, nodeId, "/generate_payment_configuration_oauth_link", "POST", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestCreateGeneratePaymentConfigurationOauthLink setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestCreateGeneratePaymentConfigurationOauthLink setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestCreateGeneratePaymentConfigurationOauthLink setConfigurationName (String configurationName) { + this.setParam("configuration_name", configurationName); + return this; + } + + public APIRequestCreateGeneratePaymentConfigurationOauthLink setRedirectUrl (String redirectUrl) { + this.setParam("redirect_url", redirectUrl); + return this; + } + + public APIRequestCreateGeneratePaymentConfigurationOauthLink requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestCreateGeneratePaymentConfigurationOauthLink requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestCreateGeneratePaymentConfigurationOauthLink requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestCreateGeneratePaymentConfigurationOauthLink requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestCreateGeneratePaymentConfigurationOauthLink requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestCreateGeneratePaymentConfigurationOauthLink requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + + public static class APIRequestGetMessageCampaigns extends APIRequest { + + APINodeList lastResponse = null; + @Override + public APINodeList getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + }; + + public static final String[] FIELDS = { + }; + + @Override + public APINodeList parseResponse(String response, String header) throws APIException { + return APINode.parseResponse(response, getContext(), this, header); + } + + @Override + public APINodeList execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + try { + return APIRequestGetMessageCampaigns.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestGetMessageCampaigns(String nodeId, APIContext context) { + super(context, nodeId, "/message_campaigns", "GET", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestGetMessageCampaigns setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestGetMessageCampaigns setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestGetMessageCampaigns requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestGetMessageCampaigns requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetMessageCampaigns requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestGetMessageCampaigns requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetMessageCampaigns requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestGetMessageCampaigns requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + + public static class APIRequestGetMessageTemplatePreviews extends APIRequest { + + APINodeList lastResponse = null; + @Override + public APINodeList getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "add_security_recommendation", + "button_types", + "category", + "code_expiration_minutes", + "languages", + }; + + public static final String[] FIELDS = { + }; + + @Override + public APINodeList parseResponse(String response, String header) throws APIException { + return APINode.parseResponse(response, getContext(), this, header); + } + + @Override + public APINodeList execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + try { + return APIRequestGetMessageTemplatePreviews.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestGetMessageTemplatePreviews(String nodeId, APIContext context) { + super(context, nodeId, "/message_template_previews", "GET", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestGetMessageTemplatePreviews setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestGetMessageTemplatePreviews setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestGetMessageTemplatePreviews setAddSecurityRecommendation (Boolean addSecurityRecommendation) { + this.setParam("add_security_recommendation", addSecurityRecommendation); + return this; + } + public APIRequestGetMessageTemplatePreviews setAddSecurityRecommendation (String addSecurityRecommendation) { + this.setParam("add_security_recommendation", addSecurityRecommendation); + return this; + } + + public APIRequestGetMessageTemplatePreviews setButtonTypes (List buttonTypes) { + this.setParam("button_types", buttonTypes); + return this; + } + public APIRequestGetMessageTemplatePreviews setButtonTypes (String buttonTypes) { + this.setParam("button_types", buttonTypes); + return this; + } + + public APIRequestGetMessageTemplatePreviews setCategory (EnumCategory category) { + this.setParam("category", category); + return this; + } + public APIRequestGetMessageTemplatePreviews setCategory (String category) { + this.setParam("category", category); + return this; + } + + public APIRequestGetMessageTemplatePreviews setCodeExpirationMinutes (Long codeExpirationMinutes) { + this.setParam("code_expiration_minutes", codeExpirationMinutes); + return this; + } + public APIRequestGetMessageTemplatePreviews setCodeExpirationMinutes (String codeExpirationMinutes) { + this.setParam("code_expiration_minutes", codeExpirationMinutes); + return this; + } + + public APIRequestGetMessageTemplatePreviews setLanguages (List languages) { + this.setParam("languages", languages); + return this; + } + public APIRequestGetMessageTemplatePreviews setLanguages (String languages) { + this.setParam("languages", languages); + return this; + } + + public APIRequestGetMessageTemplatePreviews requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestGetMessageTemplatePreviews requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetMessageTemplatePreviews requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestGetMessageTemplatePreviews requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetMessageTemplatePreviews requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestGetMessageTemplatePreviews requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + + public static class APIRequestDeleteMessageTemplates extends APIRequest { + + APINodeList lastResponse = null; + @Override + public APINodeList getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "hsm_id", + "name", + }; + + public static final String[] FIELDS = { + }; + + @Override + public APINodeList parseResponse(String response, String header) throws APIException { + return APINode.parseResponse(response, getContext(), this, header); + } + + @Override + public APINodeList execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + try { + return APIRequestDeleteMessageTemplates.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestDeleteMessageTemplates(String nodeId, APIContext context) { + super(context, nodeId, "/message_templates", "DELETE", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestDeleteMessageTemplates setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestDeleteMessageTemplates setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestDeleteMessageTemplates setHsmId (String hsmId) { + this.setParam("hsm_id", hsmId); + return this; + } + + public APIRequestDeleteMessageTemplates setName (String name) { + this.setParam("name", name); + return this; + } + + public APIRequestDeleteMessageTemplates requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestDeleteMessageTemplates requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestDeleteMessageTemplates requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestDeleteMessageTemplates requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestDeleteMessageTemplates requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestDeleteMessageTemplates requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + + public static class APIRequestGetMessageTemplates extends APIRequest { + + APINodeList lastResponse = null; + @Override + public APINodeList getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "category", + "content", + "language", + "name", + "name_or_content", + "quality_score", + "status", + }; + + public static final String[] FIELDS = { + }; + + @Override + public APINodeList parseResponse(String response, String header) throws APIException { + return APINode.parseResponse(response, getContext(), this, header); + } + + @Override + public APINodeList execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + try { + return APIRequestGetMessageTemplates.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestGetMessageTemplates(String nodeId, APIContext context) { + super(context, nodeId, "/message_templates", "GET", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestGetMessageTemplates setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestGetMessageTemplates setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestGetMessageTemplates setCategory (List category) { + this.setParam("category", category); + return this; + } + public APIRequestGetMessageTemplates setCategory (String category) { + this.setParam("category", category); + return this; + } + + public APIRequestGetMessageTemplates setContent (String content) { + this.setParam("content", content); + return this; + } + + public APIRequestGetMessageTemplates setLanguage (List language) { + this.setParam("language", language); + return this; + } + public APIRequestGetMessageTemplates setLanguage (String language) { + this.setParam("language", language); + return this; + } + + public APIRequestGetMessageTemplates setName (String name) { + this.setParam("name", name); + return this; + } + + public APIRequestGetMessageTemplates setNameOrContent (String nameOrContent) { + this.setParam("name_or_content", nameOrContent); + return this; + } + + public APIRequestGetMessageTemplates setQualityScore (List qualityScore) { + this.setParam("quality_score", qualityScore); + return this; + } + public APIRequestGetMessageTemplates setQualityScore (String qualityScore) { + this.setParam("quality_score", qualityScore); + return this; + } + + public APIRequestGetMessageTemplates setStatus (List status) { + this.setParam("status", status); + return this; + } + public APIRequestGetMessageTemplates setStatus (String status) { + this.setParam("status", status); + return this; + } + + public APIRequestGetMessageTemplates requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestGetMessageTemplates requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetMessageTemplates requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestGetMessageTemplates requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetMessageTemplates requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestGetMessageTemplates requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + + public static class APIRequestCreateMessageTemplate extends APIRequest { + + WhatsAppBusinessAccount lastResponse = null; + @Override + public WhatsAppBusinessAccount getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "allow_category_change", + "category", + "components", + "cta_url_link_tracking_opted_out", + "display_format", + "language", + "library_template_button_inputs", + "library_template_name", + "message_send_ttl_seconds", + "name", + "sub_category", + }; + + public static final String[] FIELDS = { + }; + + @Override + public WhatsAppBusinessAccount parseResponse(String response, String header) throws APIException { + return WhatsAppBusinessAccount.parseResponse(response, getContext(), this, header).head(); + } + + @Override + public WhatsAppBusinessAccount execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public WhatsAppBusinessAccount 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 WhatsAppBusinessAccount apply(ResponseWrapper result) { + try { + return APIRequestCreateMessageTemplate.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestCreateMessageTemplate(String nodeId, APIContext context) { + super(context, nodeId, "/message_templates", "POST", Arrays.asList(PARAMS)); } @Override - public APIRequestGetMessageCampaigns setParam(String param, Object value) { + public APIRequestCreateMessageTemplate setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestGetMessageCampaigns setParams(Map params) { + public APIRequestCreateMessageTemplate setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestGetMessageCampaigns requestAllFields () { + public APIRequestCreateMessageTemplate setAllowCategoryChange (Boolean allowCategoryChange) { + this.setParam("allow_category_change", allowCategoryChange); + return this; + } + public APIRequestCreateMessageTemplate setAllowCategoryChange (String allowCategoryChange) { + this.setParam("allow_category_change", allowCategoryChange); + return this; + } + + public APIRequestCreateMessageTemplate setCategory (WhatsAppBusinessAccount.EnumCategory category) { + this.setParam("category", category); + return this; + } + public APIRequestCreateMessageTemplate setCategory (String category) { + this.setParam("category", category); + return this; + } + + public APIRequestCreateMessageTemplate setComponents (List> components) { + this.setParam("components", components); + return this; + } + public APIRequestCreateMessageTemplate setComponents (String components) { + this.setParam("components", components); + return this; + } + + public APIRequestCreateMessageTemplate setCtaUrlLinkTrackingOptedOut (Boolean ctaUrlLinkTrackingOptedOut) { + this.setParam("cta_url_link_tracking_opted_out", ctaUrlLinkTrackingOptedOut); + return this; + } + public APIRequestCreateMessageTemplate setCtaUrlLinkTrackingOptedOut (String ctaUrlLinkTrackingOptedOut) { + this.setParam("cta_url_link_tracking_opted_out", ctaUrlLinkTrackingOptedOut); + return this; + } + + public APIRequestCreateMessageTemplate setDisplayFormat (WhatsAppBusinessAccount.EnumDisplayFormat displayFormat) { + this.setParam("display_format", displayFormat); + return this; + } + public APIRequestCreateMessageTemplate setDisplayFormat (String displayFormat) { + this.setParam("display_format", displayFormat); + return this; + } + + public APIRequestCreateMessageTemplate setLanguage (String language) { + this.setParam("language", language); + return this; + } + + public APIRequestCreateMessageTemplate setLibraryTemplateButtonInputs (List> libraryTemplateButtonInputs) { + this.setParam("library_template_button_inputs", libraryTemplateButtonInputs); + return this; + } + public APIRequestCreateMessageTemplate setLibraryTemplateButtonInputs (String libraryTemplateButtonInputs) { + this.setParam("library_template_button_inputs", libraryTemplateButtonInputs); + return this; + } + + public APIRequestCreateMessageTemplate setLibraryTemplateName (String libraryTemplateName) { + this.setParam("library_template_name", libraryTemplateName); + return this; + } + + public APIRequestCreateMessageTemplate setMessageSendTtlSeconds (Long messageSendTtlSeconds) { + this.setParam("message_send_ttl_seconds", messageSendTtlSeconds); + return this; + } + public APIRequestCreateMessageTemplate setMessageSendTtlSeconds (String messageSendTtlSeconds) { + this.setParam("message_send_ttl_seconds", messageSendTtlSeconds); + return this; + } + + public APIRequestCreateMessageTemplate setName (String name) { + this.setParam("name", name); + return this; + } + + public APIRequestCreateMessageTemplate setSubCategory (WhatsAppBusinessAccount.EnumSubCategory subCategory) { + this.setParam("sub_category", subCategory); + return this; + } + public APIRequestCreateMessageTemplate setSubCategory (String subCategory) { + this.setParam("sub_category", subCategory); + return this; + } + + public APIRequestCreateMessageTemplate requestAllFields () { return this.requestAllFields(true); } - public APIRequestGetMessageCampaigns requestAllFields (boolean value) { + public APIRequestCreateMessageTemplate requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -1626,12 +2762,12 @@ public APIRequestGetMessageCampaigns requestAllFields (boolean value) { } @Override - public APIRequestGetMessageCampaigns requestFields (List fields) { + public APIRequestCreateMessageTemplate requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestGetMessageCampaigns requestFields (List fields, boolean value) { + public APIRequestCreateMessageTemplate requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -1639,65 +2775,63 @@ public APIRequestGetMessageCampaigns requestFields (List fields, boolean } @Override - public APIRequestGetMessageCampaigns requestField (String field) { + public APIRequestCreateMessageTemplate requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestGetMessageCampaigns requestField (String field, boolean value) { + public APIRequestCreateMessageTemplate requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } } - public static class APIRequestGetMessageTemplatePreviews extends APIRequest { + public static class APIRequestCreateMigrateFlow extends APIRequest { - APINodeList lastResponse = null; + WhatsAppBusinessAccount lastResponse = null; @Override - public APINodeList getLastResponse() { + public WhatsAppBusinessAccount getLastResponse() { return lastResponse; } public static final String[] PARAMS = { - "add_security_recommendation", - "button_types", - "category", - "code_expiration_minutes", - "languages", + "page_number", + "source_flow_ids", + "source_waba_id", }; public static final String[] FIELDS = { }; @Override - public APINodeList parseResponse(String response, String header) throws APIException { - return APINode.parseResponse(response, getContext(), this, header); + public WhatsAppBusinessAccount parseResponse(String response, String header) throws APIException { + return WhatsAppBusinessAccount.parseResponse(response, getContext(), this, header).head(); } @Override - public APINodeList execute() throws APIException { + public WhatsAppBusinessAccount execute() throws APIException { return execute(new HashMap()); } @Override - public APINodeList execute(Map extraParams) throws APIException { + public WhatsAppBusinessAccount execute(Map extraParams) throws APIException { ResponseWrapper rw = executeInternal(extraParams); - lastResponse = parseResponse(rw.getBody(),rw.getHeader()); + 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 APINodeList apply(ResponseWrapper result) { + new Function() { + public WhatsAppBusinessAccount apply(ResponseWrapper result) { try { - return APIRequestGetMessageTemplatePreviews.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestCreateMigrateFlow.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -1707,73 +2841,172 @@ public APINodeList apply(ResponseWrapper result) { ); }; - public APIRequestGetMessageTemplatePreviews(String nodeId, APIContext context) { - super(context, nodeId, "/message_template_previews", "GET", Arrays.asList(PARAMS)); + public APIRequestCreateMigrateFlow(String nodeId, APIContext context) { + super(context, nodeId, "/migrate_flows", "POST", Arrays.asList(PARAMS)); } @Override - public APIRequestGetMessageTemplatePreviews setParam(String param, Object value) { + public APIRequestCreateMigrateFlow setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestGetMessageTemplatePreviews setParams(Map params) { + public APIRequestCreateMigrateFlow setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestGetMessageTemplatePreviews setAddSecurityRecommendation (Boolean addSecurityRecommendation) { - this.setParam("add_security_recommendation", addSecurityRecommendation); + public APIRequestCreateMigrateFlow setPageNumber (Long pageNumber) { + this.setParam("page_number", pageNumber); return this; } - public APIRequestGetMessageTemplatePreviews setAddSecurityRecommendation (String addSecurityRecommendation) { - this.setParam("add_security_recommendation", addSecurityRecommendation); + public APIRequestCreateMigrateFlow setPageNumber (String pageNumber) { + this.setParam("page_number", pageNumber); return this; } - public APIRequestGetMessageTemplatePreviews setButtonTypes (List buttonTypes) { - this.setParam("button_types", buttonTypes); + public APIRequestCreateMigrateFlow setSourceFlowIds (List sourceFlowIds) { + this.setParam("source_flow_ids", sourceFlowIds); return this; } - public APIRequestGetMessageTemplatePreviews setButtonTypes (String buttonTypes) { - this.setParam("button_types", buttonTypes); + public APIRequestCreateMigrateFlow setSourceFlowIds (String sourceFlowIds) { + this.setParam("source_flow_ids", sourceFlowIds); return this; } - public APIRequestGetMessageTemplatePreviews setCategory (EnumCategory category) { - this.setParam("category", category); + public APIRequestCreateMigrateFlow setSourceWabaId (String sourceWabaId) { + this.setParam("source_waba_id", sourceWabaId); return this; } - public APIRequestGetMessageTemplatePreviews setCategory (String category) { - this.setParam("category", category); + + public APIRequestCreateMigrateFlow requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestCreateMigrateFlow requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestCreateMigrateFlow requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestCreateMigrateFlow requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestCreateMigrateFlow requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestCreateMigrateFlow requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + + public static class APIRequestCreateMigrateMessageTemplate extends APIRequest { + + WhatsAppBusinessAccount lastResponse = null; + @Override + public WhatsAppBusinessAccount getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "page_number", + "source_waba_id", + }; + + public static final String[] FIELDS = { + }; + + @Override + public WhatsAppBusinessAccount parseResponse(String response, String header) throws APIException { + return WhatsAppBusinessAccount.parseResponse(response, getContext(), this, header).head(); + } + + @Override + public WhatsAppBusinessAccount execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public WhatsAppBusinessAccount 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 WhatsAppBusinessAccount apply(ResponseWrapper result) { + try { + return APIRequestCreateMigrateMessageTemplate.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestCreateMigrateMessageTemplate(String nodeId, APIContext context) { + super(context, nodeId, "/migrate_message_templates", "POST", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestCreateMigrateMessageTemplate setParam(String param, Object value) { + setParamInternal(param, value); return this; } - public APIRequestGetMessageTemplatePreviews setCodeExpirationMinutes (Long codeExpirationMinutes) { - this.setParam("code_expiration_minutes", codeExpirationMinutes); + @Override + public APIRequestCreateMigrateMessageTemplate setParams(Map params) { + setParamsInternal(params); return this; } - public APIRequestGetMessageTemplatePreviews setCodeExpirationMinutes (String codeExpirationMinutes) { - this.setParam("code_expiration_minutes", codeExpirationMinutes); + + + public APIRequestCreateMigrateMessageTemplate setPageNumber (Long pageNumber) { + this.setParam("page_number", pageNumber); return this; } - - public APIRequestGetMessageTemplatePreviews setLanguages (List languages) { - this.setParam("languages", languages); + public APIRequestCreateMigrateMessageTemplate setPageNumber (String pageNumber) { + this.setParam("page_number", pageNumber); return this; } - public APIRequestGetMessageTemplatePreviews setLanguages (String languages) { - this.setParam("languages", languages); + + public APIRequestCreateMigrateMessageTemplate setSourceWabaId (String sourceWabaId) { + this.setParam("source_waba_id", sourceWabaId); return this; } - public APIRequestGetMessageTemplatePreviews requestAllFields () { + public APIRequestCreateMigrateMessageTemplate requestAllFields () { return this.requestAllFields(true); } - public APIRequestGetMessageTemplatePreviews requestAllFields (boolean value) { + public APIRequestCreateMigrateMessageTemplate requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -1781,12 +3014,12 @@ public APIRequestGetMessageTemplatePreviews requestAllFields (boolean value) { } @Override - public APIRequestGetMessageTemplatePreviews requestFields (List fields) { + public APIRequestCreateMigrateMessageTemplate requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestGetMessageTemplatePreviews requestFields (List fields, boolean value) { + public APIRequestCreateMigrateMessageTemplate requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -1794,20 +3027,20 @@ public APIRequestGetMessageTemplatePreviews requestFields (List fields, } @Override - public APIRequestGetMessageTemplatePreviews requestField (String field) { + public APIRequestCreateMigrateMessageTemplate requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestGetMessageTemplatePreviews requestField (String field, boolean value) { + public APIRequestCreateMigrateMessageTemplate requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } } - public static class APIRequestDeleteMessageTemplates extends APIRequest { + public static class APIRequestDeletePaymentConfiguration extends APIRequest { APINodeList lastResponse = null; @Override @@ -1815,8 +3048,7 @@ public APINodeList getLastResponse() { return lastResponse; } public static final String[] PARAMS = { - "hsm_id", - "name", + "configuration_name", }; public static final String[] FIELDS = { @@ -1849,7 +3081,7 @@ public ListenableFuture> executeAsync(Map e new Function>() { public APINodeList apply(ResponseWrapper result) { try { - return APIRequestDeleteMessageTemplates.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestDeletePaymentConfiguration.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -1859,38 +3091,33 @@ public APINodeList apply(ResponseWrapper result) { ); }; - public APIRequestDeleteMessageTemplates(String nodeId, APIContext context) { - super(context, nodeId, "/message_templates", "DELETE", Arrays.asList(PARAMS)); + public APIRequestDeletePaymentConfiguration(String nodeId, APIContext context) { + super(context, nodeId, "/payment_configuration", "DELETE", Arrays.asList(PARAMS)); } @Override - public APIRequestDeleteMessageTemplates setParam(String param, Object value) { + public APIRequestDeletePaymentConfiguration setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestDeleteMessageTemplates setParams(Map params) { + public APIRequestDeletePaymentConfiguration setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestDeleteMessageTemplates setHsmId (String hsmId) { - this.setParam("hsm_id", hsmId); - return this; - } - - public APIRequestDeleteMessageTemplates setName (String name) { - this.setParam("name", name); + public APIRequestDeletePaymentConfiguration setConfigurationName (String configurationName) { + this.setParam("configuration_name", configurationName); return this; } - public APIRequestDeleteMessageTemplates requestAllFields () { + public APIRequestDeletePaymentConfiguration requestAllFields () { return this.requestAllFields(true); } - public APIRequestDeleteMessageTemplates requestAllFields (boolean value) { + public APIRequestDeletePaymentConfiguration requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -1898,12 +3125,12 @@ public APIRequestDeleteMessageTemplates requestAllFields (boolean value) { } @Override - public APIRequestDeleteMessageTemplates requestFields (List fields) { + public APIRequestDeletePaymentConfiguration requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestDeleteMessageTemplates requestFields (List fields, boolean value) { + public APIRequestDeletePaymentConfiguration requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -1911,20 +3138,20 @@ public APIRequestDeleteMessageTemplates requestFields (List fields, bool } @Override - public APIRequestDeleteMessageTemplates requestField (String field) { + public APIRequestDeletePaymentConfiguration requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestDeleteMessageTemplates requestField (String field, boolean value) { + public APIRequestDeletePaymentConfiguration requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } } - public static class APIRequestGetMessageTemplates extends APIRequest { + public static class APIRequestGetPaymentConfiguration extends APIRequest { APINodeList lastResponse = null; @Override @@ -1932,13 +3159,7 @@ public APINodeList getLastResponse() { return lastResponse; } public static final String[] PARAMS = { - "category", - "content", - "language", - "name", - "name_or_content", - "quality_score", - "status", + "configuration_name", }; public static final String[] FIELDS = { @@ -1971,7 +3192,7 @@ public ListenableFuture> executeAsync(Map e new Function>() { public APINodeList apply(ResponseWrapper result) { try { - return APIRequestGetMessageTemplates.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestGetPaymentConfiguration.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -1981,79 +3202,33 @@ public APINodeList apply(ResponseWrapper result) { ); }; - public APIRequestGetMessageTemplates(String nodeId, APIContext context) { - super(context, nodeId, "/message_templates", "GET", Arrays.asList(PARAMS)); + public APIRequestGetPaymentConfiguration(String nodeId, APIContext context) { + super(context, nodeId, "/payment_configuration", "GET", Arrays.asList(PARAMS)); } @Override - public APIRequestGetMessageTemplates setParam(String param, Object value) { + public APIRequestGetPaymentConfiguration setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestGetMessageTemplates setParams(Map params) { + public APIRequestGetPaymentConfiguration setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestGetMessageTemplates setCategory (List category) { - this.setParam("category", category); - return this; - } - public APIRequestGetMessageTemplates setCategory (String category) { - this.setParam("category", category); - return this; - } - - public APIRequestGetMessageTemplates setContent (String content) { - this.setParam("content", content); - return this; - } - - public APIRequestGetMessageTemplates setLanguage (List language) { - this.setParam("language", language); - return this; - } - public APIRequestGetMessageTemplates setLanguage (String language) { - this.setParam("language", language); - return this; - } - - public APIRequestGetMessageTemplates setName (String name) { - this.setParam("name", name); - return this; - } - - public APIRequestGetMessageTemplates setNameOrContent (String nameOrContent) { - this.setParam("name_or_content", nameOrContent); - return this; - } - - public APIRequestGetMessageTemplates setQualityScore (List qualityScore) { - this.setParam("quality_score", qualityScore); - return this; - } - public APIRequestGetMessageTemplates setQualityScore (String qualityScore) { - this.setParam("quality_score", qualityScore); - return this; - } - - public APIRequestGetMessageTemplates setStatus (List status) { - this.setParam("status", status); - return this; - } - public APIRequestGetMessageTemplates setStatus (String status) { - this.setParam("status", status); + public APIRequestGetPaymentConfiguration setConfigurationName (String configurationName) { + this.setParam("configuration_name", configurationName); return this; } - public APIRequestGetMessageTemplates requestAllFields () { + public APIRequestGetPaymentConfiguration requestAllFields () { return this.requestAllFields(true); } - public APIRequestGetMessageTemplates requestAllFields (boolean value) { + public APIRequestGetPaymentConfiguration requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -2061,12 +3236,12 @@ public APIRequestGetMessageTemplates requestAllFields (boolean value) { } @Override - public APIRequestGetMessageTemplates requestFields (List fields) { + public APIRequestGetPaymentConfiguration requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestGetMessageTemplates requestFields (List fields, boolean value) { + public APIRequestGetPaymentConfiguration requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -2074,20 +3249,20 @@ public APIRequestGetMessageTemplates requestFields (List fields, boolean } @Override - public APIRequestGetMessageTemplates requestField (String field) { + public APIRequestGetPaymentConfiguration requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestGetMessageTemplates requestField (String field, boolean value) { + public APIRequestGetPaymentConfiguration requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } } - public static class APIRequestCreateMessageTemplate extends APIRequest { + public static class APIRequestCreatePaymentConfiguration extends APIRequest { WhatsAppBusinessAccount lastResponse = null; @Override @@ -2095,17 +3270,12 @@ public WhatsAppBusinessAccount getLastResponse() { return lastResponse; } public static final String[] PARAMS = { - "allow_category_change", - "category", - "components", - "cta_url_link_tracking_opted_out", - "display_format", - "language", - "library_template_button_inputs", - "library_template_name", - "message_send_ttl_seconds", - "name", - "sub_category", + "configuration_name", + "merchant_category_code", + "merchant_vpa", + "provider_name", + "purpose_code", + "redirect_url", }; public static final String[] FIELDS = { @@ -2138,7 +3308,7 @@ public ListenableFuture executeAsync(Map() { public WhatsAppBusinessAccount apply(ResponseWrapper result) { try { - return APIRequestCreateMessageTemplate.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestCreatePaymentConfiguration.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -2148,115 +3318,62 @@ public WhatsAppBusinessAccount apply(ResponseWrapper result) { ); }; - public APIRequestCreateMessageTemplate(String nodeId, APIContext context) { - super(context, nodeId, "/message_templates", "POST", Arrays.asList(PARAMS)); + public APIRequestCreatePaymentConfiguration(String nodeId, APIContext context) { + super(context, nodeId, "/payment_configuration", "POST", Arrays.asList(PARAMS)); } @Override - public APIRequestCreateMessageTemplate setParam(String param, Object value) { + public APIRequestCreatePaymentConfiguration setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestCreateMessageTemplate setParams(Map params) { + public APIRequestCreatePaymentConfiguration setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestCreateMessageTemplate setAllowCategoryChange (Boolean allowCategoryChange) { - this.setParam("allow_category_change", allowCategoryChange); - return this; - } - public APIRequestCreateMessageTemplate setAllowCategoryChange (String allowCategoryChange) { - this.setParam("allow_category_change", allowCategoryChange); - return this; - } - - public APIRequestCreateMessageTemplate setCategory (WhatsAppBusinessAccount.EnumCategory category) { - this.setParam("category", category); - return this; - } - public APIRequestCreateMessageTemplate setCategory (String category) { - this.setParam("category", category); - return this; - } - - public APIRequestCreateMessageTemplate setComponents (List> components) { - this.setParam("components", components); - return this; - } - public APIRequestCreateMessageTemplate setComponents (String components) { - this.setParam("components", components); - return this; - } - - public APIRequestCreateMessageTemplate setCtaUrlLinkTrackingOptedOut (Boolean ctaUrlLinkTrackingOptedOut) { - this.setParam("cta_url_link_tracking_opted_out", ctaUrlLinkTrackingOptedOut); - return this; - } - public APIRequestCreateMessageTemplate setCtaUrlLinkTrackingOptedOut (String ctaUrlLinkTrackingOptedOut) { - this.setParam("cta_url_link_tracking_opted_out", ctaUrlLinkTrackingOptedOut); - return this; - } - - public APIRequestCreateMessageTemplate setDisplayFormat (WhatsAppBusinessAccount.EnumDisplayFormat displayFormat) { - this.setParam("display_format", displayFormat); - return this; - } - public APIRequestCreateMessageTemplate setDisplayFormat (String displayFormat) { - this.setParam("display_format", displayFormat); - return this; - } - - public APIRequestCreateMessageTemplate setLanguage (String language) { - this.setParam("language", language); + public APIRequestCreatePaymentConfiguration setConfigurationName (String configurationName) { + this.setParam("configuration_name", configurationName); return this; } - public APIRequestCreateMessageTemplate setLibraryTemplateButtonInputs (List> libraryTemplateButtonInputs) { - this.setParam("library_template_button_inputs", libraryTemplateButtonInputs); - return this; - } - public APIRequestCreateMessageTemplate setLibraryTemplateButtonInputs (String libraryTemplateButtonInputs) { - this.setParam("library_template_button_inputs", libraryTemplateButtonInputs); + public APIRequestCreatePaymentConfiguration setMerchantCategoryCode (String merchantCategoryCode) { + this.setParam("merchant_category_code", merchantCategoryCode); return this; } - public APIRequestCreateMessageTemplate setLibraryTemplateName (String libraryTemplateName) { - this.setParam("library_template_name", libraryTemplateName); + public APIRequestCreatePaymentConfiguration setMerchantVpa (String merchantVpa) { + this.setParam("merchant_vpa", merchantVpa); return this; } - public APIRequestCreateMessageTemplate setMessageSendTtlSeconds (Long messageSendTtlSeconds) { - this.setParam("message_send_ttl_seconds", messageSendTtlSeconds); + public APIRequestCreatePaymentConfiguration setProviderName (WhatsAppBusinessAccount.EnumProviderName providerName) { + this.setParam("provider_name", providerName); return this; } - public APIRequestCreateMessageTemplate setMessageSendTtlSeconds (String messageSendTtlSeconds) { - this.setParam("message_send_ttl_seconds", messageSendTtlSeconds); + public APIRequestCreatePaymentConfiguration setProviderName (String providerName) { + this.setParam("provider_name", providerName); return this; } - public APIRequestCreateMessageTemplate setName (String name) { - this.setParam("name", name); + public APIRequestCreatePaymentConfiguration setPurposeCode (String purposeCode) { + this.setParam("purpose_code", purposeCode); return this; } - public APIRequestCreateMessageTemplate setSubCategory (WhatsAppBusinessAccount.EnumSubCategory subCategory) { - this.setParam("sub_category", subCategory); - return this; - } - public APIRequestCreateMessageTemplate setSubCategory (String subCategory) { - this.setParam("sub_category", subCategory); + public APIRequestCreatePaymentConfiguration setRedirectUrl (String redirectUrl) { + this.setParam("redirect_url", redirectUrl); return this; } - public APIRequestCreateMessageTemplate requestAllFields () { + public APIRequestCreatePaymentConfiguration requestAllFields () { return this.requestAllFields(true); } - public APIRequestCreateMessageTemplate requestAllFields (boolean value) { + public APIRequestCreatePaymentConfiguration requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -2264,12 +3381,12 @@ public APIRequestCreateMessageTemplate requestAllFields (boolean value) { } @Override - public APIRequestCreateMessageTemplate requestFields (List fields) { + public APIRequestCreatePaymentConfiguration requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestCreateMessageTemplate requestFields (List fields, boolean value) { + public APIRequestCreatePaymentConfiguration requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -2277,62 +3394,60 @@ public APIRequestCreateMessageTemplate requestFields (List fields, boole } @Override - public APIRequestCreateMessageTemplate requestField (String field) { + public APIRequestCreatePaymentConfiguration requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestCreateMessageTemplate requestField (String field, boolean value) { + public APIRequestCreatePaymentConfiguration requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } } - public static class APIRequestCreateMigrateMessageTemplate extends APIRequest { + public static class APIRequestGetPaymentConfigurations extends APIRequest { - WhatsAppBusinessAccount lastResponse = null; + APINodeList lastResponse = null; @Override - public WhatsAppBusinessAccount getLastResponse() { + public APINodeList getLastResponse() { return lastResponse; } public static final String[] PARAMS = { - "page_number", - "source_waba_id", }; public static final String[] FIELDS = { }; @Override - public WhatsAppBusinessAccount parseResponse(String response, String header) throws APIException { - return WhatsAppBusinessAccount.parseResponse(response, getContext(), this, header).head(); + public APINodeList parseResponse(String response, String header) throws APIException { + return APINode.parseResponse(response, getContext(), this, header); } @Override - public WhatsAppBusinessAccount execute() throws APIException { + public APINodeList execute() throws APIException { return execute(new HashMap()); } @Override - public WhatsAppBusinessAccount execute(Map extraParams) throws APIException { + public APINodeList execute(Map extraParams) throws APIException { ResponseWrapper rw = executeInternal(extraParams); - lastResponse = parseResponse(rw.getBody(), rw.getHeader()); + 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 WhatsAppBusinessAccount apply(ResponseWrapper result) { + new Function>() { + public APINodeList apply(ResponseWrapper result) { try { - return APIRequestCreateMigrateMessageTemplate.this.parseResponse(result.getBody(), result.getHeader()); + return APIRequestGetPaymentConfigurations.this.parseResponse(result.getBody(), result.getHeader()); } catch (Exception e) { throw new RuntimeException(e); } @@ -2342,42 +3457,28 @@ public WhatsAppBusinessAccount apply(ResponseWrapper result) { ); }; - public APIRequestCreateMigrateMessageTemplate(String nodeId, APIContext context) { - super(context, nodeId, "/migrate_message_templates", "POST", Arrays.asList(PARAMS)); + public APIRequestGetPaymentConfigurations(String nodeId, APIContext context) { + super(context, nodeId, "/payment_configurations", "GET", Arrays.asList(PARAMS)); } @Override - public APIRequestCreateMigrateMessageTemplate setParam(String param, Object value) { + public APIRequestGetPaymentConfigurations setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override - public APIRequestCreateMigrateMessageTemplate setParams(Map params) { + public APIRequestGetPaymentConfigurations setParams(Map params) { setParamsInternal(params); return this; } - public APIRequestCreateMigrateMessageTemplate setPageNumber (Long pageNumber) { - this.setParam("page_number", pageNumber); - return this; - } - public APIRequestCreateMigrateMessageTemplate setPageNumber (String pageNumber) { - this.setParam("page_number", pageNumber); - return this; - } - - public APIRequestCreateMigrateMessageTemplate setSourceWabaId (String sourceWabaId) { - this.setParam("source_waba_id", sourceWabaId); - return this; - } - - public APIRequestCreateMigrateMessageTemplate requestAllFields () { + public APIRequestGetPaymentConfigurations requestAllFields () { return this.requestAllFields(true); } - public APIRequestCreateMigrateMessageTemplate requestAllFields (boolean value) { + public APIRequestGetPaymentConfigurations requestAllFields (boolean value) { for (String field : FIELDS) { this.requestField(field, value); } @@ -2385,12 +3486,12 @@ public APIRequestCreateMigrateMessageTemplate requestAllFields (boolean value) { } @Override - public APIRequestCreateMigrateMessageTemplate requestFields (List fields) { + public APIRequestGetPaymentConfigurations requestFields (List fields) { return this.requestFields(fields, true); } @Override - public APIRequestCreateMigrateMessageTemplate requestFields (List fields, boolean value) { + public APIRequestGetPaymentConfigurations requestFields (List fields, boolean value) { for (String field : fields) { this.requestField(field, value); } @@ -2398,13 +3499,13 @@ public APIRequestCreateMigrateMessageTemplate requestFields (List fields } @Override - public APIRequestCreateMigrateMessageTemplate requestField (String field) { + public APIRequestGetPaymentConfigurations requestField (String field) { this.requestField(field, true); return this; } @Override - public APIRequestCreateMigrateMessageTemplate requestField (String field, boolean value) { + public APIRequestGetPaymentConfigurations requestField (String field, boolean value) { this.requestFieldInternal(field, value); return this; } @@ -3350,6 +4451,117 @@ public APIRequestCreateSetOboMobilityIntent requestField (String field, boolean } + public static class APIRequestCreateSetSolutionMigrationInTEnt extends APIRequest { + + APINode lastResponse = null; + @Override + public APINode getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "solution_id", + }; + + public static final String[] FIELDS = { + }; + + @Override + public APINode parseResponse(String response, String header) throws APIException { + return APINode.parseResponse(response, getContext(), this, header).head(); + } + + @Override + public APINode execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINode 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 APINode apply(ResponseWrapper result) { + try { + return APIRequestCreateSetSolutionMigrationInTEnt.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestCreateSetSolutionMigrationInTEnt(String nodeId, APIContext context) { + super(context, nodeId, "/set_solution_migration_intent", "POST", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestCreateSetSolutionMigrationInTEnt setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestCreateSetSolutionMigrationInTEnt setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestCreateSetSolutionMigrationInTEnt setSolutionId (String solutionId) { + this.setParam("solution_id", solutionId); + return this; + } + + public APIRequestCreateSetSolutionMigrationInTEnt requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestCreateSetSolutionMigrationInTEnt requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestCreateSetSolutionMigrationInTEnt requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestCreateSetSolutionMigrationInTEnt requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestCreateSetSolutionMigrationInTEnt requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestCreateSetSolutionMigrationInTEnt requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + public static class APIRequestGetSolutions extends APIRequest { APINodeList lastResponse = null; @@ -3793,6 +5005,7 @@ public APINodeList getLastResponse() { "end", "granularity", "metric_types", + "product_type", "start", "template_ids", }; @@ -3877,6 +5090,15 @@ public APIRequestGetTemplateAnalytics setMetricTypes (String metricTypes) { return this; } + public APIRequestGetTemplateAnalytics setProductType (EnumProductType productType) { + this.setParam("product_type", productType); + return this; + } + public APIRequestGetTemplateAnalytics setProductType (String productType) { + this.setParam("product_type", productType); + return this; + } + public APIRequestGetTemplateAnalytics setStart (String start) { this.setParam("start", start); return this; @@ -4197,6 +5419,195 @@ public APIRequestCreateUpsertMessageTemplate requestField (String field, boolean } + public static class APIRequestGetWelcomeMessageSequences extends APIRequest { + + APINodeList lastResponse = null; + @Override + public APINodeList getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + "app_id", + "sequence_id", + }; + + public static final String[] FIELDS = { + "compatible_platforms", + "eligible_platforms", + "id", + "is_ig_only_flow", + "is_used_in_ad", + "last_update_time", + "name", + "welcome_message_flow", + "welcome_message_sequence", + }; + + @Override + public APINodeList parseResponse(String response, String header) throws APIException { + return CTXPartnerAppWelcomeMessageFlow.parseResponse(response, getContext(), this, header); + } + + @Override + public APINodeList execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public APINodeList 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 APINodeList apply(ResponseWrapper result) { + try { + return APIRequestGetWelcomeMessageSequences.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }, + MoreExecutors.directExecutor() + ); + }; + + public APIRequestGetWelcomeMessageSequences(String nodeId, APIContext context) { + super(context, nodeId, "/welcome_message_sequences", "GET", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestGetWelcomeMessageSequences setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestGetWelcomeMessageSequences setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestGetWelcomeMessageSequences setAppId (String appId) { + this.setParam("app_id", appId); + return this; + } + + public APIRequestGetWelcomeMessageSequences setSequenceId (String sequenceId) { + this.setParam("sequence_id", sequenceId); + return this; + } + + public APIRequestGetWelcomeMessageSequences requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestGetWelcomeMessageSequences requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetWelcomeMessageSequences requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestGetWelcomeMessageSequences requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetWelcomeMessageSequences requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestGetWelcomeMessageSequences requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + public APIRequestGetWelcomeMessageSequences requestCompatiblePlatformsField () { + return this.requestCompatiblePlatformsField(true); + } + public APIRequestGetWelcomeMessageSequences requestCompatiblePlatformsField (boolean value) { + this.requestField("compatible_platforms", value); + return this; + } + public APIRequestGetWelcomeMessageSequences requestEligiblePlatformsField () { + return this.requestEligiblePlatformsField(true); + } + public APIRequestGetWelcomeMessageSequences requestEligiblePlatformsField (boolean value) { + this.requestField("eligible_platforms", value); + return this; + } + public APIRequestGetWelcomeMessageSequences requestIdField () { + return this.requestIdField(true); + } + public APIRequestGetWelcomeMessageSequences requestIdField (boolean value) { + this.requestField("id", value); + return this; + } + public APIRequestGetWelcomeMessageSequences requestIsIgOnlyFlowField () { + return this.requestIsIgOnlyFlowField(true); + } + public APIRequestGetWelcomeMessageSequences requestIsIgOnlyFlowField (boolean value) { + this.requestField("is_ig_only_flow", value); + return this; + } + public APIRequestGetWelcomeMessageSequences requestIsUsedInAdField () { + return this.requestIsUsedInAdField(true); + } + public APIRequestGetWelcomeMessageSequences requestIsUsedInAdField (boolean value) { + this.requestField("is_used_in_ad", value); + return this; + } + public APIRequestGetWelcomeMessageSequences requestLastUpdateTimeField () { + return this.requestLastUpdateTimeField(true); + } + public APIRequestGetWelcomeMessageSequences requestLastUpdateTimeField (boolean value) { + this.requestField("last_update_time", value); + return this; + } + public APIRequestGetWelcomeMessageSequences requestNameField () { + return this.requestNameField(true); + } + public APIRequestGetWelcomeMessageSequences requestNameField (boolean value) { + this.requestField("name", value); + return this; + } + public APIRequestGetWelcomeMessageSequences requestWelcomeMessageFlowField () { + return this.requestWelcomeMessageFlowField(true); + } + public APIRequestGetWelcomeMessageSequences requestWelcomeMessageFlowField (boolean value) { + this.requestField("welcome_message_flow", value); + return this; + } + public APIRequestGetWelcomeMessageSequences requestWelcomeMessageSequenceField () { + return this.requestWelcomeMessageSequenceField(true); + } + public APIRequestGetWelcomeMessageSequences requestWelcomeMessageSequenceField (boolean value) { + this.requestField("welcome_message_sequence", value); + return this; + } + } + public static class APIRequestGet extends APIRequest { WhatsAppBusinessAccount lastResponse = null; @@ -4685,6 +6096,29 @@ public String toString() { } } + public static enum EnumProviderName { + @SerializedName("PAYU") + VALUE_PAYU("PAYU"), + @SerializedName("RAZORPAY") + VALUE_RAZORPAY("RAZORPAY"), + @SerializedName("UPI_VPA") + VALUE_UPI_VPA("UPI_VPA"), + @SerializedName("ZAAKPAY") + VALUE_ZAAKPAY("ZAAKPAY"), + ; + + private String value; + + private EnumProviderName(String value) { + this.value = value; + } + + @Override + public String toString() { + return value; + } + } + public static enum EnumConversationCategories { @SerializedName("AUTHENTICATION") VALUE_AUTHENTICATION("AUTHENTICATION"), @@ -4840,6 +6274,8 @@ public static enum EnumCategories { VALUE_LEAD_GENERATION("LEAD_GENERATION"), @SerializedName("OTHER") VALUE_OTHER("OTHER"), + @SerializedName("SHOPPING") + VALUE_SHOPPING("SHOPPING"), @SerializedName("SIGN_IN") VALUE_SIGN_IN("SIGN_IN"), @SerializedName("SIGN_UP") @@ -4935,6 +6371,25 @@ public String toString() { } } + public static enum EnumProductType { + @SerializedName("CLOUD_API") + VALUE_CLOUD_API("CLOUD_API"), + @SerializedName("MARKETING_MESSAGES_LITE_API") + VALUE_MARKETING_MESSAGES_LITE_API("MARKETING_MESSAGES_LITE_API"), + ; + + private String value; + + private EnumProductType(String value) { + this.value = value; + } + + @Override + public String toString() { + return value; + } + } + synchronized /*package*/ static Gson getGson() { if (gson != null) { diff --git a/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessPartnerClientVerificationSubmission.java b/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessPartnerClientVerificationSubmission.java index ba633c22..95b96312 100644 --- a/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessPartnerClientVerificationSubmission.java +++ b/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessPartnerClientVerificationSubmission.java @@ -274,6 +274,10 @@ public WhatsAppBusinessPartnerClientVerificationSubmission setFieldVerificationS public static enum EnumRejectionReasons { @SerializedName("ADDRESS_NOT_MATCHING") VALUE_ADDRESS_NOT_MATCHING("ADDRESS_NOT_MATCHING"), + @SerializedName("BUSINESS_NOT_ELIGIBLE") + VALUE_BUSINESS_NOT_ELIGIBLE("BUSINESS_NOT_ELIGIBLE"), + @SerializedName("LEGAL_NAME_NOT_FOUND_IN_DOCUMENTS") + VALUE_LEGAL_NAME_NOT_FOUND_IN_DOCUMENTS("LEGAL_NAME_NOT_FOUND_IN_DOCUMENTS"), @SerializedName("LEGAL_NAME_NOT_MATCHING") VALUE_LEGAL_NAME_NOT_MATCHING("LEGAL_NAME_NOT_MATCHING"), @SerializedName("NONE")