Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.facebook.ads.sdk.ContentBlockList Maven / Gradle / Ivy
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.ads.sdk;
import java.io.File;
import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.common.base.Function;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.SettableFuture;
import com.google.gson.JsonObject;
import com.google.gson.JsonArray;
import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import com.facebook.ads.sdk.APIException.MalformedResponseException;
/**
* This class is auto-generated.
*
* For any issues or feature requests related to this class, please let us know
* on github and we'll fix in our codegen framework. We'll not be able to accept
* pull request for this class.
*
*/
public class ContentBlockList extends APINode {
@SerializedName("business")
private Business mBusiness = null;
@SerializedName("id")
private String mId = null;
@SerializedName("name")
private String mName = null;
protected static Gson gson = null;
ContentBlockList() {
}
public ContentBlockList(Long id, APIContext context) {
this(id.toString(), context);
}
public ContentBlockList(String id, APIContext context) {
this.mId = id;
this.context = context;
}
public ContentBlockList fetch() throws APIException{
ContentBlockList newInstance = fetchById(this.getPrefixedId().toString(), this.context);
this.copyFrom(newInstance);
return this;
}
public static ContentBlockList fetchById(Long id, APIContext context) throws APIException {
return fetchById(id.toString(), context);
}
public static ListenableFuture fetchByIdAsync(Long id, APIContext context) throws APIException {
return fetchByIdAsync(id.toString(), context);
}
public static ContentBlockList fetchById(String id, APIContext context) throws APIException {
return
new APIRequestGet(id, context)
.requestAllFields()
.execute();
}
public static ListenableFuture fetchByIdAsync(String id, APIContext context) throws APIException {
return
new APIRequestGet(id, context)
.requestAllFields()
.executeAsync();
}
public static APINodeList fetchByIds(List ids, List fields, APIContext context) throws APIException {
return (APINodeList)(
new APIRequest(context, "", "/", "GET", ContentBlockList.getParser())
.setParam("ids", APIRequest.joinStringList(ids))
.requestFields(fields)
.execute()
);
}
public static ListenableFuture> fetchByIdsAsync(List ids, List fields, APIContext context) throws APIException {
return
new APIRequest(context, "", "/", "GET", ContentBlockList.getParser())
.setParam("ids", APIRequest.joinStringList(ids))
.requestFields(fields)
.executeAsyncBase();
}
private String getPrefixedId() {
return getId();
}
public String getId() {
return getFieldId().toString();
}
public static ContentBlockList loadJSON(String json, APIContext context, String header) {
ContentBlockList contentBlockList = getGson().fromJson(json, ContentBlockList.class);
if (context.isDebug()) {
JsonParser parser = new JsonParser();
JsonElement o1 = parser.parse(json);
JsonElement o2 = parser.parse(contentBlockList.toString());
if (o1.getAsJsonObject().get("__fb_trace_id__") != null) {
o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__"));
}
if (!o1.equals(o2)) {
context.log("[Warning] When parsing response, object is not consistent with JSON:");
context.log("[JSON]" + o1);
context.log("[Object]" + o2);
}
}
contentBlockList.context = context;
contentBlockList.rawValue = json;
contentBlockList.header = header;
return contentBlockList;
}
public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException {
APINodeList contentBlockLists = new APINodeList(request, json, header);
JsonArray arr;
JsonObject obj;
JsonParser parser = new JsonParser();
Exception exception = null;
try{
JsonElement result = parser.parse(json);
if (result.isJsonArray()) {
// First, check if it's a pure JSON Array
arr = result.getAsJsonArray();
for (int i = 0; i < arr.size(); i++) {
contentBlockLists.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header));
};
return contentBlockLists;
} else if (result.isJsonObject()) {
obj = result.getAsJsonObject();
if (obj.has("data")) {
if (obj.has("paging")) {
JsonObject paging = obj.get("paging").getAsJsonObject();
if (paging.has("cursors")) {
JsonObject cursors = paging.get("cursors").getAsJsonObject();
String before = cursors.has("before") ? cursors.get("before").getAsString() : null;
String after = cursors.has("after") ? cursors.get("after").getAsString() : null;
contentBlockLists.setCursors(before, after);
}
String previous = paging.has("previous") ? paging.get("previous").getAsString() : null;
String next = paging.has("next") ? paging.get("next").getAsString() : null;
contentBlockLists.setPaging(previous, next);
if (context.hasAppSecret()) {
contentBlockLists.setAppSecret(context.getAppSecretProof());
}
}
if (obj.get("data").isJsonArray()) {
// Second, check if it's a JSON array with "data"
arr = obj.get("data").getAsJsonArray();
for (int i = 0; i < arr.size(); i++) {
contentBlockLists.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header));
};
} else if (obj.get("data").isJsonObject()) {
// Third, check if it's a JSON object with "data"
obj = obj.get("data").getAsJsonObject();
boolean isRedownload = false;
for (String s : new String[]{"campaigns", "adsets", "ads"}) {
if (obj.has(s)) {
isRedownload = true;
obj = obj.getAsJsonObject(s);
for (Map.Entry entry : obj.entrySet()) {
contentBlockLists.add(loadJSON(entry.getValue().toString(), context, header));
}
break;
}
}
if (!isRedownload) {
contentBlockLists.add(loadJSON(obj.toString(), context, header));
}
}
return contentBlockLists;
} else if (obj.has("images")) {
// Fourth, check if it's a map of image objects
obj = obj.get("images").getAsJsonObject();
for (Map.Entry entry : obj.entrySet()) {
contentBlockLists.add(loadJSON(entry.getValue().toString(), context, header));
}
return contentBlockLists;
} else {
// Fifth, check if it's an array of objects indexed by id
boolean isIdIndexedArray = true;
for (Map.Entry entry : obj.entrySet()) {
String key = (String) entry.getKey();
if (key.equals("__fb_trace_id__")) {
continue;
}
JsonElement value = (JsonElement) entry.getValue();
if (
value != null &&
value.isJsonObject() &&
value.getAsJsonObject().has("id") &&
value.getAsJsonObject().get("id") != null &&
value.getAsJsonObject().get("id").getAsString().equals(key)
) {
contentBlockLists.add(loadJSON(value.toString(), context, header));
} else {
isIdIndexedArray = false;
break;
}
}
if (isIdIndexedArray) {
return contentBlockLists;
}
// Sixth, check if it's pure JsonObject
contentBlockLists.clear();
contentBlockLists.add(loadJSON(json, context, header));
return contentBlockLists;
}
}
} catch (Exception e) {
exception = e;
}
throw new MalformedResponseException(
"Invalid response string: " + json,
exception
);
}
@Override
public APIContext getContext() {
return context;
}
@Override
public void setContext(APIContext context) {
this.context = context;
}
@Override
public String toString() {
return getGson().toJson(this);
}
public APIRequestGetAppliedAdAccounts getAppliedAdAccounts() {
return new APIRequestGetAppliedAdAccounts(this.getPrefixedId().toString(), context);
}
public APIRequestGetFacebookContent getFacebookContent() {
return new APIRequestGetFacebookContent(this.getPrefixedId().toString(), context);
}
public APIRequestGetInstagramContent getInstagramContent() {
return new APIRequestGetInstagramContent(this.getPrefixedId().toString(), context);
}
public APIRequestGet get() {
return new APIRequestGet(this.getPrefixedId().toString(), context);
}
public Business getFieldBusiness() {
if (mBusiness != null) {
mBusiness.context = getContext();
}
return mBusiness;
}
public String getFieldId() {
return mId;
}
public String getFieldName() {
return mName;
}
public static class APIRequestGetAppliedAdAccounts extends APIRequest {
APINodeList lastResponse = null;
@Override
public APINodeList getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
};
public static final String[] FIELDS = {
"account_id",
"account_status",
"ad_account_promotable_objects",
"age",
"agency_client_declaration",
"all_capabilities",
"amount_spent",
"attribution_spec",
"balance",
"brand_safety_content_filter_levels",
"business",
"business_city",
"business_country_code",
"business_name",
"business_state",
"business_street",
"business_street2",
"business_zip",
"capabilities",
"created_time",
"currency",
"custom_audience_info",
"default_dsa_beneficiary",
"default_dsa_payor",
"disable_reason",
"end_advertiser",
"end_advertiser_name",
"existing_customers",
"extended_credit_invoice_group",
"failed_delivery_checks",
"fb_entity",
"funding_source",
"funding_source_details",
"has_migrated_permissions",
"has_page_authorized_adaccount",
"id",
"io_number",
"is_attribution_spec_system_default",
"is_direct_deals_enabled",
"is_in_3ds_authorization_enabled_market",
"is_notifications_enabled",
"is_personal",
"is_prepay_account",
"is_tax_id_required",
"liable_address",
"line_numbers",
"media_agency",
"min_campaign_group_spend_cap",
"min_daily_budget",
"name",
"offsite_pixels_tos_accepted",
"owner",
"owner_business",
"partner",
"rf_spec",
"send_bill_to_address",
"show_checkout_experience",
"sold_to_address",
"spend_cap",
"tax_id",
"tax_id_status",
"tax_id_type",
"timezone_id",
"timezone_name",
"timezone_offset_hours_utc",
"tos_accepted",
"user_access_expire_time",
"user_tasks",
"user_tos_accepted",
"viewable_business",
};
@Override
public APINodeList parseResponse(String response, String header) throws APIException {
return AdAccount.parseResponse(response, getContext(), this, header);
}
@Override
public APINodeList execute() throws APIException {
return execute(new HashMap());
}
@Override
public APINodeList execute(Map extraParams) throws APIException {
ResponseWrapper rw = executeInternal(extraParams);
lastResponse = parseResponse(rw.getBody(),rw.getHeader());
return lastResponse;
}
public ListenableFuture> executeAsync() throws APIException {
return executeAsync(new HashMap());
};
public ListenableFuture> executeAsync(Map extraParams) throws APIException {
return Futures.transform(
executeAsyncInternal(extraParams),
new Function>() {
public APINodeList apply(ResponseWrapper result) {
try {
return APIRequestGetAppliedAdAccounts.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
public APIRequestGetAppliedAdAccounts(String nodeId, APIContext context) {
super(context, nodeId, "/applied_ad_accounts", "GET", Arrays.asList(PARAMS));
}
@Override
public APIRequestGetAppliedAdAccounts setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestGetAppliedAdAccounts setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestGetAppliedAdAccounts requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestGetAppliedAdAccounts requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetAppliedAdAccounts requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestGetAppliedAdAccounts requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetAppliedAdAccounts requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestGetAppliedAdAccounts requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
public APIRequestGetAppliedAdAccounts requestAccountIdField () {
return this.requestAccountIdField(true);
}
public APIRequestGetAppliedAdAccounts requestAccountIdField (boolean value) {
this.requestField("account_id", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestAccountStatusField () {
return this.requestAccountStatusField(true);
}
public APIRequestGetAppliedAdAccounts requestAccountStatusField (boolean value) {
this.requestField("account_status", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestAdAccountPromotableObjectsField () {
return this.requestAdAccountPromotableObjectsField(true);
}
public APIRequestGetAppliedAdAccounts requestAdAccountPromotableObjectsField (boolean value) {
this.requestField("ad_account_promotable_objects", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestAgeField () {
return this.requestAgeField(true);
}
public APIRequestGetAppliedAdAccounts requestAgeField (boolean value) {
this.requestField("age", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestAgencyClientDeclarationField () {
return this.requestAgencyClientDeclarationField(true);
}
public APIRequestGetAppliedAdAccounts requestAgencyClientDeclarationField (boolean value) {
this.requestField("agency_client_declaration", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestAllCapabilitiesField () {
return this.requestAllCapabilitiesField(true);
}
public APIRequestGetAppliedAdAccounts requestAllCapabilitiesField (boolean value) {
this.requestField("all_capabilities", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestAmountSpentField () {
return this.requestAmountSpentField(true);
}
public APIRequestGetAppliedAdAccounts requestAmountSpentField (boolean value) {
this.requestField("amount_spent", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestAttributionSpecField () {
return this.requestAttributionSpecField(true);
}
public APIRequestGetAppliedAdAccounts requestAttributionSpecField (boolean value) {
this.requestField("attribution_spec", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestBalanceField () {
return this.requestBalanceField(true);
}
public APIRequestGetAppliedAdAccounts requestBalanceField (boolean value) {
this.requestField("balance", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestBrandSafetyContentFilterLevelsField () {
return this.requestBrandSafetyContentFilterLevelsField(true);
}
public APIRequestGetAppliedAdAccounts requestBrandSafetyContentFilterLevelsField (boolean value) {
this.requestField("brand_safety_content_filter_levels", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestBusinessField () {
return this.requestBusinessField(true);
}
public APIRequestGetAppliedAdAccounts requestBusinessField (boolean value) {
this.requestField("business", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestBusinessCityField () {
return this.requestBusinessCityField(true);
}
public APIRequestGetAppliedAdAccounts requestBusinessCityField (boolean value) {
this.requestField("business_city", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestBusinessCountryCodeField () {
return this.requestBusinessCountryCodeField(true);
}
public APIRequestGetAppliedAdAccounts requestBusinessCountryCodeField (boolean value) {
this.requestField("business_country_code", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestBusinessNameField () {
return this.requestBusinessNameField(true);
}
public APIRequestGetAppliedAdAccounts requestBusinessNameField (boolean value) {
this.requestField("business_name", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestBusinessStateField () {
return this.requestBusinessStateField(true);
}
public APIRequestGetAppliedAdAccounts requestBusinessStateField (boolean value) {
this.requestField("business_state", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestBusinessStreetField () {
return this.requestBusinessStreetField(true);
}
public APIRequestGetAppliedAdAccounts requestBusinessStreetField (boolean value) {
this.requestField("business_street", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestBusinessStreet2Field () {
return this.requestBusinessStreet2Field(true);
}
public APIRequestGetAppliedAdAccounts requestBusinessStreet2Field (boolean value) {
this.requestField("business_street2", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestBusinessZipField () {
return this.requestBusinessZipField(true);
}
public APIRequestGetAppliedAdAccounts requestBusinessZipField (boolean value) {
this.requestField("business_zip", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestCapabilitiesField () {
return this.requestCapabilitiesField(true);
}
public APIRequestGetAppliedAdAccounts requestCapabilitiesField (boolean value) {
this.requestField("capabilities", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestCreatedTimeField () {
return this.requestCreatedTimeField(true);
}
public APIRequestGetAppliedAdAccounts requestCreatedTimeField (boolean value) {
this.requestField("created_time", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestCurrencyField () {
return this.requestCurrencyField(true);
}
public APIRequestGetAppliedAdAccounts requestCurrencyField (boolean value) {
this.requestField("currency", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestCustomAudienceInfoField () {
return this.requestCustomAudienceInfoField(true);
}
public APIRequestGetAppliedAdAccounts requestCustomAudienceInfoField (boolean value) {
this.requestField("custom_audience_info", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestDefaultDsaBeneficiaryField () {
return this.requestDefaultDsaBeneficiaryField(true);
}
public APIRequestGetAppliedAdAccounts requestDefaultDsaBeneficiaryField (boolean value) {
this.requestField("default_dsa_beneficiary", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestDefaultDsaPayorField () {
return this.requestDefaultDsaPayorField(true);
}
public APIRequestGetAppliedAdAccounts requestDefaultDsaPayorField (boolean value) {
this.requestField("default_dsa_payor", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestDisableReasonField () {
return this.requestDisableReasonField(true);
}
public APIRequestGetAppliedAdAccounts requestDisableReasonField (boolean value) {
this.requestField("disable_reason", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestEndAdvertiserField () {
return this.requestEndAdvertiserField(true);
}
public APIRequestGetAppliedAdAccounts requestEndAdvertiserField (boolean value) {
this.requestField("end_advertiser", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestEndAdvertiserNameField () {
return this.requestEndAdvertiserNameField(true);
}
public APIRequestGetAppliedAdAccounts requestEndAdvertiserNameField (boolean value) {
this.requestField("end_advertiser_name", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestExistingCustomersField () {
return this.requestExistingCustomersField(true);
}
public APIRequestGetAppliedAdAccounts requestExistingCustomersField (boolean value) {
this.requestField("existing_customers", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestExtendedCreditInvoiceGroupField () {
return this.requestExtendedCreditInvoiceGroupField(true);
}
public APIRequestGetAppliedAdAccounts requestExtendedCreditInvoiceGroupField (boolean value) {
this.requestField("extended_credit_invoice_group", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestFailedDeliveryChecksField () {
return this.requestFailedDeliveryChecksField(true);
}
public APIRequestGetAppliedAdAccounts requestFailedDeliveryChecksField (boolean value) {
this.requestField("failed_delivery_checks", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestFbEntityField () {
return this.requestFbEntityField(true);
}
public APIRequestGetAppliedAdAccounts requestFbEntityField (boolean value) {
this.requestField("fb_entity", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestFundingSourceField () {
return this.requestFundingSourceField(true);
}
public APIRequestGetAppliedAdAccounts requestFundingSourceField (boolean value) {
this.requestField("funding_source", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestFundingSourceDetailsField () {
return this.requestFundingSourceDetailsField(true);
}
public APIRequestGetAppliedAdAccounts requestFundingSourceDetailsField (boolean value) {
this.requestField("funding_source_details", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestHasMigratedPermissionsField () {
return this.requestHasMigratedPermissionsField(true);
}
public APIRequestGetAppliedAdAccounts requestHasMigratedPermissionsField (boolean value) {
this.requestField("has_migrated_permissions", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestHasPageAuthorizedAdaccountField () {
return this.requestHasPageAuthorizedAdaccountField(true);
}
public APIRequestGetAppliedAdAccounts requestHasPageAuthorizedAdaccountField (boolean value) {
this.requestField("has_page_authorized_adaccount", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestIdField () {
return this.requestIdField(true);
}
public APIRequestGetAppliedAdAccounts requestIdField (boolean value) {
this.requestField("id", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestIoNumberField () {
return this.requestIoNumberField(true);
}
public APIRequestGetAppliedAdAccounts requestIoNumberField (boolean value) {
this.requestField("io_number", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestIsAttributionSpecSystemDefaultField () {
return this.requestIsAttributionSpecSystemDefaultField(true);
}
public APIRequestGetAppliedAdAccounts requestIsAttributionSpecSystemDefaultField (boolean value) {
this.requestField("is_attribution_spec_system_default", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestIsDirectDealsEnabledField () {
return this.requestIsDirectDealsEnabledField(true);
}
public APIRequestGetAppliedAdAccounts requestIsDirectDealsEnabledField (boolean value) {
this.requestField("is_direct_deals_enabled", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestIsIn3dsAuthorizationEnabledMarketField () {
return this.requestIsIn3dsAuthorizationEnabledMarketField(true);
}
public APIRequestGetAppliedAdAccounts requestIsIn3dsAuthorizationEnabledMarketField (boolean value) {
this.requestField("is_in_3ds_authorization_enabled_market", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestIsNotificationsEnabledField () {
return this.requestIsNotificationsEnabledField(true);
}
public APIRequestGetAppliedAdAccounts requestIsNotificationsEnabledField (boolean value) {
this.requestField("is_notifications_enabled", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestIsPersonalField () {
return this.requestIsPersonalField(true);
}
public APIRequestGetAppliedAdAccounts requestIsPersonalField (boolean value) {
this.requestField("is_personal", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestIsPrepayAccountField () {
return this.requestIsPrepayAccountField(true);
}
public APIRequestGetAppliedAdAccounts requestIsPrepayAccountField (boolean value) {
this.requestField("is_prepay_account", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestIsTaxIdRequiredField () {
return this.requestIsTaxIdRequiredField(true);
}
public APIRequestGetAppliedAdAccounts requestIsTaxIdRequiredField (boolean value) {
this.requestField("is_tax_id_required", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestLiableAddressField () {
return this.requestLiableAddressField(true);
}
public APIRequestGetAppliedAdAccounts requestLiableAddressField (boolean value) {
this.requestField("liable_address", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestLineNumbersField () {
return this.requestLineNumbersField(true);
}
public APIRequestGetAppliedAdAccounts requestLineNumbersField (boolean value) {
this.requestField("line_numbers", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestMediaAgencyField () {
return this.requestMediaAgencyField(true);
}
public APIRequestGetAppliedAdAccounts requestMediaAgencyField (boolean value) {
this.requestField("media_agency", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestMinCampaignGroupSpendCapField () {
return this.requestMinCampaignGroupSpendCapField(true);
}
public APIRequestGetAppliedAdAccounts requestMinCampaignGroupSpendCapField (boolean value) {
this.requestField("min_campaign_group_spend_cap", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestMinDailyBudgetField () {
return this.requestMinDailyBudgetField(true);
}
public APIRequestGetAppliedAdAccounts requestMinDailyBudgetField (boolean value) {
this.requestField("min_daily_budget", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestNameField () {
return this.requestNameField(true);
}
public APIRequestGetAppliedAdAccounts requestNameField (boolean value) {
this.requestField("name", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestOffsitePixelsTosAcceptedField () {
return this.requestOffsitePixelsTosAcceptedField(true);
}
public APIRequestGetAppliedAdAccounts requestOffsitePixelsTosAcceptedField (boolean value) {
this.requestField("offsite_pixels_tos_accepted", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestOwnerField () {
return this.requestOwnerField(true);
}
public APIRequestGetAppliedAdAccounts requestOwnerField (boolean value) {
this.requestField("owner", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestOwnerBusinessField () {
return this.requestOwnerBusinessField(true);
}
public APIRequestGetAppliedAdAccounts requestOwnerBusinessField (boolean value) {
this.requestField("owner_business", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestPartnerField () {
return this.requestPartnerField(true);
}
public APIRequestGetAppliedAdAccounts requestPartnerField (boolean value) {
this.requestField("partner", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestRfSpecField () {
return this.requestRfSpecField(true);
}
public APIRequestGetAppliedAdAccounts requestRfSpecField (boolean value) {
this.requestField("rf_spec", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestSendBillToAddressField () {
return this.requestSendBillToAddressField(true);
}
public APIRequestGetAppliedAdAccounts requestSendBillToAddressField (boolean value) {
this.requestField("send_bill_to_address", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestShowCheckoutExperienceField () {
return this.requestShowCheckoutExperienceField(true);
}
public APIRequestGetAppliedAdAccounts requestShowCheckoutExperienceField (boolean value) {
this.requestField("show_checkout_experience", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestSoldToAddressField () {
return this.requestSoldToAddressField(true);
}
public APIRequestGetAppliedAdAccounts requestSoldToAddressField (boolean value) {
this.requestField("sold_to_address", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestSpendCapField () {
return this.requestSpendCapField(true);
}
public APIRequestGetAppliedAdAccounts requestSpendCapField (boolean value) {
this.requestField("spend_cap", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestTaxIdField () {
return this.requestTaxIdField(true);
}
public APIRequestGetAppliedAdAccounts requestTaxIdField (boolean value) {
this.requestField("tax_id", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestTaxIdStatusField () {
return this.requestTaxIdStatusField(true);
}
public APIRequestGetAppliedAdAccounts requestTaxIdStatusField (boolean value) {
this.requestField("tax_id_status", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestTaxIdTypeField () {
return this.requestTaxIdTypeField(true);
}
public APIRequestGetAppliedAdAccounts requestTaxIdTypeField (boolean value) {
this.requestField("tax_id_type", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestTimezoneIdField () {
return this.requestTimezoneIdField(true);
}
public APIRequestGetAppliedAdAccounts requestTimezoneIdField (boolean value) {
this.requestField("timezone_id", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestTimezoneNameField () {
return this.requestTimezoneNameField(true);
}
public APIRequestGetAppliedAdAccounts requestTimezoneNameField (boolean value) {
this.requestField("timezone_name", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestTimezoneOffsetHoursUtcField () {
return this.requestTimezoneOffsetHoursUtcField(true);
}
public APIRequestGetAppliedAdAccounts requestTimezoneOffsetHoursUtcField (boolean value) {
this.requestField("timezone_offset_hours_utc", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestTosAcceptedField () {
return this.requestTosAcceptedField(true);
}
public APIRequestGetAppliedAdAccounts requestTosAcceptedField (boolean value) {
this.requestField("tos_accepted", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestUserAccessExpireTimeField () {
return this.requestUserAccessExpireTimeField(true);
}
public APIRequestGetAppliedAdAccounts requestUserAccessExpireTimeField (boolean value) {
this.requestField("user_access_expire_time", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestUserTasksField () {
return this.requestUserTasksField(true);
}
public APIRequestGetAppliedAdAccounts requestUserTasksField (boolean value) {
this.requestField("user_tasks", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestUserTosAcceptedField () {
return this.requestUserTosAcceptedField(true);
}
public APIRequestGetAppliedAdAccounts requestUserTosAcceptedField (boolean value) {
this.requestField("user_tos_accepted", value);
return this;
}
public APIRequestGetAppliedAdAccounts requestViewableBusinessField () {
return this.requestViewableBusinessField(true);
}
public APIRequestGetAppliedAdAccounts requestViewableBusinessField (boolean value) {
this.requestField("viewable_business", value);
return this;
}
}
public static class APIRequestGetFacebookContent extends APIRequest {
APINodeList lastResponse = null;
@Override
public APINodeList getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
};
public static final String[] FIELDS = {
};
@Override
public APINodeList parseResponse(String response, String header) throws APIException {
return APINode.parseResponse(response, getContext(), this, header);
}
@Override
public APINodeList execute() throws APIException {
return execute(new HashMap());
}
@Override
public APINodeList execute(Map extraParams) throws APIException {
ResponseWrapper rw = executeInternal(extraParams);
lastResponse = parseResponse(rw.getBody(),rw.getHeader());
return lastResponse;
}
public ListenableFuture> executeAsync() throws APIException {
return executeAsync(new HashMap());
};
public ListenableFuture> executeAsync(Map extraParams) throws APIException {
return Futures.transform(
executeAsyncInternal(extraParams),
new Function>() {
public APINodeList apply(ResponseWrapper result) {
try {
return APIRequestGetFacebookContent.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
public APIRequestGetFacebookContent(String nodeId, APIContext context) {
super(context, nodeId, "/facebook_content", "GET", Arrays.asList(PARAMS));
}
@Override
public APIRequestGetFacebookContent setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestGetFacebookContent setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestGetFacebookContent requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestGetFacebookContent requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetFacebookContent requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestGetFacebookContent requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetFacebookContent requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestGetFacebookContent requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
}
public static class APIRequestGetInstagramContent extends APIRequest {
APINodeList lastResponse = null;
@Override
public APINodeList getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
};
public static final String[] FIELDS = {
"boost_eligibility_info",
"caption",
"comments_count",
"copyright_check_information",
"id",
"ig_id",
"is_comment_enabled",
"is_shared_to_feed",
"like_count",
"media_product_type",
"media_type",
"media_url",
"owner",
"permalink",
"shortcode",
"thumbnail_url",
"timestamp",
"username",
};
@Override
public APINodeList parseResponse(String response, String header) throws APIException {
return IGMedia.parseResponse(response, getContext(), this, header);
}
@Override
public APINodeList execute() throws APIException {
return execute(new HashMap());
}
@Override
public APINodeList execute(Map extraParams) throws APIException {
ResponseWrapper rw = executeInternal(extraParams);
lastResponse = parseResponse(rw.getBody(),rw.getHeader());
return lastResponse;
}
public ListenableFuture> executeAsync() throws APIException {
return executeAsync(new HashMap());
};
public ListenableFuture> executeAsync(Map extraParams) throws APIException {
return Futures.transform(
executeAsyncInternal(extraParams),
new Function>() {
public APINodeList apply(ResponseWrapper result) {
try {
return APIRequestGetInstagramContent.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
public APIRequestGetInstagramContent(String nodeId, APIContext context) {
super(context, nodeId, "/instagram_content", "GET", Arrays.asList(PARAMS));
}
@Override
public APIRequestGetInstagramContent setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestGetInstagramContent setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestGetInstagramContent requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestGetInstagramContent requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetInstagramContent requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestGetInstagramContent requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetInstagramContent requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestGetInstagramContent requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
public APIRequestGetInstagramContent requestBoostEligibilityInfoField () {
return this.requestBoostEligibilityInfoField(true);
}
public APIRequestGetInstagramContent requestBoostEligibilityInfoField (boolean value) {
this.requestField("boost_eligibility_info", value);
return this;
}
public APIRequestGetInstagramContent requestCaptionField () {
return this.requestCaptionField(true);
}
public APIRequestGetInstagramContent requestCaptionField (boolean value) {
this.requestField("caption", value);
return this;
}
public APIRequestGetInstagramContent requestCommentsCountField () {
return this.requestCommentsCountField(true);
}
public APIRequestGetInstagramContent requestCommentsCountField (boolean value) {
this.requestField("comments_count", value);
return this;
}
public APIRequestGetInstagramContent requestCopyrightCheckInformationField () {
return this.requestCopyrightCheckInformationField(true);
}
public APIRequestGetInstagramContent requestCopyrightCheckInformationField (boolean value) {
this.requestField("copyright_check_information", value);
return this;
}
public APIRequestGetInstagramContent requestIdField () {
return this.requestIdField(true);
}
public APIRequestGetInstagramContent requestIdField (boolean value) {
this.requestField("id", value);
return this;
}
public APIRequestGetInstagramContent requestIgIdField () {
return this.requestIgIdField(true);
}
public APIRequestGetInstagramContent requestIgIdField (boolean value) {
this.requestField("ig_id", value);
return this;
}
public APIRequestGetInstagramContent requestIsCommentEnabledField () {
return this.requestIsCommentEnabledField(true);
}
public APIRequestGetInstagramContent requestIsCommentEnabledField (boolean value) {
this.requestField("is_comment_enabled", value);
return this;
}
public APIRequestGetInstagramContent requestIsSharedToFeedField () {
return this.requestIsSharedToFeedField(true);
}
public APIRequestGetInstagramContent requestIsSharedToFeedField (boolean value) {
this.requestField("is_shared_to_feed", value);
return this;
}
public APIRequestGetInstagramContent requestLikeCountField () {
return this.requestLikeCountField(true);
}
public APIRequestGetInstagramContent requestLikeCountField (boolean value) {
this.requestField("like_count", value);
return this;
}
public APIRequestGetInstagramContent requestMediaProductTypeField () {
return this.requestMediaProductTypeField(true);
}
public APIRequestGetInstagramContent requestMediaProductTypeField (boolean value) {
this.requestField("media_product_type", value);
return this;
}
public APIRequestGetInstagramContent requestMediaTypeField () {
return this.requestMediaTypeField(true);
}
public APIRequestGetInstagramContent requestMediaTypeField (boolean value) {
this.requestField("media_type", value);
return this;
}
public APIRequestGetInstagramContent requestMediaUrlField () {
return this.requestMediaUrlField(true);
}
public APIRequestGetInstagramContent requestMediaUrlField (boolean value) {
this.requestField("media_url", value);
return this;
}
public APIRequestGetInstagramContent requestOwnerField () {
return this.requestOwnerField(true);
}
public APIRequestGetInstagramContent requestOwnerField (boolean value) {
this.requestField("owner", value);
return this;
}
public APIRequestGetInstagramContent requestPermalinkField () {
return this.requestPermalinkField(true);
}
public APIRequestGetInstagramContent requestPermalinkField (boolean value) {
this.requestField("permalink", value);
return this;
}
public APIRequestGetInstagramContent requestShortcodeField () {
return this.requestShortcodeField(true);
}
public APIRequestGetInstagramContent requestShortcodeField (boolean value) {
this.requestField("shortcode", value);
return this;
}
public APIRequestGetInstagramContent requestThumbnailUrlField () {
return this.requestThumbnailUrlField(true);
}
public APIRequestGetInstagramContent requestThumbnailUrlField (boolean value) {
this.requestField("thumbnail_url", value);
return this;
}
public APIRequestGetInstagramContent requestTimestampField () {
return this.requestTimestampField(true);
}
public APIRequestGetInstagramContent requestTimestampField (boolean value) {
this.requestField("timestamp", value);
return this;
}
public APIRequestGetInstagramContent requestUsernameField () {
return this.requestUsernameField(true);
}
public APIRequestGetInstagramContent requestUsernameField (boolean value) {
this.requestField("username", value);
return this;
}
}
public static class APIRequestGet extends APIRequest {
ContentBlockList lastResponse = null;
@Override
public ContentBlockList getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
};
public static final String[] FIELDS = {
"business",
"id",
"name",
};
@Override
public ContentBlockList parseResponse(String response, String header) throws APIException {
return ContentBlockList.parseResponse(response, getContext(), this, header).head();
}
@Override
public ContentBlockList execute() throws APIException {
return execute(new HashMap());
}
@Override
public ContentBlockList execute(Map extraParams) throws APIException {
ResponseWrapper rw = executeInternal(extraParams);
lastResponse = parseResponse(rw.getBody(), rw.getHeader());
return lastResponse;
}
public ListenableFuture executeAsync() throws APIException {
return executeAsync(new HashMap());
};
public ListenableFuture executeAsync(Map extraParams) throws APIException {
return Futures.transform(
executeAsyncInternal(extraParams),
new Function() {
public ContentBlockList apply(ResponseWrapper result) {
try {
return APIRequestGet.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
public APIRequestGet(String nodeId, APIContext context) {
super(context, nodeId, "/", "GET", Arrays.asList(PARAMS));
}
@Override
public APIRequestGet setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestGet setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestGet requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestGet requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGet requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestGet requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGet requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestGet requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
public APIRequestGet requestBusinessField () {
return this.requestBusinessField(true);
}
public APIRequestGet requestBusinessField (boolean value) {
this.requestField("business", value);
return this;
}
public APIRequestGet requestIdField () {
return this.requestIdField(true);
}
public APIRequestGet requestIdField (boolean value) {
this.requestField("id", value);
return this;
}
public APIRequestGet requestNameField () {
return this.requestNameField(true);
}
public APIRequestGet requestNameField (boolean value) {
this.requestField("name", value);
return this;
}
}
synchronized /*package*/ static Gson getGson() {
if (gson != null) {
return gson;
} else {
gson = new GsonBuilder()
.excludeFieldsWithModifiers(Modifier.STATIC)
.excludeFieldsWithModifiers(Modifier.PROTECTED)
.disableHtmlEscaping()
.create();
}
return gson;
}
public ContentBlockList copyFrom(ContentBlockList instance) {
this.mBusiness = instance.mBusiness;
this.mId = instance.mId;
this.mName = instance.mName;
this.context = instance.context;
this.rawValue = instance.rawValue;
return this;
}
public static APIRequest.ResponseParser getParser() {
return new APIRequest.ResponseParser() {
public APINodeList parseResponse(String response, APIContext context, APIRequest request, String header) throws MalformedResponseException {
return ContentBlockList.parseResponse(response, context, request, header);
}
};
}
}