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.EventSourceGroup 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 EventSourceGroup extends APINode {
@SerializedName("business")
private Business mBusiness = null;
@SerializedName("event_sources")
private List mEventSources = null;
@SerializedName("id")
private String mId = null;
@SerializedName("name")
private String mName = null;
@SerializedName("owner_business")
private Business mOwnerBusiness = null;
protected static Gson gson = null;
EventSourceGroup() {
}
public EventSourceGroup(Long id, APIContext context) {
this(id.toString(), context);
}
public EventSourceGroup(String id, APIContext context) {
this.mId = id;
this.context = context;
}
public EventSourceGroup fetch() throws APIException{
EventSourceGroup newInstance = fetchById(this.getPrefixedId().toString(), this.context);
this.copyFrom(newInstance);
return this;
}
public static EventSourceGroup 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 EventSourceGroup 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", EventSourceGroup.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", EventSourceGroup.getParser())
.setParam("ids", APIRequest.joinStringList(ids))
.requestFields(fields)
.executeAsyncBase();
}
private String getPrefixedId() {
return getId();
}
public String getId() {
return getFieldId().toString();
}
public static EventSourceGroup loadJSON(String json, APIContext context, String header) {
EventSourceGroup eventSourceGroup = getGson().fromJson(json, EventSourceGroup.class);
if (context.isDebug()) {
JsonParser parser = new JsonParser();
JsonElement o1 = parser.parse(json);
JsonElement o2 = parser.parse(eventSourceGroup.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);
}
}
eventSourceGroup.context = context;
eventSourceGroup.rawValue = json;
eventSourceGroup.header = header;
return eventSourceGroup;
}
public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException {
APINodeList eventSourceGroups = 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++) {
eventSourceGroups.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header));
};
return eventSourceGroups;
} 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;
eventSourceGroups.setCursors(before, after);
}
String previous = paging.has("previous") ? paging.get("previous").getAsString() : null;
String next = paging.has("next") ? paging.get("next").getAsString() : null;
eventSourceGroups.setPaging(previous, next);
if (context.hasAppSecret()) {
eventSourceGroups.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++) {
eventSourceGroups.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()) {
eventSourceGroups.add(loadJSON(entry.getValue().toString(), context, header));
}
break;
}
}
if (!isRedownload) {
eventSourceGroups.add(loadJSON(obj.toString(), context, header));
}
}
return eventSourceGroups;
} 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()) {
eventSourceGroups.add(loadJSON(entry.getValue().toString(), context, header));
}
return eventSourceGroups;
} 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)
) {
eventSourceGroups.add(loadJSON(value.toString(), context, header));
} else {
isIdIndexedArray = false;
break;
}
}
if (isIdIndexedArray) {
return eventSourceGroups;
}
// Sixth, check if it's pure JsonObject
eventSourceGroups.clear();
eventSourceGroups.add(loadJSON(json, context, header));
return eventSourceGroups;
}
}
} 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 APIRequestGetSharedAccounts getSharedAccounts() {
return new APIRequestGetSharedAccounts(this.getPrefixedId().toString(), context);
}
public APIRequestCreateSharedAccount createSharedAccount() {
return new APIRequestCreateSharedAccount(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 Business getFieldBusiness() {
if (mBusiness != null) {
mBusiness.context = getContext();
}
return mBusiness;
}
public List getFieldEventSources() {
return mEventSources;
}
public String getFieldId() {
return mId;
}
public String getFieldName() {
return mName;
}
public Business getFieldOwnerBusiness() {
if (mOwnerBusiness != null) {
mOwnerBusiness.context = getContext();
}
return mOwnerBusiness;
}
public static class APIRequestGetSharedAccounts 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 APIRequestGetSharedAccounts.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
public APIRequestGetSharedAccounts(String nodeId, APIContext context) {
super(context, nodeId, "/shared_accounts", "GET", Arrays.asList(PARAMS));
}
@Override
public APIRequestGetSharedAccounts setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestGetSharedAccounts setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestGetSharedAccounts requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestGetSharedAccounts requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetSharedAccounts requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestGetSharedAccounts requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetSharedAccounts requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestGetSharedAccounts requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
public APIRequestGetSharedAccounts requestAccountIdField () {
return this.requestAccountIdField(true);
}
public APIRequestGetSharedAccounts requestAccountIdField (boolean value) {
this.requestField("account_id", value);
return this;
}
public APIRequestGetSharedAccounts requestAccountStatusField () {
return this.requestAccountStatusField(true);
}
public APIRequestGetSharedAccounts requestAccountStatusField (boolean value) {
this.requestField("account_status", value);
return this;
}
public APIRequestGetSharedAccounts requestAdAccountPromotableObjectsField () {
return this.requestAdAccountPromotableObjectsField(true);
}
public APIRequestGetSharedAccounts requestAdAccountPromotableObjectsField (boolean value) {
this.requestField("ad_account_promotable_objects", value);
return this;
}
public APIRequestGetSharedAccounts requestAgeField () {
return this.requestAgeField(true);
}
public APIRequestGetSharedAccounts requestAgeField (boolean value) {
this.requestField("age", value);
return this;
}
public APIRequestGetSharedAccounts requestAgencyClientDeclarationField () {
return this.requestAgencyClientDeclarationField(true);
}
public APIRequestGetSharedAccounts requestAgencyClientDeclarationField (boolean value) {
this.requestField("agency_client_declaration", value);
return this;
}
public APIRequestGetSharedAccounts requestAllCapabilitiesField () {
return this.requestAllCapabilitiesField(true);
}
public APIRequestGetSharedAccounts requestAllCapabilitiesField (boolean value) {
this.requestField("all_capabilities", value);
return this;
}
public APIRequestGetSharedAccounts requestAmountSpentField () {
return this.requestAmountSpentField(true);
}
public APIRequestGetSharedAccounts requestAmountSpentField (boolean value) {
this.requestField("amount_spent", value);
return this;
}
public APIRequestGetSharedAccounts requestAttributionSpecField () {
return this.requestAttributionSpecField(true);
}
public APIRequestGetSharedAccounts requestAttributionSpecField (boolean value) {
this.requestField("attribution_spec", value);
return this;
}
public APIRequestGetSharedAccounts requestBalanceField () {
return this.requestBalanceField(true);
}
public APIRequestGetSharedAccounts requestBalanceField (boolean value) {
this.requestField("balance", value);
return this;
}
public APIRequestGetSharedAccounts requestBrandSafetyContentFilterLevelsField () {
return this.requestBrandSafetyContentFilterLevelsField(true);
}
public APIRequestGetSharedAccounts requestBrandSafetyContentFilterLevelsField (boolean value) {
this.requestField("brand_safety_content_filter_levels", value);
return this;
}
public APIRequestGetSharedAccounts requestBusinessField () {
return this.requestBusinessField(true);
}
public APIRequestGetSharedAccounts requestBusinessField (boolean value) {
this.requestField("business", value);
return this;
}
public APIRequestGetSharedAccounts requestBusinessCityField () {
return this.requestBusinessCityField(true);
}
public APIRequestGetSharedAccounts requestBusinessCityField (boolean value) {
this.requestField("business_city", value);
return this;
}
public APIRequestGetSharedAccounts requestBusinessCountryCodeField () {
return this.requestBusinessCountryCodeField(true);
}
public APIRequestGetSharedAccounts requestBusinessCountryCodeField (boolean value) {
this.requestField("business_country_code", value);
return this;
}
public APIRequestGetSharedAccounts requestBusinessNameField () {
return this.requestBusinessNameField(true);
}
public APIRequestGetSharedAccounts requestBusinessNameField (boolean value) {
this.requestField("business_name", value);
return this;
}
public APIRequestGetSharedAccounts requestBusinessStateField () {
return this.requestBusinessStateField(true);
}
public APIRequestGetSharedAccounts requestBusinessStateField (boolean value) {
this.requestField("business_state", value);
return this;
}
public APIRequestGetSharedAccounts requestBusinessStreetField () {
return this.requestBusinessStreetField(true);
}
public APIRequestGetSharedAccounts requestBusinessStreetField (boolean value) {
this.requestField("business_street", value);
return this;
}
public APIRequestGetSharedAccounts requestBusinessStreet2Field () {
return this.requestBusinessStreet2Field(true);
}
public APIRequestGetSharedAccounts requestBusinessStreet2Field (boolean value) {
this.requestField("business_street2", value);
return this;
}
public APIRequestGetSharedAccounts requestBusinessZipField () {
return this.requestBusinessZipField(true);
}
public APIRequestGetSharedAccounts requestBusinessZipField (boolean value) {
this.requestField("business_zip", value);
return this;
}
public APIRequestGetSharedAccounts requestCapabilitiesField () {
return this.requestCapabilitiesField(true);
}
public APIRequestGetSharedAccounts requestCapabilitiesField (boolean value) {
this.requestField("capabilities", value);
return this;
}
public APIRequestGetSharedAccounts requestCreatedTimeField () {
return this.requestCreatedTimeField(true);
}
public APIRequestGetSharedAccounts requestCreatedTimeField (boolean value) {
this.requestField("created_time", value);
return this;
}
public APIRequestGetSharedAccounts requestCurrencyField () {
return this.requestCurrencyField(true);
}
public APIRequestGetSharedAccounts requestCurrencyField (boolean value) {
this.requestField("currency", value);
return this;
}
public APIRequestGetSharedAccounts requestCustomAudienceInfoField () {
return this.requestCustomAudienceInfoField(true);
}
public APIRequestGetSharedAccounts requestCustomAudienceInfoField (boolean value) {
this.requestField("custom_audience_info", value);
return this;
}
public APIRequestGetSharedAccounts requestDefaultDsaBeneficiaryField () {
return this.requestDefaultDsaBeneficiaryField(true);
}
public APIRequestGetSharedAccounts requestDefaultDsaBeneficiaryField (boolean value) {
this.requestField("default_dsa_beneficiary", value);
return this;
}
public APIRequestGetSharedAccounts requestDefaultDsaPayorField () {
return this.requestDefaultDsaPayorField(true);
}
public APIRequestGetSharedAccounts requestDefaultDsaPayorField (boolean value) {
this.requestField("default_dsa_payor", value);
return this;
}
public APIRequestGetSharedAccounts requestDisableReasonField () {
return this.requestDisableReasonField(true);
}
public APIRequestGetSharedAccounts requestDisableReasonField (boolean value) {
this.requestField("disable_reason", value);
return this;
}
public APIRequestGetSharedAccounts requestEndAdvertiserField () {
return this.requestEndAdvertiserField(true);
}
public APIRequestGetSharedAccounts requestEndAdvertiserField (boolean value) {
this.requestField("end_advertiser", value);
return this;
}
public APIRequestGetSharedAccounts requestEndAdvertiserNameField () {
return this.requestEndAdvertiserNameField(true);
}
public APIRequestGetSharedAccounts requestEndAdvertiserNameField (boolean value) {
this.requestField("end_advertiser_name", value);
return this;
}
public APIRequestGetSharedAccounts requestExistingCustomersField () {
return this.requestExistingCustomersField(true);
}
public APIRequestGetSharedAccounts requestExistingCustomersField (boolean value) {
this.requestField("existing_customers", value);
return this;
}
public APIRequestGetSharedAccounts requestExtendedCreditInvoiceGroupField () {
return this.requestExtendedCreditInvoiceGroupField(true);
}
public APIRequestGetSharedAccounts requestExtendedCreditInvoiceGroupField (boolean value) {
this.requestField("extended_credit_invoice_group", value);
return this;
}
public APIRequestGetSharedAccounts requestFailedDeliveryChecksField () {
return this.requestFailedDeliveryChecksField(true);
}
public APIRequestGetSharedAccounts requestFailedDeliveryChecksField (boolean value) {
this.requestField("failed_delivery_checks", value);
return this;
}
public APIRequestGetSharedAccounts requestFbEntityField () {
return this.requestFbEntityField(true);
}
public APIRequestGetSharedAccounts requestFbEntityField (boolean value) {
this.requestField("fb_entity", value);
return this;
}
public APIRequestGetSharedAccounts requestFundingSourceField () {
return this.requestFundingSourceField(true);
}
public APIRequestGetSharedAccounts requestFundingSourceField (boolean value) {
this.requestField("funding_source", value);
return this;
}
public APIRequestGetSharedAccounts requestFundingSourceDetailsField () {
return this.requestFundingSourceDetailsField(true);
}
public APIRequestGetSharedAccounts requestFundingSourceDetailsField (boolean value) {
this.requestField("funding_source_details", value);
return this;
}
public APIRequestGetSharedAccounts requestHasMigratedPermissionsField () {
return this.requestHasMigratedPermissionsField(true);
}
public APIRequestGetSharedAccounts requestHasMigratedPermissionsField (boolean value) {
this.requestField("has_migrated_permissions", value);
return this;
}
public APIRequestGetSharedAccounts requestHasPageAuthorizedAdaccountField () {
return this.requestHasPageAuthorizedAdaccountField(true);
}
public APIRequestGetSharedAccounts requestHasPageAuthorizedAdaccountField (boolean value) {
this.requestField("has_page_authorized_adaccount", value);
return this;
}
public APIRequestGetSharedAccounts requestIdField () {
return this.requestIdField(true);
}
public APIRequestGetSharedAccounts requestIdField (boolean value) {
this.requestField("id", value);
return this;
}
public APIRequestGetSharedAccounts requestIoNumberField () {
return this.requestIoNumberField(true);
}
public APIRequestGetSharedAccounts requestIoNumberField (boolean value) {
this.requestField("io_number", value);
return this;
}
public APIRequestGetSharedAccounts requestIsAttributionSpecSystemDefaultField () {
return this.requestIsAttributionSpecSystemDefaultField(true);
}
public APIRequestGetSharedAccounts requestIsAttributionSpecSystemDefaultField (boolean value) {
this.requestField("is_attribution_spec_system_default", value);
return this;
}
public APIRequestGetSharedAccounts requestIsDirectDealsEnabledField () {
return this.requestIsDirectDealsEnabledField(true);
}
public APIRequestGetSharedAccounts requestIsDirectDealsEnabledField (boolean value) {
this.requestField("is_direct_deals_enabled", value);
return this;
}
public APIRequestGetSharedAccounts requestIsIn3dsAuthorizationEnabledMarketField () {
return this.requestIsIn3dsAuthorizationEnabledMarketField(true);
}
public APIRequestGetSharedAccounts requestIsIn3dsAuthorizationEnabledMarketField (boolean value) {
this.requestField("is_in_3ds_authorization_enabled_market", value);
return this;
}
public APIRequestGetSharedAccounts requestIsNotificationsEnabledField () {
return this.requestIsNotificationsEnabledField(true);
}
public APIRequestGetSharedAccounts requestIsNotificationsEnabledField (boolean value) {
this.requestField("is_notifications_enabled", value);
return this;
}
public APIRequestGetSharedAccounts requestIsPersonalField () {
return this.requestIsPersonalField(true);
}
public APIRequestGetSharedAccounts requestIsPersonalField (boolean value) {
this.requestField("is_personal", value);
return this;
}
public APIRequestGetSharedAccounts requestIsPrepayAccountField () {
return this.requestIsPrepayAccountField(true);
}
public APIRequestGetSharedAccounts requestIsPrepayAccountField (boolean value) {
this.requestField("is_prepay_account", value);
return this;
}
public APIRequestGetSharedAccounts requestIsTaxIdRequiredField () {
return this.requestIsTaxIdRequiredField(true);
}
public APIRequestGetSharedAccounts requestIsTaxIdRequiredField (boolean value) {
this.requestField("is_tax_id_required", value);
return this;
}
public APIRequestGetSharedAccounts requestLiableAddressField () {
return this.requestLiableAddressField(true);
}
public APIRequestGetSharedAccounts requestLiableAddressField (boolean value) {
this.requestField("liable_address", value);
return this;
}
public APIRequestGetSharedAccounts requestLineNumbersField () {
return this.requestLineNumbersField(true);
}
public APIRequestGetSharedAccounts requestLineNumbersField (boolean value) {
this.requestField("line_numbers", value);
return this;
}
public APIRequestGetSharedAccounts requestMediaAgencyField () {
return this.requestMediaAgencyField(true);
}
public APIRequestGetSharedAccounts requestMediaAgencyField (boolean value) {
this.requestField("media_agency", value);
return this;
}
public APIRequestGetSharedAccounts requestMinCampaignGroupSpendCapField () {
return this.requestMinCampaignGroupSpendCapField(true);
}
public APIRequestGetSharedAccounts requestMinCampaignGroupSpendCapField (boolean value) {
this.requestField("min_campaign_group_spend_cap", value);
return this;
}
public APIRequestGetSharedAccounts requestMinDailyBudgetField () {
return this.requestMinDailyBudgetField(true);
}
public APIRequestGetSharedAccounts requestMinDailyBudgetField (boolean value) {
this.requestField("min_daily_budget", value);
return this;
}
public APIRequestGetSharedAccounts requestNameField () {
return this.requestNameField(true);
}
public APIRequestGetSharedAccounts requestNameField (boolean value) {
this.requestField("name", value);
return this;
}
public APIRequestGetSharedAccounts requestOffsitePixelsTosAcceptedField () {
return this.requestOffsitePixelsTosAcceptedField(true);
}
public APIRequestGetSharedAccounts requestOffsitePixelsTosAcceptedField (boolean value) {
this.requestField("offsite_pixels_tos_accepted", value);
return this;
}
public APIRequestGetSharedAccounts requestOwnerField () {
return this.requestOwnerField(true);
}
public APIRequestGetSharedAccounts requestOwnerField (boolean value) {
this.requestField("owner", value);
return this;
}
public APIRequestGetSharedAccounts requestOwnerBusinessField () {
return this.requestOwnerBusinessField(true);
}
public APIRequestGetSharedAccounts requestOwnerBusinessField (boolean value) {
this.requestField("owner_business", value);
return this;
}
public APIRequestGetSharedAccounts requestPartnerField () {
return this.requestPartnerField(true);
}
public APIRequestGetSharedAccounts requestPartnerField (boolean value) {
this.requestField("partner", value);
return this;
}
public APIRequestGetSharedAccounts requestRfSpecField () {
return this.requestRfSpecField(true);
}
public APIRequestGetSharedAccounts requestRfSpecField (boolean value) {
this.requestField("rf_spec", value);
return this;
}
public APIRequestGetSharedAccounts requestSendBillToAddressField () {
return this.requestSendBillToAddressField(true);
}
public APIRequestGetSharedAccounts requestSendBillToAddressField (boolean value) {
this.requestField("send_bill_to_address", value);
return this;
}
public APIRequestGetSharedAccounts requestShowCheckoutExperienceField () {
return this.requestShowCheckoutExperienceField(true);
}
public APIRequestGetSharedAccounts requestShowCheckoutExperienceField (boolean value) {
this.requestField("show_checkout_experience", value);
return this;
}
public APIRequestGetSharedAccounts requestSoldToAddressField () {
return this.requestSoldToAddressField(true);
}
public APIRequestGetSharedAccounts requestSoldToAddressField (boolean value) {
this.requestField("sold_to_address", value);
return this;
}
public APIRequestGetSharedAccounts requestSpendCapField () {
return this.requestSpendCapField(true);
}
public APIRequestGetSharedAccounts requestSpendCapField (boolean value) {
this.requestField("spend_cap", value);
return this;
}
public APIRequestGetSharedAccounts requestTaxIdField () {
return this.requestTaxIdField(true);
}
public APIRequestGetSharedAccounts requestTaxIdField (boolean value) {
this.requestField("tax_id", value);
return this;
}
public APIRequestGetSharedAccounts requestTaxIdStatusField () {
return this.requestTaxIdStatusField(true);
}
public APIRequestGetSharedAccounts requestTaxIdStatusField (boolean value) {
this.requestField("tax_id_status", value);
return this;
}
public APIRequestGetSharedAccounts requestTaxIdTypeField () {
return this.requestTaxIdTypeField(true);
}
public APIRequestGetSharedAccounts requestTaxIdTypeField (boolean value) {
this.requestField("tax_id_type", value);
return this;
}
public APIRequestGetSharedAccounts requestTimezoneIdField () {
return this.requestTimezoneIdField(true);
}
public APIRequestGetSharedAccounts requestTimezoneIdField (boolean value) {
this.requestField("timezone_id", value);
return this;
}
public APIRequestGetSharedAccounts requestTimezoneNameField () {
return this.requestTimezoneNameField(true);
}
public APIRequestGetSharedAccounts requestTimezoneNameField (boolean value) {
this.requestField("timezone_name", value);
return this;
}
public APIRequestGetSharedAccounts requestTimezoneOffsetHoursUtcField () {
return this.requestTimezoneOffsetHoursUtcField(true);
}
public APIRequestGetSharedAccounts requestTimezoneOffsetHoursUtcField (boolean value) {
this.requestField("timezone_offset_hours_utc", value);
return this;
}
public APIRequestGetSharedAccounts requestTosAcceptedField () {
return this.requestTosAcceptedField(true);
}
public APIRequestGetSharedAccounts requestTosAcceptedField (boolean value) {
this.requestField("tos_accepted", value);
return this;
}
public APIRequestGetSharedAccounts requestUserAccessExpireTimeField () {
return this.requestUserAccessExpireTimeField(true);
}
public APIRequestGetSharedAccounts requestUserAccessExpireTimeField (boolean value) {
this.requestField("user_access_expire_time", value);
return this;
}
public APIRequestGetSharedAccounts requestUserTasksField () {
return this.requestUserTasksField(true);
}
public APIRequestGetSharedAccounts requestUserTasksField (boolean value) {
this.requestField("user_tasks", value);
return this;
}
public APIRequestGetSharedAccounts requestUserTosAcceptedField () {
return this.requestUserTosAcceptedField(true);
}
public APIRequestGetSharedAccounts requestUserTosAcceptedField (boolean value) {
this.requestField("user_tos_accepted", value);
return this;
}
public APIRequestGetSharedAccounts requestViewableBusinessField () {
return this.requestViewableBusinessField(true);
}
public APIRequestGetSharedAccounts requestViewableBusinessField (boolean value) {
this.requestField("viewable_business", value);
return this;
}
}
public static class APIRequestCreateSharedAccount extends APIRequest {
EventSourceGroup lastResponse = null;
@Override
public EventSourceGroup getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"accounts",
};
public static final String[] FIELDS = {
};
@Override
public EventSourceGroup parseResponse(String response, String header) throws APIException {
return EventSourceGroup.parseResponse(response, getContext(), this, header).head();
}
@Override
public EventSourceGroup execute() throws APIException {
return execute(new HashMap());
}
@Override
public EventSourceGroup 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 EventSourceGroup apply(ResponseWrapper result) {
try {
return APIRequestCreateSharedAccount.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
public APIRequestCreateSharedAccount(String nodeId, APIContext context) {
super(context, nodeId, "/shared_accounts", "POST", Arrays.asList(PARAMS));
}
@Override
public APIRequestCreateSharedAccount setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestCreateSharedAccount setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestCreateSharedAccount setAccounts (List accounts) {
this.setParam("accounts", accounts);
return this;
}
public APIRequestCreateSharedAccount setAccounts (String accounts) {
this.setParam("accounts", accounts);
return this;
}
public APIRequestCreateSharedAccount requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestCreateSharedAccount requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestCreateSharedAccount requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestCreateSharedAccount requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestCreateSharedAccount requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestCreateSharedAccount requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
}
public static class APIRequestGet extends APIRequest {
EventSourceGroup lastResponse = null;
@Override
public EventSourceGroup getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
};
public static final String[] FIELDS = {
"business",
"event_sources",
"id",
"name",
"owner_business",
};
@Override
public EventSourceGroup parseResponse(String response, String header) throws APIException {
return EventSourceGroup.parseResponse(response, getContext(), this, header).head();
}
@Override
public EventSourceGroup execute() throws APIException {
return execute(new HashMap());
}
@Override
public EventSourceGroup 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 EventSourceGroup 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 requestEventSourcesField () {
return this.requestEventSourcesField(true);
}
public APIRequestGet requestEventSourcesField (boolean value) {
this.requestField("event_sources", 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;
}
public APIRequestGet requestOwnerBusinessField () {
return this.requestOwnerBusinessField(true);
}
public APIRequestGet requestOwnerBusinessField (boolean value) {
this.requestField("owner_business", value);
return this;
}
}
public static class APIRequestUpdate extends APIRequest {
EventSourceGroup lastResponse = null;
@Override
public EventSourceGroup getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"event_sources",
"name",
};
public static final String[] FIELDS = {
};
@Override
public EventSourceGroup parseResponse(String response, String header) throws APIException {
return EventSourceGroup.parseResponse(response, getContext(), this, header).head();
}
@Override
public EventSourceGroup execute() throws APIException {
return execute(new HashMap());
}
@Override
public EventSourceGroup 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 EventSourceGroup apply(ResponseWrapper result) {
try {
return APIRequestUpdate.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
public APIRequestUpdate(String nodeId, APIContext context) {
super(context, nodeId, "/", "POST", Arrays.asList(PARAMS));
}
@Override
public APIRequestUpdate setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestUpdate setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestUpdate setEventSources (List eventSources) {
this.setParam("event_sources", eventSources);
return this;
}
public APIRequestUpdate setEventSources (String eventSources) {
this.setParam("event_sources", eventSources);
return this;
}
public APIRequestUpdate setName (String name) {
this.setParam("name", name);
return this;
}
public APIRequestUpdate requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestUpdate requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestUpdate requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestUpdate requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestUpdate requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestUpdate requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
}
synchronized /*package*/ static Gson getGson() {
if (gson != null) {
return gson;
} else {
gson = new GsonBuilder()
.excludeFieldsWithModifiers(Modifier.STATIC)
.excludeFieldsWithModifiers(Modifier.PROTECTED)
.disableHtmlEscaping()
.create();
}
return gson;
}
public EventSourceGroup copyFrom(EventSourceGroup instance) {
this.mBusiness = instance.mBusiness;
this.mEventSources = instance.mEventSources;
this.mId = instance.mId;
this.mName = instance.mName;
this.mOwnerBusiness = instance.mOwnerBusiness;
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 EventSourceGroup.parseResponse(response, context, request, header);
}
};
}
}