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.CustomConversion 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-genereated.
*
* For any issues or feature requests related to this class, please let us know
* on github and we'll fix in our codegen framework. We'll not be able to accept
* pull request for this class.
*
*/
public class CustomConversion extends APINode {
@SerializedName("account_id")
private String mAccountId = null;
@SerializedName("aggregation_rule")
private String mAggregationRule = null;
@SerializedName("creation_time")
private String mCreationTime = null;
@SerializedName("custom_event_type")
private EnumCustomEventType mCustomEventType = null;
@SerializedName("default_conversion_value")
private Long mDefaultConversionValue = null;
@SerializedName("description")
private String mDescription = null;
@SerializedName("event_source_type")
private String mEventSourceType = null;
@SerializedName("first_fired_time")
private String mFirstFiredTime = null;
@SerializedName("id")
private String mId = null;
@SerializedName("is_archived")
private Boolean mIsArchived = null;
@SerializedName("last_fired_time")
private String mLastFiredTime = null;
@SerializedName("name")
private String mName = null;
@SerializedName("offline_conversion_data_set")
private Object mOfflineConversionDataSet = null;
@SerializedName("pixel")
private AdsPixel mPixel = null;
@SerializedName("retention_days")
private Long mRetentionDays = null;
@SerializedName("rule")
private String mRule = null;
protected static Gson gson = null;
CustomConversion() {
}
public CustomConversion(Long id, APIContext context) {
this(id.toString(), context);
}
public CustomConversion(String id, APIContext context) {
this.mId = id;
this.context = context;
}
public CustomConversion fetch() throws APIException{
CustomConversion newInstance = fetchById(this.getPrefixedId().toString(), this.context);
this.copyFrom(newInstance);
return this;
}
public static CustomConversion fetchById(Long id, APIContext context) throws APIException {
return fetchById(id.toString(), context);
}
public static CustomConversion fetchById(String id, APIContext context) throws APIException {
CustomConversion customConversion =
new APIRequestGet(id, context)
.requestAllFields()
.execute();
return customConversion;
}
public static APINodeList fetchByIds(List ids, List fields, APIContext context) throws APIException {
return (APINodeList)(
new APIRequest(context, "", "/", "GET", CustomConversion.getParser())
.setParam("ids", APIRequest.joinStringList(ids))
.requestFields(fields)
.execute()
);
}
private String getPrefixedId() {
return getId();
}
public String getId() {
return getFieldId().toString();
}
public static CustomConversion loadJSON(String json, APIContext context) {
CustomConversion customConversion = getGson().fromJson(json, CustomConversion.class);
if (context.isDebug()) {
JsonParser parser = new JsonParser();
JsonElement o1 = parser.parse(json);
JsonElement o2 = parser.parse(customConversion.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);
};
}
customConversion.context = context;
customConversion.rawValue = json;
return customConversion;
}
public static APINodeList parseResponse(String json, APIContext context, APIRequest request) throws MalformedResponseException {
APINodeList customConversions = 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++) {
customConversions.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context));
};
return customConversions;
} 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;
customConversions.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++) {
customConversions.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()) {
customConversions.add(loadJSON(entry.getValue().toString(), context));
}
break;
}
}
if (!isRedownload) {
customConversions.add(loadJSON(obj.toString(), context));
}
}
return customConversions;
} 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()) {
customConversions.add(loadJSON(entry.getValue().toString(), context));
}
return customConversions;
} 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)
) {
customConversions.add(loadJSON(value.toString(), context));
} else {
isIdIndexedArray = false;
break;
}
}
if (isIdIndexedArray) {
return customConversions;
}
// Sixth, check if it's pure JsonObject
customConversions.clear();
customConversions.add(loadJSON(json, context));
return customConversions;
}
}
} 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 APIRequestGetStats getStats() {
return new APIRequestGetStats(this.getPrefixedId().toString(), context);
}
public APIRequestDelete delete() {
return new APIRequestDelete(this.getPrefixedId().toString(), context);
}
public APIRequestGet get() {
return new APIRequestGet(this.getPrefixedId().toString(), context);
}
public APIRequestUpdate update() {
return new APIRequestUpdate(this.getPrefixedId().toString(), context);
}
public String getFieldAccountId() {
return mAccountId;
}
public String getFieldAggregationRule() {
return mAggregationRule;
}
public String getFieldCreationTime() {
return mCreationTime;
}
public EnumCustomEventType getFieldCustomEventType() {
return mCustomEventType;
}
public Long getFieldDefaultConversionValue() {
return mDefaultConversionValue;
}
public String getFieldDescription() {
return mDescription;
}
public String getFieldEventSourceType() {
return mEventSourceType;
}
public String getFieldFirstFiredTime() {
return mFirstFiredTime;
}
public String getFieldId() {
return mId;
}
public Boolean getFieldIsArchived() {
return mIsArchived;
}
public String getFieldLastFiredTime() {
return mLastFiredTime;
}
public String getFieldName() {
return mName;
}
public Object getFieldOfflineConversionDataSet() {
return mOfflineConversionDataSet;
}
public AdsPixel getFieldPixel() {
if (mPixel != null) {
mPixel.context = getContext();
}
return mPixel;
}
public Long getFieldRetentionDays() {
return mRetentionDays;
}
public String getFieldRule() {
return mRule;
}
public static class APIRequestGetActivities extends APIRequest {
APINodeList lastResponse = null;
@Override
public APINodeList getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"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 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 APIRequestGetStats extends APIRequest {
APINodeList lastResponse = null;
@Override
public APINodeList getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"aggregation",
"end_time",
"start_time",
};
public static final String[] FIELDS = {
"aggregation",
"data",
"timestamp",
};
@Override
public APINodeList parseResponse(String response) throws APIException {
return CustomConversionStatsResult.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 setAggregation (CustomConversionStatsResult.EnumAggregation aggregation) {
this.setParam("aggregation", aggregation);
return this;
}
public APIRequestGetStats setAggregation (String aggregation) {
this.setParam("aggregation", aggregation);
return this;
}
public APIRequestGetStats setEndTime (String endTime) {
this.setParam("end_time", endTime);
return this;
}
public APIRequestGetStats setStartTime (String startTime) {
this.setParam("start_time", startTime);
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 APIRequestGetStats requestAggregationField () {
return this.requestAggregationField(true);
}
public APIRequestGetStats requestAggregationField (boolean value) {
this.requestField("aggregation", value);
return this;
}
public APIRequestGetStats requestDataField () {
return this.requestDataField(true);
}
public APIRequestGetStats requestDataField (boolean value) {
this.requestField("data", value);
return this;
}
public APIRequestGetStats requestTimestampField () {
return this.requestTimestampField(true);
}
public APIRequestGetStats requestTimestampField (boolean value) {
this.requestField("timestamp", value);
return this;
}
}
public static class APIRequestDelete extends APIRequest {
APINode lastResponse = null;
@Override
public APINode getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
};
public static final String[] FIELDS = {
};
@Override
public APINode parseResponse(String response) throws APIException {
return APINode.parseResponse(response, getContext(), this).head();
}
@Override
public APINode execute() throws APIException {
return execute(new HashMap());
}
@Override
public APINode execute(Map extraParams) throws APIException {
lastResponse = parseResponse(executeInternal(extraParams));
return lastResponse;
}
public APIRequestDelete(String nodeId, APIContext context) {
super(context, nodeId, "/", "DELETE", Arrays.asList(PARAMS));
}
@Override
public APIRequestDelete setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestDelete setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestDelete requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestDelete requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestDelete requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestDelete requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestDelete requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestDelete requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
}
public static class APIRequestGet extends APIRequest {
CustomConversion lastResponse = null;
@Override
public CustomConversion getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
};
public static final String[] FIELDS = {
"account_id",
"aggregation_rule",
"creation_time",
"custom_event_type",
"default_conversion_value",
"description",
"event_source_type",
"first_fired_time",
"id",
"is_archived",
"last_fired_time",
"name",
"offline_conversion_data_set",
"pixel",
"retention_days",
"rule",
};
@Override
public CustomConversion parseResponse(String response) throws APIException {
return CustomConversion.parseResponse(response, getContext(), this).head();
}
@Override
public CustomConversion execute() throws APIException {
return execute(new HashMap());
}
@Override
public CustomConversion 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 requestAccountIdField () {
return this.requestAccountIdField(true);
}
public APIRequestGet requestAccountIdField (boolean value) {
this.requestField("account_id", value);
return this;
}
public APIRequestGet requestAggregationRuleField () {
return this.requestAggregationRuleField(true);
}
public APIRequestGet requestAggregationRuleField (boolean value) {
this.requestField("aggregation_rule", value);
return this;
}
public APIRequestGet requestCreationTimeField () {
return this.requestCreationTimeField(true);
}
public APIRequestGet requestCreationTimeField (boolean value) {
this.requestField("creation_time", value);
return this;
}
public APIRequestGet requestCustomEventTypeField () {
return this.requestCustomEventTypeField(true);
}
public APIRequestGet requestCustomEventTypeField (boolean value) {
this.requestField("custom_event_type", value);
return this;
}
public APIRequestGet requestDefaultConversionValueField () {
return this.requestDefaultConversionValueField(true);
}
public APIRequestGet requestDefaultConversionValueField (boolean value) {
this.requestField("default_conversion_value", value);
return this;
}
public APIRequestGet requestDescriptionField () {
return this.requestDescriptionField(true);
}
public APIRequestGet requestDescriptionField (boolean value) {
this.requestField("description", value);
return this;
}
public APIRequestGet requestEventSourceTypeField () {
return this.requestEventSourceTypeField(true);
}
public APIRequestGet requestEventSourceTypeField (boolean value) {
this.requestField("event_source_type", value);
return this;
}
public APIRequestGet requestFirstFiredTimeField () {
return this.requestFirstFiredTimeField(true);
}
public APIRequestGet requestFirstFiredTimeField (boolean value) {
this.requestField("first_fired_time", value);
return this;
}
public APIRequestGet requestIdField () {
return this.requestIdField(true);
}
public APIRequestGet requestIdField (boolean value) {
this.requestField("id", value);
return this;
}
public APIRequestGet requestIsArchivedField () {
return this.requestIsArchivedField(true);
}
public APIRequestGet requestIsArchivedField (boolean value) {
this.requestField("is_archived", value);
return this;
}
public APIRequestGet requestLastFiredTimeField () {
return this.requestLastFiredTimeField(true);
}
public APIRequestGet requestLastFiredTimeField (boolean value) {
this.requestField("last_fired_time", value);
return this;
}
public APIRequestGet requestNameField () {
return this.requestNameField(true);
}
public APIRequestGet requestNameField (boolean value) {
this.requestField("name", value);
return this;
}
public APIRequestGet requestOfflineConversionDataSetField () {
return this.requestOfflineConversionDataSetField(true);
}
public APIRequestGet requestOfflineConversionDataSetField (boolean value) {
this.requestField("offline_conversion_data_set", value);
return this;
}
public APIRequestGet requestPixelField () {
return this.requestPixelField(true);
}
public APIRequestGet requestPixelField (boolean value) {
this.requestField("pixel", value);
return this;
}
public APIRequestGet requestRetentionDaysField () {
return this.requestRetentionDaysField(true);
}
public APIRequestGet requestRetentionDaysField (boolean value) {
this.requestField("retention_days", value);
return this;
}
public APIRequestGet requestRuleField () {
return this.requestRuleField(true);
}
public APIRequestGet requestRuleField (boolean value) {
this.requestField("rule", value);
return this;
}
}
public static class APIRequestUpdate extends APIRequest {
CustomConversion lastResponse = null;
@Override
public CustomConversion getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"default_conversion_value",
"description",
"name",
};
public static final String[] FIELDS = {
};
@Override
public CustomConversion parseResponse(String response) throws APIException {
return CustomConversion.parseResponse(response, getContext(), this).head();
}
@Override
public CustomConversion execute() throws APIException {
return execute(new HashMap());
}
@Override
public CustomConversion execute(Map extraParams) throws APIException {
lastResponse = parseResponse(executeInternal(extraParams));
return lastResponse;
}
public APIRequestUpdate(String nodeId, APIContext context) {
super(context, nodeId, "/", "POST", Arrays.asList(PARAMS));
}
@Override
public APIRequestUpdate setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestUpdate setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestUpdate setDefaultConversionValue (Double defaultConversionValue) {
this.setParam("default_conversion_value", defaultConversionValue);
return this;
}
public APIRequestUpdate setDefaultConversionValue (String defaultConversionValue) {
this.setParam("default_conversion_value", defaultConversionValue);
return this;
}
public APIRequestUpdate setDescription (String description) {
this.setParam("description", description);
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;
}
}
public static enum EnumCustomEventType {
@SerializedName("ADD_PAYMENT_INFO")
VALUE_ADD_PAYMENT_INFO("ADD_PAYMENT_INFO"),
@SerializedName("ADD_TO_CART")
VALUE_ADD_TO_CART("ADD_TO_CART"),
@SerializedName("ADD_TO_WISHLIST")
VALUE_ADD_TO_WISHLIST("ADD_TO_WISHLIST"),
@SerializedName("COMPLETE_REGISTRATION")
VALUE_COMPLETE_REGISTRATION("COMPLETE_REGISTRATION"),
@SerializedName("CONTENT_VIEW")
VALUE_CONTENT_VIEW("CONTENT_VIEW"),
@SerializedName("INITIATED_CHECKOUT")
VALUE_INITIATED_CHECKOUT("INITIATED_CHECKOUT"),
@SerializedName("LEAD")
VALUE_LEAD("LEAD"),
@SerializedName("OTHER")
VALUE_OTHER("OTHER"),
@SerializedName("PURCHASE")
VALUE_PURCHASE("PURCHASE"),
@SerializedName("SEARCH")
VALUE_SEARCH("SEARCH"),
NULL(null);
private String value;
private EnumCustomEventType(String value) {
this.value = value;
}
@Override
public String toString() {
return value;
}
}
public static enum EnumEventType {
@SerializedName("conversion_create")
VALUE_CONVERSION_CREATE("conversion_create"),
@SerializedName("conversion_delete")
VALUE_CONVERSION_DELETE("conversion_delete"),
@SerializedName("conversion_update")
VALUE_CONVERSION_UPDATE("conversion_update"),
NULL(null);
private String value;
private EnumEventType(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 CustomConversion copyFrom(CustomConversion instance) {
this.mAccountId = instance.mAccountId;
this.mAggregationRule = instance.mAggregationRule;
this.mCreationTime = instance.mCreationTime;
this.mCustomEventType = instance.mCustomEventType;
this.mDefaultConversionValue = instance.mDefaultConversionValue;
this.mDescription = instance.mDescription;
this.mEventSourceType = instance.mEventSourceType;
this.mFirstFiredTime = instance.mFirstFiredTime;
this.mId = instance.mId;
this.mIsArchived = instance.mIsArchived;
this.mLastFiredTime = instance.mLastFiredTime;
this.mName = instance.mName;
this.mOfflineConversionDataSet = instance.mOfflineConversionDataSet;
this.mPixel = instance.mPixel;
this.mRetentionDays = instance.mRetentionDays;
this.mRule = instance.mRule;
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 CustomConversion.parseResponse(response, context, request);
}
};
}
}