diff --git a/pom.xml b/pom.xml index a7301882..57c1a392 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.facebook.business.sdk facebook-java-business-sdk jar - 18.0.3 + 18.0.4 ${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/APIConfig.java b/src/main/java/com/facebook/ads/sdk/APIConfig.java index e392baa8..1c8c3281 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 = "v18.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-v18.0.3"; + public static final String USER_AGENT = "fbbizsdk-java-v18.0.4"; }; diff --git a/src/main/java/com/facebook/ads/sdk/AdAccount.java b/src/main/java/com/facebook/ads/sdk/AdAccount.java index d09c2431..26f9eace 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccount.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccount.java @@ -9913,6 +9913,8 @@ public APINodeList getLastResponse() { "auto_event_mapping_android", "auto_event_mapping_ios", "auto_event_setup_enabled", + "auto_log_app_events_default", + "auto_log_app_events_enabled", "business", "canvas_fluid_height", "canvas_fluid_width", @@ -9970,8 +9972,6 @@ public APINodeList getLastResponse() { "restrictions", "restrictive_data_filter_params", "restrictive_data_filter_rules", - "sdk_auto_logging_default_value", - "sdk_auto_logging_override_value", "sdk_update_message", "seamless_login", "secure_canvas_url", @@ -10269,6 +10269,20 @@ public APIRequestGetAdvertisableApplications requestAutoEventSetupEnabledField ( this.requestField("auto_event_setup_enabled", value); return this; } + public APIRequestGetAdvertisableApplications requestAutoLogAppEventsDefaultField () { + return this.requestAutoLogAppEventsDefaultField(true); + } + public APIRequestGetAdvertisableApplications requestAutoLogAppEventsDefaultField (boolean value) { + this.requestField("auto_log_app_events_default", value); + return this; + } + public APIRequestGetAdvertisableApplications requestAutoLogAppEventsEnabledField () { + return this.requestAutoLogAppEventsEnabledField(true); + } + public APIRequestGetAdvertisableApplications requestAutoLogAppEventsEnabledField (boolean value) { + this.requestField("auto_log_app_events_enabled", value); + return this; + } public APIRequestGetAdvertisableApplications requestBusinessField () { return this.requestBusinessField(true); } @@ -10668,20 +10682,6 @@ public APIRequestGetAdvertisableApplications requestRestrictiveDataFilterRulesFi this.requestField("restrictive_data_filter_rules", value); return this; } - public APIRequestGetAdvertisableApplications requestSdkAutoLoggingDefaultValueField () { - return this.requestSdkAutoLoggingDefaultValueField(true); - } - public APIRequestGetAdvertisableApplications requestSdkAutoLoggingDefaultValueField (boolean value) { - this.requestField("sdk_auto_logging_default_value", value); - return this; - } - public APIRequestGetAdvertisableApplications requestSdkAutoLoggingOverrideValueField () { - return this.requestSdkAutoLoggingOverrideValueField(true); - } - public APIRequestGetAdvertisableApplications requestSdkAutoLoggingOverrideValueField (boolean value) { - this.requestField("sdk_auto_logging_override_value", value); - return this; - } public APIRequestGetAdvertisableApplications requestSdkUpdateMessageField () { return this.requestSdkUpdateMessageField(true); } @@ -13206,6 +13206,8 @@ public APINodeList getLastResponse() { "auto_event_mapping_android", "auto_event_mapping_ios", "auto_event_setup_enabled", + "auto_log_app_events_default", + "auto_log_app_events_enabled", "business", "canvas_fluid_height", "canvas_fluid_width", @@ -13263,8 +13265,6 @@ public APINodeList getLastResponse() { "restrictions", "restrictive_data_filter_params", "restrictive_data_filter_rules", - "sdk_auto_logging_default_value", - "sdk_auto_logging_override_value", "sdk_update_message", "seamless_login", "secure_canvas_url", @@ -13552,6 +13552,20 @@ public APIRequestGetApplications requestAutoEventSetupEnabledField (boolean valu this.requestField("auto_event_setup_enabled", value); return this; } + public APIRequestGetApplications requestAutoLogAppEventsDefaultField () { + return this.requestAutoLogAppEventsDefaultField(true); + } + public APIRequestGetApplications requestAutoLogAppEventsDefaultField (boolean value) { + this.requestField("auto_log_app_events_default", value); + return this; + } + public APIRequestGetApplications requestAutoLogAppEventsEnabledField () { + return this.requestAutoLogAppEventsEnabledField(true); + } + public APIRequestGetApplications requestAutoLogAppEventsEnabledField (boolean value) { + this.requestField("auto_log_app_events_enabled", value); + return this; + } public APIRequestGetApplications requestBusinessField () { return this.requestBusinessField(true); } @@ -13951,20 +13965,6 @@ public APIRequestGetApplications requestRestrictiveDataFilterRulesField (boolean this.requestField("restrictive_data_filter_rules", value); return this; } - public APIRequestGetApplications requestSdkAutoLoggingDefaultValueField () { - return this.requestSdkAutoLoggingDefaultValueField(true); - } - public APIRequestGetApplications requestSdkAutoLoggingDefaultValueField (boolean value) { - this.requestField("sdk_auto_logging_default_value", value); - return this; - } - public APIRequestGetApplications requestSdkAutoLoggingOverrideValueField () { - return this.requestSdkAutoLoggingOverrideValueField(true); - } - public APIRequestGetApplications requestSdkAutoLoggingOverrideValueField (boolean value) { - this.requestField("sdk_auto_logging_override_value", value); - return this; - } public APIRequestGetApplications requestSdkUpdateMessageField () { return this.requestSdkUpdateMessageField(true); } diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetFeedAdditionalData.java b/src/main/java/com/facebook/ads/sdk/AdAssetFeedAdditionalData.java new file mode 100644 index 00000000..7ea3b7a2 --- /dev/null +++ b/src/main/java/com/facebook/ads/sdk/AdAssetFeedAdditionalData.java @@ -0,0 +1,283 @@ +/* + * 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.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 AdAssetFeedAdditionalData extends APINode { + @SerializedName("automated_product_tags") + private Boolean mAutomatedProductTags = null; + @SerializedName("brand_page_id") + private String mBrandPageId = null; + @SerializedName("is_click_to_message") + private Boolean mIsClickToMessage = null; + @SerializedName("multi_share_end_card") + private Boolean mMultiShareEndCard = null; + @SerializedName("page_welcome_message") + private String mPageWelcomeMessage = null; + protected static Gson gson = null; + + public AdAssetFeedAdditionalData() { + } + + public String getId() { + return null; + } + public static AdAssetFeedAdditionalData loadJSON(String json, APIContext context, String header) { + AdAssetFeedAdditionalData adAssetFeedAdditionalData = getGson().fromJson(json, AdAssetFeedAdditionalData.class); + if (context.isDebug()) { + JsonParser parser = new JsonParser(); + JsonElement o1 = parser.parse(json); + JsonElement o2 = parser.parse(adAssetFeedAdditionalData.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); + } + } + adAssetFeedAdditionalData.context = context; + adAssetFeedAdditionalData.rawValue = json; + adAssetFeedAdditionalData.header = header; + return adAssetFeedAdditionalData; + } + + public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { + APINodeList adAssetFeedAdditionalDatas = 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++) { + adAssetFeedAdditionalDatas.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); + }; + return adAssetFeedAdditionalDatas; + } 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; + adAssetFeedAdditionalDatas.setCursors(before, after); + } + String previous = paging.has("previous") ? paging.get("previous").getAsString() : null; + String next = paging.has("next") ? paging.get("next").getAsString() : null; + adAssetFeedAdditionalDatas.setPaging(previous, next); + if (context.hasAppSecret()) { + adAssetFeedAdditionalDatas.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++) { + adAssetFeedAdditionalDatas.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()) { + adAssetFeedAdditionalDatas.add(loadJSON(entry.getValue().toString(), context, header)); + } + break; + } + } + if (!isRedownload) { + adAssetFeedAdditionalDatas.add(loadJSON(obj.toString(), context, header)); + } + } + return adAssetFeedAdditionalDatas; + } 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()) { + adAssetFeedAdditionalDatas.add(loadJSON(entry.getValue().toString(), context, header)); + } + return adAssetFeedAdditionalDatas; + } 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) + ) { + adAssetFeedAdditionalDatas.add(loadJSON(value.toString(), context, header)); + } else { + isIdIndexedArray = false; + break; + } + } + if (isIdIndexedArray) { + return adAssetFeedAdditionalDatas; + } + + // Sixth, check if it's pure JsonObject + adAssetFeedAdditionalDatas.clear(); + adAssetFeedAdditionalDatas.add(loadJSON(json, context, header)); + return adAssetFeedAdditionalDatas; + } + } + } 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 Boolean getFieldAutomatedProductTags() { + return mAutomatedProductTags; + } + + public AdAssetFeedAdditionalData setFieldAutomatedProductTags(Boolean value) { + this.mAutomatedProductTags = value; + return this; + } + + public String getFieldBrandPageId() { + return mBrandPageId; + } + + public AdAssetFeedAdditionalData setFieldBrandPageId(String value) { + this.mBrandPageId = value; + return this; + } + + public Boolean getFieldIsClickToMessage() { + return mIsClickToMessage; + } + + public AdAssetFeedAdditionalData setFieldIsClickToMessage(Boolean value) { + this.mIsClickToMessage = value; + return this; + } + + public Boolean getFieldMultiShareEndCard() { + return mMultiShareEndCard; + } + + public AdAssetFeedAdditionalData setFieldMultiShareEndCard(Boolean value) { + this.mMultiShareEndCard = value; + return this; + } + + public String getFieldPageWelcomeMessage() { + return mPageWelcomeMessage; + } + + public AdAssetFeedAdditionalData setFieldPageWelcomeMessage(String value) { + this.mPageWelcomeMessage = 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 AdAssetFeedAdditionalData copyFrom(AdAssetFeedAdditionalData instance) { + this.mAutomatedProductTags = instance.mAutomatedProductTags; + this.mBrandPageId = instance.mBrandPageId; + this.mIsClickToMessage = instance.mIsClickToMessage; + this.mMultiShareEndCard = instance.mMultiShareEndCard; + this.mPageWelcomeMessage = instance.mPageWelcomeMessage; + 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 AdAssetFeedAdditionalData.parseResponse(response, context, request, header); + } + }; + } +} diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpec.java b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpec.java index 98393ffd..166b575a 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpec.java @@ -43,7 +43,7 @@ public class AdAssetFeedSpec extends APINode { @SerializedName("ad_formats") private List mAdFormats = null; @SerializedName("additional_data") - private Object mAdditionalData = null; + private AdAssetFeedAdditionalData mAdditionalData = null; @SerializedName("app_product_page_id") private String mAppProductPageId = null; @SerializedName("asset_customization_rules") @@ -55,15 +55,15 @@ public class AdAssetFeedSpec extends APINode { @SerializedName("call_to_action_types") private List mCallToActionTypes = null; @SerializedName("call_to_actions") - private List mCallToActions = null; + private List mCallToActions = null; @SerializedName("captions") private List mCaptions = null; @SerializedName("carousels") - private List mCarousels = null; + private List mCarousels = null; @SerializedName("descriptions") private List mDescriptions = null; @SerializedName("events") - private List mEvents = null; + private List mEvents = null; @SerializedName("groups") private List mGroups = null; @SerializedName("images") @@ -73,7 +73,7 @@ public class AdAssetFeedSpec extends APINode { @SerializedName("message_extensions") private List mMessageExtensions = null; @SerializedName("onsite_destinations") - private List mOnsiteDestinations = null; + private List mOnsiteDestinations = null; @SerializedName("optimization_type") private String mOptimizationType = null; @SerializedName("reasons_to_shop") @@ -244,15 +244,20 @@ public AdAssetFeedSpec setFieldAdFormats(List value) { return this; } - public Object getFieldAdditionalData() { + public AdAssetFeedAdditionalData getFieldAdditionalData() { return mAdditionalData; } - public AdAssetFeedSpec setFieldAdditionalData(Object value) { + public AdAssetFeedSpec setFieldAdditionalData(AdAssetFeedAdditionalData value) { this.mAdditionalData = value; return this; } + public AdAssetFeedSpec setFieldAdditionalData(String value) { + Type type = new TypeToken(){}.getType(); + this.mAdditionalData = AdAssetFeedAdditionalData.getGson().fromJson(value, type); + return this; + } public String getFieldAppProductPageId() { return mAppProductPageId; } @@ -308,15 +313,20 @@ public AdAssetFeedSpec setFieldCallToActionTypes(List val return this; } - public List getFieldCallToActions() { + public List getFieldCallToActions() { return mCallToActions; } - public AdAssetFeedSpec setFieldCallToActions(List value) { + public AdAssetFeedSpec setFieldCallToActions(List value) { this.mCallToActions = value; return this; } + public AdAssetFeedSpec setFieldCallToActions(String value) { + Type type = new TypeToken>(){}.getType(); + this.mCallToActions = AdAssetFeedSpecCallToAction.getGson().fromJson(value, type); + return this; + } public List getFieldCaptions() { return mCaptions; } @@ -331,15 +341,20 @@ public AdAssetFeedSpec setFieldCaptions(String value) { this.mCaptions = AdAssetFeedSpecCaption.getGson().fromJson(value, type); return this; } - public List getFieldCarousels() { + public List getFieldCarousels() { return mCarousels; } - public AdAssetFeedSpec setFieldCarousels(List value) { + public AdAssetFeedSpec setFieldCarousels(List value) { this.mCarousels = value; return this; } + public AdAssetFeedSpec setFieldCarousels(String value) { + Type type = new TypeToken>(){}.getType(); + this.mCarousels = AdAssetFeedSpecCarousel.getGson().fromJson(value, type); + return this; + } public List getFieldDescriptions() { return mDescriptions; } @@ -354,15 +369,20 @@ public AdAssetFeedSpec setFieldDescriptions(String value) { this.mDescriptions = AdAssetFeedSpecDescription.getGson().fromJson(value, type); return this; } - public List getFieldEvents() { + public List getFieldEvents() { return mEvents; } - public AdAssetFeedSpec setFieldEvents(List value) { + public AdAssetFeedSpec setFieldEvents(List value) { this.mEvents = value; return this; } + public AdAssetFeedSpec setFieldEvents(String value) { + Type type = new TypeToken>(){}.getType(); + this.mEvents = AdAssetFeedSpecEvents.getGson().fromJson(value, type); + return this; + } public List getFieldGroups() { return mGroups; } @@ -419,15 +439,20 @@ public AdAssetFeedSpec setFieldMessageExtensions(String value) { this.mMessageExtensions = AdAssetMessageExtensions.getGson().fromJson(value, type); return this; } - public List getFieldOnsiteDestinations() { + public List getFieldOnsiteDestinations() { return mOnsiteDestinations; } - public AdAssetFeedSpec setFieldOnsiteDestinations(List value) { + public AdAssetFeedSpec setFieldOnsiteDestinations(List value) { this.mOnsiteDestinations = value; return this; } + public AdAssetFeedSpec setFieldOnsiteDestinations(String value) { + Type type = new TypeToken>(){}.getType(); + this.mOnsiteDestinations = AdAssetOnsiteDestinations.getGson().fromJson(value, type); + return this; + } public String getFieldOptimizationType() { return mOptimizationType; } diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecCallToAction.java b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecCallToAction.java new file mode 100644 index 00000000..9eb7c3ea --- /dev/null +++ b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecCallToAction.java @@ -0,0 +1,269 @@ +/* + * 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.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 AdAssetFeedSpecCallToAction extends APINode { + @SerializedName("adlabels") + private List mAdlabels = null; + @SerializedName("type") + private String mType = null; + @SerializedName("value") + private AdCreativeLinkDataCallToActionValue mValue = null; + protected static Gson gson = null; + + public AdAssetFeedSpecCallToAction() { + } + + public String getId() { + return null; + } + public static AdAssetFeedSpecCallToAction loadJSON(String json, APIContext context, String header) { + AdAssetFeedSpecCallToAction adAssetFeedSpecCallToAction = getGson().fromJson(json, AdAssetFeedSpecCallToAction.class); + if (context.isDebug()) { + JsonParser parser = new JsonParser(); + JsonElement o1 = parser.parse(json); + JsonElement o2 = parser.parse(adAssetFeedSpecCallToAction.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); + } + } + adAssetFeedSpecCallToAction.context = context; + adAssetFeedSpecCallToAction.rawValue = json; + adAssetFeedSpecCallToAction.header = header; + return adAssetFeedSpecCallToAction; + } + + public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { + APINodeList adAssetFeedSpecCallToActions = 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++) { + adAssetFeedSpecCallToActions.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); + }; + return adAssetFeedSpecCallToActions; + } 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; + adAssetFeedSpecCallToActions.setCursors(before, after); + } + String previous = paging.has("previous") ? paging.get("previous").getAsString() : null; + String next = paging.has("next") ? paging.get("next").getAsString() : null; + adAssetFeedSpecCallToActions.setPaging(previous, next); + if (context.hasAppSecret()) { + adAssetFeedSpecCallToActions.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++) { + adAssetFeedSpecCallToActions.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()) { + adAssetFeedSpecCallToActions.add(loadJSON(entry.getValue().toString(), context, header)); + } + break; + } + } + if (!isRedownload) { + adAssetFeedSpecCallToActions.add(loadJSON(obj.toString(), context, header)); + } + } + return adAssetFeedSpecCallToActions; + } 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()) { + adAssetFeedSpecCallToActions.add(loadJSON(entry.getValue().toString(), context, header)); + } + return adAssetFeedSpecCallToActions; + } 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) + ) { + adAssetFeedSpecCallToActions.add(loadJSON(value.toString(), context, header)); + } else { + isIdIndexedArray = false; + break; + } + } + if (isIdIndexedArray) { + return adAssetFeedSpecCallToActions; + } + + // Sixth, check if it's pure JsonObject + adAssetFeedSpecCallToActions.clear(); + adAssetFeedSpecCallToActions.add(loadJSON(json, context, header)); + return adAssetFeedSpecCallToActions; + } + } + } 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 List getFieldAdlabels() { + return mAdlabels; + } + + public AdAssetFeedSpecCallToAction setFieldAdlabels(List value) { + this.mAdlabels = value; + return this; + } + + public AdAssetFeedSpecCallToAction setFieldAdlabels(String value) { + Type type = new TypeToken>(){}.getType(); + this.mAdlabels = AdAssetFeedSpecAssetLabel.getGson().fromJson(value, type); + return this; + } + public String getFieldType() { + return mType; + } + + public AdAssetFeedSpecCallToAction setFieldType(String value) { + this.mType = value; + return this; + } + + public AdCreativeLinkDataCallToActionValue getFieldValue() { + return mValue; + } + + public AdAssetFeedSpecCallToAction setFieldValue(AdCreativeLinkDataCallToActionValue value) { + this.mValue = value; + return this; + } + + public AdAssetFeedSpecCallToAction setFieldValue(String value) { + Type type = new TypeToken(){}.getType(); + this.mValue = AdCreativeLinkDataCallToActionValue.getGson().fromJson(value, type); + 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 AdAssetFeedSpecCallToAction copyFrom(AdAssetFeedSpecCallToAction instance) { + this.mAdlabels = instance.mAdlabels; + this.mType = instance.mType; + this.mValue = instance.mValue; + 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 AdAssetFeedSpecCallToAction.parseResponse(response, context, request, header); + } + }; + } +} diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecCarousel.java b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecCarousel.java new file mode 100644 index 00000000..0070b513 --- /dev/null +++ b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecCarousel.java @@ -0,0 +1,281 @@ +/* + * 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.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 AdAssetFeedSpecCarousel extends APINode { + @SerializedName("adlabels") + private List mAdlabels = null; + @SerializedName("child_attachments") + private List mChildAttachments = null; + @SerializedName("multi_share_end_card") + private Boolean mMultiShareEndCard = null; + @SerializedName("multi_share_optimized") + private Boolean mMultiShareOptimized = null; + protected static Gson gson = null; + + public AdAssetFeedSpecCarousel() { + } + + public String getId() { + return null; + } + public static AdAssetFeedSpecCarousel loadJSON(String json, APIContext context, String header) { + AdAssetFeedSpecCarousel adAssetFeedSpecCarousel = getGson().fromJson(json, AdAssetFeedSpecCarousel.class); + if (context.isDebug()) { + JsonParser parser = new JsonParser(); + JsonElement o1 = parser.parse(json); + JsonElement o2 = parser.parse(adAssetFeedSpecCarousel.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); + } + } + adAssetFeedSpecCarousel.context = context; + adAssetFeedSpecCarousel.rawValue = json; + adAssetFeedSpecCarousel.header = header; + return adAssetFeedSpecCarousel; + } + + public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { + APINodeList adAssetFeedSpecCarousels = 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++) { + adAssetFeedSpecCarousels.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); + }; + return adAssetFeedSpecCarousels; + } 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; + adAssetFeedSpecCarousels.setCursors(before, after); + } + String previous = paging.has("previous") ? paging.get("previous").getAsString() : null; + String next = paging.has("next") ? paging.get("next").getAsString() : null; + adAssetFeedSpecCarousels.setPaging(previous, next); + if (context.hasAppSecret()) { + adAssetFeedSpecCarousels.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++) { + adAssetFeedSpecCarousels.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()) { + adAssetFeedSpecCarousels.add(loadJSON(entry.getValue().toString(), context, header)); + } + break; + } + } + if (!isRedownload) { + adAssetFeedSpecCarousels.add(loadJSON(obj.toString(), context, header)); + } + } + return adAssetFeedSpecCarousels; + } 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()) { + adAssetFeedSpecCarousels.add(loadJSON(entry.getValue().toString(), context, header)); + } + return adAssetFeedSpecCarousels; + } 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) + ) { + adAssetFeedSpecCarousels.add(loadJSON(value.toString(), context, header)); + } else { + isIdIndexedArray = false; + break; + } + } + if (isIdIndexedArray) { + return adAssetFeedSpecCarousels; + } + + // Sixth, check if it's pure JsonObject + adAssetFeedSpecCarousels.clear(); + adAssetFeedSpecCarousels.add(loadJSON(json, context, header)); + return adAssetFeedSpecCarousels; + } + } + } 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 List getFieldAdlabels() { + return mAdlabels; + } + + public AdAssetFeedSpecCarousel setFieldAdlabels(List value) { + this.mAdlabels = value; + return this; + } + + public AdAssetFeedSpecCarousel setFieldAdlabels(String value) { + Type type = new TypeToken>(){}.getType(); + this.mAdlabels = AdAssetFeedSpecAssetLabel.getGson().fromJson(value, type); + return this; + } + public List getFieldChildAttachments() { + return mChildAttachments; + } + + public AdAssetFeedSpecCarousel setFieldChildAttachments(List value) { + this.mChildAttachments = value; + return this; + } + + public AdAssetFeedSpecCarousel setFieldChildAttachments(String value) { + Type type = new TypeToken>(){}.getType(); + this.mChildAttachments = AdAssetFeedSpecCarouselChildAttachment.getGson().fromJson(value, type); + return this; + } + public Boolean getFieldMultiShareEndCard() { + return mMultiShareEndCard; + } + + public AdAssetFeedSpecCarousel setFieldMultiShareEndCard(Boolean value) { + this.mMultiShareEndCard = value; + return this; + } + + public Boolean getFieldMultiShareOptimized() { + return mMultiShareOptimized; + } + + public AdAssetFeedSpecCarousel setFieldMultiShareOptimized(Boolean value) { + this.mMultiShareOptimized = 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 AdAssetFeedSpecCarousel copyFrom(AdAssetFeedSpecCarousel instance) { + this.mAdlabels = instance.mAdlabels; + this.mChildAttachments = instance.mChildAttachments; + this.mMultiShareEndCard = instance.mMultiShareEndCard; + this.mMultiShareOptimized = instance.mMultiShareOptimized; + 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 AdAssetFeedSpecCarousel.parseResponse(response, context, request, header); + } + }; + } +} diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecCarouselChildAttachment.java b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecCarouselChildAttachment.java new file mode 100644 index 00000000..d576037a --- /dev/null +++ b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecCarouselChildAttachment.java @@ -0,0 +1,388 @@ +/* + * 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.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 AdAssetFeedSpecCarouselChildAttachment extends APINode { + @SerializedName("body_label") + private AdAssetFeedSpecAssetLabel mBodyLabel = null; + @SerializedName("call_to_action_type_label") + private AdAssetFeedSpecAssetLabel mCallToActionTypeLabel = null; + @SerializedName("caption_label") + private AdAssetFeedSpecAssetLabel mCaptionLabel = null; + @SerializedName("description_label") + private AdAssetFeedSpecAssetLabel mDescriptionLabel = null; + @SerializedName("image_label") + private AdAssetFeedSpecAssetLabel mImageLabel = null; + @SerializedName("link_url_label") + private AdAssetFeedSpecAssetLabel mLinkUrlLabel = null; + @SerializedName("phone_data_ids_label") + private AdAssetFeedSpecAssetLabel mPhoneDataIdsLabel = null; + @SerializedName("static_card") + private Boolean mStaticCard = null; + @SerializedName("title_label") + private AdAssetFeedSpecAssetLabel mTitleLabel = null; + @SerializedName("video_label") + private AdAssetFeedSpecAssetLabel mVideoLabel = null; + protected static Gson gson = null; + + public AdAssetFeedSpecCarouselChildAttachment() { + } + + public String getId() { + return null; + } + public static AdAssetFeedSpecCarouselChildAttachment loadJSON(String json, APIContext context, String header) { + AdAssetFeedSpecCarouselChildAttachment adAssetFeedSpecCarouselChildAttachment = getGson().fromJson(json, AdAssetFeedSpecCarouselChildAttachment.class); + if (context.isDebug()) { + JsonParser parser = new JsonParser(); + JsonElement o1 = parser.parse(json); + JsonElement o2 = parser.parse(adAssetFeedSpecCarouselChildAttachment.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); + } + } + adAssetFeedSpecCarouselChildAttachment.context = context; + adAssetFeedSpecCarouselChildAttachment.rawValue = json; + adAssetFeedSpecCarouselChildAttachment.header = header; + return adAssetFeedSpecCarouselChildAttachment; + } + + public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { + APINodeList adAssetFeedSpecCarouselChildAttachments = 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++) { + adAssetFeedSpecCarouselChildAttachments.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); + }; + return adAssetFeedSpecCarouselChildAttachments; + } 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; + adAssetFeedSpecCarouselChildAttachments.setCursors(before, after); + } + String previous = paging.has("previous") ? paging.get("previous").getAsString() : null; + String next = paging.has("next") ? paging.get("next").getAsString() : null; + adAssetFeedSpecCarouselChildAttachments.setPaging(previous, next); + if (context.hasAppSecret()) { + adAssetFeedSpecCarouselChildAttachments.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++) { + adAssetFeedSpecCarouselChildAttachments.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()) { + adAssetFeedSpecCarouselChildAttachments.add(loadJSON(entry.getValue().toString(), context, header)); + } + break; + } + } + if (!isRedownload) { + adAssetFeedSpecCarouselChildAttachments.add(loadJSON(obj.toString(), context, header)); + } + } + return adAssetFeedSpecCarouselChildAttachments; + } 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()) { + adAssetFeedSpecCarouselChildAttachments.add(loadJSON(entry.getValue().toString(), context, header)); + } + return adAssetFeedSpecCarouselChildAttachments; + } 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) + ) { + adAssetFeedSpecCarouselChildAttachments.add(loadJSON(value.toString(), context, header)); + } else { + isIdIndexedArray = false; + break; + } + } + if (isIdIndexedArray) { + return adAssetFeedSpecCarouselChildAttachments; + } + + // Sixth, check if it's pure JsonObject + adAssetFeedSpecCarouselChildAttachments.clear(); + adAssetFeedSpecCarouselChildAttachments.add(loadJSON(json, context, header)); + return adAssetFeedSpecCarouselChildAttachments; + } + } + } 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 AdAssetFeedSpecAssetLabel getFieldBodyLabel() { + return mBodyLabel; + } + + public AdAssetFeedSpecCarouselChildAttachment setFieldBodyLabel(AdAssetFeedSpecAssetLabel value) { + this.mBodyLabel = value; + return this; + } + + public AdAssetFeedSpecCarouselChildAttachment setFieldBodyLabel(String value) { + Type type = new TypeToken(){}.getType(); + this.mBodyLabel = AdAssetFeedSpecAssetLabel.getGson().fromJson(value, type); + return this; + } + public AdAssetFeedSpecAssetLabel getFieldCallToActionTypeLabel() { + return mCallToActionTypeLabel; + } + + public AdAssetFeedSpecCarouselChildAttachment setFieldCallToActionTypeLabel(AdAssetFeedSpecAssetLabel value) { + this.mCallToActionTypeLabel = value; + return this; + } + + public AdAssetFeedSpecCarouselChildAttachment setFieldCallToActionTypeLabel(String value) { + Type type = new TypeToken(){}.getType(); + this.mCallToActionTypeLabel = AdAssetFeedSpecAssetLabel.getGson().fromJson(value, type); + return this; + } + public AdAssetFeedSpecAssetLabel getFieldCaptionLabel() { + return mCaptionLabel; + } + + public AdAssetFeedSpecCarouselChildAttachment setFieldCaptionLabel(AdAssetFeedSpecAssetLabel value) { + this.mCaptionLabel = value; + return this; + } + + public AdAssetFeedSpecCarouselChildAttachment setFieldCaptionLabel(String value) { + Type type = new TypeToken(){}.getType(); + this.mCaptionLabel = AdAssetFeedSpecAssetLabel.getGson().fromJson(value, type); + return this; + } + public AdAssetFeedSpecAssetLabel getFieldDescriptionLabel() { + return mDescriptionLabel; + } + + public AdAssetFeedSpecCarouselChildAttachment setFieldDescriptionLabel(AdAssetFeedSpecAssetLabel value) { + this.mDescriptionLabel = value; + return this; + } + + public AdAssetFeedSpecCarouselChildAttachment setFieldDescriptionLabel(String value) { + Type type = new TypeToken(){}.getType(); + this.mDescriptionLabel = AdAssetFeedSpecAssetLabel.getGson().fromJson(value, type); + return this; + } + public AdAssetFeedSpecAssetLabel getFieldImageLabel() { + return mImageLabel; + } + + public AdAssetFeedSpecCarouselChildAttachment setFieldImageLabel(AdAssetFeedSpecAssetLabel value) { + this.mImageLabel = value; + return this; + } + + public AdAssetFeedSpecCarouselChildAttachment setFieldImageLabel(String value) { + Type type = new TypeToken(){}.getType(); + this.mImageLabel = AdAssetFeedSpecAssetLabel.getGson().fromJson(value, type); + return this; + } + public AdAssetFeedSpecAssetLabel getFieldLinkUrlLabel() { + return mLinkUrlLabel; + } + + public AdAssetFeedSpecCarouselChildAttachment setFieldLinkUrlLabel(AdAssetFeedSpecAssetLabel value) { + this.mLinkUrlLabel = value; + return this; + } + + public AdAssetFeedSpecCarouselChildAttachment setFieldLinkUrlLabel(String value) { + Type type = new TypeToken(){}.getType(); + this.mLinkUrlLabel = AdAssetFeedSpecAssetLabel.getGson().fromJson(value, type); + return this; + } + public AdAssetFeedSpecAssetLabel getFieldPhoneDataIdsLabel() { + return mPhoneDataIdsLabel; + } + + public AdAssetFeedSpecCarouselChildAttachment setFieldPhoneDataIdsLabel(AdAssetFeedSpecAssetLabel value) { + this.mPhoneDataIdsLabel = value; + return this; + } + + public AdAssetFeedSpecCarouselChildAttachment setFieldPhoneDataIdsLabel(String value) { + Type type = new TypeToken(){}.getType(); + this.mPhoneDataIdsLabel = AdAssetFeedSpecAssetLabel.getGson().fromJson(value, type); + return this; + } + public Boolean getFieldStaticCard() { + return mStaticCard; + } + + public AdAssetFeedSpecCarouselChildAttachment setFieldStaticCard(Boolean value) { + this.mStaticCard = value; + return this; + } + + public AdAssetFeedSpecAssetLabel getFieldTitleLabel() { + return mTitleLabel; + } + + public AdAssetFeedSpecCarouselChildAttachment setFieldTitleLabel(AdAssetFeedSpecAssetLabel value) { + this.mTitleLabel = value; + return this; + } + + public AdAssetFeedSpecCarouselChildAttachment setFieldTitleLabel(String value) { + Type type = new TypeToken(){}.getType(); + this.mTitleLabel = AdAssetFeedSpecAssetLabel.getGson().fromJson(value, type); + return this; + } + public AdAssetFeedSpecAssetLabel getFieldVideoLabel() { + return mVideoLabel; + } + + public AdAssetFeedSpecCarouselChildAttachment setFieldVideoLabel(AdAssetFeedSpecAssetLabel value) { + this.mVideoLabel = value; + return this; + } + + public AdAssetFeedSpecCarouselChildAttachment setFieldVideoLabel(String value) { + Type type = new TypeToken(){}.getType(); + this.mVideoLabel = AdAssetFeedSpecAssetLabel.getGson().fromJson(value, type); + 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 AdAssetFeedSpecCarouselChildAttachment copyFrom(AdAssetFeedSpecCarouselChildAttachment instance) { + this.mBodyLabel = instance.mBodyLabel; + this.mCallToActionTypeLabel = instance.mCallToActionTypeLabel; + this.mCaptionLabel = instance.mCaptionLabel; + this.mDescriptionLabel = instance.mDescriptionLabel; + this.mImageLabel = instance.mImageLabel; + this.mLinkUrlLabel = instance.mLinkUrlLabel; + this.mPhoneDataIdsLabel = instance.mPhoneDataIdsLabel; + this.mStaticCard = instance.mStaticCard; + this.mTitleLabel = instance.mTitleLabel; + this.mVideoLabel = instance.mVideoLabel; + 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 AdAssetFeedSpecCarouselChildAttachment.parseResponse(response, context, request, header); + } + }; + } +} diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecEvents.java b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecEvents.java new file mode 100644 index 00000000..1c44eaf2 --- /dev/null +++ b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecEvents.java @@ -0,0 +1,235 @@ +/* + * 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.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 AdAssetFeedSpecEvents extends APINode { + @SerializedName("id") + private String mId = null; + protected static Gson gson = null; + + public AdAssetFeedSpecEvents() { + } + + public String getId() { + return getFieldId().toString(); + } + public static AdAssetFeedSpecEvents loadJSON(String json, APIContext context, String header) { + AdAssetFeedSpecEvents adAssetFeedSpecEvents = getGson().fromJson(json, AdAssetFeedSpecEvents.class); + if (context.isDebug()) { + JsonParser parser = new JsonParser(); + JsonElement o1 = parser.parse(json); + JsonElement o2 = parser.parse(adAssetFeedSpecEvents.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); + } + } + adAssetFeedSpecEvents.context = context; + adAssetFeedSpecEvents.rawValue = json; + adAssetFeedSpecEvents.header = header; + return adAssetFeedSpecEvents; + } + + public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { + APINodeList adAssetFeedSpecEventss = 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++) { + adAssetFeedSpecEventss.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); + }; + return adAssetFeedSpecEventss; + } 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; + adAssetFeedSpecEventss.setCursors(before, after); + } + String previous = paging.has("previous") ? paging.get("previous").getAsString() : null; + String next = paging.has("next") ? paging.get("next").getAsString() : null; + adAssetFeedSpecEventss.setPaging(previous, next); + if (context.hasAppSecret()) { + adAssetFeedSpecEventss.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++) { + adAssetFeedSpecEventss.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()) { + adAssetFeedSpecEventss.add(loadJSON(entry.getValue().toString(), context, header)); + } + break; + } + } + if (!isRedownload) { + adAssetFeedSpecEventss.add(loadJSON(obj.toString(), context, header)); + } + } + return adAssetFeedSpecEventss; + } 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()) { + adAssetFeedSpecEventss.add(loadJSON(entry.getValue().toString(), context, header)); + } + return adAssetFeedSpecEventss; + } 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) + ) { + adAssetFeedSpecEventss.add(loadJSON(value.toString(), context, header)); + } else { + isIdIndexedArray = false; + break; + } + } + if (isIdIndexedArray) { + return adAssetFeedSpecEventss; + } + + // Sixth, check if it's pure JsonObject + adAssetFeedSpecEventss.clear(); + adAssetFeedSpecEventss.add(loadJSON(json, context, header)); + return adAssetFeedSpecEventss; + } + } + } 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 getFieldId() { + return mId; + } + + public AdAssetFeedSpecEvents setFieldId(String value) { + this.mId = 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 AdAssetFeedSpecEvents copyFrom(AdAssetFeedSpecEvents instance) { + this.mId = instance.mId; + 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 AdAssetFeedSpecEvents.parseResponse(response, context, request, header); + } + }; + } +} diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetOnsiteDestinations.java b/src/main/java/com/facebook/ads/sdk/AdAssetOnsiteDestinations.java new file mode 100644 index 00000000..06769796 --- /dev/null +++ b/src/main/java/com/facebook/ads/sdk/AdAssetOnsiteDestinations.java @@ -0,0 +1,271 @@ +/* + * 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.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 AdAssetOnsiteDestinations extends APINode { + @SerializedName("auto_optimization") + private String mAutoOptimization = null; + @SerializedName("details_page_product_id") + private String mDetailsPageProductId = null; + @SerializedName("shop_collection_product_set_id") + private String mShopCollectionProductSetId = null; + @SerializedName("storefront_shop_id") + private String mStorefrontShopId = null; + protected static Gson gson = null; + + public AdAssetOnsiteDestinations() { + } + + public String getId() { + return null; + } + public static AdAssetOnsiteDestinations loadJSON(String json, APIContext context, String header) { + AdAssetOnsiteDestinations adAssetOnsiteDestinations = getGson().fromJson(json, AdAssetOnsiteDestinations.class); + if (context.isDebug()) { + JsonParser parser = new JsonParser(); + JsonElement o1 = parser.parse(json); + JsonElement o2 = parser.parse(adAssetOnsiteDestinations.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); + } + } + adAssetOnsiteDestinations.context = context; + adAssetOnsiteDestinations.rawValue = json; + adAssetOnsiteDestinations.header = header; + return adAssetOnsiteDestinations; + } + + public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { + APINodeList adAssetOnsiteDestinationss = 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++) { + adAssetOnsiteDestinationss.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); + }; + return adAssetOnsiteDestinationss; + } 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; + adAssetOnsiteDestinationss.setCursors(before, after); + } + String previous = paging.has("previous") ? paging.get("previous").getAsString() : null; + String next = paging.has("next") ? paging.get("next").getAsString() : null; + adAssetOnsiteDestinationss.setPaging(previous, next); + if (context.hasAppSecret()) { + adAssetOnsiteDestinationss.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++) { + adAssetOnsiteDestinationss.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()) { + adAssetOnsiteDestinationss.add(loadJSON(entry.getValue().toString(), context, header)); + } + break; + } + } + if (!isRedownload) { + adAssetOnsiteDestinationss.add(loadJSON(obj.toString(), context, header)); + } + } + return adAssetOnsiteDestinationss; + } 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()) { + adAssetOnsiteDestinationss.add(loadJSON(entry.getValue().toString(), context, header)); + } + return adAssetOnsiteDestinationss; + } 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) + ) { + adAssetOnsiteDestinationss.add(loadJSON(value.toString(), context, header)); + } else { + isIdIndexedArray = false; + break; + } + } + if (isIdIndexedArray) { + return adAssetOnsiteDestinationss; + } + + // Sixth, check if it's pure JsonObject + adAssetOnsiteDestinationss.clear(); + adAssetOnsiteDestinationss.add(loadJSON(json, context, header)); + return adAssetOnsiteDestinationss; + } + } + } 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 getFieldAutoOptimization() { + return mAutoOptimization; + } + + public AdAssetOnsiteDestinations setFieldAutoOptimization(String value) { + this.mAutoOptimization = value; + return this; + } + + public String getFieldDetailsPageProductId() { + return mDetailsPageProductId; + } + + public AdAssetOnsiteDestinations setFieldDetailsPageProductId(String value) { + this.mDetailsPageProductId = value; + return this; + } + + public String getFieldShopCollectionProductSetId() { + return mShopCollectionProductSetId; + } + + public AdAssetOnsiteDestinations setFieldShopCollectionProductSetId(String value) { + this.mShopCollectionProductSetId = value; + return this; + } + + public String getFieldStorefrontShopId() { + return mStorefrontShopId; + } + + public AdAssetOnsiteDestinations setFieldStorefrontShopId(String value) { + this.mStorefrontShopId = 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 AdAssetOnsiteDestinations copyFrom(AdAssetOnsiteDestinations instance) { + this.mAutoOptimization = instance.mAutoOptimization; + this.mDetailsPageProductId = instance.mDetailsPageProductId; + this.mShopCollectionProductSetId = instance.mShopCollectionProductSetId; + this.mStorefrontShopId = instance.mStorefrontShopId; + 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 AdAssetOnsiteDestinations.parseResponse(response, context, request, header); + } + }; + } +} diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeBrandedContentAds.java b/src/main/java/com/facebook/ads/sdk/AdCreativeBrandedContentAds.java index 45a7ebae..a78aa896 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeBrandedContentAds.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeBrandedContentAds.java @@ -49,7 +49,7 @@ public class AdCreativeBrandedContentAds extends APINode { @SerializedName("is_mca_internal") private Boolean mIsMcaInternal = null; @SerializedName("partners") - private List mPartners = null; + private List mPartners = null; @SerializedName("ui_version") private Long mUiVersion = null; protected static Gson gson = null; @@ -239,15 +239,20 @@ public AdCreativeBrandedContentAds setFieldIsMcaInternal(Boolean value) { return this; } - public List getFieldPartners() { + public List getFieldPartners() { return mPartners; } - public AdCreativeBrandedContentAds setFieldPartners(List value) { + public AdCreativeBrandedContentAds setFieldPartners(List value) { this.mPartners = value; return this; } + public AdCreativeBrandedContentAds setFieldPartners(String value) { + Type type = new TypeToken>(){}.getType(); + this.mPartners = AdCreativeBrandedContentAdsPartners.getGson().fromJson(value, type); + return this; + } public Long getFieldUiVersion() { return mUiVersion; } diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeBrandedContentAdsPartners.java b/src/main/java/com/facebook/ads/sdk/AdCreativeBrandedContentAdsPartners.java new file mode 100644 index 00000000..588929cc --- /dev/null +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeBrandedContentAdsPartners.java @@ -0,0 +1,271 @@ +/* + * 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.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 AdCreativeBrandedContentAdsPartners extends APINode { + @SerializedName("fb_page_id") + private String mFbPageId = null; + @SerializedName("identity_type") + private String mIdentityType = null; + @SerializedName("ig_asset_id") + private String mIgAssetId = null; + @SerializedName("ig_user_id") + private String mIgUserId = null; + protected static Gson gson = null; + + public AdCreativeBrandedContentAdsPartners() { + } + + public String getId() { + return null; + } + public static AdCreativeBrandedContentAdsPartners loadJSON(String json, APIContext context, String header) { + AdCreativeBrandedContentAdsPartners adCreativeBrandedContentAdsPartners = getGson().fromJson(json, AdCreativeBrandedContentAdsPartners.class); + if (context.isDebug()) { + JsonParser parser = new JsonParser(); + JsonElement o1 = parser.parse(json); + JsonElement o2 = parser.parse(adCreativeBrandedContentAdsPartners.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); + } + } + adCreativeBrandedContentAdsPartners.context = context; + adCreativeBrandedContentAdsPartners.rawValue = json; + adCreativeBrandedContentAdsPartners.header = header; + return adCreativeBrandedContentAdsPartners; + } + + public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { + APINodeList adCreativeBrandedContentAdsPartnerss = 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++) { + adCreativeBrandedContentAdsPartnerss.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); + }; + return adCreativeBrandedContentAdsPartnerss; + } 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; + adCreativeBrandedContentAdsPartnerss.setCursors(before, after); + } + String previous = paging.has("previous") ? paging.get("previous").getAsString() : null; + String next = paging.has("next") ? paging.get("next").getAsString() : null; + adCreativeBrandedContentAdsPartnerss.setPaging(previous, next); + if (context.hasAppSecret()) { + adCreativeBrandedContentAdsPartnerss.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++) { + adCreativeBrandedContentAdsPartnerss.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()) { + adCreativeBrandedContentAdsPartnerss.add(loadJSON(entry.getValue().toString(), context, header)); + } + break; + } + } + if (!isRedownload) { + adCreativeBrandedContentAdsPartnerss.add(loadJSON(obj.toString(), context, header)); + } + } + return adCreativeBrandedContentAdsPartnerss; + } 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()) { + adCreativeBrandedContentAdsPartnerss.add(loadJSON(entry.getValue().toString(), context, header)); + } + return adCreativeBrandedContentAdsPartnerss; + } 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) + ) { + adCreativeBrandedContentAdsPartnerss.add(loadJSON(value.toString(), context, header)); + } else { + isIdIndexedArray = false; + break; + } + } + if (isIdIndexedArray) { + return adCreativeBrandedContentAdsPartnerss; + } + + // Sixth, check if it's pure JsonObject + adCreativeBrandedContentAdsPartnerss.clear(); + adCreativeBrandedContentAdsPartnerss.add(loadJSON(json, context, header)); + return adCreativeBrandedContentAdsPartnerss; + } + } + } 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 getFieldFbPageId() { + return mFbPageId; + } + + public AdCreativeBrandedContentAdsPartners setFieldFbPageId(String value) { + this.mFbPageId = value; + return this; + } + + public String getFieldIdentityType() { + return mIdentityType; + } + + public AdCreativeBrandedContentAdsPartners setFieldIdentityType(String value) { + this.mIdentityType = value; + return this; + } + + public String getFieldIgAssetId() { + return mIgAssetId; + } + + public AdCreativeBrandedContentAdsPartners setFieldIgAssetId(String value) { + this.mIgAssetId = value; + return this; + } + + public String getFieldIgUserId() { + return mIgUserId; + } + + public AdCreativeBrandedContentAdsPartners setFieldIgUserId(String value) { + this.mIgUserId = 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 AdCreativeBrandedContentAdsPartners copyFrom(AdCreativeBrandedContentAdsPartners instance) { + this.mFbPageId = instance.mFbPageId; + this.mIdentityType = instance.mIdentityType; + this.mIgAssetId = instance.mIgAssetId; + this.mIgUserId = instance.mIgUserId; + 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 AdCreativeBrandedContentAdsPartners.parseResponse(response, context, request, header); + } + }; + } +} diff --git a/src/main/java/com/facebook/ads/sdk/AdStudyObjective.java b/src/main/java/com/facebook/ads/sdk/AdStudyObjective.java index be381425..282d0821 100644 --- a/src/main/java/com/facebook/ads/sdk/AdStudyObjective.java +++ b/src/main/java/com/facebook/ads/sdk/AdStudyObjective.java @@ -728,6 +728,8 @@ public APINodeList getLastResponse() { "auto_event_mapping_android", "auto_event_mapping_ios", "auto_event_setup_enabled", + "auto_log_app_events_default", + "auto_log_app_events_enabled", "business", "canvas_fluid_height", "canvas_fluid_width", @@ -785,8 +787,6 @@ public APINodeList getLastResponse() { "restrictions", "restrictive_data_filter_params", "restrictive_data_filter_rules", - "sdk_auto_logging_default_value", - "sdk_auto_logging_override_value", "sdk_update_message", "seamless_login", "secure_canvas_url", @@ -1074,6 +1074,20 @@ public APIRequestGetApplications requestAutoEventSetupEnabledField (boolean valu this.requestField("auto_event_setup_enabled", value); return this; } + public APIRequestGetApplications requestAutoLogAppEventsDefaultField () { + return this.requestAutoLogAppEventsDefaultField(true); + } + public APIRequestGetApplications requestAutoLogAppEventsDefaultField (boolean value) { + this.requestField("auto_log_app_events_default", value); + return this; + } + public APIRequestGetApplications requestAutoLogAppEventsEnabledField () { + return this.requestAutoLogAppEventsEnabledField(true); + } + public APIRequestGetApplications requestAutoLogAppEventsEnabledField (boolean value) { + this.requestField("auto_log_app_events_enabled", value); + return this; + } public APIRequestGetApplications requestBusinessField () { return this.requestBusinessField(true); } @@ -1473,20 +1487,6 @@ public APIRequestGetApplications requestRestrictiveDataFilterRulesField (boolean this.requestField("restrictive_data_filter_rules", value); return this; } - public APIRequestGetApplications requestSdkAutoLoggingDefaultValueField () { - return this.requestSdkAutoLoggingDefaultValueField(true); - } - public APIRequestGetApplications requestSdkAutoLoggingDefaultValueField (boolean value) { - this.requestField("sdk_auto_logging_default_value", value); - return this; - } - public APIRequestGetApplications requestSdkAutoLoggingOverrideValueField () { - return this.requestSdkAutoLoggingOverrideValueField(true); - } - public APIRequestGetApplications requestSdkAutoLoggingOverrideValueField (boolean value) { - this.requestField("sdk_auto_logging_override_value", value); - return this; - } public APIRequestGetApplications requestSdkUpdateMessageField () { return this.requestSdkUpdateMessageField(true); } diff --git a/src/main/java/com/facebook/ads/sdk/AdVideo.java b/src/main/java/com/facebook/ads/sdk/AdVideo.java index ffddd96b..a743cdde 100644 --- a/src/main/java/com/facebook/ads/sdk/AdVideo.java +++ b/src/main/java/com/facebook/ads/sdk/AdVideo.java @@ -6868,6 +6868,8 @@ public static enum EnumContainerType { VALUE_INSTANT_APPLICATION_PREVIEW("INSTANT_APPLICATION_PREVIEW"), @SerializedName("INSTANT_ARTICLE") VALUE_INSTANT_ARTICLE("INSTANT_ARTICLE"), + @SerializedName("INSTANT_GAMES_PROMO") + VALUE_INSTANT_GAMES_PROMO("INSTANT_GAMES_PROMO"), @SerializedName("INSTANT_GAME_CLIP") VALUE_INSTANT_GAME_CLIP("INSTANT_GAME_CLIP"), @SerializedName("ISSUE_MODULE") diff --git a/src/main/java/com/facebook/ads/sdk/Application.java b/src/main/java/com/facebook/ads/sdk/Application.java index c5f5cf7d..618e3991 100644 --- a/src/main/java/com/facebook/ads/sdk/Application.java +++ b/src/main/java/com/facebook/ads/sdk/Application.java @@ -90,6 +90,10 @@ public class Application extends APINode { private List mAutoEventMappingIos = null; @SerializedName("auto_event_setup_enabled") private Boolean mAutoEventSetupEnabled = null; + @SerializedName("auto_log_app_events_default") + private Boolean mAutoLogAppEventsDefault = null; + @SerializedName("auto_log_app_events_enabled") + private Boolean mAutoLogAppEventsEnabled = null; @SerializedName("business") private Business mBusiness = null; @SerializedName("canvas_fluid_height") @@ -204,10 +208,6 @@ public class Application extends APINode { private String mRestrictiveDataFilterParams = null; @SerializedName("restrictive_data_filter_rules") private String mRestrictiveDataFilterRules = null; - @SerializedName("sdk_auto_logging_default_value") - private Boolean mSdkAutoLoggingDefaultValue = null; - @SerializedName("sdk_auto_logging_override_value") - private Boolean mSdkAutoLoggingOverrideValue = null; @SerializedName("sdk_update_message") private String mSdkUpdateMessage = null; @SerializedName("seamless_login") @@ -563,10 +563,6 @@ public APIRequestGetAuthorizedAdAccounts getAuthorizedAdAccounts() { return new APIRequestGetAuthorizedAdAccounts(this.getPrefixedId().toString(), context); } - public APIRequestGetBanned getBanned() { - return new APIRequestGetBanned(this.getPrefixedId().toString(), context); - } - public APIRequestGetButtonAutoDetectionDeviceSelection getButtonAutoDetectionDeviceSelection() { return new APIRequestGetButtonAutoDetectionDeviceSelection(this.getPrefixedId().toString(), context); } @@ -796,6 +792,14 @@ public Boolean getFieldAutoEventSetupEnabled() { return mAutoEventSetupEnabled; } + public Boolean getFieldAutoLogAppEventsDefault() { + return mAutoLogAppEventsDefault; + } + + public Boolean getFieldAutoLogAppEventsEnabled() { + return mAutoLogAppEventsEnabled; + } + public Business getFieldBusiness() { if (mBusiness != null) { mBusiness.context = getContext(); @@ -1030,14 +1034,6 @@ public String getFieldRestrictiveDataFilterRules() { return mRestrictiveDataFilterRules; } - public Boolean getFieldSdkAutoLoggingDefaultValue() { - return mSdkAutoLoggingDefaultValue; - } - - public Boolean getFieldSdkAutoLoggingOverrideValue() { - return mSdkAutoLoggingOverrideValue; - } - public String getFieldSdkUpdateMessage() { return mSdkUpdateMessage; } @@ -5674,512 +5670,6 @@ public APIRequestGetAuthorizedAdAccounts requestViewableBusinessField (boolean v } } - public static class APIRequestGetBanned extends APIRequest { - - APINodeList lastResponse = null; - @Override - public APINodeList getLastResponse() { - return lastResponse; - } - public static final String[] PARAMS = { - "uid", - }; - - public static final String[] FIELDS = { - "about", - "age_range", - "avatar_2d_profile_picture", - "birthday", - "community", - "cover", - "currency", - "education", - "email", - "favorite_athletes", - "favorite_teams", - "first_name", - "gender", - "hometown", - "id", - "id_for_avatars", - "inspirational_people", - "install_type", - "installed", - "is_guest_user", - "is_work_account", - "languages", - "last_name", - "link", - "local_news_megaphone_dismiss_status", - "local_news_subscription_status", - "locale", - "location", - "meeting_for", - "middle_name", - "name", - "name_format", - "payment_pricepoints", - "political", - "profile_pic", - "quotes", - "relationship_status", - "shared_login_upgrade_required_by", - "short_name", - "significant_other", - "sports", - "supports_donate_button_in_live_video", - "third_party_id", - "timezone", - "token_for_business", - "updated_time", - "verified", - "video_upload_limits", - "website", - }; - - @Override - public APINodeList parseResponse(String response, String header) throws APIException { - return User.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 APIRequestGetBanned.this.parseResponse(result.getBody(), result.getHeader()); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - } - ); - }; - - public APIRequestGetBanned(String nodeId, APIContext context) { - super(context, nodeId, "/banned", "GET", Arrays.asList(PARAMS)); - } - - @Override - public APIRequestGetBanned setParam(String param, Object value) { - setParamInternal(param, value); - return this; - } - - @Override - public APIRequestGetBanned setParams(Map params) { - setParamsInternal(params); - return this; - } - - - public APIRequestGetBanned setUid (Long uid) { - this.setParam("uid", uid); - return this; - } - public APIRequestGetBanned setUid (String uid) { - this.setParam("uid", uid); - return this; - } - - public APIRequestGetBanned requestAllFields () { - return this.requestAllFields(true); - } - - public APIRequestGetBanned requestAllFields (boolean value) { - for (String field : FIELDS) { - this.requestField(field, value); - } - return this; - } - - @Override - public APIRequestGetBanned requestFields (List fields) { - return this.requestFields(fields, true); - } - - @Override - public APIRequestGetBanned requestFields (List fields, boolean value) { - for (String field : fields) { - this.requestField(field, value); - } - return this; - } - - @Override - public APIRequestGetBanned requestField (String field) { - this.requestField(field, true); - return this; - } - - @Override - public APIRequestGetBanned requestField (String field, boolean value) { - this.requestFieldInternal(field, value); - return this; - } - - public APIRequestGetBanned requestAboutField () { - return this.requestAboutField(true); - } - public APIRequestGetBanned requestAboutField (boolean value) { - this.requestField("about", value); - return this; - } - public APIRequestGetBanned requestAgeRangeField () { - return this.requestAgeRangeField(true); - } - public APIRequestGetBanned requestAgeRangeField (boolean value) { - this.requestField("age_range", value); - return this; - } - public APIRequestGetBanned requestAvatar2dProfilePictureField () { - return this.requestAvatar2dProfilePictureField(true); - } - public APIRequestGetBanned requestAvatar2dProfilePictureField (boolean value) { - this.requestField("avatar_2d_profile_picture", value); - return this; - } - public APIRequestGetBanned requestBirthdayField () { - return this.requestBirthdayField(true); - } - public APIRequestGetBanned requestBirthdayField (boolean value) { - this.requestField("birthday", value); - return this; - } - public APIRequestGetBanned requestCommunityField () { - return this.requestCommunityField(true); - } - public APIRequestGetBanned requestCommunityField (boolean value) { - this.requestField("community", value); - return this; - } - public APIRequestGetBanned requestCoverField () { - return this.requestCoverField(true); - } - public APIRequestGetBanned requestCoverField (boolean value) { - this.requestField("cover", value); - return this; - } - public APIRequestGetBanned requestCurrencyField () { - return this.requestCurrencyField(true); - } - public APIRequestGetBanned requestCurrencyField (boolean value) { - this.requestField("currency", value); - return this; - } - public APIRequestGetBanned requestEducationField () { - return this.requestEducationField(true); - } - public APIRequestGetBanned requestEducationField (boolean value) { - this.requestField("education", value); - return this; - } - public APIRequestGetBanned requestEmailField () { - return this.requestEmailField(true); - } - public APIRequestGetBanned requestEmailField (boolean value) { - this.requestField("email", value); - return this; - } - public APIRequestGetBanned requestFavoriteAthletesField () { - return this.requestFavoriteAthletesField(true); - } - public APIRequestGetBanned requestFavoriteAthletesField (boolean value) { - this.requestField("favorite_athletes", value); - return this; - } - public APIRequestGetBanned requestFavoriteTeamsField () { - return this.requestFavoriteTeamsField(true); - } - public APIRequestGetBanned requestFavoriteTeamsField (boolean value) { - this.requestField("favorite_teams", value); - return this; - } - public APIRequestGetBanned requestFirstNameField () { - return this.requestFirstNameField(true); - } - public APIRequestGetBanned requestFirstNameField (boolean value) { - this.requestField("first_name", value); - return this; - } - public APIRequestGetBanned requestGenderField () { - return this.requestGenderField(true); - } - public APIRequestGetBanned requestGenderField (boolean value) { - this.requestField("gender", value); - return this; - } - public APIRequestGetBanned requestHometownField () { - return this.requestHometownField(true); - } - public APIRequestGetBanned requestHometownField (boolean value) { - this.requestField("hometown", value); - return this; - } - public APIRequestGetBanned requestIdField () { - return this.requestIdField(true); - } - public APIRequestGetBanned requestIdField (boolean value) { - this.requestField("id", value); - return this; - } - public APIRequestGetBanned requestIdForAvatarsField () { - return this.requestIdForAvatarsField(true); - } - public APIRequestGetBanned requestIdForAvatarsField (boolean value) { - this.requestField("id_for_avatars", value); - return this; - } - public APIRequestGetBanned requestInspirationalPeopleField () { - return this.requestInspirationalPeopleField(true); - } - public APIRequestGetBanned requestInspirationalPeopleField (boolean value) { - this.requestField("inspirational_people", value); - return this; - } - public APIRequestGetBanned requestInstallTypeField () { - return this.requestInstallTypeField(true); - } - public APIRequestGetBanned requestInstallTypeField (boolean value) { - this.requestField("install_type", value); - return this; - } - public APIRequestGetBanned requestInstalledField () { - return this.requestInstalledField(true); - } - public APIRequestGetBanned requestInstalledField (boolean value) { - this.requestField("installed", value); - return this; - } - public APIRequestGetBanned requestIsGuestUserField () { - return this.requestIsGuestUserField(true); - } - public APIRequestGetBanned requestIsGuestUserField (boolean value) { - this.requestField("is_guest_user", value); - return this; - } - public APIRequestGetBanned requestIsWorkAccountField () { - return this.requestIsWorkAccountField(true); - } - public APIRequestGetBanned requestIsWorkAccountField (boolean value) { - this.requestField("is_work_account", value); - return this; - } - public APIRequestGetBanned requestLanguagesField () { - return this.requestLanguagesField(true); - } - public APIRequestGetBanned requestLanguagesField (boolean value) { - this.requestField("languages", value); - return this; - } - public APIRequestGetBanned requestLastNameField () { - return this.requestLastNameField(true); - } - public APIRequestGetBanned requestLastNameField (boolean value) { - this.requestField("last_name", value); - return this; - } - public APIRequestGetBanned requestLinkField () { - return this.requestLinkField(true); - } - public APIRequestGetBanned requestLinkField (boolean value) { - this.requestField("link", value); - return this; - } - public APIRequestGetBanned requestLocalNewsMegaphoneDismissStatusField () { - return this.requestLocalNewsMegaphoneDismissStatusField(true); - } - public APIRequestGetBanned requestLocalNewsMegaphoneDismissStatusField (boolean value) { - this.requestField("local_news_megaphone_dismiss_status", value); - return this; - } - public APIRequestGetBanned requestLocalNewsSubscriptionStatusField () { - return this.requestLocalNewsSubscriptionStatusField(true); - } - public APIRequestGetBanned requestLocalNewsSubscriptionStatusField (boolean value) { - this.requestField("local_news_subscription_status", value); - return this; - } - public APIRequestGetBanned requestLocaleField () { - return this.requestLocaleField(true); - } - public APIRequestGetBanned requestLocaleField (boolean value) { - this.requestField("locale", value); - return this; - } - public APIRequestGetBanned requestLocationField () { - return this.requestLocationField(true); - } - public APIRequestGetBanned requestLocationField (boolean value) { - this.requestField("location", value); - return this; - } - public APIRequestGetBanned requestMeetingForField () { - return this.requestMeetingForField(true); - } - public APIRequestGetBanned requestMeetingForField (boolean value) { - this.requestField("meeting_for", value); - return this; - } - public APIRequestGetBanned requestMiddleNameField () { - return this.requestMiddleNameField(true); - } - public APIRequestGetBanned requestMiddleNameField (boolean value) { - this.requestField("middle_name", value); - return this; - } - public APIRequestGetBanned requestNameField () { - return this.requestNameField(true); - } - public APIRequestGetBanned requestNameField (boolean value) { - this.requestField("name", value); - return this; - } - public APIRequestGetBanned requestNameFormatField () { - return this.requestNameFormatField(true); - } - public APIRequestGetBanned requestNameFormatField (boolean value) { - this.requestField("name_format", value); - return this; - } - public APIRequestGetBanned requestPaymentPricepointsField () { - return this.requestPaymentPricepointsField(true); - } - public APIRequestGetBanned requestPaymentPricepointsField (boolean value) { - this.requestField("payment_pricepoints", value); - return this; - } - public APIRequestGetBanned requestPoliticalField () { - return this.requestPoliticalField(true); - } - public APIRequestGetBanned requestPoliticalField (boolean value) { - this.requestField("political", value); - return this; - } - public APIRequestGetBanned requestProfilePicField () { - return this.requestProfilePicField(true); - } - public APIRequestGetBanned requestProfilePicField (boolean value) { - this.requestField("profile_pic", value); - return this; - } - public APIRequestGetBanned requestQuotesField () { - return this.requestQuotesField(true); - } - public APIRequestGetBanned requestQuotesField (boolean value) { - this.requestField("quotes", value); - return this; - } - public APIRequestGetBanned requestRelationshipStatusField () { - return this.requestRelationshipStatusField(true); - } - public APIRequestGetBanned requestRelationshipStatusField (boolean value) { - this.requestField("relationship_status", value); - return this; - } - public APIRequestGetBanned requestSharedLoginUpgradeRequiredByField () { - return this.requestSharedLoginUpgradeRequiredByField(true); - } - public APIRequestGetBanned requestSharedLoginUpgradeRequiredByField (boolean value) { - this.requestField("shared_login_upgrade_required_by", value); - return this; - } - public APIRequestGetBanned requestShortNameField () { - return this.requestShortNameField(true); - } - public APIRequestGetBanned requestShortNameField (boolean value) { - this.requestField("short_name", value); - return this; - } - public APIRequestGetBanned requestSignificantOtherField () { - return this.requestSignificantOtherField(true); - } - public APIRequestGetBanned requestSignificantOtherField (boolean value) { - this.requestField("significant_other", value); - return this; - } - public APIRequestGetBanned requestSportsField () { - return this.requestSportsField(true); - } - public APIRequestGetBanned requestSportsField (boolean value) { - this.requestField("sports", value); - return this; - } - public APIRequestGetBanned requestSupportsDonateButtonInLiveVideoField () { - return this.requestSupportsDonateButtonInLiveVideoField(true); - } - public APIRequestGetBanned requestSupportsDonateButtonInLiveVideoField (boolean value) { - this.requestField("supports_donate_button_in_live_video", value); - return this; - } - public APIRequestGetBanned requestThirdPartyIdField () { - return this.requestThirdPartyIdField(true); - } - public APIRequestGetBanned requestThirdPartyIdField (boolean value) { - this.requestField("third_party_id", value); - return this; - } - public APIRequestGetBanned requestTimezoneField () { - return this.requestTimezoneField(true); - } - public APIRequestGetBanned requestTimezoneField (boolean value) { - this.requestField("timezone", value); - return this; - } - public APIRequestGetBanned requestTokenForBusinessField () { - return this.requestTokenForBusinessField(true); - } - public APIRequestGetBanned requestTokenForBusinessField (boolean value) { - this.requestField("token_for_business", value); - return this; - } - public APIRequestGetBanned requestUpdatedTimeField () { - return this.requestUpdatedTimeField(true); - } - public APIRequestGetBanned requestUpdatedTimeField (boolean value) { - this.requestField("updated_time", value); - return this; - } - public APIRequestGetBanned requestVerifiedField () { - return this.requestVerifiedField(true); - } - public APIRequestGetBanned requestVerifiedField (boolean value) { - this.requestField("verified", value); - return this; - } - public APIRequestGetBanned requestVideoUploadLimitsField () { - return this.requestVideoUploadLimitsField(true); - } - public APIRequestGetBanned requestVideoUploadLimitsField (boolean value) { - this.requestField("video_upload_limits", value); - return this; - } - public APIRequestGetBanned requestWebsiteField () { - return this.requestWebsiteField(true); - } - public APIRequestGetBanned requestWebsiteField (boolean value) { - this.requestField("website", value); - return this; - } - } - public static class APIRequestGetButtonAutoDetectionDeviceSelection extends APIRequest { APINodeList lastResponse = null; @@ -10223,6 +9713,8 @@ public Application getLastResponse() { "auto_event_mapping_android", "auto_event_mapping_ios", "auto_event_setup_enabled", + "auto_log_app_events_default", + "auto_log_app_events_enabled", "business", "canvas_fluid_height", "canvas_fluid_width", @@ -10280,8 +9772,6 @@ public Application getLastResponse() { "restrictions", "restrictive_data_filter_params", "restrictive_data_filter_rules", - "sdk_auto_logging_default_value", - "sdk_auto_logging_override_value", "sdk_update_message", "seamless_login", "secure_canvas_url", @@ -10574,6 +10064,20 @@ public APIRequestGet requestAutoEventSetupEnabledField (boolean value) { this.requestField("auto_event_setup_enabled", value); return this; } + public APIRequestGet requestAutoLogAppEventsDefaultField () { + return this.requestAutoLogAppEventsDefaultField(true); + } + public APIRequestGet requestAutoLogAppEventsDefaultField (boolean value) { + this.requestField("auto_log_app_events_default", value); + return this; + } + public APIRequestGet requestAutoLogAppEventsEnabledField () { + return this.requestAutoLogAppEventsEnabledField(true); + } + public APIRequestGet requestAutoLogAppEventsEnabledField (boolean value) { + this.requestField("auto_log_app_events_enabled", value); + return this; + } public APIRequestGet requestBusinessField () { return this.requestBusinessField(true); } @@ -10973,20 +10477,6 @@ public APIRequestGet requestRestrictiveDataFilterRulesField (boolean value) { this.requestField("restrictive_data_filter_rules", value); return this; } - public APIRequestGet requestSdkAutoLoggingDefaultValueField () { - return this.requestSdkAutoLoggingDefaultValueField(true); - } - public APIRequestGet requestSdkAutoLoggingDefaultValueField (boolean value) { - this.requestField("sdk_auto_logging_default_value", value); - return this; - } - public APIRequestGet requestSdkAutoLoggingOverrideValueField () { - return this.requestSdkAutoLoggingOverrideValueField(true); - } - public APIRequestGet requestSdkAutoLoggingOverrideValueField (boolean value) { - this.requestField("sdk_auto_logging_override_value", value); - return this; - } public APIRequestGet requestSdkUpdateMessageField () { return this.requestSdkUpdateMessageField(true); } @@ -11797,6 +11287,8 @@ public Application copyFrom(Application instance) { this.mAutoEventMappingAndroid = instance.mAutoEventMappingAndroid; this.mAutoEventMappingIos = instance.mAutoEventMappingIos; this.mAutoEventSetupEnabled = instance.mAutoEventSetupEnabled; + this.mAutoLogAppEventsDefault = instance.mAutoLogAppEventsDefault; + this.mAutoLogAppEventsEnabled = instance.mAutoLogAppEventsEnabled; this.mBusiness = instance.mBusiness; this.mCanvasFluidHeight = instance.mCanvasFluidHeight; this.mCanvasFluidWidth = instance.mCanvasFluidWidth; @@ -11854,8 +11346,6 @@ public Application copyFrom(Application instance) { this.mRestrictions = instance.mRestrictions; this.mRestrictiveDataFilterParams = instance.mRestrictiveDataFilterParams; this.mRestrictiveDataFilterRules = instance.mRestrictiveDataFilterRules; - this.mSdkAutoLoggingDefaultValue = instance.mSdkAutoLoggingDefaultValue; - this.mSdkAutoLoggingOverrideValue = instance.mSdkAutoLoggingOverrideValue; this.mSdkUpdateMessage = instance.mSdkUpdateMessage; this.mSeamlessLogin = instance.mSeamlessLogin; this.mSecureCanvasUrl = instance.mSecureCanvasUrl; diff --git a/src/main/java/com/facebook/ads/sdk/Business.java b/src/main/java/com/facebook/ads/sdk/Business.java index dd967de2..040a9f74 100644 --- a/src/main/java/com/facebook/ads/sdk/Business.java +++ b/src/main/java/com/facebook/ads/sdk/Business.java @@ -5571,6 +5571,8 @@ public APINodeList getLastResponse() { "auto_event_mapping_android", "auto_event_mapping_ios", "auto_event_setup_enabled", + "auto_log_app_events_default", + "auto_log_app_events_enabled", "business", "canvas_fluid_height", "canvas_fluid_width", @@ -5628,8 +5630,6 @@ public APINodeList getLastResponse() { "restrictions", "restrictive_data_filter_params", "restrictive_data_filter_rules", - "sdk_auto_logging_default_value", - "sdk_auto_logging_override_value", "sdk_update_message", "seamless_login", "secure_canvas_url", @@ -5917,6 +5917,20 @@ public APIRequestGetClientApps requestAutoEventSetupEnabledField (boolean value) this.requestField("auto_event_setup_enabled", value); return this; } + public APIRequestGetClientApps requestAutoLogAppEventsDefaultField () { + return this.requestAutoLogAppEventsDefaultField(true); + } + public APIRequestGetClientApps requestAutoLogAppEventsDefaultField (boolean value) { + this.requestField("auto_log_app_events_default", value); + return this; + } + public APIRequestGetClientApps requestAutoLogAppEventsEnabledField () { + return this.requestAutoLogAppEventsEnabledField(true); + } + public APIRequestGetClientApps requestAutoLogAppEventsEnabledField (boolean value) { + this.requestField("auto_log_app_events_enabled", value); + return this; + } public APIRequestGetClientApps requestBusinessField () { return this.requestBusinessField(true); } @@ -6316,20 +6330,6 @@ public APIRequestGetClientApps requestRestrictiveDataFilterRulesField (boolean v this.requestField("restrictive_data_filter_rules", value); return this; } - public APIRequestGetClientApps requestSdkAutoLoggingDefaultValueField () { - return this.requestSdkAutoLoggingDefaultValueField(true); - } - public APIRequestGetClientApps requestSdkAutoLoggingDefaultValueField (boolean value) { - this.requestField("sdk_auto_logging_default_value", value); - return this; - } - public APIRequestGetClientApps requestSdkAutoLoggingOverrideValueField () { - return this.requestSdkAutoLoggingOverrideValueField(true); - } - public APIRequestGetClientApps requestSdkAutoLoggingOverrideValueField (boolean value) { - this.requestField("sdk_auto_logging_override_value", value); - return this; - } public APIRequestGetClientApps requestSdkUpdateMessageField () { return this.requestSdkUpdateMessageField(true); } @@ -15409,6 +15409,8 @@ public APINodeList getLastResponse() { "auto_event_mapping_android", "auto_event_mapping_ios", "auto_event_setup_enabled", + "auto_log_app_events_default", + "auto_log_app_events_enabled", "business", "canvas_fluid_height", "canvas_fluid_width", @@ -15466,8 +15468,6 @@ public APINodeList getLastResponse() { "restrictions", "restrictive_data_filter_params", "restrictive_data_filter_rules", - "sdk_auto_logging_default_value", - "sdk_auto_logging_override_value", "sdk_update_message", "seamless_login", "secure_canvas_url", @@ -15755,6 +15755,20 @@ public APIRequestGetOwnedApps requestAutoEventSetupEnabledField (boolean value) this.requestField("auto_event_setup_enabled", value); return this; } + public APIRequestGetOwnedApps requestAutoLogAppEventsDefaultField () { + return this.requestAutoLogAppEventsDefaultField(true); + } + public APIRequestGetOwnedApps requestAutoLogAppEventsDefaultField (boolean value) { + this.requestField("auto_log_app_events_default", value); + return this; + } + public APIRequestGetOwnedApps requestAutoLogAppEventsEnabledField () { + return this.requestAutoLogAppEventsEnabledField(true); + } + public APIRequestGetOwnedApps requestAutoLogAppEventsEnabledField (boolean value) { + this.requestField("auto_log_app_events_enabled", value); + return this; + } public APIRequestGetOwnedApps requestBusinessField () { return this.requestBusinessField(true); } @@ -16154,20 +16168,6 @@ public APIRequestGetOwnedApps requestRestrictiveDataFilterRulesField (boolean va this.requestField("restrictive_data_filter_rules", value); return this; } - public APIRequestGetOwnedApps requestSdkAutoLoggingDefaultValueField () { - return this.requestSdkAutoLoggingDefaultValueField(true); - } - public APIRequestGetOwnedApps requestSdkAutoLoggingDefaultValueField (boolean value) { - this.requestField("sdk_auto_logging_default_value", value); - return this; - } - public APIRequestGetOwnedApps requestSdkAutoLoggingOverrideValueField () { - return this.requestSdkAutoLoggingOverrideValueField(true); - } - public APIRequestGetOwnedApps requestSdkAutoLoggingOverrideValueField (boolean value) { - this.requestField("sdk_auto_logging_override_value", value); - return this; - } public APIRequestGetOwnedApps requestSdkUpdateMessageField () { return this.requestSdkUpdateMessageField(true); } diff --git a/src/main/java/com/facebook/ads/sdk/BusinessAssetGroup.java b/src/main/java/com/facebook/ads/sdk/BusinessAssetGroup.java index 90e5b8a4..a1aecf33 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessAssetGroup.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessAssetGroup.java @@ -1821,6 +1821,8 @@ public APINodeList getLastResponse() { "auto_event_mapping_android", "auto_event_mapping_ios", "auto_event_setup_enabled", + "auto_log_app_events_default", + "auto_log_app_events_enabled", "business", "canvas_fluid_height", "canvas_fluid_width", @@ -1878,8 +1880,6 @@ public APINodeList getLastResponse() { "restrictions", "restrictive_data_filter_params", "restrictive_data_filter_rules", - "sdk_auto_logging_default_value", - "sdk_auto_logging_override_value", "sdk_update_message", "seamless_login", "secure_canvas_url", @@ -2167,6 +2167,20 @@ public APIRequestGetContainedApplications requestAutoEventSetupEnabledField (boo this.requestField("auto_event_setup_enabled", value); return this; } + public APIRequestGetContainedApplications requestAutoLogAppEventsDefaultField () { + return this.requestAutoLogAppEventsDefaultField(true); + } + public APIRequestGetContainedApplications requestAutoLogAppEventsDefaultField (boolean value) { + this.requestField("auto_log_app_events_default", value); + return this; + } + public APIRequestGetContainedApplications requestAutoLogAppEventsEnabledField () { + return this.requestAutoLogAppEventsEnabledField(true); + } + public APIRequestGetContainedApplications requestAutoLogAppEventsEnabledField (boolean value) { + this.requestField("auto_log_app_events_enabled", value); + return this; + } public APIRequestGetContainedApplications requestBusinessField () { return this.requestBusinessField(true); } @@ -2566,20 +2580,6 @@ public APIRequestGetContainedApplications requestRestrictiveDataFilterRulesField this.requestField("restrictive_data_filter_rules", value); return this; } - public APIRequestGetContainedApplications requestSdkAutoLoggingDefaultValueField () { - return this.requestSdkAutoLoggingDefaultValueField(true); - } - public APIRequestGetContainedApplications requestSdkAutoLoggingDefaultValueField (boolean value) { - this.requestField("sdk_auto_logging_default_value", value); - return this; - } - public APIRequestGetContainedApplications requestSdkAutoLoggingOverrideValueField () { - return this.requestSdkAutoLoggingOverrideValueField(true); - } - public APIRequestGetContainedApplications requestSdkAutoLoggingOverrideValueField (boolean value) { - this.requestField("sdk_auto_logging_override_value", value); - return this; - } public APIRequestGetContainedApplications requestSdkUpdateMessageField () { return this.requestSdkUpdateMessageField(true); } diff --git a/src/main/java/com/facebook/ads/sdk/BusinessUser.java b/src/main/java/com/facebook/ads/sdk/BusinessUser.java index 7c0584c2..b40aaeb4 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessUser.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessUser.java @@ -3056,6 +3056,7 @@ public BusinessUser getLastResponse() { "last_name", "pending_email", "role", + "skip_verification_email", "title", }; @@ -3153,6 +3154,15 @@ public APIRequestUpdate setRole (String role) { return this; } + public APIRequestUpdate setSkipVerificationEmail (Boolean skipVerificationEmail) { + this.setParam("skip_verification_email", skipVerificationEmail); + return this; + } + public APIRequestUpdate setSkipVerificationEmail (String skipVerificationEmail) { + this.setParam("skip_verification_email", skipVerificationEmail); + return this; + } + public APIRequestUpdate setTitle (String title) { this.setParam("title", title); return this; diff --git a/src/main/java/com/facebook/ads/sdk/CommerceMerchantSettings.java b/src/main/java/com/facebook/ads/sdk/CommerceMerchantSettings.java index f4ff920d..deb9269f 100644 --- a/src/main/java/com/facebook/ads/sdk/CommerceMerchantSettings.java +++ b/src/main/java/com/facebook/ads/sdk/CommerceMerchantSettings.java @@ -1335,6 +1335,8 @@ public APINodeList getLastResponse() { "auto_event_mapping_android", "auto_event_mapping_ios", "auto_event_setup_enabled", + "auto_log_app_events_default", + "auto_log_app_events_enabled", "business", "canvas_fluid_height", "canvas_fluid_width", @@ -1392,8 +1394,6 @@ public APINodeList getLastResponse() { "restrictions", "restrictive_data_filter_params", "restrictive_data_filter_rules", - "sdk_auto_logging_default_value", - "sdk_auto_logging_override_value", "sdk_update_message", "seamless_login", "secure_canvas_url", @@ -1681,6 +1681,20 @@ public APIRequestGetOrderManagementApps requestAutoEventSetupEnabledField (boole this.requestField("auto_event_setup_enabled", value); return this; } + public APIRequestGetOrderManagementApps requestAutoLogAppEventsDefaultField () { + return this.requestAutoLogAppEventsDefaultField(true); + } + public APIRequestGetOrderManagementApps requestAutoLogAppEventsDefaultField (boolean value) { + this.requestField("auto_log_app_events_default", value); + return this; + } + public APIRequestGetOrderManagementApps requestAutoLogAppEventsEnabledField () { + return this.requestAutoLogAppEventsEnabledField(true); + } + public APIRequestGetOrderManagementApps requestAutoLogAppEventsEnabledField (boolean value) { + this.requestField("auto_log_app_events_enabled", value); + return this; + } public APIRequestGetOrderManagementApps requestBusinessField () { return this.requestBusinessField(true); } @@ -2080,20 +2094,6 @@ public APIRequestGetOrderManagementApps requestRestrictiveDataFilterRulesField ( this.requestField("restrictive_data_filter_rules", value); return this; } - public APIRequestGetOrderManagementApps requestSdkAutoLoggingDefaultValueField () { - return this.requestSdkAutoLoggingDefaultValueField(true); - } - public APIRequestGetOrderManagementApps requestSdkAutoLoggingDefaultValueField (boolean value) { - this.requestField("sdk_auto_logging_default_value", value); - return this; - } - public APIRequestGetOrderManagementApps requestSdkAutoLoggingOverrideValueField () { - return this.requestSdkAutoLoggingOverrideValueField(true); - } - public APIRequestGetOrderManagementApps requestSdkAutoLoggingOverrideValueField (boolean value) { - this.requestField("sdk_auto_logging_override_value", value); - return this; - } public APIRequestGetOrderManagementApps requestSdkUpdateMessageField () { return this.requestSdkUpdateMessageField(true); } diff --git a/src/main/java/com/facebook/ads/sdk/MessengerProfile.java b/src/main/java/com/facebook/ads/sdk/MessengerProfile.java index 7590b5ba..60f7f740 100644 --- a/src/main/java/com/facebook/ads/sdk/MessengerProfile.java +++ b/src/main/java/com/facebook/ads/sdk/MessengerProfile.java @@ -42,6 +42,8 @@ public class MessengerProfile extends APINode { @SerializedName("account_linking_url") private String mAccountLinkingUrl = null; + @SerializedName("commands") + private List mCommands = null; @SerializedName("get_started") private Object mGetStarted = null; @SerializedName("greeting") @@ -218,6 +220,15 @@ public MessengerProfile setFieldAccountLinkingUrl(String value) { return this; } + public List getFieldCommands() { + return mCommands; + } + + public MessengerProfile setFieldCommands(List value) { + this.mCommands = value; + return this; + } + public Object getFieldGetStarted() { return mGetStarted; } @@ -308,6 +319,7 @@ public MessengerProfile setFieldWhitelistedDomains(List value) { public MessengerProfile copyFrom(MessengerProfile instance) { this.mAccountLinkingUrl = instance.mAccountLinkingUrl; + this.mCommands = instance.mCommands; this.mGetStarted = instance.mGetStarted; this.mGreeting = instance.mGreeting; this.mIceBreakers = instance.mIceBreakers; diff --git a/src/main/java/com/facebook/ads/sdk/Page.java b/src/main/java/com/facebook/ads/sdk/Page.java index 1ff9a839..1ea97938 100644 --- a/src/main/java/com/facebook/ads/sdk/Page.java +++ b/src/main/java/com/facebook/ads/sdk/Page.java @@ -1699,7 +1699,6 @@ public APINodeList getLastResponse() { "insight_snapshots", "name", "optimization_goal", - "post_variant_fields", "publish_status", "publish_time", "scheduled_experiment_timestamp", @@ -1879,13 +1878,6 @@ public APIRequestGetAbTests requestOptimizationGoalField (boolean value) { this.requestField("optimization_goal", value); return this; } - public APIRequestGetAbTests requestPostVariantFieldsField () { - return this.requestPostVariantFieldsField(true); - } - public APIRequestGetAbTests requestPostVariantFieldsField (boolean value) { - this.requestField("post_variant_fields", value); - return this; - } public APIRequestGetAbTests requestPublishStatusField () { return this.requestPublishStatusField(true); } @@ -20491,6 +20483,7 @@ public APINodeList getLastResponse() { public static final String[] FIELDS = { "account_linking_url", + "commands", "get_started", "greeting", "ice_breakers", @@ -20606,6 +20599,13 @@ public APIRequestGetMessengerProfile requestAccountLinkingUrlField (boolean valu this.requestField("account_linking_url", value); return this; } + public APIRequestGetMessengerProfile requestCommandsField () { + return this.requestCommandsField(true); + } + public APIRequestGetMessengerProfile requestCommandsField (boolean value) { + this.requestField("commands", value); + return this; + } public APIRequestGetMessengerProfile requestGetStartedField () { return this.requestGetStartedField(true); } @@ -26959,6 +26959,8 @@ public APINodeList getLastResponse() { "auto_event_mapping_android", "auto_event_mapping_ios", "auto_event_setup_enabled", + "auto_log_app_events_default", + "auto_log_app_events_enabled", "business", "canvas_fluid_height", "canvas_fluid_width", @@ -27016,8 +27018,6 @@ public APINodeList getLastResponse() { "restrictions", "restrictive_data_filter_params", "restrictive_data_filter_rules", - "sdk_auto_logging_default_value", - "sdk_auto_logging_override_value", "sdk_update_message", "seamless_login", "secure_canvas_url", @@ -27314,6 +27314,20 @@ public APIRequestGetSecondaryReceivers requestAutoEventSetupEnabledField (boolea this.requestField("auto_event_setup_enabled", value); return this; } + public APIRequestGetSecondaryReceivers requestAutoLogAppEventsDefaultField () { + return this.requestAutoLogAppEventsDefaultField(true); + } + public APIRequestGetSecondaryReceivers requestAutoLogAppEventsDefaultField (boolean value) { + this.requestField("auto_log_app_events_default", value); + return this; + } + public APIRequestGetSecondaryReceivers requestAutoLogAppEventsEnabledField () { + return this.requestAutoLogAppEventsEnabledField(true); + } + public APIRequestGetSecondaryReceivers requestAutoLogAppEventsEnabledField (boolean value) { + this.requestField("auto_log_app_events_enabled", value); + return this; + } public APIRequestGetSecondaryReceivers requestBusinessField () { return this.requestBusinessField(true); } @@ -27713,20 +27727,6 @@ public APIRequestGetSecondaryReceivers requestRestrictiveDataFilterRulesField (b this.requestField("restrictive_data_filter_rules", value); return this; } - public APIRequestGetSecondaryReceivers requestSdkAutoLoggingDefaultValueField () { - return this.requestSdkAutoLoggingDefaultValueField(true); - } - public APIRequestGetSecondaryReceivers requestSdkAutoLoggingDefaultValueField (boolean value) { - this.requestField("sdk_auto_logging_default_value", value); - return this; - } - public APIRequestGetSecondaryReceivers requestSdkAutoLoggingOverrideValueField () { - return this.requestSdkAutoLoggingOverrideValueField(true); - } - public APIRequestGetSecondaryReceivers requestSdkAutoLoggingOverrideValueField (boolean value) { - this.requestField("sdk_auto_logging_override_value", value); - return this; - } public APIRequestGetSecondaryReceivers requestSdkUpdateMessageField () { return this.requestSdkUpdateMessageField(true); } @@ -28576,6 +28576,8 @@ public APINodeList getLastResponse() { "auto_event_mapping_android", "auto_event_mapping_ios", "auto_event_setup_enabled", + "auto_log_app_events_default", + "auto_log_app_events_enabled", "business", "canvas_fluid_height", "canvas_fluid_width", @@ -28633,8 +28635,6 @@ public APINodeList getLastResponse() { "restrictions", "restrictive_data_filter_params", "restrictive_data_filter_rules", - "sdk_auto_logging_default_value", - "sdk_auto_logging_override_value", "sdk_update_message", "seamless_login", "secure_canvas_url", @@ -28922,6 +28922,20 @@ public APIRequestGetSubscribedApps requestAutoEventSetupEnabledField (boolean va this.requestField("auto_event_setup_enabled", value); return this; } + public APIRequestGetSubscribedApps requestAutoLogAppEventsDefaultField () { + return this.requestAutoLogAppEventsDefaultField(true); + } + public APIRequestGetSubscribedApps requestAutoLogAppEventsDefaultField (boolean value) { + this.requestField("auto_log_app_events_default", value); + return this; + } + public APIRequestGetSubscribedApps requestAutoLogAppEventsEnabledField () { + return this.requestAutoLogAppEventsEnabledField(true); + } + public APIRequestGetSubscribedApps requestAutoLogAppEventsEnabledField (boolean value) { + this.requestField("auto_log_app_events_enabled", value); + return this; + } public APIRequestGetSubscribedApps requestBusinessField () { return this.requestBusinessField(true); } @@ -29321,20 +29335,6 @@ public APIRequestGetSubscribedApps requestRestrictiveDataFilterRulesField (boole this.requestField("restrictive_data_filter_rules", value); return this; } - public APIRequestGetSubscribedApps requestSdkAutoLoggingDefaultValueField () { - return this.requestSdkAutoLoggingDefaultValueField(true); - } - public APIRequestGetSubscribedApps requestSdkAutoLoggingDefaultValueField (boolean value) { - this.requestField("sdk_auto_logging_default_value", value); - return this; - } - public APIRequestGetSubscribedApps requestSdkAutoLoggingOverrideValueField () { - return this.requestSdkAutoLoggingOverrideValueField(true); - } - public APIRequestGetSubscribedApps requestSdkAutoLoggingOverrideValueField (boolean value) { - this.requestField("sdk_auto_logging_override_value", value); - return this; - } public APIRequestGetSubscribedApps requestSdkUpdateMessageField () { return this.requestSdkUpdateMessageField(true); } diff --git a/src/main/java/com/facebook/ads/sdk/PagePostExperiment.java b/src/main/java/com/facebook/ads/sdk/PagePostExperiment.java index b5cce3f0..434410d7 100644 --- a/src/main/java/com/facebook/ads/sdk/PagePostExperiment.java +++ b/src/main/java/com/facebook/ads/sdk/PagePostExperiment.java @@ -64,8 +64,6 @@ public class PagePostExperiment extends APINode { private String mName = null; @SerializedName("optimization_goal") private String mOptimizationGoal = null; - @SerializedName("post_variant_fields") - private List mPostVariantFields = null; @SerializedName("publish_status") private String mPublishStatus = null; @SerializedName("publish_time") @@ -347,10 +345,6 @@ public String getFieldOptimizationGoal() { return mOptimizationGoal; } - public List getFieldPostVariantFields() { - return mPostVariantFields; - } - public String getFieldPublishStatus() { return mPublishStatus; } @@ -600,7 +594,6 @@ public PagePostExperiment getLastResponse() { "insight_snapshots", "name", "optimization_goal", - "post_variant_fields", "publish_status", "publish_time", "scheduled_experiment_timestamp", @@ -780,13 +773,6 @@ public APIRequestGet requestOptimizationGoalField (boolean value) { this.requestField("optimization_goal", value); return this; } - public APIRequestGet requestPostVariantFieldsField () { - return this.requestPostVariantFieldsField(true); - } - public APIRequestGet requestPostVariantFieldsField (boolean value) { - this.requestField("post_variant_fields", value); - return this; - } public APIRequestGet requestPublishStatusField () { return this.requestPublishStatusField(true); } @@ -881,7 +867,6 @@ public PagePostExperiment copyFrom(PagePostExperiment instance) { this.mInsightSnapshots = instance.mInsightSnapshots; this.mName = instance.mName; this.mOptimizationGoal = instance.mOptimizationGoal; - this.mPostVariantFields = instance.mPostVariantFields; this.mPublishStatus = instance.mPublishStatus; this.mPublishTime = instance.mPublishTime; this.mScheduledExperimentTimestamp = instance.mScheduledExperimentTimestamp; diff --git a/src/main/java/com/facebook/ads/sdk/ProductCatalog.java b/src/main/java/com/facebook/ads/sdk/ProductCatalog.java index d45a2890..c88897cd 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductCatalog.java +++ b/src/main/java/com/facebook/ads/sdk/ProductCatalog.java @@ -8096,6 +8096,7 @@ public APINodeList getLastResponse() { "short_description", "size", "start_date", + "tags", "url", "video_fetch_status", "visibility", @@ -8726,6 +8727,13 @@ public APIRequestGetProducts requestStartDateField (boolean value) { this.requestField("start_date", value); return this; } + public APIRequestGetProducts requestTagsField () { + return this.requestTagsField(true); + } + public APIRequestGetProducts requestTagsField (boolean value) { + this.requestField("tags", value); + return this; + } public APIRequestGetProducts requestUrlField () { return this.requestUrlField(true); } diff --git a/src/main/java/com/facebook/ads/sdk/ProductFeed.java b/src/main/java/com/facebook/ads/sdk/ProductFeed.java index 4a18c6b3..c217b6a6 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductFeed.java +++ b/src/main/java/com/facebook/ads/sdk/ProductFeed.java @@ -2534,6 +2534,7 @@ public APINodeList getLastResponse() { "short_description", "size", "start_date", + "tags", "url", "video_fetch_status", "visibility", @@ -3155,6 +3156,13 @@ public APIRequestGetProducts requestStartDateField (boolean value) { this.requestField("start_date", value); return this; } + public APIRequestGetProducts requestTagsField () { + return this.requestTagsField(true); + } + public APIRequestGetProducts requestTagsField (boolean value) { + this.requestField("tags", value); + return this; + } public APIRequestGetProducts requestUrlField () { return this.requestUrlField(true); } diff --git a/src/main/java/com/facebook/ads/sdk/ProductGroup.java b/src/main/java/com/facebook/ads/sdk/ProductGroup.java index b44c8f92..5d9695e4 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductGroup.java +++ b/src/main/java/com/facebook/ads/sdk/ProductGroup.java @@ -380,6 +380,7 @@ public APINodeList getLastResponse() { "short_description", "size", "start_date", + "tags", "url", "video_fetch_status", "visibility", @@ -965,6 +966,13 @@ public APIRequestGetProducts requestStartDateField (boolean value) { this.requestField("start_date", value); return this; } + public APIRequestGetProducts requestTagsField () { + return this.requestTagsField(true); + } + public APIRequestGetProducts requestTagsField (boolean value) { + this.requestField("tags", value); + return this; + } public APIRequestGetProducts requestUrlField () { return this.requestUrlField(true); } diff --git a/src/main/java/com/facebook/ads/sdk/ProductItem.java b/src/main/java/com/facebook/ads/sdk/ProductItem.java index 44900401..3e3182d3 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductItem.java +++ b/src/main/java/com/facebook/ads/sdk/ProductItem.java @@ -180,6 +180,8 @@ public class ProductItem extends APINode { private String mSize = null; @SerializedName("start_date") private String mStartDate = null; + @SerializedName("tags") + private List mTags = null; @SerializedName("url") private String mUrl = null; @SerializedName("video_fetch_status") @@ -714,6 +716,10 @@ public String getFieldStartDate() { return mStartDate; } + public List getFieldTags() { + return mTags; + } + public String getFieldUrl() { return mUrl; } @@ -1362,6 +1368,7 @@ public ProductItem getLastResponse() { "short_description", "size", "start_date", + "tags", "url", "video_fetch_status", "visibility", @@ -1980,6 +1987,13 @@ public APIRequestGet requestStartDateField (boolean value) { this.requestField("start_date", value); return this; } + public APIRequestGet requestTagsField () { + return this.requestTagsField(true); + } + public APIRequestGet requestTagsField (boolean value) { + this.requestField("tags", value); + return this; + } public APIRequestGet requestUrlField () { return this.requestUrlField(true); } @@ -3366,6 +3380,8 @@ public static enum EnumErrorType { VALUE_BAD_QUALITY_IMAGE("BAD_QUALITY_IMAGE"), @SerializedName("CANNOT_EDIT_SUBSCRIPTION_PRODUCTS") VALUE_CANNOT_EDIT_SUBSCRIPTION_PRODUCTS("CANNOT_EDIT_SUBSCRIPTION_PRODUCTS"), + @SerializedName("CHECKOUT_DISABLED_BY_USER") + VALUE_CHECKOUT_DISABLED_BY_USER("CHECKOUT_DISABLED_BY_USER"), @SerializedName("COMMERCE_ACCOUNT_NOT_LEGALLY_COMPLIANT") VALUE_COMMERCE_ACCOUNT_NOT_LEGALLY_COMPLIANT("COMMERCE_ACCOUNT_NOT_LEGALLY_COMPLIANT"), @SerializedName("CRAWLED_AVAILABILITY_MISMATCH") @@ -3444,6 +3460,8 @@ public static enum EnumErrorType { VALUE_ITEM_OVERRIDE_NOT_VISIBLE("ITEM_OVERRIDE_NOT_VISIBLE"), @SerializedName("ITEM_STALE_OUT_OF_STOCK") VALUE_ITEM_STALE_OUT_OF_STOCK("ITEM_STALE_OUT_OF_STOCK"), + @SerializedName("MARKETPLACE_DISABLED_BY_USER") + VALUE_MARKETPLACE_DISABLED_BY_USER("MARKETPLACE_DISABLED_BY_USER"), @SerializedName("MINI_SHOPS_DISABLED_BY_USER") VALUE_MINI_SHOPS_DISABLED_BY_USER("MINI_SHOPS_DISABLED_BY_USER"), @SerializedName("MISSING_CHECKOUT") @@ -4208,6 +4226,7 @@ public ProductItem copyFrom(ProductItem instance) { this.mShortDescription = instance.mShortDescription; this.mSize = instance.mSize; this.mStartDate = instance.mStartDate; + this.mTags = instance.mTags; this.mUrl = instance.mUrl; this.mVideoFetchStatus = instance.mVideoFetchStatus; this.mVisibility = instance.mVisibility; diff --git a/src/main/java/com/facebook/ads/sdk/ProductSet.java b/src/main/java/com/facebook/ads/sdk/ProductSet.java index 5236bd29..c8167f3b 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductSet.java +++ b/src/main/java/com/facebook/ads/sdk/ProductSet.java @@ -2440,6 +2440,7 @@ public APINodeList getLastResponse() { "short_description", "size", "start_date", + "tags", "url", "video_fetch_status", "visibility", @@ -3061,6 +3062,13 @@ public APIRequestGetProducts requestStartDateField (boolean value) { this.requestField("start_date", value); return this; } + public APIRequestGetProducts requestTagsField () { + return this.requestTagsField(true); + } + public APIRequestGetProducts requestTagsField (boolean value) { + this.requestField("tags", value); + return this; + } public APIRequestGetProducts requestUrlField () { return this.requestUrlField(true); } diff --git a/src/main/java/com/facebook/ads/sdk/User.java b/src/main/java/com/facebook/ads/sdk/User.java index 8232657b..00af6e30 100644 --- a/src/main/java/com/facebook/ads/sdk/User.java +++ b/src/main/java/com/facebook/ads/sdk/User.java @@ -439,6 +439,10 @@ public APIRequestGetEvents getEvents() { return new APIRequestGetEvents(this.getPrefixedId().toString(), context); } + public APIRequestGetFbdlRuns getFbdlRuns() { + return new APIRequestGetFbdlRuns(this.getPrefixedId().toString(), context); + } + public APIRequestGetFeed getFeed() { return new APIRequestGetFeed(this.getPrefixedId().toString(), context); } @@ -8437,6 +8441,174 @@ public APIRequestGetEvents requestUpdatedTimeField (boolean value) { } } + public static class APIRequestGetFbdlRuns extends APIRequest { + + APINodeList lastResponse = null; + @Override + public APINodeList getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + }; + + public static final String[] FIELDS = { + "creation_time", + "id", + "is_pinned", + "note", + "result", + "run_code", + "status", + "user_type", + }; + + @Override + public APINodeList parseResponse(String response, String header) throws APIException { + return WhitehatFBDLRun.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 APIRequestGetFbdlRuns.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + ); + }; + + public APIRequestGetFbdlRuns(String nodeId, APIContext context) { + super(context, nodeId, "/fbdl_runs", "GET", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestGetFbdlRuns setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestGetFbdlRuns setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestGetFbdlRuns requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestGetFbdlRuns requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetFbdlRuns requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestGetFbdlRuns requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetFbdlRuns requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestGetFbdlRuns requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + public APIRequestGetFbdlRuns requestCreationTimeField () { + return this.requestCreationTimeField(true); + } + public APIRequestGetFbdlRuns requestCreationTimeField (boolean value) { + this.requestField("creation_time", value); + return this; + } + public APIRequestGetFbdlRuns requestIdField () { + return this.requestIdField(true); + } + public APIRequestGetFbdlRuns requestIdField (boolean value) { + this.requestField("id", value); + return this; + } + public APIRequestGetFbdlRuns requestIsPinnedField () { + return this.requestIsPinnedField(true); + } + public APIRequestGetFbdlRuns requestIsPinnedField (boolean value) { + this.requestField("is_pinned", value); + return this; + } + public APIRequestGetFbdlRuns requestNoteField () { + return this.requestNoteField(true); + } + public APIRequestGetFbdlRuns requestNoteField (boolean value) { + this.requestField("note", value); + return this; + } + public APIRequestGetFbdlRuns requestResultField () { + return this.requestResultField(true); + } + public APIRequestGetFbdlRuns requestResultField (boolean value) { + this.requestField("result", value); + return this; + } + public APIRequestGetFbdlRuns requestRunCodeField () { + return this.requestRunCodeField(true); + } + public APIRequestGetFbdlRuns requestRunCodeField (boolean value) { + this.requestField("run_code", value); + return this; + } + public APIRequestGetFbdlRuns requestStatusField () { + return this.requestStatusField(true); + } + public APIRequestGetFbdlRuns requestStatusField (boolean value) { + this.requestField("status", value); + return this; + } + public APIRequestGetFbdlRuns requestUserTypeField () { + return this.requestUserTypeField(true); + } + public APIRequestGetFbdlRuns requestUserTypeField (boolean value) { + this.requestField("user_type", value); + return this; + } + } + public static class APIRequestGetFeed extends APIRequest { APINodeList lastResponse = null; diff --git a/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessAccount.java b/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessAccount.java index ba2cd53f..42f543ab 100644 --- a/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessAccount.java +++ b/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessAccount.java @@ -53,7 +53,7 @@ public class WhatsAppBusinessAccount extends APINode { @SerializedName("currency") private String mCurrency = null; @SerializedName("health_status") - private Object mHealthStatus = null; + private WhatsAppBusinessHealthStatusForMessageSend mHealthStatus = null; @SerializedName("id") private String mId = null; @SerializedName("is_enabled_for_insights") @@ -307,6 +307,10 @@ public APIRequestGetConversationAnalytics getConversationAnalytics() { return new APIRequestGetConversationAnalytics(this.getPrefixedId().toString(), context); } + public APIRequestGetDccConfig getDccConfig() { + return new APIRequestGetDccConfig(this.getPrefixedId().toString(), context); + } + public APIRequestGetFlows getFlows() { return new APIRequestGetFlows(this.getPrefixedId().toString(), context); } @@ -420,7 +424,7 @@ public String getFieldCurrency() { return mCurrency; } - public Object getFieldHealthStatus() { + public WhatsAppBusinessHealthStatusForMessageSend getFieldHealthStatus() { return mHealthStatus; } @@ -1165,6 +1169,110 @@ public APIRequestGetConversationAnalytics requestField (String field, boolean va } + public static class APIRequestGetDccConfig 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 APIRequestGetDccConfig.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + ); + }; + + public APIRequestGetDccConfig(String nodeId, APIContext context) { + super(context, nodeId, "/dcc_config", "GET", Arrays.asList(PARAMS)); + } + + @Override + public APIRequestGetDccConfig setParam(String param, Object value) { + setParamInternal(param, value); + return this; + } + + @Override + public APIRequestGetDccConfig setParams(Map params) { + setParamsInternal(params); + return this; + } + + + public APIRequestGetDccConfig requestAllFields () { + return this.requestAllFields(true); + } + + public APIRequestGetDccConfig requestAllFields (boolean value) { + for (String field : FIELDS) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetDccConfig requestFields (List fields) { + return this.requestFields(fields, true); + } + + @Override + public APIRequestGetDccConfig requestFields (List fields, boolean value) { + for (String field : fields) { + this.requestField(field, value); + } + return this; + } + + @Override + public APIRequestGetDccConfig requestField (String field) { + this.requestField(field, true); + return this; + } + + @Override + public APIRequestGetDccConfig requestField (String field, boolean value) { + this.requestFieldInternal(field, value); + return this; + } + + } + public static class APIRequestGetFlows extends APIRequest { APINodeList lastResponse = null; @@ -1280,7 +1388,7 @@ public APINode getLastResponse() { "categories", "clone_flow_id", "clone_template", - "data_channel_uri", + "endpoint_uri", "name", }; @@ -1359,8 +1467,8 @@ public APIRequestCreateFlow setCloneTemplate (String cloneTemplate) { return this; } - public APIRequestCreateFlow setDataChannelUri (String dataChannelUri) { - this.setParam("data_channel_uri", dataChannelUri); + public APIRequestCreateFlow setEndpointUri (String endpointUri) { + this.setParam("endpoint_uri", endpointUri); return this; } diff --git a/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessHealthStatus.java b/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessHealthStatus.java new file mode 100644 index 00000000..ae9bf5e9 --- /dev/null +++ b/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessHealthStatus.java @@ -0,0 +1,283 @@ +/* + * 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.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 WhatsAppBusinessHealthStatus extends APINode { + @SerializedName("additional_info") + private List mAdditionalInfo = null; + @SerializedName("can_send_message") + private String mCanSendMessage = null; + @SerializedName("entity_type") + private String mEntityType = null; + @SerializedName("errors") + private List mErrors = null; + @SerializedName("id") + private String mId = null; + protected static Gson gson = null; + + public WhatsAppBusinessHealthStatus() { + } + + public String getId() { + return getFieldId().toString(); + } + public static WhatsAppBusinessHealthStatus loadJSON(String json, APIContext context, String header) { + WhatsAppBusinessHealthStatus whatsAppBusinessHealthStatus = getGson().fromJson(json, WhatsAppBusinessHealthStatus.class); + if (context.isDebug()) { + JsonParser parser = new JsonParser(); + JsonElement o1 = parser.parse(json); + JsonElement o2 = parser.parse(whatsAppBusinessHealthStatus.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); + } + } + whatsAppBusinessHealthStatus.context = context; + whatsAppBusinessHealthStatus.rawValue = json; + whatsAppBusinessHealthStatus.header = header; + return whatsAppBusinessHealthStatus; + } + + public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { + APINodeList whatsAppBusinessHealthStatuss = 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++) { + whatsAppBusinessHealthStatuss.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); + }; + return whatsAppBusinessHealthStatuss; + } 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; + whatsAppBusinessHealthStatuss.setCursors(before, after); + } + String previous = paging.has("previous") ? paging.get("previous").getAsString() : null; + String next = paging.has("next") ? paging.get("next").getAsString() : null; + whatsAppBusinessHealthStatuss.setPaging(previous, next); + if (context.hasAppSecret()) { + whatsAppBusinessHealthStatuss.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++) { + whatsAppBusinessHealthStatuss.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()) { + whatsAppBusinessHealthStatuss.add(loadJSON(entry.getValue().toString(), context, header)); + } + break; + } + } + if (!isRedownload) { + whatsAppBusinessHealthStatuss.add(loadJSON(obj.toString(), context, header)); + } + } + return whatsAppBusinessHealthStatuss; + } 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()) { + whatsAppBusinessHealthStatuss.add(loadJSON(entry.getValue().toString(), context, header)); + } + return whatsAppBusinessHealthStatuss; + } 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) + ) { + whatsAppBusinessHealthStatuss.add(loadJSON(value.toString(), context, header)); + } else { + isIdIndexedArray = false; + break; + } + } + if (isIdIndexedArray) { + return whatsAppBusinessHealthStatuss; + } + + // Sixth, check if it's pure JsonObject + whatsAppBusinessHealthStatuss.clear(); + whatsAppBusinessHealthStatuss.add(loadJSON(json, context, header)); + return whatsAppBusinessHealthStatuss; + } + } + } 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 List getFieldAdditionalInfo() { + return mAdditionalInfo; + } + + public WhatsAppBusinessHealthStatus setFieldAdditionalInfo(List value) { + this.mAdditionalInfo = value; + return this; + } + + public String getFieldCanSendMessage() { + return mCanSendMessage; + } + + public WhatsAppBusinessHealthStatus setFieldCanSendMessage(String value) { + this.mCanSendMessage = value; + return this; + } + + public String getFieldEntityType() { + return mEntityType; + } + + public WhatsAppBusinessHealthStatus setFieldEntityType(String value) { + this.mEntityType = value; + return this; + } + + public List getFieldErrors() { + return mErrors; + } + + public WhatsAppBusinessHealthStatus setFieldErrors(List value) { + this.mErrors = value; + return this; + } + + public String getFieldId() { + return mId; + } + + public WhatsAppBusinessHealthStatus setFieldId(String value) { + this.mId = 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 WhatsAppBusinessHealthStatus copyFrom(WhatsAppBusinessHealthStatus instance) { + this.mAdditionalInfo = instance.mAdditionalInfo; + this.mCanSendMessage = instance.mCanSendMessage; + this.mEntityType = instance.mEntityType; + this.mErrors = instance.mErrors; + this.mId = instance.mId; + 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 WhatsAppBusinessHealthStatus.parseResponse(response, context, request, header); + } + }; + } +} diff --git a/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessHealthStatusForMessageSend.java b/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessHealthStatusForMessageSend.java new file mode 100644 index 00000000..4df1d763 --- /dev/null +++ b/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessHealthStatusForMessageSend.java @@ -0,0 +1,252 @@ +/* + * 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.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 WhatsAppBusinessHealthStatusForMessageSend extends APINode { + @SerializedName("can_send_message") + private String mCanSendMessage = null; + @SerializedName("entities") + private List mEntities = null; + protected static Gson gson = null; + + public WhatsAppBusinessHealthStatusForMessageSend() { + } + + public String getId() { + return null; + } + public static WhatsAppBusinessHealthStatusForMessageSend loadJSON(String json, APIContext context, String header) { + WhatsAppBusinessHealthStatusForMessageSend whatsAppBusinessHealthStatusForMessageSend = getGson().fromJson(json, WhatsAppBusinessHealthStatusForMessageSend.class); + if (context.isDebug()) { + JsonParser parser = new JsonParser(); + JsonElement o1 = parser.parse(json); + JsonElement o2 = parser.parse(whatsAppBusinessHealthStatusForMessageSend.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); + } + } + whatsAppBusinessHealthStatusForMessageSend.context = context; + whatsAppBusinessHealthStatusForMessageSend.rawValue = json; + whatsAppBusinessHealthStatusForMessageSend.header = header; + return whatsAppBusinessHealthStatusForMessageSend; + } + + public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { + APINodeList whatsAppBusinessHealthStatusForMessageSends = 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++) { + whatsAppBusinessHealthStatusForMessageSends.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); + }; + return whatsAppBusinessHealthStatusForMessageSends; + } 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; + whatsAppBusinessHealthStatusForMessageSends.setCursors(before, after); + } + String previous = paging.has("previous") ? paging.get("previous").getAsString() : null; + String next = paging.has("next") ? paging.get("next").getAsString() : null; + whatsAppBusinessHealthStatusForMessageSends.setPaging(previous, next); + if (context.hasAppSecret()) { + whatsAppBusinessHealthStatusForMessageSends.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++) { + whatsAppBusinessHealthStatusForMessageSends.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()) { + whatsAppBusinessHealthStatusForMessageSends.add(loadJSON(entry.getValue().toString(), context, header)); + } + break; + } + } + if (!isRedownload) { + whatsAppBusinessHealthStatusForMessageSends.add(loadJSON(obj.toString(), context, header)); + } + } + return whatsAppBusinessHealthStatusForMessageSends; + } 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()) { + whatsAppBusinessHealthStatusForMessageSends.add(loadJSON(entry.getValue().toString(), context, header)); + } + return whatsAppBusinessHealthStatusForMessageSends; + } 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) + ) { + whatsAppBusinessHealthStatusForMessageSends.add(loadJSON(value.toString(), context, header)); + } else { + isIdIndexedArray = false; + break; + } + } + if (isIdIndexedArray) { + return whatsAppBusinessHealthStatusForMessageSends; + } + + // Sixth, check if it's pure JsonObject + whatsAppBusinessHealthStatusForMessageSends.clear(); + whatsAppBusinessHealthStatusForMessageSends.add(loadJSON(json, context, header)); + return whatsAppBusinessHealthStatusForMessageSends; + } + } + } 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 getFieldCanSendMessage() { + return mCanSendMessage; + } + + public WhatsAppBusinessHealthStatusForMessageSend setFieldCanSendMessage(String value) { + this.mCanSendMessage = value; + return this; + } + + public List getFieldEntities() { + return mEntities; + } + + public WhatsAppBusinessHealthStatusForMessageSend setFieldEntities(List value) { + this.mEntities = value; + return this; + } + + public WhatsAppBusinessHealthStatusForMessageSend setFieldEntities(String value) { + Type type = new TypeToken>(){}.getType(); + this.mEntities = WhatsAppBusinessHealthStatus.getGson().fromJson(value, type); + 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 WhatsAppBusinessHealthStatusForMessageSend copyFrom(WhatsAppBusinessHealthStatusForMessageSend instance) { + this.mCanSendMessage = instance.mCanSendMessage; + this.mEntities = instance.mEntities; + 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 WhatsAppBusinessHealthStatusForMessageSend.parseResponse(response, context, request, header); + } + }; + } +} diff --git a/src/main/java/com/facebook/ads/sdk/WhitehatFBDLRun.java b/src/main/java/com/facebook/ads/sdk/WhitehatFBDLRun.java new file mode 100644 index 00000000..ec6e0b27 --- /dev/null +++ b/src/main/java/com/facebook/ads/sdk/WhitehatFBDLRun.java @@ -0,0 +1,510 @@ +/* + * 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.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 WhitehatFBDLRun extends APINode { + @SerializedName("creation_time") + private String mCreationTime = null; + @SerializedName("id") + private String mId = null; + @SerializedName("is_pinned") + private Boolean mIsPinned = null; + @SerializedName("note") + private String mNote = null; + @SerializedName("result") + private List> mResult = null; + @SerializedName("run_code") + private String mRunCode = null; + @SerializedName("status") + private String mStatus = null; + @SerializedName("user_type") + private String mUserType = null; + protected static Gson gson = null; + + WhitehatFBDLRun() { + } + + public WhitehatFBDLRun(Long id, APIContext context) { + this(id.toString(), context); + } + + public WhitehatFBDLRun(String id, APIContext context) { + this.mId = id; + + this.context = context; + } + + public WhitehatFBDLRun fetch() throws APIException{ + WhitehatFBDLRun newInstance = fetchById(this.getPrefixedId().toString(), this.context); + this.copyFrom(newInstance); + return this; + } + + public static WhitehatFBDLRun 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 WhitehatFBDLRun 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", WhitehatFBDLRun.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", WhitehatFBDLRun.getParser()) + .setParam("ids", APIRequest.joinStringList(ids)) + .requestFields(fields) + .executeAsyncBase(); + } + + private String getPrefixedId() { + return getId(); + } + + public String getId() { + return getFieldId().toString(); + } + public static WhitehatFBDLRun loadJSON(String json, APIContext context, String header) { + WhitehatFBDLRun whitehatFBDLRun = getGson().fromJson(json, WhitehatFBDLRun.class); + if (context.isDebug()) { + JsonParser parser = new JsonParser(); + JsonElement o1 = parser.parse(json); + JsonElement o2 = parser.parse(whitehatFBDLRun.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); + } + } + whitehatFBDLRun.context = context; + whitehatFBDLRun.rawValue = json; + whitehatFBDLRun.header = header; + return whitehatFBDLRun; + } + + public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { + APINodeList whitehatFBDLRuns = 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++) { + whitehatFBDLRuns.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); + }; + return whitehatFBDLRuns; + } 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; + whitehatFBDLRuns.setCursors(before, after); + } + String previous = paging.has("previous") ? paging.get("previous").getAsString() : null; + String next = paging.has("next") ? paging.get("next").getAsString() : null; + whitehatFBDLRuns.setPaging(previous, next); + if (context.hasAppSecret()) { + whitehatFBDLRuns.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++) { + whitehatFBDLRuns.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()) { + whitehatFBDLRuns.add(loadJSON(entry.getValue().toString(), context, header)); + } + break; + } + } + if (!isRedownload) { + whitehatFBDLRuns.add(loadJSON(obj.toString(), context, header)); + } + } + return whitehatFBDLRuns; + } 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()) { + whitehatFBDLRuns.add(loadJSON(entry.getValue().toString(), context, header)); + } + return whitehatFBDLRuns; + } 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) + ) { + whitehatFBDLRuns.add(loadJSON(value.toString(), context, header)); + } else { + isIdIndexedArray = false; + break; + } + } + if (isIdIndexedArray) { + return whitehatFBDLRuns; + } + + // Sixth, check if it's pure JsonObject + whitehatFBDLRuns.clear(); + whitehatFBDLRuns.add(loadJSON(json, context, header)); + return whitehatFBDLRuns; + } + } + } 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 getFieldCreationTime() { + return mCreationTime; + } + + public String getFieldId() { + return mId; + } + + public Boolean getFieldIsPinned() { + return mIsPinned; + } + + public String getFieldNote() { + return mNote; + } + + public List> getFieldResult() { + return mResult; + } + + public String getFieldRunCode() { + return mRunCode; + } + + public String getFieldStatus() { + return mStatus; + } + + public String getFieldUserType() { + return mUserType; + } + + + + public static class APIRequestGet extends APIRequest { + + WhitehatFBDLRun lastResponse = null; + @Override + public WhitehatFBDLRun getLastResponse() { + return lastResponse; + } + public static final String[] PARAMS = { + }; + + public static final String[] FIELDS = { + "creation_time", + "id", + "is_pinned", + "note", + "result", + "run_code", + "status", + "user_type", + }; + + @Override + public WhitehatFBDLRun parseResponse(String response, String header) throws APIException { + return WhitehatFBDLRun.parseResponse(response, getContext(), this, header).head(); + } + + @Override + public WhitehatFBDLRun execute() throws APIException { + return execute(new HashMap()); + } + + @Override + public WhitehatFBDLRun 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 WhitehatFBDLRun apply(ResponseWrapper result) { + try { + return APIRequestGet.this.parseResponse(result.getBody(), result.getHeader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + ); + }; + + 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 requestIdField () { + return this.requestIdField(true); + } + public APIRequestGet requestIdField (boolean value) { + this.requestField("id", value); + return this; + } + public APIRequestGet requestIsPinnedField () { + return this.requestIsPinnedField(true); + } + public APIRequestGet requestIsPinnedField (boolean value) { + this.requestField("is_pinned", value); + return this; + } + public APIRequestGet requestNoteField () { + return this.requestNoteField(true); + } + public APIRequestGet requestNoteField (boolean value) { + this.requestField("note", value); + return this; + } + public APIRequestGet requestResultField () { + return this.requestResultField(true); + } + public APIRequestGet requestResultField (boolean value) { + this.requestField("result", value); + return this; + } + public APIRequestGet requestRunCodeField () { + return this.requestRunCodeField(true); + } + public APIRequestGet requestRunCodeField (boolean value) { + this.requestField("run_code", value); + return this; + } + public APIRequestGet requestStatusField () { + return this.requestStatusField(true); + } + public APIRequestGet requestStatusField (boolean value) { + this.requestField("status", value); + return this; + } + public APIRequestGet requestUserTypeField () { + return this.requestUserTypeField(true); + } + public APIRequestGet requestUserTypeField (boolean value) { + this.requestField("user_type", 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 WhitehatFBDLRun copyFrom(WhitehatFBDLRun instance) { + this.mCreationTime = instance.mCreationTime; + this.mId = instance.mId; + this.mIsPinned = instance.mIsPinned; + this.mNote = instance.mNote; + this.mResult = instance.mResult; + this.mRunCode = instance.mRunCode; + this.mStatus = instance.mStatus; + this.mUserType = instance.mUserType; + 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 WhitehatFBDLRun.parseResponse(response, context, request, header); + } + }; + } +}