Java tutorial
/** * Copyright (c) 2015-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to * use, copy, modify, and distribute this software in source code or binary * form for use in connection with the web services and APIs provided by * Facebook. * * As with any software that integrates with the Facebook platform, your use * of this software is subject to the Facebook Developer Principles and * Policies [http://developers.facebook.com/policy/]. This copyright notice * shall be included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * */ package com.facebook.ads.sdk; import java.lang.reflect.Modifier; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.lang.StringUtils; import com.facebook.ads.sdk.APIException.MalformedResponseException; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.google.gson.annotations.SerializedName; /** * This class is auto-genereated. * * 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 Ad extends APINode { @SerializedName("account_id") private String mAccountId = null; @SerializedName("ad_review_feedback") private AdgroupReviewFeedback mAdReviewFeedback = null; @SerializedName("adlabels") private List<AdLabel> mAdlabels = null; @SerializedName("adset") private AdSet mAdset = null; @SerializedName("adset_id") private String mAdsetId = null; @SerializedName("bid_amount") private Long mBidAmount = null; @SerializedName("bid_info") private Map<String, Long> mBidInfo = null; @SerializedName("bid_type") private EnumBidType mBidType = null; @SerializedName("campaign") private Campaign mCampaign = null; @SerializedName("campaign_id") private String mCampaignId = null; @SerializedName("configured_status") private EnumConfiguredStatus mConfiguredStatus = null; @SerializedName("conversion_specs") private List<ConversionActionQuery> mConversionSpecs = null; @SerializedName("created_time") private String mCreatedTime = null; @SerializedName("creative") private AdCreative mCreative = null; @SerializedName("effective_status") private EnumEffectiveStatus mEffectiveStatus = null; @SerializedName("id") private String mId = null; @SerializedName("last_updated_by_app_id") private String mLastUpdatedByAppId = null; @SerializedName("name") private String mName = null; @SerializedName("recommendations") private List<AdRecommendation> mRecommendations = null; @SerializedName("status") private EnumStatus mStatus = null; @SerializedName("tracking_specs") private List<ConversionActionQuery> mTrackingSpecs = null; @SerializedName("updated_time") private String mUpdatedTime = null; protected static Gson gson = null; Ad() { } public Ad(Long id, APIContext context) { this(id.toString(), context); } public Ad(String id, APIContext context) { this.mId = id; this.context = context; } public Ad fetch() throws APIException { Ad newInstance = fetchById(this.getPrefixedId().toString(), this.context); this.copyFrom(newInstance); return this; } public static Ad fetchById(Long id, APIContext context) throws APIException { return fetchById(id.toString(), context); } public static Ad fetchById(String id, APIContext context) throws APIException { Ad ad = new APIRequestGet(id, context).requestAllFields().execute(); return ad; } public static APINodeList<Ad> fetchByIds(List<String> ids, List<String> fields, APIContext context) throws APIException { return (APINodeList<Ad>) (new APIRequest<Ad>(context, "", "/", "GET", Ad.getParser()) .setParam("ids", StringUtils.join(ids, ",")).requestFields(fields).execute()); } private String getPrefixedId() { return getId(); } public String getId() { return getFieldId().toString(); } public static Ad loadJSON(String json, APIContext context) { Ad ad = getGson().fromJson(json, Ad.class); if (context.isDebug()) { JsonParser parser = new JsonParser(); JsonElement o1 = parser.parse(json); JsonElement o2 = parser.parse(ad.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); } ; } ad.context = context; ad.rawValue = json; return ad; } public static APINodeList<Ad> parseResponse(String json, APIContext context, APIRequest request) throws MalformedResponseException { APINodeList<Ad> ads = new APINodeList<Ad>(request, json); 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++) { ads.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context)); } ; return ads; } else if (result.isJsonObject()) { obj = result.getAsJsonObject(); if (obj.has("data")) { if (obj.has("paging")) { JsonObject paging = obj.get("paging").getAsJsonObject().get("cursors").getAsJsonObject(); String before = paging.has("before") ? paging.get("before").getAsString() : null; String after = paging.has("after") ? paging.get("after").getAsString() : null; ads.setPaging(before, after); } 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++) { ads.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context)); } ; } 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<String, JsonElement> entry : obj.entrySet()) { ads.add(loadJSON(entry.getValue().toString(), context)); } break; } } if (!isRedownload) { ads.add(loadJSON(obj.toString(), context)); } } return ads; } else if (obj.has("images")) { // Fourth, check if it's a map of image objects obj = obj.get("images").getAsJsonObject(); for (Map.Entry<String, JsonElement> entry : obj.entrySet()) { ads.add(loadJSON(entry.getValue().toString(), context)); } return ads; } 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)) { ads.add(loadJSON(value.toString(), context)); } else { isIdIndexedArray = false; break; } } if (isIdIndexedArray) { return ads; } // Sixth, check if it's pure JsonObject ads.clear(); ads.add(loadJSON(json, context)); return ads; } } } 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 APIRequestGetAdCreatives getAdCreatives() { return new APIRequestGetAdCreatives(this.getPrefixedId().toString(), context); } public APIRequestDeleteAdLabels deleteAdLabels() { return new APIRequestDeleteAdLabels(this.getPrefixedId().toString(), context); } public APIRequestCreateAdLabel createAdLabel() { return new APIRequestCreateAdLabel(this.getPrefixedId().toString(), context); } public APIRequestGetInsights getInsights() { return new APIRequestGetInsights(this.getPrefixedId().toString(), context); } public APIRequestGetInsightsAsync getInsightsAsync() { return new APIRequestGetInsightsAsync(this.getPrefixedId().toString(), context); } public APIRequestGetKeywordStats getKeywordStats() { return new APIRequestGetKeywordStats(this.getPrefixedId().toString(), context); } public APIRequestGetLeads getLeads() { return new APIRequestGetLeads(this.getPrefixedId().toString(), context); } public APIRequestGetPreviews getPreviews() { return new APIRequestGetPreviews(this.getPrefixedId().toString(), context); } public APIRequestGetReachEstimate getReachEstimate() { return new APIRequestGetReachEstimate(this.getPrefixedId().toString(), context); } public APIRequestGetTargetingSentenceLines getTargetingSentenceLines() { return new APIRequestGetTargetingSentenceLines(this.getPrefixedId().toString(), context); } public APIRequestDelete delete() { return new APIRequestDelete(this.getPrefixedId().toString(), context); } public APIRequestGet get() { return new APIRequestGet(this.getPrefixedId().toString(), context); } public APIRequestUpdate update() { return new APIRequestUpdate(this.getPrefixedId().toString(), context); } public String getFieldAccountId() { return mAccountId; } public AdgroupReviewFeedback getFieldAdReviewFeedback() { return mAdReviewFeedback; } public List<AdLabel> getFieldAdlabels() { return mAdlabels; } public AdSet getFieldAdset() { return mAdset; } public String getFieldAdsetId() { return mAdsetId; } public Long getFieldBidAmount() { return mBidAmount; } public Map<String, Long> getFieldBidInfo() { return mBidInfo; } public EnumBidType getFieldBidType() { return mBidType; } public Campaign getFieldCampaign() { return mCampaign; } public String getFieldCampaignId() { return mCampaignId; } public EnumConfiguredStatus getFieldConfiguredStatus() { return mConfiguredStatus; } public List<ConversionActionQuery> getFieldConversionSpecs() { return mConversionSpecs; } public String getFieldCreatedTime() { return mCreatedTime; } public AdCreative getFieldCreative() { if (mCreative != null) { mCreative.context = getContext(); } return mCreative; } public EnumEffectiveStatus getFieldEffectiveStatus() { return mEffectiveStatus; } public String getFieldId() { return mId; } public String getFieldLastUpdatedByAppId() { return mLastUpdatedByAppId; } public String getFieldName() { return mName; } public List<AdRecommendation> getFieldRecommendations() { return mRecommendations; } public EnumStatus getFieldStatus() { return mStatus; } public List<ConversionActionQuery> getFieldTrackingSpecs() { return mTrackingSpecs; } public String getFieldUpdatedTime() { return mUpdatedTime; } public static class APIRequestGetAdCreatives extends APIRequest<AdCreative> { APINodeList<AdCreative> lastResponse = null; @Override public APINodeList<AdCreative> getLastResponse() { return lastResponse; } public static final String[] PARAMS = {}; public static final String[] FIELDS = { "adlabels", "applink_treatment", "body", "call_to_action_type", "effective_instagram_story_id", "effective_object_story_id", "id", "image_crops", "image_hash", "image_url", "instagram_actor_id", "instagram_permalink_url", "instagram_story_id", "link_og_id", "link_url", "name", "object_id", "object_story_id", "object_story_spec", "object_type", "object_url", "platform_customizations", "product_set_id", "run_status", "template_url", "thumbnail_url", "title", "url_tags", "use_page_actor_override", }; @Override public APINodeList<AdCreative> parseResponse(String response) throws APIException { return AdCreative.parseResponse(response, getContext(), this); } @Override public APINodeList<AdCreative> execute() throws APIException { return execute(new HashMap<String, Object>()); } @Override public APINodeList<AdCreative> execute(Map<String, Object> extraParams) throws APIException { lastResponse = parseResponse(executeInternal(extraParams)); return lastResponse; } public APIRequestGetAdCreatives(String nodeId, APIContext context) { super(context, nodeId, "/adcreatives", "GET", Arrays.asList(PARAMS)); } @Override public APIRequestGetAdCreatives setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override public APIRequestGetAdCreatives setParams(Map<String, Object> params) { setParamsInternal(params); return this; } public APIRequestGetAdCreatives requestAllFields() { return this.requestAllFields(true); } public APIRequestGetAdCreatives requestAllFields(boolean value) { for (String field : FIELDS) { this.requestField(field, value); } return this; } @Override public APIRequestGetAdCreatives requestFields(List<String> fields) { return this.requestFields(fields, true); } @Override public APIRequestGetAdCreatives requestFields(List<String> fields, boolean value) { for (String field : fields) { this.requestField(field, value); } return this; } @Override public APIRequestGetAdCreatives requestField(String field) { this.requestField(field, true); return this; } @Override public APIRequestGetAdCreatives requestField(String field, boolean value) { this.requestFieldInternal(field, value); return this; } public APIRequestGetAdCreatives requestAdlabelsField() { return this.requestAdlabelsField(true); } public APIRequestGetAdCreatives requestAdlabelsField(boolean value) { this.requestField("adlabels", value); return this; } public APIRequestGetAdCreatives requestApplinkTreatmentField() { return this.requestApplinkTreatmentField(true); } public APIRequestGetAdCreatives requestApplinkTreatmentField(boolean value) { this.requestField("applink_treatment", value); return this; } public APIRequestGetAdCreatives requestBodyField() { return this.requestBodyField(true); } public APIRequestGetAdCreatives requestBodyField(boolean value) { this.requestField("body", value); return this; } public APIRequestGetAdCreatives requestCallToActionTypeField() { return this.requestCallToActionTypeField(true); } public APIRequestGetAdCreatives requestCallToActionTypeField(boolean value) { this.requestField("call_to_action_type", value); return this; } public APIRequestGetAdCreatives requestEffectiveInstagramStoryIdField() { return this.requestEffectiveInstagramStoryIdField(true); } public APIRequestGetAdCreatives requestEffectiveInstagramStoryIdField(boolean value) { this.requestField("effective_instagram_story_id", value); return this; } public APIRequestGetAdCreatives requestEffectiveObjectStoryIdField() { return this.requestEffectiveObjectStoryIdField(true); } public APIRequestGetAdCreatives requestEffectiveObjectStoryIdField(boolean value) { this.requestField("effective_object_story_id", value); return this; } public APIRequestGetAdCreatives requestIdField() { return this.requestIdField(true); } public APIRequestGetAdCreatives requestIdField(boolean value) { this.requestField("id", value); return this; } public APIRequestGetAdCreatives requestImageCropsField() { return this.requestImageCropsField(true); } public APIRequestGetAdCreatives requestImageCropsField(boolean value) { this.requestField("image_crops", value); return this; } public APIRequestGetAdCreatives requestImageHashField() { return this.requestImageHashField(true); } public APIRequestGetAdCreatives requestImageHashField(boolean value) { this.requestField("image_hash", value); return this; } public APIRequestGetAdCreatives requestImageUrlField() { return this.requestImageUrlField(true); } public APIRequestGetAdCreatives requestImageUrlField(boolean value) { this.requestField("image_url", value); return this; } public APIRequestGetAdCreatives requestInstagramActorIdField() { return this.requestInstagramActorIdField(true); } public APIRequestGetAdCreatives requestInstagramActorIdField(boolean value) { this.requestField("instagram_actor_id", value); return this; } public APIRequestGetAdCreatives requestInstagramPermalinkUrlField() { return this.requestInstagramPermalinkUrlField(true); } public APIRequestGetAdCreatives requestInstagramPermalinkUrlField(boolean value) { this.requestField("instagram_permalink_url", value); return this; } public APIRequestGetAdCreatives requestInstagramStoryIdField() { return this.requestInstagramStoryIdField(true); } public APIRequestGetAdCreatives requestInstagramStoryIdField(boolean value) { this.requestField("instagram_story_id", value); return this; } public APIRequestGetAdCreatives requestLinkOgIdField() { return this.requestLinkOgIdField(true); } public APIRequestGetAdCreatives requestLinkOgIdField(boolean value) { this.requestField("link_og_id", value); return this; } public APIRequestGetAdCreatives requestLinkUrlField() { return this.requestLinkUrlField(true); } public APIRequestGetAdCreatives requestLinkUrlField(boolean value) { this.requestField("link_url", value); return this; } public APIRequestGetAdCreatives requestNameField() { return this.requestNameField(true); } public APIRequestGetAdCreatives requestNameField(boolean value) { this.requestField("name", value); return this; } public APIRequestGetAdCreatives requestObjectIdField() { return this.requestObjectIdField(true); } public APIRequestGetAdCreatives requestObjectIdField(boolean value) { this.requestField("object_id", value); return this; } public APIRequestGetAdCreatives requestObjectStoryIdField() { return this.requestObjectStoryIdField(true); } public APIRequestGetAdCreatives requestObjectStoryIdField(boolean value) { this.requestField("object_story_id", value); return this; } public APIRequestGetAdCreatives requestObjectStorySpecField() { return this.requestObjectStorySpecField(true); } public APIRequestGetAdCreatives requestObjectStorySpecField(boolean value) { this.requestField("object_story_spec", value); return this; } public APIRequestGetAdCreatives requestObjectTypeField() { return this.requestObjectTypeField(true); } public APIRequestGetAdCreatives requestObjectTypeField(boolean value) { this.requestField("object_type", value); return this; } public APIRequestGetAdCreatives requestObjectUrlField() { return this.requestObjectUrlField(true); } public APIRequestGetAdCreatives requestObjectUrlField(boolean value) { this.requestField("object_url", value); return this; } public APIRequestGetAdCreatives requestPlatformCustomizationsField() { return this.requestPlatformCustomizationsField(true); } public APIRequestGetAdCreatives requestPlatformCustomizationsField(boolean value) { this.requestField("platform_customizations", value); return this; } public APIRequestGetAdCreatives requestProductSetIdField() { return this.requestProductSetIdField(true); } public APIRequestGetAdCreatives requestProductSetIdField(boolean value) { this.requestField("product_set_id", value); return this; } public APIRequestGetAdCreatives requestRunStatusField() { return this.requestRunStatusField(true); } public APIRequestGetAdCreatives requestRunStatusField(boolean value) { this.requestField("run_status", value); return this; } public APIRequestGetAdCreatives requestTemplateUrlField() { return this.requestTemplateUrlField(true); } public APIRequestGetAdCreatives requestTemplateUrlField(boolean value) { this.requestField("template_url", value); return this; } public APIRequestGetAdCreatives requestThumbnailUrlField() { return this.requestThumbnailUrlField(true); } public APIRequestGetAdCreatives requestThumbnailUrlField(boolean value) { this.requestField("thumbnail_url", value); return this; } public APIRequestGetAdCreatives requestTitleField() { return this.requestTitleField(true); } public APIRequestGetAdCreatives requestTitleField(boolean value) { this.requestField("title", value); return this; } public APIRequestGetAdCreatives requestUrlTagsField() { return this.requestUrlTagsField(true); } public APIRequestGetAdCreatives requestUrlTagsField(boolean value) { this.requestField("url_tags", value); return this; } public APIRequestGetAdCreatives requestUsePageActorOverrideField() { return this.requestUsePageActorOverrideField(true); } public APIRequestGetAdCreatives requestUsePageActorOverrideField(boolean value) { this.requestField("use_page_actor_override", value); return this; } } public static class APIRequestDeleteAdLabels extends APIRequest<APINode> { APINodeList<APINode> lastResponse = null; @Override public APINodeList<APINode> getLastResponse() { return lastResponse; } public static final String[] PARAMS = { "adlabels", "execution_options", }; public static final String[] FIELDS = {}; @Override public APINodeList<APINode> parseResponse(String response) throws APIException { return APINode.parseResponse(response, getContext(), this); } @Override public APINodeList<APINode> execute() throws APIException { return execute(new HashMap<String, Object>()); } @Override public APINodeList<APINode> execute(Map<String, Object> extraParams) throws APIException { lastResponse = parseResponse(executeInternal(extraParams)); return lastResponse; } public APIRequestDeleteAdLabels(String nodeId, APIContext context) { super(context, nodeId, "/adlabels", "DELETE", Arrays.asList(PARAMS)); } @Override public APIRequestDeleteAdLabels setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override public APIRequestDeleteAdLabels setParams(Map<String, Object> params) { setParamsInternal(params); return this; } public APIRequestDeleteAdLabels setAdlabels(List<Object> adlabels) { this.setParam("adlabels", adlabels); return this; } public APIRequestDeleteAdLabels setAdlabels(String adlabels) { this.setParam("adlabels", adlabels); return this; } public APIRequestDeleteAdLabels setExecutionOptions(List<AdLabel.EnumExecutionOptions> executionOptions) { this.setParam("execution_options", executionOptions); return this; } public APIRequestDeleteAdLabels setExecutionOptions(String executionOptions) { this.setParam("execution_options", executionOptions); return this; } public APIRequestDeleteAdLabels requestAllFields() { return this.requestAllFields(true); } public APIRequestDeleteAdLabels requestAllFields(boolean value) { for (String field : FIELDS) { this.requestField(field, value); } return this; } @Override public APIRequestDeleteAdLabels requestFields(List<String> fields) { return this.requestFields(fields, true); } @Override public APIRequestDeleteAdLabels requestFields(List<String> fields, boolean value) { for (String field : fields) { this.requestField(field, value); } return this; } @Override public APIRequestDeleteAdLabels requestField(String field) { this.requestField(field, true); return this; } @Override public APIRequestDeleteAdLabels requestField(String field, boolean value) { this.requestFieldInternal(field, value); return this; } } public static class APIRequestCreateAdLabel extends APIRequest<AdLabel> { AdLabel lastResponse = null; @Override public AdLabel getLastResponse() { return lastResponse; } public static final String[] PARAMS = { "adlabels", "execution_options", }; public static final String[] FIELDS = {}; @Override public AdLabel parseResponse(String response) throws APIException { return AdLabel.parseResponse(response, getContext(), this).head(); } @Override public AdLabel execute() throws APIException { return execute(new HashMap<String, Object>()); } @Override public AdLabel execute(Map<String, Object> extraParams) throws APIException { lastResponse = parseResponse(executeInternal(extraParams)); return lastResponse; } public APIRequestCreateAdLabel(String nodeId, APIContext context) { super(context, nodeId, "/adlabels", "POST", Arrays.asList(PARAMS)); } @Override public APIRequestCreateAdLabel setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override public APIRequestCreateAdLabel setParams(Map<String, Object> params) { setParamsInternal(params); return this; } public APIRequestCreateAdLabel setAdlabels(List<Object> adlabels) { this.setParam("adlabels", adlabels); return this; } public APIRequestCreateAdLabel setAdlabels(String adlabels) { this.setParam("adlabels", adlabels); return this; } public APIRequestCreateAdLabel setExecutionOptions(List<AdLabel.EnumExecutionOptions> executionOptions) { this.setParam("execution_options", executionOptions); return this; } public APIRequestCreateAdLabel setExecutionOptions(String executionOptions) { this.setParam("execution_options", executionOptions); return this; } public APIRequestCreateAdLabel requestAllFields() { return this.requestAllFields(true); } public APIRequestCreateAdLabel requestAllFields(boolean value) { for (String field : FIELDS) { this.requestField(field, value); } return this; } @Override public APIRequestCreateAdLabel requestFields(List<String> fields) { return this.requestFields(fields, true); } @Override public APIRequestCreateAdLabel requestFields(List<String> fields, boolean value) { for (String field : fields) { this.requestField(field, value); } return this; } @Override public APIRequestCreateAdLabel requestField(String field) { this.requestField(field, true); return this; } @Override public APIRequestCreateAdLabel requestField(String field, boolean value) { this.requestFieldInternal(field, value); return this; } } public static class APIRequestGetInsights extends APIRequest<AdsInsights> { APINodeList<AdsInsights> lastResponse = null; @Override public APINodeList<AdsInsights> getLastResponse() { return lastResponse; } public static final String[] PARAMS = { "action_attribution_windows", "action_breakdowns", "action_report_time", "breakdowns", "date_preset", "default_summary", "export_columns", "export_format", "export_name", "fields", "filtering", "level", "product_id_limit", "sort", "summary", "summary_action_breakdowns", "time_increment", "time_range", "time_ranges", }; public static final String[] FIELDS = {}; @Override public APINodeList<AdsInsights> parseResponse(String response) throws APIException { return AdsInsights.parseResponse(response, getContext(), this); } @Override public APINodeList<AdsInsights> execute() throws APIException { return execute(new HashMap<String, Object>()); } @Override public APINodeList<AdsInsights> execute(Map<String, Object> extraParams) throws APIException { lastResponse = parseResponse(executeInternal(extraParams)); return lastResponse; } public APIRequestGetInsights(String nodeId, APIContext context) { super(context, nodeId, "/insights", "GET", Arrays.asList(PARAMS)); } @Override public APIRequestGetInsights setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override public APIRequestGetInsights setParams(Map<String, Object> params) { setParamsInternal(params); return this; } public APIRequestGetInsights setActionAttributionWindows( List<AdsInsights.EnumActionAttributionWindows> actionAttributionWindows) { this.setParam("action_attribution_windows", actionAttributionWindows); return this; } public APIRequestGetInsights setActionAttributionWindows(String actionAttributionWindows) { this.setParam("action_attribution_windows", actionAttributionWindows); return this; } public APIRequestGetInsights setActionBreakdowns(List<AdsInsights.EnumActionBreakdowns> actionBreakdowns) { this.setParam("action_breakdowns", actionBreakdowns); return this; } public APIRequestGetInsights setActionBreakdowns(String actionBreakdowns) { this.setParam("action_breakdowns", actionBreakdowns); return this; } public APIRequestGetInsights setActionReportTime(AdsInsights.EnumActionReportTime actionReportTime) { this.setParam("action_report_time", actionReportTime); return this; } public APIRequestGetInsights setActionReportTime(String actionReportTime) { this.setParam("action_report_time", actionReportTime); return this; } public APIRequestGetInsights setBreakdowns(List<AdsInsights.EnumBreakdowns> breakdowns) { this.setParam("breakdowns", breakdowns); return this; } public APIRequestGetInsights setBreakdowns(String breakdowns) { this.setParam("breakdowns", breakdowns); return this; } public APIRequestGetInsights setDatePreset(AdsInsights.EnumDatePreset datePreset) { this.setParam("date_preset", datePreset); return this; } public APIRequestGetInsights setDatePreset(String datePreset) { this.setParam("date_preset", datePreset); return this; } public APIRequestGetInsights setDefaultSummary(Boolean defaultSummary) { this.setParam("default_summary", defaultSummary); return this; } public APIRequestGetInsights setDefaultSummary(String defaultSummary) { this.setParam("default_summary", defaultSummary); return this; } public APIRequestGetInsights setExportColumns(List<String> exportColumns) { this.setParam("export_columns", exportColumns); return this; } public APIRequestGetInsights setExportColumns(String exportColumns) { this.setParam("export_columns", exportColumns); return this; } public APIRequestGetInsights setExportFormat(String exportFormat) { this.setParam("export_format", exportFormat); return this; } public APIRequestGetInsights setExportName(String exportName) { this.setParam("export_name", exportName); return this; } public APIRequestGetInsights setFields(List<AdsInsights.EnumSummary> fields) { this.setParam("fields", fields); return this; } public APIRequestGetInsights setFields(String fields) { this.setParam("fields", fields); return this; } public APIRequestGetInsights setFiltering(List<Object> filtering) { this.setParam("filtering", filtering); return this; } public APIRequestGetInsights setFiltering(String filtering) { this.setParam("filtering", filtering); return this; } public APIRequestGetInsights setLevel(AdsInsights.EnumLevel level) { this.setParam("level", level); return this; } public APIRequestGetInsights setLevel(String level) { this.setParam("level", level); return this; } public APIRequestGetInsights setProductIdLimit(Long productIdLimit) { this.setParam("product_id_limit", productIdLimit); return this; } public APIRequestGetInsights setProductIdLimit(String productIdLimit) { this.setParam("product_id_limit", productIdLimit); return this; } public APIRequestGetInsights setSort(List<String> sort) { this.setParam("sort", sort); return this; } public APIRequestGetInsights setSort(String sort) { this.setParam("sort", sort); return this; } public APIRequestGetInsights setSummary(List<AdsInsights.EnumSummary> summary) { this.setParam("summary", summary); return this; } public APIRequestGetInsights setSummary(String summary) { this.setParam("summary", summary); return this; } public APIRequestGetInsights setSummaryActionBreakdowns( List<AdsInsights.EnumSummaryActionBreakdowns> summaryActionBreakdowns) { this.setParam("summary_action_breakdowns", summaryActionBreakdowns); return this; } public APIRequestGetInsights setSummaryActionBreakdowns(String summaryActionBreakdowns) { this.setParam("summary_action_breakdowns", summaryActionBreakdowns); return this; } public APIRequestGetInsights setTimeIncrement(String timeIncrement) { this.setParam("time_increment", timeIncrement); return this; } public APIRequestGetInsights setTimeRange(Object timeRange) { this.setParam("time_range", timeRange); return this; } public APIRequestGetInsights setTimeRange(String timeRange) { this.setParam("time_range", timeRange); return this; } public APIRequestGetInsights setTimeRanges(List<Object> timeRanges) { this.setParam("time_ranges", timeRanges); return this; } public APIRequestGetInsights setTimeRanges(String timeRanges) { this.setParam("time_ranges", timeRanges); return this; } public APIRequestGetInsights requestAllFields() { return this.requestAllFields(true); } public APIRequestGetInsights requestAllFields(boolean value) { for (String field : FIELDS) { this.requestField(field, value); } return this; } @Override public APIRequestGetInsights requestFields(List<String> fields) { return this.requestFields(fields, true); } @Override public APIRequestGetInsights requestFields(List<String> fields, boolean value) { for (String field : fields) { this.requestField(field, value); } return this; } @Override public APIRequestGetInsights requestField(String field) { this.requestField(field, true); return this; } @Override public APIRequestGetInsights requestField(String field, boolean value) { this.requestFieldInternal(field, value); return this; } } public static class APIRequestGetInsightsAsync extends APIRequest<AdReportRun> { APINodeList<AdReportRun> lastResponse = null; @Override public APINodeList<AdReportRun> getLastResponse() { return lastResponse; } public static final String[] PARAMS = { "action_attribution_windows", "action_breakdowns", "action_report_time", "breakdowns", "date_preset", "default_summary", "export_columns", "export_format", "export_name", "fields", "filtering", "level", "product_id_limit", "sort", "summary", "summary_action_breakdowns", "time_increment", "time_range", "time_ranges", }; public static final String[] FIELDS = {}; @Override public APINodeList<AdReportRun> parseResponse(String response) throws APIException { return AdReportRun.parseResponse(response, getContext(), this); } @Override public APINodeList<AdReportRun> execute() throws APIException { return execute(new HashMap<String, Object>()); } @Override public APINodeList<AdReportRun> execute(Map<String, Object> extraParams) throws APIException { lastResponse = parseResponse(executeInternal(extraParams)); return lastResponse; } public APIRequestGetInsightsAsync(String nodeId, APIContext context) { super(context, nodeId, "/insights", "POST", Arrays.asList(PARAMS)); } @Override public APIRequestGetInsightsAsync setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override public APIRequestGetInsightsAsync setParams(Map<String, Object> params) { setParamsInternal(params); return this; } public APIRequestGetInsightsAsync setActionAttributionWindows( List<AdsInsights.EnumActionAttributionWindows> actionAttributionWindows) { this.setParam("action_attribution_windows", actionAttributionWindows); return this; } public APIRequestGetInsightsAsync setActionAttributionWindows(String actionAttributionWindows) { this.setParam("action_attribution_windows", actionAttributionWindows); return this; } public APIRequestGetInsightsAsync setActionBreakdowns( List<AdsInsights.EnumActionBreakdowns> actionBreakdowns) { this.setParam("action_breakdowns", actionBreakdowns); return this; } public APIRequestGetInsightsAsync setActionBreakdowns(String actionBreakdowns) { this.setParam("action_breakdowns", actionBreakdowns); return this; } public APIRequestGetInsightsAsync setActionReportTime(AdsInsights.EnumActionReportTime actionReportTime) { this.setParam("action_report_time", actionReportTime); return this; } public APIRequestGetInsightsAsync setActionReportTime(String actionReportTime) { this.setParam("action_report_time", actionReportTime); return this; } public APIRequestGetInsightsAsync setBreakdowns(List<AdsInsights.EnumBreakdowns> breakdowns) { this.setParam("breakdowns", breakdowns); return this; } public APIRequestGetInsightsAsync setBreakdowns(String breakdowns) { this.setParam("breakdowns", breakdowns); return this; } public APIRequestGetInsightsAsync setDatePreset(AdsInsights.EnumDatePreset datePreset) { this.setParam("date_preset", datePreset); return this; } public APIRequestGetInsightsAsync setDatePreset(String datePreset) { this.setParam("date_preset", datePreset); return this; } public APIRequestGetInsightsAsync setDefaultSummary(Boolean defaultSummary) { this.setParam("default_summary", defaultSummary); return this; } public APIRequestGetInsightsAsync setDefaultSummary(String defaultSummary) { this.setParam("default_summary", defaultSummary); return this; } public APIRequestGetInsightsAsync setExportColumns(List<String> exportColumns) { this.setParam("export_columns", exportColumns); return this; } public APIRequestGetInsightsAsync setExportColumns(String exportColumns) { this.setParam("export_columns", exportColumns); return this; } public APIRequestGetInsightsAsync setExportFormat(String exportFormat) { this.setParam("export_format", exportFormat); return this; } public APIRequestGetInsightsAsync setExportName(String exportName) { this.setParam("export_name", exportName); return this; } public APIRequestGetInsightsAsync setFields(List<AdsInsights.EnumSummary> fields) { this.setParam("fields", fields); return this; } public APIRequestGetInsightsAsync setFields(String fields) { this.setParam("fields", fields); return this; } public APIRequestGetInsightsAsync setFiltering(List<Object> filtering) { this.setParam("filtering", filtering); return this; } public APIRequestGetInsightsAsync setFiltering(String filtering) { this.setParam("filtering", filtering); return this; } public APIRequestGetInsightsAsync setLevel(AdsInsights.EnumLevel level) { this.setParam("level", level); return this; } public APIRequestGetInsightsAsync setLevel(String level) { this.setParam("level", level); return this; } public APIRequestGetInsightsAsync setProductIdLimit(Long productIdLimit) { this.setParam("product_id_limit", productIdLimit); return this; } public APIRequestGetInsightsAsync setProductIdLimit(String productIdLimit) { this.setParam("product_id_limit", productIdLimit); return this; } public APIRequestGetInsightsAsync setSort(List<String> sort) { this.setParam("sort", sort); return this; } public APIRequestGetInsightsAsync setSort(String sort) { this.setParam("sort", sort); return this; } public APIRequestGetInsightsAsync setSummary(List<AdsInsights.EnumSummary> summary) { this.setParam("summary", summary); return this; } public APIRequestGetInsightsAsync setSummary(String summary) { this.setParam("summary", summary); return this; } public APIRequestGetInsightsAsync setSummaryActionBreakdowns( List<AdsInsights.EnumSummaryActionBreakdowns> summaryActionBreakdowns) { this.setParam("summary_action_breakdowns", summaryActionBreakdowns); return this; } public APIRequestGetInsightsAsync setSummaryActionBreakdowns(String summaryActionBreakdowns) { this.setParam("summary_action_breakdowns", summaryActionBreakdowns); return this; } public APIRequestGetInsightsAsync setTimeIncrement(String timeIncrement) { this.setParam("time_increment", timeIncrement); return this; } public APIRequestGetInsightsAsync setTimeRange(Object timeRange) { this.setParam("time_range", timeRange); return this; } public APIRequestGetInsightsAsync setTimeRange(String timeRange) { this.setParam("time_range", timeRange); return this; } public APIRequestGetInsightsAsync setTimeRanges(List<Object> timeRanges) { this.setParam("time_ranges", timeRanges); return this; } public APIRequestGetInsightsAsync setTimeRanges(String timeRanges) { this.setParam("time_ranges", timeRanges); return this; } public APIRequestGetInsightsAsync requestAllFields() { return this.requestAllFields(true); } public APIRequestGetInsightsAsync requestAllFields(boolean value) { for (String field : FIELDS) { this.requestField(field, value); } return this; } @Override public APIRequestGetInsightsAsync requestFields(List<String> fields) { return this.requestFields(fields, true); } @Override public APIRequestGetInsightsAsync requestFields(List<String> fields, boolean value) { for (String field : fields) { this.requestField(field, value); } return this; } @Override public APIRequestGetInsightsAsync requestField(String field) { this.requestField(field, true); return this; } @Override public APIRequestGetInsightsAsync requestField(String field, boolean value) { this.requestFieldInternal(field, value); return this; } } public static class APIRequestGetKeywordStats extends APIRequest<AdKeywordStats> { APINodeList<AdKeywordStats> lastResponse = null; @Override public APINodeList<AdKeywordStats> getLastResponse() { return lastResponse; } public static final String[] PARAMS = { "date", }; public static final String[] FIELDS = { "actions", "clicks", "cost_per_total_action", "cost_per_unique_click", "cpc", "cpm", "cpp", "ctr", "frequency", "id", "impressions", "name", "reach", "spend", "total_actions", "total_unique_actions", "unique_actions", "unique_clicks", "unique_ctr", "unique_impressions", }; @Override public APINodeList<AdKeywordStats> parseResponse(String response) throws APIException { return AdKeywordStats.parseResponse(response, getContext(), this); } @Override public APINodeList<AdKeywordStats> execute() throws APIException { return execute(new HashMap<String, Object>()); } @Override public APINodeList<AdKeywordStats> execute(Map<String, Object> extraParams) throws APIException { lastResponse = parseResponse(executeInternal(extraParams)); return lastResponse; } public APIRequestGetKeywordStats(String nodeId, APIContext context) { super(context, nodeId, "/keywordstats", "GET", Arrays.asList(PARAMS)); } @Override public APIRequestGetKeywordStats setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override public APIRequestGetKeywordStats setParams(Map<String, Object> params) { setParamsInternal(params); return this; } public APIRequestGetKeywordStats setDate(String date) { this.setParam("date", date); return this; } public APIRequestGetKeywordStats requestAllFields() { return this.requestAllFields(true); } public APIRequestGetKeywordStats requestAllFields(boolean value) { for (String field : FIELDS) { this.requestField(field, value); } return this; } @Override public APIRequestGetKeywordStats requestFields(List<String> fields) { return this.requestFields(fields, true); } @Override public APIRequestGetKeywordStats requestFields(List<String> fields, boolean value) { for (String field : fields) { this.requestField(field, value); } return this; } @Override public APIRequestGetKeywordStats requestField(String field) { this.requestField(field, true); return this; } @Override public APIRequestGetKeywordStats requestField(String field, boolean value) { this.requestFieldInternal(field, value); return this; } public APIRequestGetKeywordStats requestActionsField() { return this.requestActionsField(true); } public APIRequestGetKeywordStats requestActionsField(boolean value) { this.requestField("actions", value); return this; } public APIRequestGetKeywordStats requestClicksField() { return this.requestClicksField(true); } public APIRequestGetKeywordStats requestClicksField(boolean value) { this.requestField("clicks", value); return this; } public APIRequestGetKeywordStats requestCostPerTotalActionField() { return this.requestCostPerTotalActionField(true); } public APIRequestGetKeywordStats requestCostPerTotalActionField(boolean value) { this.requestField("cost_per_total_action", value); return this; } public APIRequestGetKeywordStats requestCostPerUniqueClickField() { return this.requestCostPerUniqueClickField(true); } public APIRequestGetKeywordStats requestCostPerUniqueClickField(boolean value) { this.requestField("cost_per_unique_click", value); return this; } public APIRequestGetKeywordStats requestCpcField() { return this.requestCpcField(true); } public APIRequestGetKeywordStats requestCpcField(boolean value) { this.requestField("cpc", value); return this; } public APIRequestGetKeywordStats requestCpmField() { return this.requestCpmField(true); } public APIRequestGetKeywordStats requestCpmField(boolean value) { this.requestField("cpm", value); return this; } public APIRequestGetKeywordStats requestCppField() { return this.requestCppField(true); } public APIRequestGetKeywordStats requestCppField(boolean value) { this.requestField("cpp", value); return this; } public APIRequestGetKeywordStats requestCtrField() { return this.requestCtrField(true); } public APIRequestGetKeywordStats requestCtrField(boolean value) { this.requestField("ctr", value); return this; } public APIRequestGetKeywordStats requestFrequencyField() { return this.requestFrequencyField(true); } public APIRequestGetKeywordStats requestFrequencyField(boolean value) { this.requestField("frequency", value); return this; } public APIRequestGetKeywordStats requestIdField() { return this.requestIdField(true); } public APIRequestGetKeywordStats requestIdField(boolean value) { this.requestField("id", value); return this; } public APIRequestGetKeywordStats requestImpressionsField() { return this.requestImpressionsField(true); } public APIRequestGetKeywordStats requestImpressionsField(boolean value) { this.requestField("impressions", value); return this; } public APIRequestGetKeywordStats requestNameField() { return this.requestNameField(true); } public APIRequestGetKeywordStats requestNameField(boolean value) { this.requestField("name", value); return this; } public APIRequestGetKeywordStats requestReachField() { return this.requestReachField(true); } public APIRequestGetKeywordStats requestReachField(boolean value) { this.requestField("reach", value); return this; } public APIRequestGetKeywordStats requestSpendField() { return this.requestSpendField(true); } public APIRequestGetKeywordStats requestSpendField(boolean value) { this.requestField("spend", value); return this; } public APIRequestGetKeywordStats requestTotalActionsField() { return this.requestTotalActionsField(true); } public APIRequestGetKeywordStats requestTotalActionsField(boolean value) { this.requestField("total_actions", value); return this; } public APIRequestGetKeywordStats requestTotalUniqueActionsField() { return this.requestTotalUniqueActionsField(true); } public APIRequestGetKeywordStats requestTotalUniqueActionsField(boolean value) { this.requestField("total_unique_actions", value); return this; } public APIRequestGetKeywordStats requestUniqueActionsField() { return this.requestUniqueActionsField(true); } public APIRequestGetKeywordStats requestUniqueActionsField(boolean value) { this.requestField("unique_actions", value); return this; } public APIRequestGetKeywordStats requestUniqueClicksField() { return this.requestUniqueClicksField(true); } public APIRequestGetKeywordStats requestUniqueClicksField(boolean value) { this.requestField("unique_clicks", value); return this; } public APIRequestGetKeywordStats requestUniqueCtrField() { return this.requestUniqueCtrField(true); } public APIRequestGetKeywordStats requestUniqueCtrField(boolean value) { this.requestField("unique_ctr", value); return this; } public APIRequestGetKeywordStats requestUniqueImpressionsField() { return this.requestUniqueImpressionsField(true); } public APIRequestGetKeywordStats requestUniqueImpressionsField(boolean value) { this.requestField("unique_impressions", value); return this; } } public static class APIRequestGetLeads extends APIRequest<Lead> { APINodeList<Lead> lastResponse = null; @Override public APINodeList<Lead> getLastResponse() { return lastResponse; } public static final String[] PARAMS = {}; public static final String[] FIELDS = { "ad_id", "ad_name", "adset_id", "adset_name", "campaign_id", "campaign_name", "created_time", "custom_disclaimer_responses", "field_data", "form_id", "id", "is_organic", "post", }; @Override public APINodeList<Lead> parseResponse(String response) throws APIException { return Lead.parseResponse(response, getContext(), this); } @Override public APINodeList<Lead> execute() throws APIException { return execute(new HashMap<String, Object>()); } @Override public APINodeList<Lead> execute(Map<String, Object> extraParams) throws APIException { lastResponse = parseResponse(executeInternal(extraParams)); return lastResponse; } public APIRequestGetLeads(String nodeId, APIContext context) { super(context, nodeId, "/leads", "GET", Arrays.asList(PARAMS)); } @Override public APIRequestGetLeads setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override public APIRequestGetLeads setParams(Map<String, Object> params) { setParamsInternal(params); return this; } public APIRequestGetLeads requestAllFields() { return this.requestAllFields(true); } public APIRequestGetLeads requestAllFields(boolean value) { for (String field : FIELDS) { this.requestField(field, value); } return this; } @Override public APIRequestGetLeads requestFields(List<String> fields) { return this.requestFields(fields, true); } @Override public APIRequestGetLeads requestFields(List<String> fields, boolean value) { for (String field : fields) { this.requestField(field, value); } return this; } @Override public APIRequestGetLeads requestField(String field) { this.requestField(field, true); return this; } @Override public APIRequestGetLeads requestField(String field, boolean value) { this.requestFieldInternal(field, value); return this; } public APIRequestGetLeads requestAdIdField() { return this.requestAdIdField(true); } public APIRequestGetLeads requestAdIdField(boolean value) { this.requestField("ad_id", value); return this; } public APIRequestGetLeads requestAdNameField() { return this.requestAdNameField(true); } public APIRequestGetLeads requestAdNameField(boolean value) { this.requestField("ad_name", value); return this; } public APIRequestGetLeads requestAdsetIdField() { return this.requestAdsetIdField(true); } public APIRequestGetLeads requestAdsetIdField(boolean value) { this.requestField("adset_id", value); return this; } public APIRequestGetLeads requestAdsetNameField() { return this.requestAdsetNameField(true); } public APIRequestGetLeads requestAdsetNameField(boolean value) { this.requestField("adset_name", value); return this; } public APIRequestGetLeads requestCampaignIdField() { return this.requestCampaignIdField(true); } public APIRequestGetLeads requestCampaignIdField(boolean value) { this.requestField("campaign_id", value); return this; } public APIRequestGetLeads requestCampaignNameField() { return this.requestCampaignNameField(true); } public APIRequestGetLeads requestCampaignNameField(boolean value) { this.requestField("campaign_name", value); return this; } public APIRequestGetLeads requestCreatedTimeField() { return this.requestCreatedTimeField(true); } public APIRequestGetLeads requestCreatedTimeField(boolean value) { this.requestField("created_time", value); return this; } public APIRequestGetLeads requestCustomDisclaimerResponsesField() { return this.requestCustomDisclaimerResponsesField(true); } public APIRequestGetLeads requestCustomDisclaimerResponsesField(boolean value) { this.requestField("custom_disclaimer_responses", value); return this; } public APIRequestGetLeads requestFieldDataField() { return this.requestFieldDataField(true); } public APIRequestGetLeads requestFieldDataField(boolean value) { this.requestField("field_data", value); return this; } public APIRequestGetLeads requestFormIdField() { return this.requestFormIdField(true); } public APIRequestGetLeads requestFormIdField(boolean value) { this.requestField("form_id", value); return this; } public APIRequestGetLeads requestIdField() { return this.requestIdField(true); } public APIRequestGetLeads requestIdField(boolean value) { this.requestField("id", value); return this; } public APIRequestGetLeads requestIsOrganicField() { return this.requestIsOrganicField(true); } public APIRequestGetLeads requestIsOrganicField(boolean value) { this.requestField("is_organic", value); return this; } public APIRequestGetLeads requestPostField() { return this.requestPostField(true); } public APIRequestGetLeads requestPostField(boolean value) { this.requestField("post", value); return this; } } public static class APIRequestGetPreviews extends APIRequest<AdPreview> { APINodeList<AdPreview> lastResponse = null; @Override public APINodeList<AdPreview> getLastResponse() { return lastResponse; } public static final String[] PARAMS = { "ad_format", "dynamic_creative_spec", "height", "interactive", "locale", "place_page_id", "post", "product_item_ids", "width", }; public static final String[] FIELDS = { "body", }; @Override public APINodeList<AdPreview> parseResponse(String response) throws APIException { return AdPreview.parseResponse(response, getContext(), this); } @Override public APINodeList<AdPreview> execute() throws APIException { return execute(new HashMap<String, Object>()); } @Override public APINodeList<AdPreview> execute(Map<String, Object> extraParams) throws APIException { lastResponse = parseResponse(executeInternal(extraParams)); return lastResponse; } public APIRequestGetPreviews(String nodeId, APIContext context) { super(context, nodeId, "/previews", "GET", Arrays.asList(PARAMS)); } @Override public APIRequestGetPreviews setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override public APIRequestGetPreviews setParams(Map<String, Object> params) { setParamsInternal(params); return this; } public APIRequestGetPreviews setAdFormat(AdPreview.EnumAdFormat adFormat) { this.setParam("ad_format", adFormat); return this; } public APIRequestGetPreviews setAdFormat(String adFormat) { this.setParam("ad_format", adFormat); return this; } public APIRequestGetPreviews setDynamicCreativeSpec(Object dynamicCreativeSpec) { this.setParam("dynamic_creative_spec", dynamicCreativeSpec); return this; } public APIRequestGetPreviews setDynamicCreativeSpec(String dynamicCreativeSpec) { this.setParam("dynamic_creative_spec", dynamicCreativeSpec); return this; } public APIRequestGetPreviews setHeight(Long height) { this.setParam("height", height); return this; } public APIRequestGetPreviews setHeight(String height) { this.setParam("height", height); return this; } public APIRequestGetPreviews setInteractive(Boolean interactive) { this.setParam("interactive", interactive); return this; } public APIRequestGetPreviews setInteractive(String interactive) { this.setParam("interactive", interactive); return this; } public APIRequestGetPreviews setLocale(String locale) { this.setParam("locale", locale); return this; } public APIRequestGetPreviews setPlacePageId(Long placePageId) { this.setParam("place_page_id", placePageId); return this; } public APIRequestGetPreviews setPlacePageId(String placePageId) { this.setParam("place_page_id", placePageId); return this; } public APIRequestGetPreviews setPost(Object post) { this.setParam("post", post); return this; } public APIRequestGetPreviews setPost(String post) { this.setParam("post", post); return this; } public APIRequestGetPreviews setProductItemIds(List<String> productItemIds) { this.setParam("product_item_ids", productItemIds); return this; } public APIRequestGetPreviews setProductItemIds(String productItemIds) { this.setParam("product_item_ids", productItemIds); return this; } public APIRequestGetPreviews setWidth(Long width) { this.setParam("width", width); return this; } public APIRequestGetPreviews setWidth(String width) { this.setParam("width", width); return this; } public APIRequestGetPreviews requestAllFields() { return this.requestAllFields(true); } public APIRequestGetPreviews requestAllFields(boolean value) { for (String field : FIELDS) { this.requestField(field, value); } return this; } @Override public APIRequestGetPreviews requestFields(List<String> fields) { return this.requestFields(fields, true); } @Override public APIRequestGetPreviews requestFields(List<String> fields, boolean value) { for (String field : fields) { this.requestField(field, value); } return this; } @Override public APIRequestGetPreviews requestField(String field) { this.requestField(field, true); return this; } @Override public APIRequestGetPreviews requestField(String field, boolean value) { this.requestFieldInternal(field, value); return this; } public APIRequestGetPreviews requestBodyField() { return this.requestBodyField(true); } public APIRequestGetPreviews requestBodyField(boolean value) { this.requestField("body", value); return this; } } public static class APIRequestGetReachEstimate extends APIRequest<ReachEstimate> { APINodeList<ReachEstimate> lastResponse = null; @Override public APINodeList<ReachEstimate> getLastResponse() { return lastResponse; } public static final String[] PARAMS = { "currency", "daily_budget", "optimize_for", }; public static final String[] FIELDS = { "bid_estimations", "estimate_ready", "unsupported", "users", }; @Override public APINodeList<ReachEstimate> parseResponse(String response) throws APIException { return ReachEstimate.parseResponse(response, getContext(), this); } @Override public APINodeList<ReachEstimate> execute() throws APIException { return execute(new HashMap<String, Object>()); } @Override public APINodeList<ReachEstimate> execute(Map<String, Object> extraParams) throws APIException { lastResponse = parseResponse(executeInternal(extraParams)); return lastResponse; } public APIRequestGetReachEstimate(String nodeId, APIContext context) { super(context, nodeId, "/reachestimate", "GET", Arrays.asList(PARAMS)); } @Override public APIRequestGetReachEstimate setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override public APIRequestGetReachEstimate setParams(Map<String, Object> params) { setParamsInternal(params); return this; } public APIRequestGetReachEstimate setCurrency(String currency) { this.setParam("currency", currency); return this; } public APIRequestGetReachEstimate setDailyBudget(Double dailyBudget) { this.setParam("daily_budget", dailyBudget); return this; } public APIRequestGetReachEstimate setDailyBudget(String dailyBudget) { this.setParam("daily_budget", dailyBudget); return this; } public APIRequestGetReachEstimate setOptimizeFor(ReachEstimate.EnumOptimizeFor optimizeFor) { this.setParam("optimize_for", optimizeFor); return this; } public APIRequestGetReachEstimate setOptimizeFor(String optimizeFor) { this.setParam("optimize_for", optimizeFor); return this; } public APIRequestGetReachEstimate requestAllFields() { return this.requestAllFields(true); } public APIRequestGetReachEstimate requestAllFields(boolean value) { for (String field : FIELDS) { this.requestField(field, value); } return this; } @Override public APIRequestGetReachEstimate requestFields(List<String> fields) { return this.requestFields(fields, true); } @Override public APIRequestGetReachEstimate requestFields(List<String> fields, boolean value) { for (String field : fields) { this.requestField(field, value); } return this; } @Override public APIRequestGetReachEstimate requestField(String field) { this.requestField(field, true); return this; } @Override public APIRequestGetReachEstimate requestField(String field, boolean value) { this.requestFieldInternal(field, value); return this; } public APIRequestGetReachEstimate requestBidEstimationsField() { return this.requestBidEstimationsField(true); } public APIRequestGetReachEstimate requestBidEstimationsField(boolean value) { this.requestField("bid_estimations", value); return this; } public APIRequestGetReachEstimate requestEstimateReadyField() { return this.requestEstimateReadyField(true); } public APIRequestGetReachEstimate requestEstimateReadyField(boolean value) { this.requestField("estimate_ready", value); return this; } public APIRequestGetReachEstimate requestUnsupportedField() { return this.requestUnsupportedField(true); } public APIRequestGetReachEstimate requestUnsupportedField(boolean value) { this.requestField("unsupported", value); return this; } public APIRequestGetReachEstimate requestUsersField() { return this.requestUsersField(true); } public APIRequestGetReachEstimate requestUsersField(boolean value) { this.requestField("users", value); return this; } } public static class APIRequestGetTargetingSentenceLines extends APIRequest<TargetingSentenceLine> { APINodeList<TargetingSentenceLine> lastResponse = null; @Override public APINodeList<TargetingSentenceLine> getLastResponse() { return lastResponse; } public static final String[] PARAMS = {}; public static final String[] FIELDS = { "id", "params", "targetingsentencelines", }; @Override public APINodeList<TargetingSentenceLine> parseResponse(String response) throws APIException { return TargetingSentenceLine.parseResponse(response, getContext(), this); } @Override public APINodeList<TargetingSentenceLine> execute() throws APIException { return execute(new HashMap<String, Object>()); } @Override public APINodeList<TargetingSentenceLine> execute(Map<String, Object> extraParams) throws APIException { lastResponse = parseResponse(executeInternal(extraParams)); return lastResponse; } public APIRequestGetTargetingSentenceLines(String nodeId, APIContext context) { super(context, nodeId, "/targetingsentencelines", "GET", Arrays.asList(PARAMS)); } @Override public APIRequestGetTargetingSentenceLines setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override public APIRequestGetTargetingSentenceLines setParams(Map<String, Object> params) { setParamsInternal(params); return this; } public APIRequestGetTargetingSentenceLines requestAllFields() { return this.requestAllFields(true); } public APIRequestGetTargetingSentenceLines requestAllFields(boolean value) { for (String field : FIELDS) { this.requestField(field, value); } return this; } @Override public APIRequestGetTargetingSentenceLines requestFields(List<String> fields) { return this.requestFields(fields, true); } @Override public APIRequestGetTargetingSentenceLines requestFields(List<String> fields, boolean value) { for (String field : fields) { this.requestField(field, value); } return this; } @Override public APIRequestGetTargetingSentenceLines requestField(String field) { this.requestField(field, true); return this; } @Override public APIRequestGetTargetingSentenceLines requestField(String field, boolean value) { this.requestFieldInternal(field, value); return this; } public APIRequestGetTargetingSentenceLines requestIdField() { return this.requestIdField(true); } public APIRequestGetTargetingSentenceLines requestIdField(boolean value) { this.requestField("id", value); return this; } public APIRequestGetTargetingSentenceLines requestParamsField() { return this.requestParamsField(true); } public APIRequestGetTargetingSentenceLines requestParamsField(boolean value) { this.requestField("params", value); return this; } public APIRequestGetTargetingSentenceLines requestTargetingsentencelinesField() { return this.requestTargetingsentencelinesField(true); } public APIRequestGetTargetingSentenceLines requestTargetingsentencelinesField(boolean value) { this.requestField("targetingsentencelines", value); return this; } } public static class APIRequestDelete extends APIRequest<APINode> { APINode lastResponse = null; @Override public APINode getLastResponse() { return lastResponse; } public static final String[] PARAMS = {}; public static final String[] FIELDS = {}; @Override public APINode parseResponse(String response) throws APIException { return APINode.parseResponse(response, getContext(), this).head(); } @Override public APINode execute() throws APIException { return execute(new HashMap<String, Object>()); } @Override public APINode execute(Map<String, Object> extraParams) throws APIException { lastResponse = parseResponse(executeInternal(extraParams)); return lastResponse; } public APIRequestDelete(String nodeId, APIContext context) { super(context, nodeId, "/", "DELETE", Arrays.asList(PARAMS)); } @Override public APIRequestDelete setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override public APIRequestDelete setParams(Map<String, Object> params) { setParamsInternal(params); return this; } public APIRequestDelete requestAllFields() { return this.requestAllFields(true); } public APIRequestDelete requestAllFields(boolean value) { for (String field : FIELDS) { this.requestField(field, value); } return this; } @Override public APIRequestDelete requestFields(List<String> fields) { return this.requestFields(fields, true); } @Override public APIRequestDelete requestFields(List<String> fields, boolean value) { for (String field : fields) { this.requestField(field, value); } return this; } @Override public APIRequestDelete requestField(String field) { this.requestField(field, true); return this; } @Override public APIRequestDelete requestField(String field, boolean value) { this.requestFieldInternal(field, value); return this; } } public static class APIRequestGet extends APIRequest<Ad> { Ad lastResponse = null; @Override public Ad getLastResponse() { return lastResponse; } public static final String[] PARAMS = {}; public static final String[] FIELDS = { "account_id", "ad_review_feedback", "adlabels", "adset", "adset_id", "bid_amount", "bid_info", "bid_type", "campaign", "campaign_id", "configured_status", "conversion_specs", "created_time", "creative", "effective_status", "id", "last_updated_by_app_id", "name", "recommendations", "status", "tracking_specs", "updated_time", }; @Override public Ad parseResponse(String response) throws APIException { return Ad.parseResponse(response, getContext(), this).head(); } @Override public Ad execute() throws APIException { return execute(new HashMap<String, Object>()); } @Override public Ad execute(Map<String, Object> extraParams) throws APIException { lastResponse = parseResponse(executeInternal(extraParams)); return lastResponse; } 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<String, Object> 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<String> fields) { return this.requestFields(fields, true); } @Override public APIRequestGet requestFields(List<String> 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 requestAccountIdField() { return this.requestAccountIdField(true); } public APIRequestGet requestAccountIdField(boolean value) { this.requestField("account_id", value); return this; } public APIRequestGet requestAdReviewFeedbackField() { return this.requestAdReviewFeedbackField(true); } public APIRequestGet requestAdReviewFeedbackField(boolean value) { this.requestField("ad_review_feedback", value); return this; } public APIRequestGet requestAdlabelsField() { return this.requestAdlabelsField(true); } public APIRequestGet requestAdlabelsField(boolean value) { this.requestField("adlabels", value); return this; } public APIRequestGet requestAdsetField() { return this.requestAdsetField(true); } public APIRequestGet requestAdsetField(boolean value) { this.requestField("adset", value); return this; } public APIRequestGet requestAdsetIdField() { return this.requestAdsetIdField(true); } public APIRequestGet requestAdsetIdField(boolean value) { this.requestField("adset_id", value); return this; } public APIRequestGet requestBidAmountField() { return this.requestBidAmountField(true); } public APIRequestGet requestBidAmountField(boolean value) { this.requestField("bid_amount", value); return this; } public APIRequestGet requestBidInfoField() { return this.requestBidInfoField(true); } public APIRequestGet requestBidInfoField(boolean value) { this.requestField("bid_info", value); return this; } public APIRequestGet requestBidTypeField() { return this.requestBidTypeField(true); } public APIRequestGet requestBidTypeField(boolean value) { this.requestField("bid_type", value); return this; } public APIRequestGet requestCampaignField() { return this.requestCampaignField(true); } public APIRequestGet requestCampaignField(boolean value) { this.requestField("campaign", value); return this; } public APIRequestGet requestCampaignIdField() { return this.requestCampaignIdField(true); } public APIRequestGet requestCampaignIdField(boolean value) { this.requestField("campaign_id", value); return this; } public APIRequestGet requestConfiguredStatusField() { return this.requestConfiguredStatusField(true); } public APIRequestGet requestConfiguredStatusField(boolean value) { this.requestField("configured_status", value); return this; } public APIRequestGet requestConversionSpecsField() { return this.requestConversionSpecsField(true); } public APIRequestGet requestConversionSpecsField(boolean value) { this.requestField("conversion_specs", value); return this; } public APIRequestGet requestCreatedTimeField() { return this.requestCreatedTimeField(true); } public APIRequestGet requestCreatedTimeField(boolean value) { this.requestField("created_time", value); return this; } public APIRequestGet requestCreativeField() { return this.requestCreativeField(true); } public APIRequestGet requestCreativeField(boolean value) { this.requestField("creative", value); return this; } public APIRequestGet requestEffectiveStatusField() { return this.requestEffectiveStatusField(true); } public APIRequestGet requestEffectiveStatusField(boolean value) { this.requestField("effective_status", value); return this; } public APIRequestGet requestIdField() { return this.requestIdField(true); } public APIRequestGet requestIdField(boolean value) { this.requestField("id", value); return this; } public APIRequestGet requestLastUpdatedByAppIdField() { return this.requestLastUpdatedByAppIdField(true); } public APIRequestGet requestLastUpdatedByAppIdField(boolean value) { this.requestField("last_updated_by_app_id", value); return this; } public APIRequestGet requestNameField() { return this.requestNameField(true); } public APIRequestGet requestNameField(boolean value) { this.requestField("name", value); return this; } public APIRequestGet requestRecommendationsField() { return this.requestRecommendationsField(true); } public APIRequestGet requestRecommendationsField(boolean value) { this.requestField("recommendations", value); return this; } public APIRequestGet requestStatusField() { return this.requestStatusField(true); } public APIRequestGet requestStatusField(boolean value) { this.requestField("status", value); return this; } public APIRequestGet requestTrackingSpecsField() { return this.requestTrackingSpecsField(true); } public APIRequestGet requestTrackingSpecsField(boolean value) { this.requestField("tracking_specs", value); return this; } public APIRequestGet requestUpdatedTimeField() { return this.requestUpdatedTimeField(true); } public APIRequestGet requestUpdatedTimeField(boolean value) { this.requestField("updated_time", value); return this; } } public static class APIRequestUpdate extends APIRequest<Ad> { Ad lastResponse = null; @Override public Ad getLastResponse() { return lastResponse; } public static final String[] PARAMS = { "adlabels", "adset_id", "bid_amount", "creative", "display_sequence", "execution_options", "name", "redownload", "status", "tracking_specs", }; public static final String[] FIELDS = {}; @Override public Ad parseResponse(String response) throws APIException { return Ad.parseResponse(response, getContext(), this).head(); } @Override public Ad execute() throws APIException { return execute(new HashMap<String, Object>()); } @Override public Ad execute(Map<String, Object> extraParams) throws APIException { lastResponse = parseResponse(executeInternal(extraParams)); return lastResponse; } public APIRequestUpdate(String nodeId, APIContext context) { super(context, nodeId, "/", "POST", Arrays.asList(PARAMS)); } @Override public APIRequestUpdate setParam(String param, Object value) { setParamInternal(param, value); return this; } @Override public APIRequestUpdate setParams(Map<String, Object> params) { setParamsInternal(params); return this; } public APIRequestUpdate setAdlabels(List<Object> adlabels) { this.setParam("adlabels", adlabels); return this; } public APIRequestUpdate setAdlabels(String adlabels) { this.setParam("adlabels", adlabels); return this; } public APIRequestUpdate setAdsetId(Long adsetId) { this.setParam("adset_id", adsetId); return this; } public APIRequestUpdate setAdsetId(String adsetId) { this.setParam("adset_id", adsetId); return this; } public APIRequestUpdate setBidAmount(Long bidAmount) { this.setParam("bid_amount", bidAmount); return this; } public APIRequestUpdate setBidAmount(String bidAmount) { this.setParam("bid_amount", bidAmount); return this; } public APIRequestUpdate setCreative(AdCreative creative) { this.setParam("creative", creative); return this; } public APIRequestUpdate setCreative(String creative) { this.setParam("creative", creative); return this; } public APIRequestUpdate setDisplaySequence(Long displaySequence) { this.setParam("display_sequence", displaySequence); return this; } public APIRequestUpdate setDisplaySequence(String displaySequence) { this.setParam("display_sequence", displaySequence); return this; } public APIRequestUpdate setExecutionOptions(List<Ad.EnumExecutionOptions> executionOptions) { this.setParam("execution_options", executionOptions); return this; } public APIRequestUpdate setExecutionOptions(String executionOptions) { this.setParam("execution_options", executionOptions); return this; } public APIRequestUpdate setName(String name) { this.setParam("name", name); return this; } public APIRequestUpdate setRedownload(Boolean redownload) { this.setParam("redownload", redownload); return this; } public APIRequestUpdate setRedownload(String redownload) { this.setParam("redownload", redownload); return this; } public APIRequestUpdate setStatus(Ad.EnumStatus status) { this.setParam("status", status); return this; } public APIRequestUpdate setStatus(String status) { this.setParam("status", status); return this; } public APIRequestUpdate setTrackingSpecs(Object trackingSpecs) { this.setParam("tracking_specs", trackingSpecs); return this; } public APIRequestUpdate setTrackingSpecs(String trackingSpecs) { this.setParam("tracking_specs", trackingSpecs); return this; } public APIRequestUpdate requestAllFields() { return this.requestAllFields(true); } public APIRequestUpdate requestAllFields(boolean value) { for (String field : FIELDS) { this.requestField(field, value); } return this; } @Override public APIRequestUpdate requestFields(List<String> fields) { return this.requestFields(fields, true); } @Override public APIRequestUpdate requestFields(List<String> fields, boolean value) { for (String field : fields) { this.requestField(field, value); } return this; } @Override public APIRequestUpdate requestField(String field) { this.requestField(field, true); return this; } @Override public APIRequestUpdate requestField(String field, boolean value) { this.requestFieldInternal(field, value); return this; } } public static enum EnumBidType { @SerializedName("CPC") VALUE_CPC("CPC"), @SerializedName("CPM") VALUE_CPM("CPM"), @SerializedName("MULTI_PREMIUM") VALUE_MULTI_PREMIUM("MULTI_PREMIUM"), @SerializedName("ABSOLUTE_OCPM") VALUE_ABSOLUTE_OCPM("ABSOLUTE_OCPM"), @SerializedName("CPA") VALUE_CPA("CPA"), NULL(null); private String value; private EnumBidType(String value) { this.value = value; } @Override public String toString() { return value; } } public static enum EnumConfiguredStatus { @SerializedName("ACTIVE") VALUE_ACTIVE("ACTIVE"), @SerializedName("PAUSED") VALUE_PAUSED("PAUSED"), @SerializedName("DELETED") VALUE_DELETED("DELETED"), @SerializedName("ARCHIVED") VALUE_ARCHIVED("ARCHIVED"), NULL(null); private String value; private EnumConfiguredStatus(String value) { this.value = value; } @Override public String toString() { return value; } } public static enum EnumEffectiveStatus { @SerializedName("ACTIVE") VALUE_ACTIVE("ACTIVE"), @SerializedName("PAUSED") VALUE_PAUSED("PAUSED"), @SerializedName("DELETED") VALUE_DELETED("DELETED"), @SerializedName("PENDING_REVIEW") VALUE_PENDING_REVIEW("PENDING_REVIEW"), @SerializedName("DISAPPROVED") VALUE_DISAPPROVED("DISAPPROVED"), @SerializedName("PREAPPROVED") VALUE_PREAPPROVED("PREAPPROVED"), @SerializedName("PENDING_BILLING_INFO") VALUE_PENDING_BILLING_INFO("PENDING_BILLING_INFO"), @SerializedName("CAMPAIGN_PAUSED") VALUE_CAMPAIGN_PAUSED("CAMPAIGN_PAUSED"), @SerializedName("ARCHIVED") VALUE_ARCHIVED("ARCHIVED"), @SerializedName("ADSET_PAUSED") VALUE_ADSET_PAUSED("ADSET_PAUSED"), NULL(null); private String value; private EnumEffectiveStatus(String value) { this.value = value; } @Override public String toString() { return value; } } public static enum EnumStatus { @SerializedName("ACTIVE") VALUE_ACTIVE("ACTIVE"), @SerializedName("PAUSED") VALUE_PAUSED("PAUSED"), @SerializedName("DELETED") VALUE_DELETED("DELETED"), @SerializedName("ARCHIVED") VALUE_ARCHIVED("ARCHIVED"), NULL(null); private String value; private EnumStatus(String value) { this.value = value; } @Override public String toString() { return value; } } public static enum EnumDatePreset { @SerializedName("today") VALUE_TODAY("today"), @SerializedName("yesterday") VALUE_YESTERDAY("yesterday"), @SerializedName("last_3_days") VALUE_LAST_3_DAYS("last_3_days"), @SerializedName("this_week") VALUE_THIS_WEEK("this_week"), @SerializedName("last_week") VALUE_LAST_WEEK("last_week"), @SerializedName("last_7_days") VALUE_LAST_7_DAYS("last_7_days"), @SerializedName("last_14_days") VALUE_LAST_14_DAYS("last_14_days"), @SerializedName("last_28_days") VALUE_LAST_28_DAYS("last_28_days"), @SerializedName("last_30_days") VALUE_LAST_30_DAYS("last_30_days"), @SerializedName("last_90_days") VALUE_LAST_90_DAYS("last_90_days"), @SerializedName("this_month") VALUE_THIS_MONTH("this_month"), @SerializedName("last_month") VALUE_LAST_MONTH("last_month"), @SerializedName("this_quarter") VALUE_THIS_QUARTER("this_quarter"), @SerializedName("last_3_months") VALUE_LAST_3_MONTHS("last_3_months"), @SerializedName("lifetime") VALUE_LIFETIME("lifetime"), NULL(null); private String value; private EnumDatePreset(String value) { this.value = value; } @Override public String toString() { return value; } } public static enum EnumExecutionOptions { @SerializedName("validate_only") VALUE_VALIDATE_ONLY("validate_only"), @SerializedName("synchronous_ad_review") VALUE_SYNCHRONOUS_AD_REVIEW("synchronous_ad_review"), @SerializedName("include_recommendations") VALUE_INCLUDE_RECOMMENDATIONS("include_recommendations"), NULL(null); private String value; private EnumExecutionOptions(String value) { this.value = value; } @Override public String toString() { return value; } } public static enum EnumOperator { @SerializedName("ALL") VALUE_ALL("ALL"), @SerializedName("ANY") VALUE_ANY("ANY"), NULL(null); private String value; private EnumOperator(String value) { this.value = value; } @Override public String toString() { return value; } } synchronized /*package*/ static Gson getGson() { if (gson != null) { return gson; } else { gson = new GsonBuilder().excludeFieldsWithModifiers(Modifier.STATIC) .excludeFieldsWithModifiers(Modifier.PROTECTED).disableHtmlEscaping().create(); } return gson; } public Ad copyFrom(Ad instance) { this.mAccountId = instance.mAccountId; this.mAdReviewFeedback = instance.mAdReviewFeedback; this.mAdlabels = instance.mAdlabels; this.mAdset = instance.mAdset; this.mAdsetId = instance.mAdsetId; this.mBidAmount = instance.mBidAmount; this.mBidInfo = instance.mBidInfo; this.mBidType = instance.mBidType; this.mCampaign = instance.mCampaign; this.mCampaignId = instance.mCampaignId; this.mConfiguredStatus = instance.mConfiguredStatus; this.mConversionSpecs = instance.mConversionSpecs; this.mCreatedTime = instance.mCreatedTime; this.mCreative = instance.mCreative; this.mEffectiveStatus = instance.mEffectiveStatus; this.mId = instance.mId; this.mLastUpdatedByAppId = instance.mLastUpdatedByAppId; this.mName = instance.mName; this.mRecommendations = instance.mRecommendations; this.mStatus = instance.mStatus; this.mTrackingSpecs = instance.mTrackingSpecs; this.mUpdatedTime = instance.mUpdatedTime; this.context = instance.context; this.rawValue = instance.rawValue; return this; } public static APIRequest.ResponseParser<Ad> getParser() { return new APIRequest.ResponseParser<Ad>() { public APINodeList<Ad> parseResponse(String response, APIContext context, APIRequest<Ad> request) throws MalformedResponseException { return Ad.parseResponse(response, context, request); } }; } }