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.OfflineConversionDataSet Maven / Gradle / Ivy
/**
* 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.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.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 OfflineConversionDataSet extends APINode {
@SerializedName("attribute_stats")
private String mAttributeStats = null;
@SerializedName("business")
private Business mBusiness = null;
@SerializedName("config")
private String mConfig = null;
@SerializedName("creation_time")
private String mCreationTime = null;
@SerializedName("description")
private String mDescription = null;
@SerializedName("duplicate_entries")
private Long mDuplicateEntries = null;
@SerializedName("enable_auto_assign_to_accounts")
private Boolean mEnableAutoAssignToAccounts = null;
@SerializedName("event_stats")
private String mEventStats = null;
@SerializedName("event_time_max")
private Long mEventTimeMax = null;
@SerializedName("event_time_min")
private Long mEventTimeMin = null;
@SerializedName("id")
private String mId = null;
@SerializedName("is_restricted_use")
private Boolean mIsRestrictedUse = null;
@SerializedName("last_upload_app")
private String mLastUploadApp = null;
@SerializedName("matched_entries")
private Long mMatchedEntries = null;
@SerializedName("matched_unique_users")
private Long mMatchedUniqueUsers = null;
@SerializedName("name")
private String mName = null;
@SerializedName("usage")
private Object mUsage = null;
@SerializedName("valid_entries")
private Long mValidEntries = null;
protected static Gson gson = null;
OfflineConversionDataSet() {
}
public OfflineConversionDataSet(Long id, APIContext context) {
this(id.toString(), context);
}
public OfflineConversionDataSet(String id, APIContext context) {
this.mId = id;
this.context = context;
}
public OfflineConversionDataSet fetch() throws APIException{
OfflineConversionDataSet newInstance = fetchById(this.getPrefixedId().toString(), this.context);
this.copyFrom(newInstance);
return this;
}
public static OfflineConversionDataSet fetchById(Long id, APIContext context) throws APIException {
return fetchById(id.toString(), context);
}
public static OfflineConversionDataSet fetchById(String id, APIContext context) throws APIException {
OfflineConversionDataSet offlineConversionDataSet =
new APIRequestGet(id, context)
.requestAllFields()
.execute();
return offlineConversionDataSet;
}
public static APINodeList fetchByIds(List ids, List fields, APIContext context) throws APIException {
return (APINodeList)(
new APIRequest(context, "", "/", "GET", OfflineConversionDataSet.getParser())
.setParam("ids", APIRequest.joinStringList(ids))
.requestFields(fields)
.execute()
);
}
private String getPrefixedId() {
return getId();
}
public String getId() {
return getFieldId().toString();
}
public static OfflineConversionDataSet loadJSON(String json, APIContext context) {
OfflineConversionDataSet offlineConversionDataSet = getGson().fromJson(json, OfflineConversionDataSet.class);
if (context.isDebug()) {
JsonParser parser = new JsonParser();
JsonElement o1 = parser.parse(json);
JsonElement o2 = parser.parse(offlineConversionDataSet.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);
};
}
offlineConversionDataSet.context = context;
offlineConversionDataSet.rawValue = json;
return offlineConversionDataSet;
}
public static APINodeList parseResponse(String json, APIContext context, APIRequest request) throws MalformedResponseException {
APINodeList offlineConversionDataSets = new APINodeList(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++) {
offlineConversionDataSets.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context));
};
return offlineConversionDataSets;
} 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;
offlineConversionDataSets.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++) {
offlineConversionDataSets.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 entry : obj.entrySet()) {
offlineConversionDataSets.add(loadJSON(entry.getValue().toString(), context));
}
break;
}
}
if (!isRedownload) {
offlineConversionDataSets.add(loadJSON(obj.toString(), context));
}
}
return offlineConversionDataSets;
} 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()) {
offlineConversionDataSets.add(loadJSON(entry.getValue().toString(), context));
}
return offlineConversionDataSets;
} 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)
) {
offlineConversionDataSets.add(loadJSON(value.toString(), context));
} else {
isIdIndexedArray = false;
break;
}
}
if (isIdIndexedArray) {
return offlineConversionDataSets;
}
// Sixth, check if it's pure JsonObject
offlineConversionDataSets.clear();
offlineConversionDataSets.add(loadJSON(json, context));
return offlineConversionDataSets;
}
}
} 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 APIRequestGetActivities getActivities() {
return new APIRequestGetActivities(this.getPrefixedId().toString(), context);
}
public APIRequestGetAdAccounts getAdAccounts() {
return new APIRequestGetAdAccounts(this.getPrefixedId().toString(), context);
}
public APIRequestCreateAdAccount createAdAccount() {
return new APIRequestCreateAdAccount(this.getPrefixedId().toString(), context);
}
public APIRequestCreateEvent createEvent() {
return new APIRequestCreateEvent(this.getPrefixedId().toString(), context);
}
public APIRequestGetStats getStats() {
return new APIRequestGetStats(this.getPrefixedId().toString(), context);
}
public APIRequestGetUploads getUploads() {
return new APIRequestGetUploads(this.getPrefixedId().toString(), context);
}
public APIRequestGet get() {
return new APIRequestGet(this.getPrefixedId().toString(), context);
}
public String getFieldAttributeStats() {
return mAttributeStats;
}
public Business getFieldBusiness() {
if (mBusiness != null) {
mBusiness.context = getContext();
}
return mBusiness;
}
public String getFieldConfig() {
return mConfig;
}
public String getFieldCreationTime() {
return mCreationTime;
}
public String getFieldDescription() {
return mDescription;
}
public Long getFieldDuplicateEntries() {
return mDuplicateEntries;
}
public Boolean getFieldEnableAutoAssignToAccounts() {
return mEnableAutoAssignToAccounts;
}
public String getFieldEventStats() {
return mEventStats;
}
public Long getFieldEventTimeMax() {
return mEventTimeMax;
}
public Long getFieldEventTimeMin() {
return mEventTimeMin;
}
public String getFieldId() {
return mId;
}
public Boolean getFieldIsRestrictedUse() {
return mIsRestrictedUse;
}
public String getFieldLastUploadApp() {
return mLastUploadApp;
}
public Long getFieldMatchedEntries() {
return mMatchedEntries;
}
public Long getFieldMatchedUniqueUsers() {
return mMatchedUniqueUsers;
}
public String getFieldName() {
return mName;
}
public Object getFieldUsage() {
return mUsage;
}
public Long getFieldValidEntries() {
return mValidEntries;
}
public static class APIRequestGetActivities extends APIRequest {
APINodeList lastResponse = null;
@Override
public APINodeList getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"business_id",
"end_time",
"event_type",
"start_time",
};
public static final String[] FIELDS = {
};
@Override
public APINodeList parseResponse(String response) throws APIException {
return APINode.parseResponse(response, getContext(), this);
}
@Override
public APINodeList execute() throws APIException {
return execute(new HashMap());
}
@Override
public APINodeList execute(Map extraParams) throws APIException {
lastResponse = parseResponse(executeInternal(extraParams));
return lastResponse;
}
public APIRequestGetActivities(String nodeId, APIContext context) {
super(context, nodeId, "/activities", "GET", Arrays.asList(PARAMS));
}
@Override
public APIRequestGetActivities setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestGetActivities setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestGetActivities setBusinessId (String businessId) {
this.setParam("business_id", businessId);
return this;
}
public APIRequestGetActivities setEndTime (String endTime) {
this.setParam("end_time", endTime);
return this;
}
public APIRequestGetActivities setEventType (EnumEventType eventType) {
this.setParam("event_type", eventType);
return this;
}
public APIRequestGetActivities setEventType (String eventType) {
this.setParam("event_type", eventType);
return this;
}
public APIRequestGetActivities setStartTime (String startTime) {
this.setParam("start_time", startTime);
return this;
}
public APIRequestGetActivities requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestGetActivities requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetActivities requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestGetActivities requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetActivities requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestGetActivities requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
}
public static class APIRequestGetAdAccounts extends APIRequest {
APINodeList lastResponse = null;
@Override
public APINodeList getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"business",
};
public static final String[] FIELDS = {
"account_id",
"account_status",
"age",
"agency_client_declaration",
"amount_spent",
"attribution_spec",
"balance",
"business",
"business_city",
"business_country_code",
"business_name",
"business_state",
"business_street",
"business_street2",
"business_zip",
"capabilities",
"created_time",
"currency",
"disable_reason",
"end_advertiser",
"end_advertiser_name",
"failed_delivery_checks",
"funding_source",
"funding_source_details",
"has_migrated_permissions",
"id",
"io_number",
"is_attribution_spec_system_default",
"is_direct_deals_enabled",
"is_notifications_enabled",
"is_personal",
"is_prepay_account",
"is_tax_id_required",
"line_numbers",
"media_agency",
"min_campaign_group_spend_cap",
"min_daily_budget",
"name",
"next_bill_date",
"offsite_pixels_tos_accepted",
"owner",
"partner",
"rf_spec",
"salesforce_invoice_group_id",
"show_checkout_experience",
"spend_cap",
"tax_id",
"tax_id_status",
"tax_id_type",
"timezone_id",
"timezone_name",
"timezone_offset_hours_utc",
"tos_accepted",
"user_role",
};
@Override
public APINodeList parseResponse(String response) throws APIException {
return AdAccount.parseResponse(response, getContext(), this);
}
@Override
public APINodeList execute() throws APIException {
return execute(new HashMap());
}
@Override
public APINodeList execute(Map extraParams) throws APIException {
lastResponse = parseResponse(executeInternal(extraParams));
return lastResponse;
}
public APIRequestGetAdAccounts(String nodeId, APIContext context) {
super(context, nodeId, "/adaccounts", "GET", Arrays.asList(PARAMS));
}
@Override
public APIRequestGetAdAccounts setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestGetAdAccounts setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestGetAdAccounts setBusiness (String business) {
this.setParam("business", business);
return this;
}
public APIRequestGetAdAccounts requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestGetAdAccounts requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetAdAccounts requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestGetAdAccounts requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetAdAccounts requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestGetAdAccounts requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
public APIRequestGetAdAccounts requestAccountIdField () {
return this.requestAccountIdField(true);
}
public APIRequestGetAdAccounts requestAccountIdField (boolean value) {
this.requestField("account_id", value);
return this;
}
public APIRequestGetAdAccounts requestAccountStatusField () {
return this.requestAccountStatusField(true);
}
public APIRequestGetAdAccounts requestAccountStatusField (boolean value) {
this.requestField("account_status", value);
return this;
}
public APIRequestGetAdAccounts requestAgeField () {
return this.requestAgeField(true);
}
public APIRequestGetAdAccounts requestAgeField (boolean value) {
this.requestField("age", value);
return this;
}
public APIRequestGetAdAccounts requestAgencyClientDeclarationField () {
return this.requestAgencyClientDeclarationField(true);
}
public APIRequestGetAdAccounts requestAgencyClientDeclarationField (boolean value) {
this.requestField("agency_client_declaration", value);
return this;
}
public APIRequestGetAdAccounts requestAmountSpentField () {
return this.requestAmountSpentField(true);
}
public APIRequestGetAdAccounts requestAmountSpentField (boolean value) {
this.requestField("amount_spent", value);
return this;
}
public APIRequestGetAdAccounts requestAttributionSpecField () {
return this.requestAttributionSpecField(true);
}
public APIRequestGetAdAccounts requestAttributionSpecField (boolean value) {
this.requestField("attribution_spec", value);
return this;
}
public APIRequestGetAdAccounts requestBalanceField () {
return this.requestBalanceField(true);
}
public APIRequestGetAdAccounts requestBalanceField (boolean value) {
this.requestField("balance", value);
return this;
}
public APIRequestGetAdAccounts requestBusinessField () {
return this.requestBusinessField(true);
}
public APIRequestGetAdAccounts requestBusinessField (boolean value) {
this.requestField("business", value);
return this;
}
public APIRequestGetAdAccounts requestBusinessCityField () {
return this.requestBusinessCityField(true);
}
public APIRequestGetAdAccounts requestBusinessCityField (boolean value) {
this.requestField("business_city", value);
return this;
}
public APIRequestGetAdAccounts requestBusinessCountryCodeField () {
return this.requestBusinessCountryCodeField(true);
}
public APIRequestGetAdAccounts requestBusinessCountryCodeField (boolean value) {
this.requestField("business_country_code", value);
return this;
}
public APIRequestGetAdAccounts requestBusinessNameField () {
return this.requestBusinessNameField(true);
}
public APIRequestGetAdAccounts requestBusinessNameField (boolean value) {
this.requestField("business_name", value);
return this;
}
public APIRequestGetAdAccounts requestBusinessStateField () {
return this.requestBusinessStateField(true);
}
public APIRequestGetAdAccounts requestBusinessStateField (boolean value) {
this.requestField("business_state", value);
return this;
}
public APIRequestGetAdAccounts requestBusinessStreetField () {
return this.requestBusinessStreetField(true);
}
public APIRequestGetAdAccounts requestBusinessStreetField (boolean value) {
this.requestField("business_street", value);
return this;
}
public APIRequestGetAdAccounts requestBusinessStreet2Field () {
return this.requestBusinessStreet2Field(true);
}
public APIRequestGetAdAccounts requestBusinessStreet2Field (boolean value) {
this.requestField("business_street2", value);
return this;
}
public APIRequestGetAdAccounts requestBusinessZipField () {
return this.requestBusinessZipField(true);
}
public APIRequestGetAdAccounts requestBusinessZipField (boolean value) {
this.requestField("business_zip", value);
return this;
}
public APIRequestGetAdAccounts requestCapabilitiesField () {
return this.requestCapabilitiesField(true);
}
public APIRequestGetAdAccounts requestCapabilitiesField (boolean value) {
this.requestField("capabilities", value);
return this;
}
public APIRequestGetAdAccounts requestCreatedTimeField () {
return this.requestCreatedTimeField(true);
}
public APIRequestGetAdAccounts requestCreatedTimeField (boolean value) {
this.requestField("created_time", value);
return this;
}
public APIRequestGetAdAccounts requestCurrencyField () {
return this.requestCurrencyField(true);
}
public APIRequestGetAdAccounts requestCurrencyField (boolean value) {
this.requestField("currency", value);
return this;
}
public APIRequestGetAdAccounts requestDisableReasonField () {
return this.requestDisableReasonField(true);
}
public APIRequestGetAdAccounts requestDisableReasonField (boolean value) {
this.requestField("disable_reason", value);
return this;
}
public APIRequestGetAdAccounts requestEndAdvertiserField () {
return this.requestEndAdvertiserField(true);
}
public APIRequestGetAdAccounts requestEndAdvertiserField (boolean value) {
this.requestField("end_advertiser", value);
return this;
}
public APIRequestGetAdAccounts requestEndAdvertiserNameField () {
return this.requestEndAdvertiserNameField(true);
}
public APIRequestGetAdAccounts requestEndAdvertiserNameField (boolean value) {
this.requestField("end_advertiser_name", value);
return this;
}
public APIRequestGetAdAccounts requestFailedDeliveryChecksField () {
return this.requestFailedDeliveryChecksField(true);
}
public APIRequestGetAdAccounts requestFailedDeliveryChecksField (boolean value) {
this.requestField("failed_delivery_checks", value);
return this;
}
public APIRequestGetAdAccounts requestFundingSourceField () {
return this.requestFundingSourceField(true);
}
public APIRequestGetAdAccounts requestFundingSourceField (boolean value) {
this.requestField("funding_source", value);
return this;
}
public APIRequestGetAdAccounts requestFundingSourceDetailsField () {
return this.requestFundingSourceDetailsField(true);
}
public APIRequestGetAdAccounts requestFundingSourceDetailsField (boolean value) {
this.requestField("funding_source_details", value);
return this;
}
public APIRequestGetAdAccounts requestHasMigratedPermissionsField () {
return this.requestHasMigratedPermissionsField(true);
}
public APIRequestGetAdAccounts requestHasMigratedPermissionsField (boolean value) {
this.requestField("has_migrated_permissions", value);
return this;
}
public APIRequestGetAdAccounts requestIdField () {
return this.requestIdField(true);
}
public APIRequestGetAdAccounts requestIdField (boolean value) {
this.requestField("id", value);
return this;
}
public APIRequestGetAdAccounts requestIoNumberField () {
return this.requestIoNumberField(true);
}
public APIRequestGetAdAccounts requestIoNumberField (boolean value) {
this.requestField("io_number", value);
return this;
}
public APIRequestGetAdAccounts requestIsAttributionSpecSystemDefaultField () {
return this.requestIsAttributionSpecSystemDefaultField(true);
}
public APIRequestGetAdAccounts requestIsAttributionSpecSystemDefaultField (boolean value) {
this.requestField("is_attribution_spec_system_default", value);
return this;
}
public APIRequestGetAdAccounts requestIsDirectDealsEnabledField () {
return this.requestIsDirectDealsEnabledField(true);
}
public APIRequestGetAdAccounts requestIsDirectDealsEnabledField (boolean value) {
this.requestField("is_direct_deals_enabled", value);
return this;
}
public APIRequestGetAdAccounts requestIsNotificationsEnabledField () {
return this.requestIsNotificationsEnabledField(true);
}
public APIRequestGetAdAccounts requestIsNotificationsEnabledField (boolean value) {
this.requestField("is_notifications_enabled", value);
return this;
}
public APIRequestGetAdAccounts requestIsPersonalField () {
return this.requestIsPersonalField(true);
}
public APIRequestGetAdAccounts requestIsPersonalField (boolean value) {
this.requestField("is_personal", value);
return this;
}
public APIRequestGetAdAccounts requestIsPrepayAccountField () {
return this.requestIsPrepayAccountField(true);
}
public APIRequestGetAdAccounts requestIsPrepayAccountField (boolean value) {
this.requestField("is_prepay_account", value);
return this;
}
public APIRequestGetAdAccounts requestIsTaxIdRequiredField () {
return this.requestIsTaxIdRequiredField(true);
}
public APIRequestGetAdAccounts requestIsTaxIdRequiredField (boolean value) {
this.requestField("is_tax_id_required", value);
return this;
}
public APIRequestGetAdAccounts requestLineNumbersField () {
return this.requestLineNumbersField(true);
}
public APIRequestGetAdAccounts requestLineNumbersField (boolean value) {
this.requestField("line_numbers", value);
return this;
}
public APIRequestGetAdAccounts requestMediaAgencyField () {
return this.requestMediaAgencyField(true);
}
public APIRequestGetAdAccounts requestMediaAgencyField (boolean value) {
this.requestField("media_agency", value);
return this;
}
public APIRequestGetAdAccounts requestMinCampaignGroupSpendCapField () {
return this.requestMinCampaignGroupSpendCapField(true);
}
public APIRequestGetAdAccounts requestMinCampaignGroupSpendCapField (boolean value) {
this.requestField("min_campaign_group_spend_cap", value);
return this;
}
public APIRequestGetAdAccounts requestMinDailyBudgetField () {
return this.requestMinDailyBudgetField(true);
}
public APIRequestGetAdAccounts requestMinDailyBudgetField (boolean value) {
this.requestField("min_daily_budget", value);
return this;
}
public APIRequestGetAdAccounts requestNameField () {
return this.requestNameField(true);
}
public APIRequestGetAdAccounts requestNameField (boolean value) {
this.requestField("name", value);
return this;
}
public APIRequestGetAdAccounts requestNextBillDateField () {
return this.requestNextBillDateField(true);
}
public APIRequestGetAdAccounts requestNextBillDateField (boolean value) {
this.requestField("next_bill_date", value);
return this;
}
public APIRequestGetAdAccounts requestOffsitePixelsTosAcceptedField () {
return this.requestOffsitePixelsTosAcceptedField(true);
}
public APIRequestGetAdAccounts requestOffsitePixelsTosAcceptedField (boolean value) {
this.requestField("offsite_pixels_tos_accepted", value);
return this;
}
public APIRequestGetAdAccounts requestOwnerField () {
return this.requestOwnerField(true);
}
public APIRequestGetAdAccounts requestOwnerField (boolean value) {
this.requestField("owner", value);
return this;
}
public APIRequestGetAdAccounts requestPartnerField () {
return this.requestPartnerField(true);
}
public APIRequestGetAdAccounts requestPartnerField (boolean value) {
this.requestField("partner", value);
return this;
}
public APIRequestGetAdAccounts requestRfSpecField () {
return this.requestRfSpecField(true);
}
public APIRequestGetAdAccounts requestRfSpecField (boolean value) {
this.requestField("rf_spec", value);
return this;
}
public APIRequestGetAdAccounts requestSalesforceInvoiceGroupIdField () {
return this.requestSalesforceInvoiceGroupIdField(true);
}
public APIRequestGetAdAccounts requestSalesforceInvoiceGroupIdField (boolean value) {
this.requestField("salesforce_invoice_group_id", value);
return this;
}
public APIRequestGetAdAccounts requestShowCheckoutExperienceField () {
return this.requestShowCheckoutExperienceField(true);
}
public APIRequestGetAdAccounts requestShowCheckoutExperienceField (boolean value) {
this.requestField("show_checkout_experience", value);
return this;
}
public APIRequestGetAdAccounts requestSpendCapField () {
return this.requestSpendCapField(true);
}
public APIRequestGetAdAccounts requestSpendCapField (boolean value) {
this.requestField("spend_cap", value);
return this;
}
public APIRequestGetAdAccounts requestTaxIdField () {
return this.requestTaxIdField(true);
}
public APIRequestGetAdAccounts requestTaxIdField (boolean value) {
this.requestField("tax_id", value);
return this;
}
public APIRequestGetAdAccounts requestTaxIdStatusField () {
return this.requestTaxIdStatusField(true);
}
public APIRequestGetAdAccounts requestTaxIdStatusField (boolean value) {
this.requestField("tax_id_status", value);
return this;
}
public APIRequestGetAdAccounts requestTaxIdTypeField () {
return this.requestTaxIdTypeField(true);
}
public APIRequestGetAdAccounts requestTaxIdTypeField (boolean value) {
this.requestField("tax_id_type", value);
return this;
}
public APIRequestGetAdAccounts requestTimezoneIdField () {
return this.requestTimezoneIdField(true);
}
public APIRequestGetAdAccounts requestTimezoneIdField (boolean value) {
this.requestField("timezone_id", value);
return this;
}
public APIRequestGetAdAccounts requestTimezoneNameField () {
return this.requestTimezoneNameField(true);
}
public APIRequestGetAdAccounts requestTimezoneNameField (boolean value) {
this.requestField("timezone_name", value);
return this;
}
public APIRequestGetAdAccounts requestTimezoneOffsetHoursUtcField () {
return this.requestTimezoneOffsetHoursUtcField(true);
}
public APIRequestGetAdAccounts requestTimezoneOffsetHoursUtcField (boolean value) {
this.requestField("timezone_offset_hours_utc", value);
return this;
}
public APIRequestGetAdAccounts requestTosAcceptedField () {
return this.requestTosAcceptedField(true);
}
public APIRequestGetAdAccounts requestTosAcceptedField (boolean value) {
this.requestField("tos_accepted", value);
return this;
}
public APIRequestGetAdAccounts requestUserRoleField () {
return this.requestUserRoleField(true);
}
public APIRequestGetAdAccounts requestUserRoleField (boolean value) {
this.requestField("user_role", value);
return this;
}
}
public static class APIRequestCreateAdAccount extends APIRequest {
APINode lastResponse = null;
@Override
public APINode getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"account_id",
"auto_track_for_ads",
"business",
};
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());
}
@Override
public APINode execute(Map extraParams) throws APIException {
lastResponse = parseResponse(executeInternal(extraParams));
return lastResponse;
}
public APIRequestCreateAdAccount(String nodeId, APIContext context) {
super(context, nodeId, "/adaccounts", "POST", Arrays.asList(PARAMS));
}
@Override
public APIRequestCreateAdAccount setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestCreateAdAccount setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestCreateAdAccount setAccountId (String accountId) {
this.setParam("account_id", accountId);
return this;
}
public APIRequestCreateAdAccount setAutoTrackForAds (Boolean autoTrackForAds) {
this.setParam("auto_track_for_ads", autoTrackForAds);
return this;
}
public APIRequestCreateAdAccount setAutoTrackForAds (String autoTrackForAds) {
this.setParam("auto_track_for_ads", autoTrackForAds);
return this;
}
public APIRequestCreateAdAccount setBusiness (String business) {
this.setParam("business", business);
return this;
}
public APIRequestCreateAdAccount requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestCreateAdAccount requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestCreateAdAccount requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestCreateAdAccount requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestCreateAdAccount requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestCreateAdAccount requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
}
public static class APIRequestCreateEvent extends APIRequest {
APINode lastResponse = null;
@Override
public APINode getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"data",
"namespace_id",
"progress",
"upload_id",
"upload_tag",
};
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());
}
@Override
public APINode execute(Map extraParams) throws APIException {
lastResponse = parseResponse(executeInternal(extraParams));
return lastResponse;
}
public APIRequestCreateEvent(String nodeId, APIContext context) {
super(context, nodeId, "/events", "POST", Arrays.asList(PARAMS));
}
@Override
public APIRequestCreateEvent setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestCreateEvent setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestCreateEvent setData (List data) {
this.setParam("data", data);
return this;
}
public APIRequestCreateEvent setData (String data) {
this.setParam("data", data);
return this;
}
public APIRequestCreateEvent setNamespaceId (String namespaceId) {
this.setParam("namespace_id", namespaceId);
return this;
}
public APIRequestCreateEvent setProgress (Object progress) {
this.setParam("progress", progress);
return this;
}
public APIRequestCreateEvent setProgress (String progress) {
this.setParam("progress", progress);
return this;
}
public APIRequestCreateEvent setUploadId (String uploadId) {
this.setParam("upload_id", uploadId);
return this;
}
public APIRequestCreateEvent setUploadTag (String uploadTag) {
this.setParam("upload_tag", uploadTag);
return this;
}
public APIRequestCreateEvent requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestCreateEvent requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestCreateEvent requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestCreateEvent requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestCreateEvent requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestCreateEvent requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
}
public static class APIRequestGetStats extends APIRequest {
APINodeList lastResponse = null;
@Override
public APINodeList getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"aggr_time",
"end",
"skip_empty_values",
"start",
"user_timezone_id",
};
public static final String[] FIELDS = {
};
@Override
public APINodeList parseResponse(String response) throws APIException {
return APINode.parseResponse(response, getContext(), this);
}
@Override
public APINodeList execute() throws APIException {
return execute(new HashMap());
}
@Override
public APINodeList execute(Map extraParams) throws APIException {
lastResponse = parseResponse(executeInternal(extraParams));
return lastResponse;
}
public APIRequestGetStats(String nodeId, APIContext context) {
super(context, nodeId, "/stats", "GET", Arrays.asList(PARAMS));
}
@Override
public APIRequestGetStats setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestGetStats setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestGetStats setAggrTime (EnumAggrTime aggrTime) {
this.setParam("aggr_time", aggrTime);
return this;
}
public APIRequestGetStats setAggrTime (String aggrTime) {
this.setParam("aggr_time", aggrTime);
return this;
}
public APIRequestGetStats setEnd (Long end) {
this.setParam("end", end);
return this;
}
public APIRequestGetStats setEnd (String end) {
this.setParam("end", end);
return this;
}
public APIRequestGetStats setSkipEmptyValues (Boolean skipEmptyValues) {
this.setParam("skip_empty_values", skipEmptyValues);
return this;
}
public APIRequestGetStats setSkipEmptyValues (String skipEmptyValues) {
this.setParam("skip_empty_values", skipEmptyValues);
return this;
}
public APIRequestGetStats setStart (Long start) {
this.setParam("start", start);
return this;
}
public APIRequestGetStats setStart (String start) {
this.setParam("start", start);
return this;
}
public APIRequestGetStats setUserTimezoneId (Long userTimezoneId) {
this.setParam("user_timezone_id", userTimezoneId);
return this;
}
public APIRequestGetStats setUserTimezoneId (String userTimezoneId) {
this.setParam("user_timezone_id", userTimezoneId);
return this;
}
public APIRequestGetStats requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestGetStats requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetStats requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestGetStats requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetStats requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestGetStats requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
}
public static class APIRequestGetUploads extends APIRequest {
APINodeList lastResponse = null;
@Override
public APINodeList getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"upload_tag",
};
public static final String[] FIELDS = {
};
@Override
public APINodeList parseResponse(String response) throws APIException {
return APINode.parseResponse(response, getContext(), this);
}
@Override
public APINodeList execute() throws APIException {
return execute(new HashMap());
}
@Override
public APINodeList execute(Map extraParams) throws APIException {
lastResponse = parseResponse(executeInternal(extraParams));
return lastResponse;
}
public APIRequestGetUploads(String nodeId, APIContext context) {
super(context, nodeId, "/uploads", "GET", Arrays.asList(PARAMS));
}
@Override
public APIRequestGetUploads setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestGetUploads setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestGetUploads setUploadTag (String uploadTag) {
this.setParam("upload_tag", uploadTag);
return this;
}
public APIRequestGetUploads requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestGetUploads requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetUploads requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestGetUploads requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetUploads requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestGetUploads requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
}
public static class APIRequestGet extends APIRequest {
OfflineConversionDataSet lastResponse = null;
@Override
public OfflineConversionDataSet getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
};
public static final String[] FIELDS = {
"attribute_stats",
"business",
"config",
"creation_time",
"description",
"duplicate_entries",
"enable_auto_assign_to_accounts",
"event_stats",
"event_time_max",
"event_time_min",
"id",
"is_restricted_use",
"last_upload_app",
"matched_entries",
"matched_unique_users",
"name",
"usage",
"valid_entries",
};
@Override
public OfflineConversionDataSet parseResponse(String response) throws APIException {
return OfflineConversionDataSet.parseResponse(response, getContext(), this).head();
}
@Override
public OfflineConversionDataSet execute() throws APIException {
return execute(new HashMap());
}
@Override
public OfflineConversionDataSet execute(Map 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 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 requestAttributeStatsField () {
return this.requestAttributeStatsField(true);
}
public APIRequestGet requestAttributeStatsField (boolean value) {
this.requestField("attribute_stats", value);
return this;
}
public APIRequestGet requestBusinessField () {
return this.requestBusinessField(true);
}
public APIRequestGet requestBusinessField (boolean value) {
this.requestField("business", value);
return this;
}
public APIRequestGet requestConfigField () {
return this.requestConfigField(true);
}
public APIRequestGet requestConfigField (boolean value) {
this.requestField("config", value);
return this;
}
public APIRequestGet requestCreationTimeField () {
return this.requestCreationTimeField(true);
}
public APIRequestGet requestCreationTimeField (boolean value) {
this.requestField("creation_time", value);
return this;
}
public APIRequestGet requestDescriptionField () {
return this.requestDescriptionField(true);
}
public APIRequestGet requestDescriptionField (boolean value) {
this.requestField("description", value);
return this;
}
public APIRequestGet requestDuplicateEntriesField () {
return this.requestDuplicateEntriesField(true);
}
public APIRequestGet requestDuplicateEntriesField (boolean value) {
this.requestField("duplicate_entries", value);
return this;
}
public APIRequestGet requestEnableAutoAssignToAccountsField () {
return this.requestEnableAutoAssignToAccountsField(true);
}
public APIRequestGet requestEnableAutoAssignToAccountsField (boolean value) {
this.requestField("enable_auto_assign_to_accounts", value);
return this;
}
public APIRequestGet requestEventStatsField () {
return this.requestEventStatsField(true);
}
public APIRequestGet requestEventStatsField (boolean value) {
this.requestField("event_stats", value);
return this;
}
public APIRequestGet requestEventTimeMaxField () {
return this.requestEventTimeMaxField(true);
}
public APIRequestGet requestEventTimeMaxField (boolean value) {
this.requestField("event_time_max", value);
return this;
}
public APIRequestGet requestEventTimeMinField () {
return this.requestEventTimeMinField(true);
}
public APIRequestGet requestEventTimeMinField (boolean value) {
this.requestField("event_time_min", value);
return this;
}
public APIRequestGet requestIdField () {
return this.requestIdField(true);
}
public APIRequestGet requestIdField (boolean value) {
this.requestField("id", value);
return this;
}
public APIRequestGet requestIsRestrictedUseField () {
return this.requestIsRestrictedUseField(true);
}
public APIRequestGet requestIsRestrictedUseField (boolean value) {
this.requestField("is_restricted_use", value);
return this;
}
public APIRequestGet requestLastUploadAppField () {
return this.requestLastUploadAppField(true);
}
public APIRequestGet requestLastUploadAppField (boolean value) {
this.requestField("last_upload_app", value);
return this;
}
public APIRequestGet requestMatchedEntriesField () {
return this.requestMatchedEntriesField(true);
}
public APIRequestGet requestMatchedEntriesField (boolean value) {
this.requestField("matched_entries", value);
return this;
}
public APIRequestGet requestMatchedUniqueUsersField () {
return this.requestMatchedUniqueUsersField(true);
}
public APIRequestGet requestMatchedUniqueUsersField (boolean value) {
this.requestField("matched_unique_users", value);
return this;
}
public APIRequestGet requestNameField () {
return this.requestNameField(true);
}
public APIRequestGet requestNameField (boolean value) {
this.requestField("name", value);
return this;
}
public APIRequestGet requestUsageField () {
return this.requestUsageField(true);
}
public APIRequestGet requestUsageField (boolean value) {
this.requestField("usage", value);
return this;
}
public APIRequestGet requestValidEntriesField () {
return this.requestValidEntriesField(true);
}
public APIRequestGet requestValidEntriesField (boolean value) {
this.requestField("valid_entries", value);
return this;
}
}
public static enum EnumEventType {
@SerializedName("dataset_assign_to_adacct")
VALUE_DATASET_ASSIGN_TO_ADACCT("dataset_assign_to_adacct"),
@SerializedName("dataset_autotrack_on_adacct")
VALUE_DATASET_AUTOTRACK_ON_ADACCT("dataset_autotrack_on_adacct"),
@SerializedName("dataset_disable_autotrack_on_adacct")
VALUE_DATASET_DISABLE_AUTOTRACK_ON_ADACCT("dataset_disable_autotrack_on_adacct"),
@SerializedName("dataset_unassign_from_adacct")
VALUE_DATASET_UNASSIGN_FROM_ADACCT("dataset_unassign_from_adacct"),
@SerializedName("add_dataset_to_business")
VALUE_ADD_DATASET_TO_BUSINESS("add_dataset_to_business"),
@SerializedName("add_user_to_dataset")
VALUE_ADD_USER_TO_DATASET("add_user_to_dataset"),
@SerializedName("remove_user_from_dataset")
VALUE_REMOVE_USER_FROM_DATASET("remove_user_from_dataset"),
@SerializedName("update_user_role_on_dataset")
VALUE_UPDATE_USER_ROLE_ON_DATASET("update_user_role_on_dataset"),
@SerializedName("create_custom_conversion")
VALUE_CREATE_CUSTOM_CONVERSION("create_custom_conversion"),
@SerializedName("update_custom_conversion")
VALUE_UPDATE_CUSTOM_CONVERSION("update_custom_conversion"),
@SerializedName("create_custom_audience")
VALUE_CREATE_CUSTOM_AUDIENCE("create_custom_audience"),
@SerializedName("share_custom_audience")
VALUE_SHARE_CUSTOM_AUDIENCE("share_custom_audience"),
@SerializedName("unshare_custom_audience")
VALUE_UNSHARE_CUSTOM_AUDIENCE("unshare_custom_audience"),
NULL(null);
private String value;
private EnumEventType(String value) {
this.value = value;
}
@Override
public String toString() {
return value;
}
}
public static enum EnumAggrTime {
@SerializedName("upload_time")
VALUE_UPLOAD_TIME("upload_time"),
@SerializedName("event_time")
VALUE_EVENT_TIME("event_time"),
NULL(null);
private String value;
private EnumAggrTime(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 OfflineConversionDataSet copyFrom(OfflineConversionDataSet instance) {
this.mAttributeStats = instance.mAttributeStats;
this.mBusiness = instance.mBusiness;
this.mConfig = instance.mConfig;
this.mCreationTime = instance.mCreationTime;
this.mDescription = instance.mDescription;
this.mDuplicateEntries = instance.mDuplicateEntries;
this.mEnableAutoAssignToAccounts = instance.mEnableAutoAssignToAccounts;
this.mEventStats = instance.mEventStats;
this.mEventTimeMax = instance.mEventTimeMax;
this.mEventTimeMin = instance.mEventTimeMin;
this.mId = instance.mId;
this.mIsRestrictedUse = instance.mIsRestrictedUse;
this.mLastUploadApp = instance.mLastUploadApp;
this.mMatchedEntries = instance.mMatchedEntries;
this.mMatchedUniqueUsers = instance.mMatchedUniqueUsers;
this.mName = instance.mName;
this.mUsage = instance.mUsage;
this.mValidEntries = instance.mValidEntries;
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) throws MalformedResponseException {
return OfflineConversionDataSet.parseResponse(response, context, request);
}
};
}
}