
com.facebook.ads.sdk.ProductCatalog Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of facebook-java-business-sdk Show documentation
Show all versions of facebook-java-business-sdk Show documentation
Facebook Business Solutions SDK for Java
/**
* 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.common.base.Function;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
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 ProductCatalog extends APINode {
@SerializedName("business")
private Business mBusiness = null;
@SerializedName("commerce_merchant_settings")
private CommerceMerchantSettings mCommerceMerchantSettings = null;
@SerializedName("da_display_settings")
private ProductCatalogImageSettings mDaDisplaySettings = null;
@SerializedName("default_image_url")
private String mDefaultImageUrl = null;
@SerializedName("fallback_image_url")
private List mFallbackImageUrl = null;
@SerializedName("feed_count")
private Long mFeedCount = null;
@SerializedName("id")
private String mId = null;
@SerializedName("is_catalog_segment")
private Boolean mIsCatalogSegment = null;
@SerializedName("name")
private String mName = null;
@SerializedName("product_count")
private Long mProductCount = null;
@SerializedName("store_catalog_settings")
private StoreCatalogSettings mStoreCatalogSettings = null;
@SerializedName("vertical")
private String mVertical = null;
protected static Gson gson = null;
ProductCatalog() {
}
public ProductCatalog(Long id, APIContext context) {
this(id.toString(), context);
}
public ProductCatalog(String id, APIContext context) {
this.mId = id;
this.context = context;
}
public ProductCatalog fetch() throws APIException{
ProductCatalog newInstance = fetchById(this.getPrefixedId().toString(), this.context);
this.copyFrom(newInstance);
return this;
}
public static ProductCatalog 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 ProductCatalog 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", ProductCatalog.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", ProductCatalog.getParser())
.setParam("ids", APIRequest.joinStringList(ids))
.requestFields(fields)
.executeAsyncBase();
}
private String getPrefixedId() {
return getId();
}
public String getId() {
return getFieldId().toString();
}
public static ProductCatalog loadJSON(String json, APIContext context, String header) {
ProductCatalog productCatalog = getGson().fromJson(json, ProductCatalog.class);
if (context.isDebug()) {
JsonParser parser = new JsonParser();
JsonElement o1 = parser.parse(json);
JsonElement o2 = parser.parse(productCatalog.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);
}
}
productCatalog.context = context;
productCatalog.rawValue = json;
productCatalog.header = header;
return productCatalog;
}
public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException {
APINodeList productCatalogs = 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++) {
productCatalogs.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header));
};
return productCatalogs;
} 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;
productCatalogs.setCursors(before, after);
}
String previous = paging.has("previous") ? paging.get("previous").getAsString() : null;
String next = paging.has("next") ? paging.get("next").getAsString() : null;
productCatalogs.setPaging(previous, next);
if (context.hasAppSecret()) {
productCatalogs.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++) {
productCatalogs.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()) {
productCatalogs.add(loadJSON(entry.getValue().toString(), context, header));
}
break;
}
}
if (!isRedownload) {
productCatalogs.add(loadJSON(obj.toString(), context, header));
}
}
return productCatalogs;
} 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()) {
productCatalogs.add(loadJSON(entry.getValue().toString(), context, header));
}
return productCatalogs;
} 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)
) {
productCatalogs.add(loadJSON(value.toString(), context, header));
} else {
isIdIndexedArray = false;
break;
}
}
if (isIdIndexedArray) {
return productCatalogs;
}
// Sixth, check if it's pure JsonObject
productCatalogs.clear();
productCatalogs.add(loadJSON(json, context, header));
return productCatalogs;
}
}
} 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 APIRequestDeleteAgencies deleteAgencies() {
return new APIRequestDeleteAgencies(this.getPrefixedId().toString(), context);
}
public APIRequestGetAgencies getAgencies() {
return new APIRequestGetAgencies(this.getPrefixedId().toString(), context);
}
public APIRequestCreateAgency createAgency() {
return new APIRequestCreateAgency(this.getPrefixedId().toString(), context);
}
public APIRequestDeleteAssignedUsers deleteAssignedUsers() {
return new APIRequestDeleteAssignedUsers(this.getPrefixedId().toString(), context);
}
public APIRequestGetAssignedUsers getAssignedUsers() {
return new APIRequestGetAssignedUsers(this.getPrefixedId().toString(), context);
}
public APIRequestCreateAssignedUser createAssignedUser() {
return new APIRequestCreateAssignedUser(this.getPrefixedId().toString(), context);
}
public APIRequestGetAutoMarkets getAutoMarkets() {
return new APIRequestGetAutoMarkets(this.getPrefixedId().toString(), context);
}
public APIRequestGetAutomotiveModels getAutomotiveModels() {
return new APIRequestGetAutomotiveModels(this.getPrefixedId().toString(), context);
}
public APIRequestCreateAutomotiveModel createAutomotiveModel() {
return new APIRequestCreateAutomotiveModel(this.getPrefixedId().toString(), context);
}
public APIRequestGetAutos getAutos() {
return new APIRequestGetAutos(this.getPrefixedId().toString(), context);
}
public APIRequestCreateBatch createBatch() {
return new APIRequestCreateBatch(this.getPrefixedId().toString(), context);
}
public APIRequestGetCategories getCategories() {
return new APIRequestGetCategories(this.getPrefixedId().toString(), context);
}
public APIRequestCreateCategory createCategory() {
return new APIRequestCreateCategory(this.getPrefixedId().toString(), context);
}
public APIRequestGetCheckBatchRequestStatus getCheckBatchRequestStatus() {
return new APIRequestGetCheckBatchRequestStatus(this.getPrefixedId().toString(), context);
}
public APIRequestGetCollaborativeAdsShareSettings getCollaborativeAdsShareSettings() {
return new APIRequestGetCollaborativeAdsShareSettings(this.getPrefixedId().toString(), context);
}
public APIRequestGetDestinations getDestinations() {
return new APIRequestGetDestinations(this.getPrefixedId().toString(), context);
}
public APIRequestGetEventStats getEventStats() {
return new APIRequestGetEventStats(this.getPrefixedId().toString(), context);
}
public APIRequestDeleteExternalEventSources deleteExternalEventSources() {
return new APIRequestDeleteExternalEventSources(this.getPrefixedId().toString(), context);
}
public APIRequestGetExternalEventSources getExternalEventSources() {
return new APIRequestGetExternalEventSources(this.getPrefixedId().toString(), context);
}
public APIRequestCreateExternalEventSource createExternalEventSource() {
return new APIRequestCreateExternalEventSource(this.getPrefixedId().toString(), context);
}
public APIRequestGetFlights getFlights() {
return new APIRequestGetFlights(this.getPrefixedId().toString(), context);
}
public APIRequestGetHomeListings getHomeListings() {
return new APIRequestGetHomeListings(this.getPrefixedId().toString(), context);
}
public APIRequestCreateHomeListing createHomeListing() {
return new APIRequestCreateHomeListing(this.getPrefixedId().toString(), context);
}
public APIRequestGetHotelRoomsBatch getHotelRoomsBatch() {
return new APIRequestGetHotelRoomsBatch(this.getPrefixedId().toString(), context);
}
public APIRequestCreateHotelRoomsBatch createHotelRoomsBatch() {
return new APIRequestCreateHotelRoomsBatch(this.getPrefixedId().toString(), context);
}
public APIRequestGetHotels getHotels() {
return new APIRequestGetHotels(this.getPrefixedId().toString(), context);
}
public APIRequestCreateHotel createHotel() {
return new APIRequestCreateHotel(this.getPrefixedId().toString(), context);
}
public APIRequestCreateItemsBatch createItemsBatch() {
return new APIRequestCreateItemsBatch(this.getPrefixedId().toString(), context);
}
public APIRequestGetMediaTitles getMediaTitles() {
return new APIRequestGetMediaTitles(this.getPrefixedId().toString(), context);
}
public APIRequestGetPricingVariablesBatch getPricingVariablesBatch() {
return new APIRequestGetPricingVariablesBatch(this.getPrefixedId().toString(), context);
}
public APIRequestCreatePricingVariablesBatch createPricingVariablesBatch() {
return new APIRequestCreatePricingVariablesBatch(this.getPrefixedId().toString(), context);
}
public APIRequestGetProductFeeds getProductFeeds() {
return new APIRequestGetProductFeeds(this.getPrefixedId().toString(), context);
}
public APIRequestCreateProductFeed createProductFeed() {
return new APIRequestCreateProductFeed(this.getPrefixedId().toString(), context);
}
public APIRequestGetProductGroups getProductGroups() {
return new APIRequestGetProductGroups(this.getPrefixedId().toString(), context);
}
public APIRequestCreateProductGroup createProductGroup() {
return new APIRequestCreateProductGroup(this.getPrefixedId().toString(), context);
}
public APIRequestGetProductSets getProductSets() {
return new APIRequestGetProductSets(this.getPrefixedId().toString(), context);
}
public APIRequestCreateProductSet createProductSet() {
return new APIRequestCreateProductSet(this.getPrefixedId().toString(), context);
}
public APIRequestGetProductSetsBatch getProductSetsBatch() {
return new APIRequestGetProductSetsBatch(this.getPrefixedId().toString(), context);
}
public APIRequestGetProducts getProducts() {
return new APIRequestGetProducts(this.getPrefixedId().toString(), context);
}
public APIRequestCreateProduct createProduct() {
return new APIRequestCreateProduct(this.getPrefixedId().toString(), context);
}
public APIRequestGetVehicleOffers getVehicleOffers() {
return new APIRequestGetVehicleOffers(this.getPrefixedId().toString(), context);
}
public APIRequestGetVehicles getVehicles() {
return new APIRequestGetVehicles(this.getPrefixedId().toString(), context);
}
public APIRequestCreateVehicle createVehicle() {
return new APIRequestCreateVehicle(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 Business getFieldBusiness() {
if (mBusiness != null) {
mBusiness.context = getContext();
}
return mBusiness;
}
public CommerceMerchantSettings getFieldCommerceMerchantSettings() {
if (mCommerceMerchantSettings != null) {
mCommerceMerchantSettings.context = getContext();
}
return mCommerceMerchantSettings;
}
public ProductCatalogImageSettings getFieldDaDisplaySettings() {
return mDaDisplaySettings;
}
public String getFieldDefaultImageUrl() {
return mDefaultImageUrl;
}
public List getFieldFallbackImageUrl() {
return mFallbackImageUrl;
}
public Long getFieldFeedCount() {
return mFeedCount;
}
public String getFieldId() {
return mId;
}
public Boolean getFieldIsCatalogSegment() {
return mIsCatalogSegment;
}
public String getFieldName() {
return mName;
}
public Long getFieldProductCount() {
return mProductCount;
}
public StoreCatalogSettings getFieldStoreCatalogSettings() {
if (mStoreCatalogSettings != null) {
mStoreCatalogSettings.context = getContext();
}
return mStoreCatalogSettings;
}
public String getFieldVertical() {
return mVertical;
}
public static class APIRequestDeleteAgencies extends APIRequest {
APINodeList lastResponse = null;
@Override
public APINodeList getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"business",
};
public static final String[] FIELDS = {
};
@Override
public APINodeList parseResponse(String response, String header) throws APIException {
return APINode.parseResponse(response, getContext(), this, header);
}
@Override
public APINodeList execute() throws APIException {
return execute(new HashMap());
}
@Override
public APINodeList execute(Map extraParams) throws APIException {
ResponseWrapper rw = executeInternal(extraParams);
lastResponse = parseResponse(rw.getBody(),rw.getHeader());
return lastResponse;
}
public ListenableFuture> executeAsync() throws APIException {
return executeAsync(new HashMap());
};
public ListenableFuture> executeAsync(Map extraParams) throws APIException {
return Futures.transform(
executeAsyncInternal(extraParams),
new Function>() {
public APINodeList apply(ResponseWrapper result) {
try {
return APIRequestDeleteAgencies.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
);
};
public APIRequestDeleteAgencies(String nodeId, APIContext context) {
super(context, nodeId, "/agencies", "DELETE", Arrays.asList(PARAMS));
}
@Override
public APIRequestDeleteAgencies setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestDeleteAgencies setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestDeleteAgencies setBusiness (String business) {
this.setParam("business", business);
return this;
}
public APIRequestDeleteAgencies requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestDeleteAgencies requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestDeleteAgencies requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestDeleteAgencies requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestDeleteAgencies requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestDeleteAgencies requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
}
public static class APIRequestGetAgencies extends APIRequest {
APINodeList lastResponse = null;
@Override
public APINodeList getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
};
public static final String[] FIELDS = {
"block_offline_analytics",
"created_by",
"created_time",
"extended_updated_time",
"id",
"is_hidden",
"is_instagram_enabled_in_fb_analytics",
"link",
"name",
"primary_page",
"profile_picture_uri",
"timezone_id",
"two_factor_type",
"updated_by",
"updated_time",
"verification_status",
"vertical",
"vertical_id",
};
@Override
public APINodeList parseResponse(String response, String header) throws APIException {
return Business.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 APIRequestGetAgencies.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
);
};
public APIRequestGetAgencies(String nodeId, APIContext context) {
super(context, nodeId, "/agencies", "GET", Arrays.asList(PARAMS));
}
@Override
public APIRequestGetAgencies setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestGetAgencies setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestGetAgencies requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestGetAgencies requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetAgencies requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestGetAgencies requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetAgencies requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestGetAgencies requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
public APIRequestGetAgencies requestBlockOfflineAnalyticsField () {
return this.requestBlockOfflineAnalyticsField(true);
}
public APIRequestGetAgencies requestBlockOfflineAnalyticsField (boolean value) {
this.requestField("block_offline_analytics", value);
return this;
}
public APIRequestGetAgencies requestCreatedByField () {
return this.requestCreatedByField(true);
}
public APIRequestGetAgencies requestCreatedByField (boolean value) {
this.requestField("created_by", value);
return this;
}
public APIRequestGetAgencies requestCreatedTimeField () {
return this.requestCreatedTimeField(true);
}
public APIRequestGetAgencies requestCreatedTimeField (boolean value) {
this.requestField("created_time", value);
return this;
}
public APIRequestGetAgencies requestExtendedUpdatedTimeField () {
return this.requestExtendedUpdatedTimeField(true);
}
public APIRequestGetAgencies requestExtendedUpdatedTimeField (boolean value) {
this.requestField("extended_updated_time", value);
return this;
}
public APIRequestGetAgencies requestIdField () {
return this.requestIdField(true);
}
public APIRequestGetAgencies requestIdField (boolean value) {
this.requestField("id", value);
return this;
}
public APIRequestGetAgencies requestIsHiddenField () {
return this.requestIsHiddenField(true);
}
public APIRequestGetAgencies requestIsHiddenField (boolean value) {
this.requestField("is_hidden", value);
return this;
}
public APIRequestGetAgencies requestIsInstagramEnabledInFbAnalyticsField () {
return this.requestIsInstagramEnabledInFbAnalyticsField(true);
}
public APIRequestGetAgencies requestIsInstagramEnabledInFbAnalyticsField (boolean value) {
this.requestField("is_instagram_enabled_in_fb_analytics", value);
return this;
}
public APIRequestGetAgencies requestLinkField () {
return this.requestLinkField(true);
}
public APIRequestGetAgencies requestLinkField (boolean value) {
this.requestField("link", value);
return this;
}
public APIRequestGetAgencies requestNameField () {
return this.requestNameField(true);
}
public APIRequestGetAgencies requestNameField (boolean value) {
this.requestField("name", value);
return this;
}
public APIRequestGetAgencies requestPrimaryPageField () {
return this.requestPrimaryPageField(true);
}
public APIRequestGetAgencies requestPrimaryPageField (boolean value) {
this.requestField("primary_page", value);
return this;
}
public APIRequestGetAgencies requestProfilePictureUriField () {
return this.requestProfilePictureUriField(true);
}
public APIRequestGetAgencies requestProfilePictureUriField (boolean value) {
this.requestField("profile_picture_uri", value);
return this;
}
public APIRequestGetAgencies requestTimezoneIdField () {
return this.requestTimezoneIdField(true);
}
public APIRequestGetAgencies requestTimezoneIdField (boolean value) {
this.requestField("timezone_id", value);
return this;
}
public APIRequestGetAgencies requestTwoFactorTypeField () {
return this.requestTwoFactorTypeField(true);
}
public APIRequestGetAgencies requestTwoFactorTypeField (boolean value) {
this.requestField("two_factor_type", value);
return this;
}
public APIRequestGetAgencies requestUpdatedByField () {
return this.requestUpdatedByField(true);
}
public APIRequestGetAgencies requestUpdatedByField (boolean value) {
this.requestField("updated_by", value);
return this;
}
public APIRequestGetAgencies requestUpdatedTimeField () {
return this.requestUpdatedTimeField(true);
}
public APIRequestGetAgencies requestUpdatedTimeField (boolean value) {
this.requestField("updated_time", value);
return this;
}
public APIRequestGetAgencies requestVerificationStatusField () {
return this.requestVerificationStatusField(true);
}
public APIRequestGetAgencies requestVerificationStatusField (boolean value) {
this.requestField("verification_status", value);
return this;
}
public APIRequestGetAgencies requestVerticalField () {
return this.requestVerticalField(true);
}
public APIRequestGetAgencies requestVerticalField (boolean value) {
this.requestField("vertical", value);
return this;
}
public APIRequestGetAgencies requestVerticalIdField () {
return this.requestVerticalIdField(true);
}
public APIRequestGetAgencies requestVerticalIdField (boolean value) {
this.requestField("vertical_id", value);
return this;
}
}
public static class APIRequestCreateAgency extends APIRequest {
ProductCatalog lastResponse = null;
@Override
public ProductCatalog getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"business",
"permitted_roles",
"permitted_tasks",
"utm_settings",
};
public static final String[] FIELDS = {
};
@Override
public ProductCatalog parseResponse(String response, String header) throws APIException {
return ProductCatalog.parseResponse(response, getContext(), this, header).head();
}
@Override
public ProductCatalog execute() throws APIException {
return execute(new HashMap());
}
@Override
public ProductCatalog 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 ProductCatalog apply(ResponseWrapper result) {
try {
return APIRequestCreateAgency.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
);
};
public APIRequestCreateAgency(String nodeId, APIContext context) {
super(context, nodeId, "/agencies", "POST", Arrays.asList(PARAMS));
}
@Override
public APIRequestCreateAgency setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestCreateAgency setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestCreateAgency setBusiness (String business) {
this.setParam("business", business);
return this;
}
public APIRequestCreateAgency setPermittedRoles (List permittedRoles) {
this.setParam("permitted_roles", permittedRoles);
return this;
}
public APIRequestCreateAgency setPermittedRoles (String permittedRoles) {
this.setParam("permitted_roles", permittedRoles);
return this;
}
public APIRequestCreateAgency setPermittedTasks (List permittedTasks) {
this.setParam("permitted_tasks", permittedTasks);
return this;
}
public APIRequestCreateAgency setPermittedTasks (String permittedTasks) {
this.setParam("permitted_tasks", permittedTasks);
return this;
}
public APIRequestCreateAgency setUtmSettings (Map utmSettings) {
this.setParam("utm_settings", utmSettings);
return this;
}
public APIRequestCreateAgency setUtmSettings (String utmSettings) {
this.setParam("utm_settings", utmSettings);
return this;
}
public APIRequestCreateAgency requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestCreateAgency requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestCreateAgency requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestCreateAgency requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestCreateAgency requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestCreateAgency requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
}
public static class APIRequestDeleteAssignedUsers extends APIRequest {
APINodeList lastResponse = null;
@Override
public APINodeList getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"user",
};
public static final String[] FIELDS = {
};
@Override
public APINodeList parseResponse(String response, String header) throws APIException {
return APINode.parseResponse(response, getContext(), this, header);
}
@Override
public APINodeList execute() throws APIException {
return execute(new HashMap());
}
@Override
public APINodeList execute(Map extraParams) throws APIException {
ResponseWrapper rw = executeInternal(extraParams);
lastResponse = parseResponse(rw.getBody(),rw.getHeader());
return lastResponse;
}
public ListenableFuture> executeAsync() throws APIException {
return executeAsync(new HashMap());
};
public ListenableFuture> executeAsync(Map extraParams) throws APIException {
return Futures.transform(
executeAsyncInternal(extraParams),
new Function>() {
public APINodeList apply(ResponseWrapper result) {
try {
return APIRequestDeleteAssignedUsers.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
);
};
public APIRequestDeleteAssignedUsers(String nodeId, APIContext context) {
super(context, nodeId, "/assigned_users", "DELETE", Arrays.asList(PARAMS));
}
@Override
public APIRequestDeleteAssignedUsers setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestDeleteAssignedUsers setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestDeleteAssignedUsers setUser (Long user) {
this.setParam("user", user);
return this;
}
public APIRequestDeleteAssignedUsers setUser (String user) {
this.setParam("user", user);
return this;
}
public APIRequestDeleteAssignedUsers requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestDeleteAssignedUsers requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestDeleteAssignedUsers requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestDeleteAssignedUsers requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestDeleteAssignedUsers requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestDeleteAssignedUsers requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
}
public static class APIRequestGetAssignedUsers extends APIRequest {
APINodeList lastResponse = null;
@Override
public APINodeList getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"business",
};
public static final String[] FIELDS = {
"business",
"id",
"name",
"user_type",
};
@Override
public APINodeList parseResponse(String response, String header) throws APIException {
return AssignedUser.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 APIRequestGetAssignedUsers.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
);
};
public APIRequestGetAssignedUsers(String nodeId, APIContext context) {
super(context, nodeId, "/assigned_users", "GET", Arrays.asList(PARAMS));
}
@Override
public APIRequestGetAssignedUsers setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestGetAssignedUsers setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestGetAssignedUsers setBusiness (String business) {
this.setParam("business", business);
return this;
}
public APIRequestGetAssignedUsers requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestGetAssignedUsers requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetAssignedUsers requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestGetAssignedUsers requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetAssignedUsers requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestGetAssignedUsers requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
public APIRequestGetAssignedUsers requestBusinessField () {
return this.requestBusinessField(true);
}
public APIRequestGetAssignedUsers requestBusinessField (boolean value) {
this.requestField("business", value);
return this;
}
public APIRequestGetAssignedUsers requestIdField () {
return this.requestIdField(true);
}
public APIRequestGetAssignedUsers requestIdField (boolean value) {
this.requestField("id", value);
return this;
}
public APIRequestGetAssignedUsers requestNameField () {
return this.requestNameField(true);
}
public APIRequestGetAssignedUsers requestNameField (boolean value) {
this.requestField("name", value);
return this;
}
public APIRequestGetAssignedUsers requestUserTypeField () {
return this.requestUserTypeField(true);
}
public APIRequestGetAssignedUsers requestUserTypeField (boolean value) {
this.requestField("user_type", value);
return this;
}
}
public static class APIRequestCreateAssignedUser extends APIRequest {
ProductCatalog lastResponse = null;
@Override
public ProductCatalog getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"tasks",
"user",
};
public static final String[] FIELDS = {
};
@Override
public ProductCatalog parseResponse(String response, String header) throws APIException {
return ProductCatalog.parseResponse(response, getContext(), this, header).head();
}
@Override
public ProductCatalog execute() throws APIException {
return execute(new HashMap());
}
@Override
public ProductCatalog 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 ProductCatalog apply(ResponseWrapper result) {
try {
return APIRequestCreateAssignedUser.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
);
};
public APIRequestCreateAssignedUser(String nodeId, APIContext context) {
super(context, nodeId, "/assigned_users", "POST", Arrays.asList(PARAMS));
}
@Override
public APIRequestCreateAssignedUser setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestCreateAssignedUser setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestCreateAssignedUser setTasks (List tasks) {
this.setParam("tasks", tasks);
return this;
}
public APIRequestCreateAssignedUser setTasks (String tasks) {
this.setParam("tasks", tasks);
return this;
}
public APIRequestCreateAssignedUser setUser (Long user) {
this.setParam("user", user);
return this;
}
public APIRequestCreateAssignedUser setUser (String user) {
this.setParam("user", user);
return this;
}
public APIRequestCreateAssignedUser requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestCreateAssignedUser requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestCreateAssignedUser requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestCreateAssignedUser requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestCreateAssignedUser requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestCreateAssignedUser requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
}
public static class APIRequestGetAutoMarkets extends APIRequest {
APINodeList lastResponse = null;
@Override
public APINodeList getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
};
public static final String[] FIELDS = {
};
@Override
public APINodeList parseResponse(String response, String header) throws APIException {
return APINode.parseResponse(response, getContext(), this, header);
}
@Override
public APINodeList execute() throws APIException {
return execute(new HashMap());
}
@Override
public APINodeList execute(Map extraParams) throws APIException {
ResponseWrapper rw = executeInternal(extraParams);
lastResponse = parseResponse(rw.getBody(),rw.getHeader());
return lastResponse;
}
public ListenableFuture> executeAsync() throws APIException {
return executeAsync(new HashMap());
};
public ListenableFuture> executeAsync(Map extraParams) throws APIException {
return Futures.transform(
executeAsyncInternal(extraParams),
new Function>() {
public APINodeList apply(ResponseWrapper result) {
try {
return APIRequestGetAutoMarkets.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
);
};
public APIRequestGetAutoMarkets(String nodeId, APIContext context) {
super(context, nodeId, "/auto_markets", "GET", Arrays.asList(PARAMS));
}
@Override
public APIRequestGetAutoMarkets setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestGetAutoMarkets setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestGetAutoMarkets requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestGetAutoMarkets requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetAutoMarkets requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestGetAutoMarkets requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetAutoMarkets requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestGetAutoMarkets requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
}
public static class APIRequestGetAutomotiveModels extends APIRequest {
APINodeList lastResponse = null;
@Override
public APINodeList getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"bulk_pagination",
"filter",
};
public static final String[] FIELDS = {
"applinks",
"automotive_model_id",
"availability",
"body_style",
"category_specific_fields",
"currency",
"custom_label_0",
"description",
"drivetrain",
"exterior_color",
"finance_description",
"finance_type",
"fuel_type",
"generation",
"id",
"image_fetch_status",
"images",
"interior_color",
"interior_upholstery",
"make",
"model",
"price",
"sanitized_images",
"title",
"transmission",
"trim",
"url",
"year",
};
@Override
public APINodeList parseResponse(String response, String header) throws APIException {
return AutomotiveModel.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 APIRequestGetAutomotiveModels.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
);
};
public APIRequestGetAutomotiveModels(String nodeId, APIContext context) {
super(context, nodeId, "/automotive_models", "GET", Arrays.asList(PARAMS));
}
@Override
public APIRequestGetAutomotiveModels setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestGetAutomotiveModels setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestGetAutomotiveModels setBulkPagination (Boolean bulkPagination) {
this.setParam("bulk_pagination", bulkPagination);
return this;
}
public APIRequestGetAutomotiveModels setBulkPagination (String bulkPagination) {
this.setParam("bulk_pagination", bulkPagination);
return this;
}
public APIRequestGetAutomotiveModels setFilter (Object filter) {
this.setParam("filter", filter);
return this;
}
public APIRequestGetAutomotiveModels setFilter (String filter) {
this.setParam("filter", filter);
return this;
}
public APIRequestGetAutomotiveModels requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestGetAutomotiveModels requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetAutomotiveModels requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestGetAutomotiveModels requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetAutomotiveModels requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestGetAutomotiveModels requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
public APIRequestGetAutomotiveModels requestApplinksField () {
return this.requestApplinksField(true);
}
public APIRequestGetAutomotiveModels requestApplinksField (boolean value) {
this.requestField("applinks", value);
return this;
}
public APIRequestGetAutomotiveModels requestAutomotiveModelIdField () {
return this.requestAutomotiveModelIdField(true);
}
public APIRequestGetAutomotiveModels requestAutomotiveModelIdField (boolean value) {
this.requestField("automotive_model_id", value);
return this;
}
public APIRequestGetAutomotiveModels requestAvailabilityField () {
return this.requestAvailabilityField(true);
}
public APIRequestGetAutomotiveModels requestAvailabilityField (boolean value) {
this.requestField("availability", value);
return this;
}
public APIRequestGetAutomotiveModels requestBodyStyleField () {
return this.requestBodyStyleField(true);
}
public APIRequestGetAutomotiveModels requestBodyStyleField (boolean value) {
this.requestField("body_style", value);
return this;
}
public APIRequestGetAutomotiveModels requestCategorySpecificFieldsField () {
return this.requestCategorySpecificFieldsField(true);
}
public APIRequestGetAutomotiveModels requestCategorySpecificFieldsField (boolean value) {
this.requestField("category_specific_fields", value);
return this;
}
public APIRequestGetAutomotiveModels requestCurrencyField () {
return this.requestCurrencyField(true);
}
public APIRequestGetAutomotiveModels requestCurrencyField (boolean value) {
this.requestField("currency", value);
return this;
}
public APIRequestGetAutomotiveModels requestCustomLabel0Field () {
return this.requestCustomLabel0Field(true);
}
public APIRequestGetAutomotiveModels requestCustomLabel0Field (boolean value) {
this.requestField("custom_label_0", value);
return this;
}
public APIRequestGetAutomotiveModels requestDescriptionField () {
return this.requestDescriptionField(true);
}
public APIRequestGetAutomotiveModels requestDescriptionField (boolean value) {
this.requestField("description", value);
return this;
}
public APIRequestGetAutomotiveModels requestDrivetrainField () {
return this.requestDrivetrainField(true);
}
public APIRequestGetAutomotiveModels requestDrivetrainField (boolean value) {
this.requestField("drivetrain", value);
return this;
}
public APIRequestGetAutomotiveModels requestExteriorColorField () {
return this.requestExteriorColorField(true);
}
public APIRequestGetAutomotiveModels requestExteriorColorField (boolean value) {
this.requestField("exterior_color", value);
return this;
}
public APIRequestGetAutomotiveModels requestFinanceDescriptionField () {
return this.requestFinanceDescriptionField(true);
}
public APIRequestGetAutomotiveModels requestFinanceDescriptionField (boolean value) {
this.requestField("finance_description", value);
return this;
}
public APIRequestGetAutomotiveModels requestFinanceTypeField () {
return this.requestFinanceTypeField(true);
}
public APIRequestGetAutomotiveModels requestFinanceTypeField (boolean value) {
this.requestField("finance_type", value);
return this;
}
public APIRequestGetAutomotiveModels requestFuelTypeField () {
return this.requestFuelTypeField(true);
}
public APIRequestGetAutomotiveModels requestFuelTypeField (boolean value) {
this.requestField("fuel_type", value);
return this;
}
public APIRequestGetAutomotiveModels requestGenerationField () {
return this.requestGenerationField(true);
}
public APIRequestGetAutomotiveModels requestGenerationField (boolean value) {
this.requestField("generation", value);
return this;
}
public APIRequestGetAutomotiveModels requestIdField () {
return this.requestIdField(true);
}
public APIRequestGetAutomotiveModels requestIdField (boolean value) {
this.requestField("id", value);
return this;
}
public APIRequestGetAutomotiveModels requestImageFetchStatusField () {
return this.requestImageFetchStatusField(true);
}
public APIRequestGetAutomotiveModels requestImageFetchStatusField (boolean value) {
this.requestField("image_fetch_status", value);
return this;
}
public APIRequestGetAutomotiveModels requestImagesField () {
return this.requestImagesField(true);
}
public APIRequestGetAutomotiveModels requestImagesField (boolean value) {
this.requestField("images", value);
return this;
}
public APIRequestGetAutomotiveModels requestInteriorColorField () {
return this.requestInteriorColorField(true);
}
public APIRequestGetAutomotiveModels requestInteriorColorField (boolean value) {
this.requestField("interior_color", value);
return this;
}
public APIRequestGetAutomotiveModels requestInteriorUpholsteryField () {
return this.requestInteriorUpholsteryField(true);
}
public APIRequestGetAutomotiveModels requestInteriorUpholsteryField (boolean value) {
this.requestField("interior_upholstery", value);
return this;
}
public APIRequestGetAutomotiveModels requestMakeField () {
return this.requestMakeField(true);
}
public APIRequestGetAutomotiveModels requestMakeField (boolean value) {
this.requestField("make", value);
return this;
}
public APIRequestGetAutomotiveModels requestModelField () {
return this.requestModelField(true);
}
public APIRequestGetAutomotiveModels requestModelField (boolean value) {
this.requestField("model", value);
return this;
}
public APIRequestGetAutomotiveModels requestPriceField () {
return this.requestPriceField(true);
}
public APIRequestGetAutomotiveModels requestPriceField (boolean value) {
this.requestField("price", value);
return this;
}
public APIRequestGetAutomotiveModels requestSanitizedImagesField () {
return this.requestSanitizedImagesField(true);
}
public APIRequestGetAutomotiveModels requestSanitizedImagesField (boolean value) {
this.requestField("sanitized_images", value);
return this;
}
public APIRequestGetAutomotiveModels requestTitleField () {
return this.requestTitleField(true);
}
public APIRequestGetAutomotiveModels requestTitleField (boolean value) {
this.requestField("title", value);
return this;
}
public APIRequestGetAutomotiveModels requestTransmissionField () {
return this.requestTransmissionField(true);
}
public APIRequestGetAutomotiveModels requestTransmissionField (boolean value) {
this.requestField("transmission", value);
return this;
}
public APIRequestGetAutomotiveModels requestTrimField () {
return this.requestTrimField(true);
}
public APIRequestGetAutomotiveModels requestTrimField (boolean value) {
this.requestField("trim", value);
return this;
}
public APIRequestGetAutomotiveModels requestUrlField () {
return this.requestUrlField(true);
}
public APIRequestGetAutomotiveModels requestUrlField (boolean value) {
this.requestField("url", value);
return this;
}
public APIRequestGetAutomotiveModels requestYearField () {
return this.requestYearField(true);
}
public APIRequestGetAutomotiveModels requestYearField (boolean value) {
this.requestField("year", value);
return this;
}
}
public static class APIRequestCreateAutomotiveModel extends APIRequest {
AutomotiveModel lastResponse = null;
@Override
public AutomotiveModel getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"automotive_model_id",
"body_style",
"currency",
"description",
"images",
"make",
"model",
"price",
"title",
"url",
"year",
};
public static final String[] FIELDS = {
};
@Override
public AutomotiveModel parseResponse(String response, String header) throws APIException {
return AutomotiveModel.parseResponse(response, getContext(), this, header).head();
}
@Override
public AutomotiveModel execute() throws APIException {
return execute(new HashMap());
}
@Override
public AutomotiveModel 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 AutomotiveModel apply(ResponseWrapper result) {
try {
return APIRequestCreateAutomotiveModel.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
);
};
public APIRequestCreateAutomotiveModel(String nodeId, APIContext context) {
super(context, nodeId, "/automotive_models", "POST", Arrays.asList(PARAMS));
}
@Override
public APIRequestCreateAutomotiveModel setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestCreateAutomotiveModel setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestCreateAutomotiveModel setAutomotiveModelId (String automotiveModelId) {
this.setParam("automotive_model_id", automotiveModelId);
return this;
}
public APIRequestCreateAutomotiveModel setBodyStyle (AutomotiveModel.EnumBodyStyle bodyStyle) {
this.setParam("body_style", bodyStyle);
return this;
}
public APIRequestCreateAutomotiveModel setBodyStyle (String bodyStyle) {
this.setParam("body_style", bodyStyle);
return this;
}
public APIRequestCreateAutomotiveModel setCurrency (String currency) {
this.setParam("currency", currency);
return this;
}
public APIRequestCreateAutomotiveModel setDescription (String description) {
this.setParam("description", description);
return this;
}
public APIRequestCreateAutomotiveModel setImages (List