com.facebook.ads.sdk.IGUser 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) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.ads.sdk;
import java.io.File;
import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.common.base.Function;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.SettableFuture;
import com.google.gson.JsonObject;
import com.google.gson.JsonArray;
import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import com.facebook.ads.sdk.APIException.MalformedResponseException;
/**
* This class is auto-generated.
*
* For any issues or feature requests related to this class, please let us know
* on github and we'll fix in our codegen framework. We'll not be able to accept
* pull request for this class.
*
*/
public class IGUser extends APINode {
@SerializedName("biography")
private String mBiography = null;
@SerializedName("business_discovery")
private IGUser mBusinessDiscovery = null;
@SerializedName("followers_count")
private Long mFollowersCount = null;
@SerializedName("follows_count")
private Long mFollowsCount = null;
@SerializedName("id")
private String mId = null;
@SerializedName("ig_id")
private Long mIgId = null;
@SerializedName("media_count")
private Long mMediaCount = null;
@SerializedName("mentioned_comment")
private IGComment mMentionedComment = null;
@SerializedName("mentioned_media")
private IGMedia mMentionedMedia = null;
@SerializedName("name")
private String mName = null;
@SerializedName("owner_business")
private Business mOwnerBusiness = null;
@SerializedName("profile_picture_url")
private String mProfilePictureUrl = null;
@SerializedName("shopping_product_tag_eligibility")
private Boolean mShoppingProductTagEligibility = null;
@SerializedName("shopping_review_status")
private String mShoppingReviewStatus = null;
@SerializedName("username")
private String mUsername = null;
@SerializedName("website")
private String mWebsite = null;
protected static Gson gson = null;
IGUser() {
}
public IGUser(Long id, APIContext context) {
this(id.toString(), context);
}
public IGUser(String id, APIContext context) {
this.mId = id;
this.context = context;
}
public IGUser fetch() throws APIException{
IGUser newInstance = fetchById(this.getPrefixedId().toString(), this.context);
this.copyFrom(newInstance);
return this;
}
public static IGUser 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 IGUser 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", IGUser.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", IGUser.getParser())
.setParam("ids", APIRequest.joinStringList(ids))
.requestFields(fields)
.executeAsyncBase();
}
private String getPrefixedId() {
return getId();
}
public String getId() {
return getFieldId().toString();
}
public static IGUser loadJSON(String json, APIContext context, String header) {
IGUser igUser = getGson().fromJson(json, IGUser.class);
if (context.isDebug()) {
JsonParser parser = new JsonParser();
JsonElement o1 = parser.parse(json);
JsonElement o2 = parser.parse(igUser.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);
}
}
igUser.context = context;
igUser.rawValue = json;
igUser.header = header;
return igUser;
}
public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException {
APINodeList igUsers = 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++) {
igUsers.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header));
};
return igUsers;
} 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;
igUsers.setCursors(before, after);
}
String previous = paging.has("previous") ? paging.get("previous").getAsString() : null;
String next = paging.has("next") ? paging.get("next").getAsString() : null;
igUsers.setPaging(previous, next);
if (context.hasAppSecret()) {
igUsers.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++) {
igUsers.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()) {
igUsers.add(loadJSON(entry.getValue().toString(), context, header));
}
break;
}
}
if (!isRedownload) {
igUsers.add(loadJSON(obj.toString(), context, header));
}
}
return igUsers;
} 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()) {
igUsers.add(loadJSON(entry.getValue().toString(), context, header));
}
return igUsers;
} 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)
) {
igUsers.add(loadJSON(value.toString(), context, header));
} else {
isIdIndexedArray = false;
break;
}
}
if (isIdIndexedArray) {
return igUsers;
}
// Sixth, check if it's pure JsonObject
igUsers.clear();
igUsers.add(loadJSON(json, context, header));
return igUsers;
}
}
} 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 APIRequestGetAvailableCatalogs getAvailableCatalogs() {
return new APIRequestGetAvailableCatalogs(this.getPrefixedId().toString(), context);
}
public APIRequestGetBrandedContentAdPermissions getBrandedContentAdPermissions() {
return new APIRequestGetBrandedContentAdPermissions(this.getPrefixedId().toString(), context);
}
public APIRequestCreateBrandedContentAdPermission createBrandedContentAdPermission() {
return new APIRequestCreateBrandedContentAdPermission(this.getPrefixedId().toString(), context);
}
public APIRequestGetBrandedContentAdvertisableMedias getBrandedContentAdvertisableMedias() {
return new APIRequestGetBrandedContentAdvertisableMedias(this.getPrefixedId().toString(), context);
}
public APIRequestDeleteBrandedContentTagApproval deleteBrandedContentTagApproval() {
return new APIRequestDeleteBrandedContentTagApproval(this.getPrefixedId().toString(), context);
}
public APIRequestGetBrandedContentTagApproval getBrandedContentTagApproval() {
return new APIRequestGetBrandedContentTagApproval(this.getPrefixedId().toString(), context);
}
public APIRequestCreateBrandedContentTagApproval createBrandedContentTagApproval() {
return new APIRequestCreateBrandedContentTagApproval(this.getPrefixedId().toString(), context);
}
public APIRequestGetCatalogProductSearch getCatalogProductSearch() {
return new APIRequestGetCatalogProductSearch(this.getPrefixedId().toString(), context);
}
public APIRequestGetContentPublishingLimit getContentPublishingLimit() {
return new APIRequestGetContentPublishingLimit(this.getPrefixedId().toString(), context);
}
public APIRequestGetDataset getDataset() {
return new APIRequestGetDataset(this.getPrefixedId().toString(), context);
}
public APIRequestCreateDataset createDataset() {
return new APIRequestCreateDataset(this.getPrefixedId().toString(), context);
}
public APIRequestGetInsights getInsights() {
return new APIRequestGetInsights(this.getPrefixedId().toString(), context);
}
public APIRequestGetLiveMedia getLiveMedia() {
return new APIRequestGetLiveMedia(this.getPrefixedId().toString(), context);
}
public APIRequestGetMedia getMedia() {
return new APIRequestGetMedia(this.getPrefixedId().toString(), context);
}
public APIRequestCreateMedia createMedia() {
return new APIRequestCreateMedia(this.getPrefixedId().toString(), context);
}
public APIRequestCreateMediaPublish createMediaPublish() {
return new APIRequestCreateMediaPublish(this.getPrefixedId().toString(), context);
}
public APIRequestCreateMention createMention() {
return new APIRequestCreateMention(this.getPrefixedId().toString(), context);
}
public APIRequestGetNotificationMessageTokens getNotificationMessageTokens() {
return new APIRequestGetNotificationMessageTokens(this.getPrefixedId().toString(), context);
}
public APIRequestGetProductAppeal getProductAppeal() {
return new APIRequestGetProductAppeal(this.getPrefixedId().toString(), context);
}
public APIRequestCreateProductAppeal createProductAppeal() {
return new APIRequestCreateProductAppeal(this.getPrefixedId().toString(), context);
}
public APIRequestGetRecentlySearchedHashtags getRecentlySearchedHashtags() {
return new APIRequestGetRecentlySearchedHashtags(this.getPrefixedId().toString(), context);
}
public APIRequestGetStories getStories() {
return new APIRequestGetStories(this.getPrefixedId().toString(), context);
}
public APIRequestGetTags getTags() {
return new APIRequestGetTags(this.getPrefixedId().toString(), context);
}
public APIRequestGet get() {
return new APIRequestGet(this.getPrefixedId().toString(), context);
}
public String getFieldBiography() {
return mBiography;
}
public IGUser getFieldBusinessDiscovery() {
if (mBusinessDiscovery != null) {
mBusinessDiscovery.context = getContext();
}
return mBusinessDiscovery;
}
public Long getFieldFollowersCount() {
return mFollowersCount;
}
public Long getFieldFollowsCount() {
return mFollowsCount;
}
public String getFieldId() {
return mId;
}
public Long getFieldIgId() {
return mIgId;
}
public Long getFieldMediaCount() {
return mMediaCount;
}
public IGComment getFieldMentionedComment() {
if (mMentionedComment != null) {
mMentionedComment.context = getContext();
}
return mMentionedComment;
}
public IGMedia getFieldMentionedMedia() {
if (mMentionedMedia != null) {
mMentionedMedia.context = getContext();
}
return mMentionedMedia;
}
public String getFieldName() {
return mName;
}
public Business getFieldOwnerBusiness() {
if (mOwnerBusiness != null) {
mOwnerBusiness.context = getContext();
}
return mOwnerBusiness;
}
public String getFieldProfilePictureUrl() {
return mProfilePictureUrl;
}
public Boolean getFieldShoppingProductTagEligibility() {
return mShoppingProductTagEligibility;
}
public String getFieldShoppingReviewStatus() {
return mShoppingReviewStatus;
}
public String getFieldUsername() {
return mUsername;
}
public String getFieldWebsite() {
return mWebsite;
}
public static class APIRequestGetAvailableCatalogs extends APIRequest {
APINodeList lastResponse = null;
@Override
public APINodeList getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
};
public static final String[] FIELDS = {
"catalog_id",
"catalog_name",
"product_count",
"shop_name",
};
@Override
public APINodeList parseResponse(String response, String header) throws APIException {
return UserAvailableCatalogs.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 APIRequestGetAvailableCatalogs.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
public APIRequestGetAvailableCatalogs(String nodeId, APIContext context) {
super(context, nodeId, "/available_catalogs", "GET", Arrays.asList(PARAMS));
}
@Override
public APIRequestGetAvailableCatalogs setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestGetAvailableCatalogs setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestGetAvailableCatalogs requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestGetAvailableCatalogs requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetAvailableCatalogs requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestGetAvailableCatalogs requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetAvailableCatalogs requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestGetAvailableCatalogs requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
public APIRequestGetAvailableCatalogs requestCatalogIdField () {
return this.requestCatalogIdField(true);
}
public APIRequestGetAvailableCatalogs requestCatalogIdField (boolean value) {
this.requestField("catalog_id", value);
return this;
}
public APIRequestGetAvailableCatalogs requestCatalogNameField () {
return this.requestCatalogNameField(true);
}
public APIRequestGetAvailableCatalogs requestCatalogNameField (boolean value) {
this.requestField("catalog_name", value);
return this;
}
public APIRequestGetAvailableCatalogs requestProductCountField () {
return this.requestProductCountField(true);
}
public APIRequestGetAvailableCatalogs requestProductCountField (boolean value) {
this.requestField("product_count", value);
return this;
}
public APIRequestGetAvailableCatalogs requestShopNameField () {
return this.requestShopNameField(true);
}
public APIRequestGetAvailableCatalogs requestShopNameField (boolean value) {
this.requestField("shop_name", value);
return this;
}
}
public static class APIRequestGetBrandedContentAdPermissions extends APIRequest {
APINodeList lastResponse = null;
@Override
public APINodeList getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
};
public static final String[] FIELDS = {
"id",
"permission_type",
"status",
};
@Override
public APINodeList parseResponse(String response, String header) throws APIException {
return IGBCAdsPermission.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 APIRequestGetBrandedContentAdPermissions.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
public APIRequestGetBrandedContentAdPermissions(String nodeId, APIContext context) {
super(context, nodeId, "/branded_content_ad_permissions", "GET", Arrays.asList(PARAMS));
}
@Override
public APIRequestGetBrandedContentAdPermissions setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestGetBrandedContentAdPermissions setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestGetBrandedContentAdPermissions requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestGetBrandedContentAdPermissions requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetBrandedContentAdPermissions requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestGetBrandedContentAdPermissions requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetBrandedContentAdPermissions requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestGetBrandedContentAdPermissions requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
public APIRequestGetBrandedContentAdPermissions requestIdField () {
return this.requestIdField(true);
}
public APIRequestGetBrandedContentAdPermissions requestIdField (boolean value) {
this.requestField("id", value);
return this;
}
public APIRequestGetBrandedContentAdPermissions requestPermissionTypeField () {
return this.requestPermissionTypeField(true);
}
public APIRequestGetBrandedContentAdPermissions requestPermissionTypeField (boolean value) {
this.requestField("permission_type", value);
return this;
}
public APIRequestGetBrandedContentAdPermissions requestStatusField () {
return this.requestStatusField(true);
}
public APIRequestGetBrandedContentAdPermissions requestStatusField (boolean value) {
this.requestField("status", value);
return this;
}
}
public static class APIRequestCreateBrandedContentAdPermission extends APIRequest {
IGBCAdsPermission lastResponse = null;
@Override
public IGBCAdsPermission getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"creator_instagram_account",
"creator_instagram_username",
"revoke",
};
public static final String[] FIELDS = {
};
@Override
public IGBCAdsPermission parseResponse(String response, String header) throws APIException {
return IGBCAdsPermission.parseResponse(response, getContext(), this, header).head();
}
@Override
public IGBCAdsPermission execute() throws APIException {
return execute(new HashMap());
}
@Override
public IGBCAdsPermission 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 IGBCAdsPermission apply(ResponseWrapper result) {
try {
return APIRequestCreateBrandedContentAdPermission.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
public APIRequestCreateBrandedContentAdPermission(String nodeId, APIContext context) {
super(context, nodeId, "/branded_content_ad_permissions", "POST", Arrays.asList(PARAMS));
}
@Override
public APIRequestCreateBrandedContentAdPermission setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestCreateBrandedContentAdPermission setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestCreateBrandedContentAdPermission setCreatorInstagramAccount (String creatorInstagramAccount) {
this.setParam("creator_instagram_account", creatorInstagramAccount);
return this;
}
public APIRequestCreateBrandedContentAdPermission setCreatorInstagramUsername (String creatorInstagramUsername) {
this.setParam("creator_instagram_username", creatorInstagramUsername);
return this;
}
public APIRequestCreateBrandedContentAdPermission setRevoke (Boolean revoke) {
this.setParam("revoke", revoke);
return this;
}
public APIRequestCreateBrandedContentAdPermission setRevoke (String revoke) {
this.setParam("revoke", revoke);
return this;
}
public APIRequestCreateBrandedContentAdPermission requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestCreateBrandedContentAdPermission requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestCreateBrandedContentAdPermission requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestCreateBrandedContentAdPermission requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestCreateBrandedContentAdPermission requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestCreateBrandedContentAdPermission requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
}
public static class APIRequestGetBrandedContentAdvertisableMedias extends APIRequest {
APINodeList lastResponse = null;
@Override
public APINodeList getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"ad_code",
"creator_username",
"only_fetch_allowlisted",
"permalinks",
};
public static final String[] FIELDS = {
"eligibility_errors",
"has_permission_for_partnership_ad",
"id",
"owner_id",
"permalink",
};
@Override
public APINodeList parseResponse(String response, String header) throws APIException {
return BrandedContentShadowIGMediaID.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 APIRequestGetBrandedContentAdvertisableMedias.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
public APIRequestGetBrandedContentAdvertisableMedias(String nodeId, APIContext context) {
super(context, nodeId, "/branded_content_advertisable_medias", "GET", Arrays.asList(PARAMS));
}
@Override
public APIRequestGetBrandedContentAdvertisableMedias setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestGetBrandedContentAdvertisableMedias setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestGetBrandedContentAdvertisableMedias setAdCode (String adCode) {
this.setParam("ad_code", adCode);
return this;
}
public APIRequestGetBrandedContentAdvertisableMedias setCreatorUsername (String creatorUsername) {
this.setParam("creator_username", creatorUsername);
return this;
}
public APIRequestGetBrandedContentAdvertisableMedias setOnlyFetchAllowlisted (Boolean onlyFetchAllowlisted) {
this.setParam("only_fetch_allowlisted", onlyFetchAllowlisted);
return this;
}
public APIRequestGetBrandedContentAdvertisableMedias setOnlyFetchAllowlisted (String onlyFetchAllowlisted) {
this.setParam("only_fetch_allowlisted", onlyFetchAllowlisted);
return this;
}
public APIRequestGetBrandedContentAdvertisableMedias setPermalinks (List permalinks) {
this.setParam("permalinks", permalinks);
return this;
}
public APIRequestGetBrandedContentAdvertisableMedias setPermalinks (String permalinks) {
this.setParam("permalinks", permalinks);
return this;
}
public APIRequestGetBrandedContentAdvertisableMedias requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestGetBrandedContentAdvertisableMedias requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetBrandedContentAdvertisableMedias requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestGetBrandedContentAdvertisableMedias requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetBrandedContentAdvertisableMedias requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestGetBrandedContentAdvertisableMedias requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
public APIRequestGetBrandedContentAdvertisableMedias requestEligibilityErrorsField () {
return this.requestEligibilityErrorsField(true);
}
public APIRequestGetBrandedContentAdvertisableMedias requestEligibilityErrorsField (boolean value) {
this.requestField("eligibility_errors", value);
return this;
}
public APIRequestGetBrandedContentAdvertisableMedias requestHasPermissionForPartnershipAdField () {
return this.requestHasPermissionForPartnershipAdField(true);
}
public APIRequestGetBrandedContentAdvertisableMedias requestHasPermissionForPartnershipAdField (boolean value) {
this.requestField("has_permission_for_partnership_ad", value);
return this;
}
public APIRequestGetBrandedContentAdvertisableMedias requestIdField () {
return this.requestIdField(true);
}
public APIRequestGetBrandedContentAdvertisableMedias requestIdField (boolean value) {
this.requestField("id", value);
return this;
}
public APIRequestGetBrandedContentAdvertisableMedias requestOwnerIdField () {
return this.requestOwnerIdField(true);
}
public APIRequestGetBrandedContentAdvertisableMedias requestOwnerIdField (boolean value) {
this.requestField("owner_id", value);
return this;
}
public APIRequestGetBrandedContentAdvertisableMedias requestPermalinkField () {
return this.requestPermalinkField(true);
}
public APIRequestGetBrandedContentAdvertisableMedias requestPermalinkField (boolean value) {
this.requestField("permalink", value);
return this;
}
}
public static class APIRequestDeleteBrandedContentTagApproval extends APIRequest {
APINodeList lastResponse = null;
@Override
public APINodeList getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"user_ids",
};
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 APIRequestDeleteBrandedContentTagApproval.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
public APIRequestDeleteBrandedContentTagApproval(String nodeId, APIContext context) {
super(context, nodeId, "/branded_content_tag_approval", "DELETE", Arrays.asList(PARAMS));
}
@Override
public APIRequestDeleteBrandedContentTagApproval setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestDeleteBrandedContentTagApproval setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestDeleteBrandedContentTagApproval setUserIds (List userIds) {
this.setParam("user_ids", userIds);
return this;
}
public APIRequestDeleteBrandedContentTagApproval setUserIds (String userIds) {
this.setParam("user_ids", userIds);
return this;
}
public APIRequestDeleteBrandedContentTagApproval requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestDeleteBrandedContentTagApproval requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestDeleteBrandedContentTagApproval requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestDeleteBrandedContentTagApproval requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestDeleteBrandedContentTagApproval requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestDeleteBrandedContentTagApproval requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
}
public static class APIRequestGetBrandedContentTagApproval extends APIRequest {
APINodeList lastResponse = null;
@Override
public APINodeList getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"user_ids",
};
public static final String[] FIELDS = {
"id",
};
@Override
public APINodeList parseResponse(String response, String header) throws APIException {
return BrandedContentShadowIGUserID.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 APIRequestGetBrandedContentTagApproval.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
public APIRequestGetBrandedContentTagApproval(String nodeId, APIContext context) {
super(context, nodeId, "/branded_content_tag_approval", "GET", Arrays.asList(PARAMS));
}
@Override
public APIRequestGetBrandedContentTagApproval setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestGetBrandedContentTagApproval setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestGetBrandedContentTagApproval setUserIds (List userIds) {
this.setParam("user_ids", userIds);
return this;
}
public APIRequestGetBrandedContentTagApproval setUserIds (String userIds) {
this.setParam("user_ids", userIds);
return this;
}
public APIRequestGetBrandedContentTagApproval requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestGetBrandedContentTagApproval requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetBrandedContentTagApproval requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestGetBrandedContentTagApproval requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetBrandedContentTagApproval requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestGetBrandedContentTagApproval requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
public APIRequestGetBrandedContentTagApproval requestIdField () {
return this.requestIdField(true);
}
public APIRequestGetBrandedContentTagApproval requestIdField (boolean value) {
this.requestField("id", value);
return this;
}
}
public static class APIRequestCreateBrandedContentTagApproval extends APIRequest {
BrandedContentShadowIGUserID lastResponse = null;
@Override
public BrandedContentShadowIGUserID getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"user_ids",
};
public static final String[] FIELDS = {
};
@Override
public BrandedContentShadowIGUserID parseResponse(String response, String header) throws APIException {
return BrandedContentShadowIGUserID.parseResponse(response, getContext(), this, header).head();
}
@Override
public BrandedContentShadowIGUserID execute() throws APIException {
return execute(new HashMap());
}
@Override
public BrandedContentShadowIGUserID 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 BrandedContentShadowIGUserID apply(ResponseWrapper result) {
try {
return APIRequestCreateBrandedContentTagApproval.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
public APIRequestCreateBrandedContentTagApproval(String nodeId, APIContext context) {
super(context, nodeId, "/branded_content_tag_approval", "POST", Arrays.asList(PARAMS));
}
@Override
public APIRequestCreateBrandedContentTagApproval setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestCreateBrandedContentTagApproval setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestCreateBrandedContentTagApproval setUserIds (List userIds) {
this.setParam("user_ids", userIds);
return this;
}
public APIRequestCreateBrandedContentTagApproval setUserIds (String userIds) {
this.setParam("user_ids", userIds);
return this;
}
public APIRequestCreateBrandedContentTagApproval requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestCreateBrandedContentTagApproval requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestCreateBrandedContentTagApproval requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestCreateBrandedContentTagApproval requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestCreateBrandedContentTagApproval requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestCreateBrandedContentTagApproval requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
}
public static class APIRequestGetCatalogProductSearch extends APIRequest {
APINodeList lastResponse = null;
@Override
public APINodeList getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"catalog_id",
"q",
};
public static final String[] FIELDS = {
"image_url",
"is_checkout_flow",
"merchant_id",
"product_id",
"product_name",
"product_variants",
"retailer_id",
"review_status",
};
@Override
public APINodeList parseResponse(String response, String header) throws APIException {
return ShadowIGUserCatalogProductSearch.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 APIRequestGetCatalogProductSearch.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
public APIRequestGetCatalogProductSearch(String nodeId, APIContext context) {
super(context, nodeId, "/catalog_product_search", "GET", Arrays.asList(PARAMS));
}
@Override
public APIRequestGetCatalogProductSearch setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestGetCatalogProductSearch setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestGetCatalogProductSearch setCatalogId (String catalogId) {
this.setParam("catalog_id", catalogId);
return this;
}
public APIRequestGetCatalogProductSearch setQ (String q) {
this.setParam("q", q);
return this;
}
public APIRequestGetCatalogProductSearch requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestGetCatalogProductSearch requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetCatalogProductSearch requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestGetCatalogProductSearch requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetCatalogProductSearch requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestGetCatalogProductSearch requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
public APIRequestGetCatalogProductSearch requestImageUrlField () {
return this.requestImageUrlField(true);
}
public APIRequestGetCatalogProductSearch requestImageUrlField (boolean value) {
this.requestField("image_url", value);
return this;
}
public APIRequestGetCatalogProductSearch requestIsCheckoutFlowField () {
return this.requestIsCheckoutFlowField(true);
}
public APIRequestGetCatalogProductSearch requestIsCheckoutFlowField (boolean value) {
this.requestField("is_checkout_flow", value);
return this;
}
public APIRequestGetCatalogProductSearch requestMerchantIdField () {
return this.requestMerchantIdField(true);
}
public APIRequestGetCatalogProductSearch requestMerchantIdField (boolean value) {
this.requestField("merchant_id", value);
return this;
}
public APIRequestGetCatalogProductSearch requestProductIdField () {
return this.requestProductIdField(true);
}
public APIRequestGetCatalogProductSearch requestProductIdField (boolean value) {
this.requestField("product_id", value);
return this;
}
public APIRequestGetCatalogProductSearch requestProductNameField () {
return this.requestProductNameField(true);
}
public APIRequestGetCatalogProductSearch requestProductNameField (boolean value) {
this.requestField("product_name", value);
return this;
}
public APIRequestGetCatalogProductSearch requestProductVariantsField () {
return this.requestProductVariantsField(true);
}
public APIRequestGetCatalogProductSearch requestProductVariantsField (boolean value) {
this.requestField("product_variants", value);
return this;
}
public APIRequestGetCatalogProductSearch requestRetailerIdField () {
return this.requestRetailerIdField(true);
}
public APIRequestGetCatalogProductSearch requestRetailerIdField (boolean value) {
this.requestField("retailer_id", value);
return this;
}
public APIRequestGetCatalogProductSearch requestReviewStatusField () {
return this.requestReviewStatusField(true);
}
public APIRequestGetCatalogProductSearch requestReviewStatusField (boolean value) {
this.requestField("review_status", value);
return this;
}
}
public static class APIRequestGetContentPublishingLimit extends APIRequest {
APINodeList lastResponse = null;
@Override
public APINodeList getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"since",
};
public static final String[] FIELDS = {
"config",
"quota_usage",
};
@Override
public APINodeList parseResponse(String response, String header) throws APIException {
return ContentPublishingLimitResponse.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 APIRequestGetContentPublishingLimit.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
public APIRequestGetContentPublishingLimit(String nodeId, APIContext context) {
super(context, nodeId, "/content_publishing_limit", "GET", Arrays.asList(PARAMS));
}
@Override
public APIRequestGetContentPublishingLimit setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestGetContentPublishingLimit setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestGetContentPublishingLimit setSince (String since) {
this.setParam("since", since);
return this;
}
public APIRequestGetContentPublishingLimit requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestGetContentPublishingLimit requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetContentPublishingLimit requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestGetContentPublishingLimit requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetContentPublishingLimit requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestGetContentPublishingLimit requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
public APIRequestGetContentPublishingLimit requestConfigField () {
return this.requestConfigField(true);
}
public APIRequestGetContentPublishingLimit requestConfigField (boolean value) {
this.requestField("config", value);
return this;
}
public APIRequestGetContentPublishingLimit requestQuotaUsageField () {
return this.requestQuotaUsageField(true);
}
public APIRequestGetContentPublishingLimit requestQuotaUsageField (boolean value) {
this.requestField("quota_usage", value);
return this;
}
}
public static class APIRequestGetDataset extends APIRequest {
APINodeList lastResponse = null;
@Override
public APINodeList getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
};
public static final String[] FIELDS = {
"id",
"name",
};
@Override
public APINodeList parseResponse(String response, String header) throws APIException {
return Dataset.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 APIRequestGetDataset.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
public APIRequestGetDataset(String nodeId, APIContext context) {
super(context, nodeId, "/dataset", "GET", Arrays.asList(PARAMS));
}
@Override
public APIRequestGetDataset setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestGetDataset setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestGetDataset requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestGetDataset requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetDataset requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestGetDataset requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetDataset requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestGetDataset requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
public APIRequestGetDataset requestIdField () {
return this.requestIdField(true);
}
public APIRequestGetDataset requestIdField (boolean value) {
this.requestField("id", value);
return this;
}
public APIRequestGetDataset requestNameField () {
return this.requestNameField(true);
}
public APIRequestGetDataset requestNameField (boolean value) {
this.requestField("name", value);
return this;
}
}
public static class APIRequestCreateDataset extends APIRequest {
Dataset lastResponse = null;
@Override
public Dataset getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"dataset_name",
};
public static final String[] FIELDS = {
};
@Override
public Dataset parseResponse(String response, String header) throws APIException {
return Dataset.parseResponse(response, getContext(), this, header).head();
}
@Override
public Dataset execute() throws APIException {
return execute(new HashMap());
}
@Override
public Dataset 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 Dataset apply(ResponseWrapper result) {
try {
return APIRequestCreateDataset.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
public APIRequestCreateDataset(String nodeId, APIContext context) {
super(context, nodeId, "/dataset", "POST", Arrays.asList(PARAMS));
}
@Override
public APIRequestCreateDataset setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestCreateDataset setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestCreateDataset setDatasetName (String datasetName) {
this.setParam("dataset_name", datasetName);
return this;
}
public APIRequestCreateDataset requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestCreateDataset requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestCreateDataset requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestCreateDataset requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestCreateDataset requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestCreateDataset requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
}
public static class APIRequestGetInsights extends APIRequest {
APINodeList lastResponse = null;
@Override
public APINodeList getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"breakdown",
"metric",
"metric_type",
"period",
"since",
"timeframe",
"until",
};
public static final String[] FIELDS = {
"description",
"id",
"name",
"period",
"title",
"total_value",
"values",
};
@Override
public APINodeList parseResponse(String response, String header) throws APIException {
return InstagramInsightsResult.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 APIRequestGetInsights.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
public APIRequestGetInsights(String nodeId, APIContext context) {
super(context, nodeId, "/insights", "GET", Arrays.asList(PARAMS));
}
@Override
public APIRequestGetInsights setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestGetInsights setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestGetInsights setBreakdown (List breakdown) {
this.setParam("breakdown", breakdown);
return this;
}
public APIRequestGetInsights setBreakdown (String breakdown) {
this.setParam("breakdown", breakdown);
return this;
}
public APIRequestGetInsights setMetric (List metric) {
this.setParam("metric", metric);
return this;
}
public APIRequestGetInsights setMetric (String metric) {
this.setParam("metric", metric);
return this;
}
public APIRequestGetInsights setMetricType (InstagramInsightsResult.EnumMetricType metricType) {
this.setParam("metric_type", metricType);
return this;
}
public APIRequestGetInsights setMetricType (String metricType) {
this.setParam("metric_type", metricType);
return this;
}
public APIRequestGetInsights setPeriod (List period) {
this.setParam("period", period);
return this;
}
public APIRequestGetInsights setPeriod (String period) {
this.setParam("period", period);
return this;
}
public APIRequestGetInsights setSince (String since) {
this.setParam("since", since);
return this;
}
public APIRequestGetInsights setTimeframe (InstagramInsightsResult.EnumTimeframe timeframe) {
this.setParam("timeframe", timeframe);
return this;
}
public APIRequestGetInsights setTimeframe (String timeframe) {
this.setParam("timeframe", timeframe);
return this;
}
public APIRequestGetInsights setUntil (String until) {
this.setParam("until", until);
return this;
}
public APIRequestGetInsights requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestGetInsights requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetInsights requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestGetInsights requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetInsights requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestGetInsights requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
public APIRequestGetInsights requestDescriptionField () {
return this.requestDescriptionField(true);
}
public APIRequestGetInsights requestDescriptionField (boolean value) {
this.requestField("description", value);
return this;
}
public APIRequestGetInsights requestIdField () {
return this.requestIdField(true);
}
public APIRequestGetInsights requestIdField (boolean value) {
this.requestField("id", value);
return this;
}
public APIRequestGetInsights requestNameField () {
return this.requestNameField(true);
}
public APIRequestGetInsights requestNameField (boolean value) {
this.requestField("name", value);
return this;
}
public APIRequestGetInsights requestPeriodField () {
return this.requestPeriodField(true);
}
public APIRequestGetInsights requestPeriodField (boolean value) {
this.requestField("period", value);
return this;
}
public APIRequestGetInsights requestTitleField () {
return this.requestTitleField(true);
}
public APIRequestGetInsights requestTitleField (boolean value) {
this.requestField("title", value);
return this;
}
public APIRequestGetInsights requestTotalValueField () {
return this.requestTotalValueField(true);
}
public APIRequestGetInsights requestTotalValueField (boolean value) {
this.requestField("total_value", value);
return this;
}
public APIRequestGetInsights requestValuesField () {
return this.requestValuesField(true);
}
public APIRequestGetInsights requestValuesField (boolean value) {
this.requestField("values", value);
return this;
}
}
public static class APIRequestGetLiveMedia extends APIRequest {
APINodeList lastResponse = null;
@Override
public APINodeList getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"since",
"until",
};
public static final String[] FIELDS = {
"boost_eligibility_info",
"caption",
"comments_count",
"copyright_check_information",
"id",
"ig_id",
"is_comment_enabled",
"is_shared_to_feed",
"like_count",
"media_product_type",
"media_type",
"media_url",
"owner",
"permalink",
"shortcode",
"thumbnail_url",
"timestamp",
"username",
};
@Override
public APINodeList parseResponse(String response, String header) throws APIException {
return IGMedia.parseResponse(response, getContext(), this, header);
}
@Override
public APINodeList execute() throws APIException {
return execute(new HashMap());
}
@Override
public APINodeList execute(Map extraParams) throws APIException {
ResponseWrapper rw = executeInternal(extraParams);
lastResponse = parseResponse(rw.getBody(),rw.getHeader());
return lastResponse;
}
public ListenableFuture> executeAsync() throws APIException {
return executeAsync(new HashMap());
};
public ListenableFuture> executeAsync(Map extraParams) throws APIException {
return Futures.transform(
executeAsyncInternal(extraParams),
new Function>() {
public APINodeList apply(ResponseWrapper result) {
try {
return APIRequestGetLiveMedia.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
public APIRequestGetLiveMedia(String nodeId, APIContext context) {
super(context, nodeId, "/live_media", "GET", Arrays.asList(PARAMS));
}
@Override
public APIRequestGetLiveMedia setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestGetLiveMedia setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestGetLiveMedia setSince (String since) {
this.setParam("since", since);
return this;
}
public APIRequestGetLiveMedia setUntil (String until) {
this.setParam("until", until);
return this;
}
public APIRequestGetLiveMedia requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestGetLiveMedia requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetLiveMedia requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestGetLiveMedia requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetLiveMedia requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestGetLiveMedia requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
public APIRequestGetLiveMedia requestBoostEligibilityInfoField () {
return this.requestBoostEligibilityInfoField(true);
}
public APIRequestGetLiveMedia requestBoostEligibilityInfoField (boolean value) {
this.requestField("boost_eligibility_info", value);
return this;
}
public APIRequestGetLiveMedia requestCaptionField () {
return this.requestCaptionField(true);
}
public APIRequestGetLiveMedia requestCaptionField (boolean value) {
this.requestField("caption", value);
return this;
}
public APIRequestGetLiveMedia requestCommentsCountField () {
return this.requestCommentsCountField(true);
}
public APIRequestGetLiveMedia requestCommentsCountField (boolean value) {
this.requestField("comments_count", value);
return this;
}
public APIRequestGetLiveMedia requestCopyrightCheckInformationField () {
return this.requestCopyrightCheckInformationField(true);
}
public APIRequestGetLiveMedia requestCopyrightCheckInformationField (boolean value) {
this.requestField("copyright_check_information", value);
return this;
}
public APIRequestGetLiveMedia requestIdField () {
return this.requestIdField(true);
}
public APIRequestGetLiveMedia requestIdField (boolean value) {
this.requestField("id", value);
return this;
}
public APIRequestGetLiveMedia requestIgIdField () {
return this.requestIgIdField(true);
}
public APIRequestGetLiveMedia requestIgIdField (boolean value) {
this.requestField("ig_id", value);
return this;
}
public APIRequestGetLiveMedia requestIsCommentEnabledField () {
return this.requestIsCommentEnabledField(true);
}
public APIRequestGetLiveMedia requestIsCommentEnabledField (boolean value) {
this.requestField("is_comment_enabled", value);
return this;
}
public APIRequestGetLiveMedia requestIsSharedToFeedField () {
return this.requestIsSharedToFeedField(true);
}
public APIRequestGetLiveMedia requestIsSharedToFeedField (boolean value) {
this.requestField("is_shared_to_feed", value);
return this;
}
public APIRequestGetLiveMedia requestLikeCountField () {
return this.requestLikeCountField(true);
}
public APIRequestGetLiveMedia requestLikeCountField (boolean value) {
this.requestField("like_count", value);
return this;
}
public APIRequestGetLiveMedia requestMediaProductTypeField () {
return this.requestMediaProductTypeField(true);
}
public APIRequestGetLiveMedia requestMediaProductTypeField (boolean value) {
this.requestField("media_product_type", value);
return this;
}
public APIRequestGetLiveMedia requestMediaTypeField () {
return this.requestMediaTypeField(true);
}
public APIRequestGetLiveMedia requestMediaTypeField (boolean value) {
this.requestField("media_type", value);
return this;
}
public APIRequestGetLiveMedia requestMediaUrlField () {
return this.requestMediaUrlField(true);
}
public APIRequestGetLiveMedia requestMediaUrlField (boolean value) {
this.requestField("media_url", value);
return this;
}
public APIRequestGetLiveMedia requestOwnerField () {
return this.requestOwnerField(true);
}
public APIRequestGetLiveMedia requestOwnerField (boolean value) {
this.requestField("owner", value);
return this;
}
public APIRequestGetLiveMedia requestPermalinkField () {
return this.requestPermalinkField(true);
}
public APIRequestGetLiveMedia requestPermalinkField (boolean value) {
this.requestField("permalink", value);
return this;
}
public APIRequestGetLiveMedia requestShortcodeField () {
return this.requestShortcodeField(true);
}
public APIRequestGetLiveMedia requestShortcodeField (boolean value) {
this.requestField("shortcode", value);
return this;
}
public APIRequestGetLiveMedia requestThumbnailUrlField () {
return this.requestThumbnailUrlField(true);
}
public APIRequestGetLiveMedia requestThumbnailUrlField (boolean value) {
this.requestField("thumbnail_url", value);
return this;
}
public APIRequestGetLiveMedia requestTimestampField () {
return this.requestTimestampField(true);
}
public APIRequestGetLiveMedia requestTimestampField (boolean value) {
this.requestField("timestamp", value);
return this;
}
public APIRequestGetLiveMedia requestUsernameField () {
return this.requestUsernameField(true);
}
public APIRequestGetLiveMedia requestUsernameField (boolean value) {
this.requestField("username", value);
return this;
}
}
public static class APIRequestGetMedia extends APIRequest {
APINodeList lastResponse = null;
@Override
public APINodeList getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"since",
"until",
};
public static final String[] FIELDS = {
"boost_eligibility_info",
"caption",
"comments_count",
"copyright_check_information",
"id",
"ig_id",
"is_comment_enabled",
"is_shared_to_feed",
"like_count",
"media_product_type",
"media_type",
"media_url",
"owner",
"permalink",
"shortcode",
"thumbnail_url",
"timestamp",
"username",
};
@Override
public APINodeList parseResponse(String response, String header) throws APIException {
return IGMedia.parseResponse(response, getContext(), this, header);
}
@Override
public APINodeList execute() throws APIException {
return execute(new HashMap());
}
@Override
public APINodeList execute(Map extraParams) throws APIException {
ResponseWrapper rw = executeInternal(extraParams);
lastResponse = parseResponse(rw.getBody(),rw.getHeader());
return lastResponse;
}
public ListenableFuture> executeAsync() throws APIException {
return executeAsync(new HashMap());
};
public ListenableFuture> executeAsync(Map extraParams) throws APIException {
return Futures.transform(
executeAsyncInternal(extraParams),
new Function>() {
public APINodeList apply(ResponseWrapper result) {
try {
return APIRequestGetMedia.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
public APIRequestGetMedia(String nodeId, APIContext context) {
super(context, nodeId, "/media", "GET", Arrays.asList(PARAMS));
}
@Override
public APIRequestGetMedia setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestGetMedia setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestGetMedia setSince (String since) {
this.setParam("since", since);
return this;
}
public APIRequestGetMedia setUntil (String until) {
this.setParam("until", until);
return this;
}
public APIRequestGetMedia requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestGetMedia requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetMedia requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestGetMedia requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetMedia requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestGetMedia requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
public APIRequestGetMedia requestBoostEligibilityInfoField () {
return this.requestBoostEligibilityInfoField(true);
}
public APIRequestGetMedia requestBoostEligibilityInfoField (boolean value) {
this.requestField("boost_eligibility_info", value);
return this;
}
public APIRequestGetMedia requestCaptionField () {
return this.requestCaptionField(true);
}
public APIRequestGetMedia requestCaptionField (boolean value) {
this.requestField("caption", value);
return this;
}
public APIRequestGetMedia requestCommentsCountField () {
return this.requestCommentsCountField(true);
}
public APIRequestGetMedia requestCommentsCountField (boolean value) {
this.requestField("comments_count", value);
return this;
}
public APIRequestGetMedia requestCopyrightCheckInformationField () {
return this.requestCopyrightCheckInformationField(true);
}
public APIRequestGetMedia requestCopyrightCheckInformationField (boolean value) {
this.requestField("copyright_check_information", value);
return this;
}
public APIRequestGetMedia requestIdField () {
return this.requestIdField(true);
}
public APIRequestGetMedia requestIdField (boolean value) {
this.requestField("id", value);
return this;
}
public APIRequestGetMedia requestIgIdField () {
return this.requestIgIdField(true);
}
public APIRequestGetMedia requestIgIdField (boolean value) {
this.requestField("ig_id", value);
return this;
}
public APIRequestGetMedia requestIsCommentEnabledField () {
return this.requestIsCommentEnabledField(true);
}
public APIRequestGetMedia requestIsCommentEnabledField (boolean value) {
this.requestField("is_comment_enabled", value);
return this;
}
public APIRequestGetMedia requestIsSharedToFeedField () {
return this.requestIsSharedToFeedField(true);
}
public APIRequestGetMedia requestIsSharedToFeedField (boolean value) {
this.requestField("is_shared_to_feed", value);
return this;
}
public APIRequestGetMedia requestLikeCountField () {
return this.requestLikeCountField(true);
}
public APIRequestGetMedia requestLikeCountField (boolean value) {
this.requestField("like_count", value);
return this;
}
public APIRequestGetMedia requestMediaProductTypeField () {
return this.requestMediaProductTypeField(true);
}
public APIRequestGetMedia requestMediaProductTypeField (boolean value) {
this.requestField("media_product_type", value);
return this;
}
public APIRequestGetMedia requestMediaTypeField () {
return this.requestMediaTypeField(true);
}
public APIRequestGetMedia requestMediaTypeField (boolean value) {
this.requestField("media_type", value);
return this;
}
public APIRequestGetMedia requestMediaUrlField () {
return this.requestMediaUrlField(true);
}
public APIRequestGetMedia requestMediaUrlField (boolean value) {
this.requestField("media_url", value);
return this;
}
public APIRequestGetMedia requestOwnerField () {
return this.requestOwnerField(true);
}
public APIRequestGetMedia requestOwnerField (boolean value) {
this.requestField("owner", value);
return this;
}
public APIRequestGetMedia requestPermalinkField () {
return this.requestPermalinkField(true);
}
public APIRequestGetMedia requestPermalinkField (boolean value) {
this.requestField("permalink", value);
return this;
}
public APIRequestGetMedia requestShortcodeField () {
return this.requestShortcodeField(true);
}
public APIRequestGetMedia requestShortcodeField (boolean value) {
this.requestField("shortcode", value);
return this;
}
public APIRequestGetMedia requestThumbnailUrlField () {
return this.requestThumbnailUrlField(true);
}
public APIRequestGetMedia requestThumbnailUrlField (boolean value) {
this.requestField("thumbnail_url", value);
return this;
}
public APIRequestGetMedia requestTimestampField () {
return this.requestTimestampField(true);
}
public APIRequestGetMedia requestTimestampField (boolean value) {
this.requestField("timestamp", value);
return this;
}
public APIRequestGetMedia requestUsernameField () {
return this.requestUsernameField(true);
}
public APIRequestGetMedia requestUsernameField (boolean value) {
this.requestField("username", value);
return this;
}
}
public static class APIRequestCreateMedia extends APIRequest {
IGMedia lastResponse = null;
@Override
public IGMedia getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"audio_name",
"caption",
"children",
"collaborators",
"cover_url",
"image_url",
"is_carousel_item",
"location_id",
"media_type",
"product_tags",
"share_to_feed",
"thumb_offset",
"upload_type",
"user_tags",
"video_url",
};
public static final String[] FIELDS = {
};
@Override
public IGMedia parseResponse(String response, String header) throws APIException {
return IGMedia.parseResponse(response, getContext(), this, header).head();
}
@Override
public IGMedia execute() throws APIException {
return execute(new HashMap());
}
@Override
public IGMedia 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 IGMedia apply(ResponseWrapper result) {
try {
return APIRequestCreateMedia.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
public APIRequestCreateMedia(String nodeId, APIContext context) {
super(context, nodeId, "/media", "POST", Arrays.asList(PARAMS));
}
@Override
public APIRequestCreateMedia setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestCreateMedia setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestCreateMedia setAudioName (String audioName) {
this.setParam("audio_name", audioName);
return this;
}
public APIRequestCreateMedia setCaption (String caption) {
this.setParam("caption", caption);
return this;
}
public APIRequestCreateMedia setChildren (List