com.facebook.ads.sdk.WhatsAppBusinessAccount 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 WhatsAppBusinessAccount extends APINode {
@SerializedName("account_review_status")
private String mAccountReviewStatus = null;
@SerializedName("analytics")
private Object mAnalytics = null;
@SerializedName("auth_international_rate_eligibility")
private Object mAuthInternationalRateEligibility = null;
@SerializedName("business_verification_status")
private String mBusinessVerificationStatus = null;
@SerializedName("country")
private String mCountry = null;
@SerializedName("creation_time")
private Long mCreationTime = null;
@SerializedName("currency")
private String mCurrency = null;
@SerializedName("health_status")
private WhatsAppBusinessHealthStatusForMessageSend mHealthStatus = null;
@SerializedName("id")
private String mId = null;
@SerializedName("is_enabled_for_insights")
private Boolean mIsEnabledForInsights = null;
@SerializedName("linked_commerce_account")
private CommerceMerchantSettings mLinkedCommerceAccount = null;
@SerializedName("message_template_namespace")
private String mMessageTemplateNamespace = null;
@SerializedName("name")
private String mName = null;
@SerializedName("on_behalf_of_business_info")
private Object mOnBehalfOfBusinessInfo = null;
@SerializedName("owner_business")
private Business mOwnerBusiness = null;
@SerializedName("owner_business_info")
private Object mOwnerBusinessInfo = null;
@SerializedName("ownership_type")
private String mOwnershipType = null;
@SerializedName("primary_business_location")
private String mPrimaryBusinessLocation = null;
@SerializedName("primary_funding_id")
private String mPrimaryFundingId = null;
@SerializedName("purchase_order_number")
private String mPurchaseOrderNumber = null;
@SerializedName("status")
private String mStatus = null;
@SerializedName("timezone_id")
private String mTimezoneId = null;
protected static Gson gson = null;
WhatsAppBusinessAccount() {
}
public WhatsAppBusinessAccount(Long id, APIContext context) {
this(id.toString(), context);
}
public WhatsAppBusinessAccount(String id, APIContext context) {
this.mId = id;
this.context = context;
}
public WhatsAppBusinessAccount fetch() throws APIException{
WhatsAppBusinessAccount newInstance = fetchById(this.getPrefixedId().toString(), this.context);
this.copyFrom(newInstance);
return this;
}
public static WhatsAppBusinessAccount 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 WhatsAppBusinessAccount 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", WhatsAppBusinessAccount.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", WhatsAppBusinessAccount.getParser())
.setParam("ids", APIRequest.joinStringList(ids))
.requestFields(fields)
.executeAsyncBase();
}
private String getPrefixedId() {
return getId();
}
public String getId() {
return getFieldId().toString();
}
public static WhatsAppBusinessAccount loadJSON(String json, APIContext context, String header) {
WhatsAppBusinessAccount whatsAppBusinessAccount = getGson().fromJson(json, WhatsAppBusinessAccount.class);
if (context.isDebug()) {
JsonParser parser = new JsonParser();
JsonElement o1 = parser.parse(json);
JsonElement o2 = parser.parse(whatsAppBusinessAccount.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);
}
}
whatsAppBusinessAccount.context = context;
whatsAppBusinessAccount.rawValue = json;
whatsAppBusinessAccount.header = header;
return whatsAppBusinessAccount;
}
public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException {
APINodeList whatsAppBusinessAccounts = 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++) {
whatsAppBusinessAccounts.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header));
};
return whatsAppBusinessAccounts;
} 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;
whatsAppBusinessAccounts.setCursors(before, after);
}
String previous = paging.has("previous") ? paging.get("previous").getAsString() : null;
String next = paging.has("next") ? paging.get("next").getAsString() : null;
whatsAppBusinessAccounts.setPaging(previous, next);
if (context.hasAppSecret()) {
whatsAppBusinessAccounts.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++) {
whatsAppBusinessAccounts.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()) {
whatsAppBusinessAccounts.add(loadJSON(entry.getValue().toString(), context, header));
}
break;
}
}
if (!isRedownload) {
whatsAppBusinessAccounts.add(loadJSON(obj.toString(), context, header));
}
}
return whatsAppBusinessAccounts;
} 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()) {
whatsAppBusinessAccounts.add(loadJSON(entry.getValue().toString(), context, header));
}
return whatsAppBusinessAccounts;
} 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)
) {
whatsAppBusinessAccounts.add(loadJSON(value.toString(), context, header));
} else {
isIdIndexedArray = false;
break;
}
}
if (isIdIndexedArray) {
return whatsAppBusinessAccounts;
}
// Sixth, check if it's pure JsonObject
whatsAppBusinessAccounts.clear();
whatsAppBusinessAccounts.add(loadJSON(json, context, header));
return whatsAppBusinessAccounts;
}
}
} catch (Exception e) {
exception = e;
}
throw new MalformedResponseException(
"Invalid response string: " + json,
exception
);
}
@Override
public APIContext getContext() {
return context;
}
@Override
public void setContext(APIContext context) {
this.context = context;
}
@Override
public String toString() {
return getGson().toJson(this);
}
public APIRequestGetActivities getActivities() {
return new APIRequestGetActivities(this.getPrefixedId().toString(), context);
}
public 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 APIRequestGetAudiences getAudiences() {
return new APIRequestGetAudiences(this.getPrefixedId().toString(), context);
}
public APIRequestGetConversationAnalytics getConversationAnalytics() {
return new APIRequestGetConversationAnalytics(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 APIRequestGetDccConfig getDccConfig() {
return new APIRequestGetDccConfig(this.getPrefixedId().toString(), context);
}
public APIRequestGetFlows getFlows() {
return new APIRequestGetFlows(this.getPrefixedId().toString(), context);
}
public APIRequestCreateFlow createFlow() {
return new APIRequestCreateFlow(this.getPrefixedId().toString(), context);
}
public APIRequestCreateGeneratePaymentConfigurationOauthLink createGeneratePaymentConfigurationOauthLink() {
return new APIRequestCreateGeneratePaymentConfigurationOauthLink(this.getPrefixedId().toString(), context);
}
public APIRequestGetMessageCampaigns getMessageCampaigns() {
return new APIRequestGetMessageCampaigns(this.getPrefixedId().toString(), context);
}
public APIRequestGetMessageTemplatePreviews getMessageTemplatePreviews() {
return new APIRequestGetMessageTemplatePreviews(this.getPrefixedId().toString(), context);
}
public APIRequestDeleteMessageTemplates deleteMessageTemplates() {
return new APIRequestDeleteMessageTemplates(this.getPrefixedId().toString(), context);
}
public APIRequestGetMessageTemplates getMessageTemplates() {
return new APIRequestGetMessageTemplates(this.getPrefixedId().toString(), context);
}
public APIRequestCreateMessageTemplate createMessageTemplate() {
return new APIRequestCreateMessageTemplate(this.getPrefixedId().toString(), context);
}
public APIRequestCreateMigrateFlow createMigrateFlow() {
return new APIRequestCreateMigrateFlow(this.getPrefixedId().toString(), context);
}
public APIRequestCreateMigrateMessageTemplate createMigrateMessageTemplate() {
return new APIRequestCreateMigrateMessageTemplate(this.getPrefixedId().toString(), context);
}
public APIRequestDeletePaymentConfiguration deletePaymentConfiguration() {
return new APIRequestDeletePaymentConfiguration(this.getPrefixedId().toString(), context);
}
public APIRequestGetPaymentConfiguration getPaymentConfiguration() {
return new APIRequestGetPaymentConfiguration(this.getPrefixedId().toString(), context);
}
public APIRequestCreatePaymentConfiguration createPaymentConfiguration() {
return new APIRequestCreatePaymentConfiguration(this.getPrefixedId().toString(), context);
}
public APIRequestGetPaymentConfigurations getPaymentConfigurations() {
return new APIRequestGetPaymentConfigurations(this.getPrefixedId().toString(), context);
}
public APIRequestGetPhoneNumbers getPhoneNumbers() {
return new APIRequestGetPhoneNumbers(this.getPrefixedId().toString(), context);
}
public APIRequestCreatePhoneNumber createPhoneNumber() {
return new APIRequestCreatePhoneNumber(this.getPrefixedId().toString(), context);
}
public APIRequestDeleteProductCatalogs deleteProductCatalogs() {
return new APIRequestDeleteProductCatalogs(this.getPrefixedId().toString(), context);
}
public APIRequestGetProductCatalogs getProductCatalogs() {
return new APIRequestGetProductCatalogs(this.getPrefixedId().toString(), context);
}
public APIRequestCreateProductCatalog createProductCatalog() {
return new APIRequestCreateProductCatalog(this.getPrefixedId().toString(), context);
}
public APIRequestGetSchedules getSchedules() {
return new APIRequestGetSchedules(this.getPrefixedId().toString(), context);
}
public APIRequestCreateSetOboMobilityIntent createSetOboMobilityIntent() {
return new APIRequestCreateSetOboMobilityIntent(this.getPrefixedId().toString(), context);
}
public APIRequestCreateSetSolutionMigrationInTEnt createSetSolutionMigrationInTEnt() {
return new APIRequestCreateSetSolutionMigrationInTEnt(this.getPrefixedId().toString(), context);
}
public APIRequestGetSolutions getSolutions() {
return new APIRequestGetSolutions(this.getPrefixedId().toString(), context);
}
public APIRequestDeleteSubscribedApps deleteSubscribedApps() {
return new APIRequestDeleteSubscribedApps(this.getPrefixedId().toString(), context);
}
public APIRequestGetSubscribedApps getSubscribedApps() {
return new APIRequestGetSubscribedApps(this.getPrefixedId().toString(), context);
}
public APIRequestCreateSubscribedApp createSubscribedApp() {
return new APIRequestCreateSubscribedApp(this.getPrefixedId().toString(), context);
}
public APIRequestGetTemplateAnalytics getTemplateAnalytics() {
return new APIRequestGetTemplateAnalytics(this.getPrefixedId().toString(), context);
}
public APIRequestGetTemplatePerformanceMetrics getTemplatePerformanceMetrics() {
return new APIRequestGetTemplatePerformanceMetrics(this.getPrefixedId().toString(), context);
}
public APIRequestCreateUpsertMessageTemplate createUpsertMessageTemplate() {
return new APIRequestCreateUpsertMessageTemplate(this.getPrefixedId().toString(), context);
}
public APIRequestGetWelcomeMessageSequences getWelcomeMessageSequences() {
return new APIRequestGetWelcomeMessageSequences(this.getPrefixedId().toString(), context);
}
public APIRequestGet get() {
return new APIRequestGet(this.getPrefixedId().toString(), context);
}
public APIRequestUpdate update() {
return new APIRequestUpdate(this.getPrefixedId().toString(), context);
}
public String getFieldAccountReviewStatus() {
return mAccountReviewStatus;
}
public Object getFieldAnalytics() {
return mAnalytics;
}
public Object getFieldAuthInternationalRateEligibility() {
return mAuthInternationalRateEligibility;
}
public String getFieldBusinessVerificationStatus() {
return mBusinessVerificationStatus;
}
public String getFieldCountry() {
return mCountry;
}
public Long getFieldCreationTime() {
return mCreationTime;
}
public String getFieldCurrency() {
return mCurrency;
}
public WhatsAppBusinessHealthStatusForMessageSend getFieldHealthStatus() {
return mHealthStatus;
}
public String getFieldId() {
return mId;
}
public Boolean getFieldIsEnabledForInsights() {
return mIsEnabledForInsights;
}
public CommerceMerchantSettings getFieldLinkedCommerceAccount() {
if (mLinkedCommerceAccount != null) {
mLinkedCommerceAccount.context = getContext();
}
return mLinkedCommerceAccount;
}
public String getFieldMessageTemplateNamespace() {
return mMessageTemplateNamespace;
}
public String getFieldName() {
return mName;
}
public Object getFieldOnBehalfOfBusinessInfo() {
return mOnBehalfOfBusinessInfo;
}
public Business getFieldOwnerBusiness() {
if (mOwnerBusiness != null) {
mOwnerBusiness.context = getContext();
}
return mOwnerBusiness;
}
public Object getFieldOwnerBusinessInfo() {
return mOwnerBusinessInfo;
}
public String getFieldOwnershipType() {
return mOwnershipType;
}
public String getFieldPrimaryBusinessLocation() {
return mPrimaryBusinessLocation;
}
public String getFieldPrimaryFundingId() {
return mPrimaryFundingId;
}
public String getFieldPurchaseOrderNumber() {
return mPurchaseOrderNumber;
}
public String getFieldStatus() {
return mStatus;
}
public String getFieldTimezoneId() {
return mTimezoneId;
}
public static class APIRequestGetActivities 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 APIRequestGetActivities.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
public APIRequestGetActivities(String nodeId, APIContext context) {
super(context, nodeId, "/activities", "GET", Arrays.asList(PARAMS));
}
@Override
public APIRequestGetActivities setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestGetActivities setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestGetActivities requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestGetActivities requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetActivities requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestGetActivities requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetActivities requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestGetActivities requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
}
public static class 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);
}
}
},
MoreExecutors.directExecutor()
);
};
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);
}
}
},
MoreExecutors.directExecutor()
);
};
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 {
WhatsAppBusinessAccount lastResponse = null;
@Override
public WhatsAppBusinessAccount getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"tasks",
"user",
};
public static final String[] FIELDS = {
};
@Override
public WhatsAppBusinessAccount parseResponse(String response, String header) throws APIException {
return WhatsAppBusinessAccount.parseResponse(response, getContext(), this, header).head();
}
@Override
public WhatsAppBusinessAccount execute() throws APIException {
return execute(new HashMap());
}
@Override
public WhatsAppBusinessAccount 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 WhatsAppBusinessAccount apply(ResponseWrapper result) {
try {
return APIRequestCreateAssignedUser.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
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 APIRequestGetAudiences 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 APIRequestGetAudiences.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
public APIRequestGetAudiences(String nodeId, APIContext context) {
super(context, nodeId, "/audiences", "GET", Arrays.asList(PARAMS));
}
@Override
public APIRequestGetAudiences setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestGetAudiences setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestGetAudiences requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestGetAudiences requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetAudiences requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestGetAudiences requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetAudiences requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestGetAudiences requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
}
public static class APIRequestGetConversationAnalytics extends APIRequest {
APINodeList lastResponse = null;
@Override
public APINodeList getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"conversation_categories",
"conversation_directions",
"conversation_types",
"country_codes",
"dimensions",
"end",
"granularity",
"metric_types",
"phone_numbers",
"start",
};
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 APIRequestGetConversationAnalytics.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
public APIRequestGetConversationAnalytics(String nodeId, APIContext context) {
super(context, nodeId, "/conversation_analytics", "GET", Arrays.asList(PARAMS));
}
@Override
public APIRequestGetConversationAnalytics setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestGetConversationAnalytics setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestGetConversationAnalytics setConversationCategories (List conversationCategories) {
this.setParam("conversation_categories", conversationCategories);
return this;
}
public APIRequestGetConversationAnalytics setConversationCategories (String conversationCategories) {
this.setParam("conversation_categories", conversationCategories);
return this;
}
public APIRequestGetConversationAnalytics setConversationDirections (List conversationDirections) {
this.setParam("conversation_directions", conversationDirections);
return this;
}
public APIRequestGetConversationAnalytics setConversationDirections (String conversationDirections) {
this.setParam("conversation_directions", conversationDirections);
return this;
}
public APIRequestGetConversationAnalytics setConversationTypes (List conversationTypes) {
this.setParam("conversation_types", conversationTypes);
return this;
}
public APIRequestGetConversationAnalytics setConversationTypes (String conversationTypes) {
this.setParam("conversation_types", conversationTypes);
return this;
}
public APIRequestGetConversationAnalytics setCountryCodes (List countryCodes) {
this.setParam("country_codes", countryCodes);
return this;
}
public APIRequestGetConversationAnalytics setCountryCodes (String countryCodes) {
this.setParam("country_codes", countryCodes);
return this;
}
public APIRequestGetConversationAnalytics setDimensions (List dimensions) {
this.setParam("dimensions", dimensions);
return this;
}
public APIRequestGetConversationAnalytics setDimensions (String dimensions) {
this.setParam("dimensions", dimensions);
return this;
}
public APIRequestGetConversationAnalytics setEnd (Long end) {
this.setParam("end", end);
return this;
}
public APIRequestGetConversationAnalytics setEnd (String end) {
this.setParam("end", end);
return this;
}
public APIRequestGetConversationAnalytics setGranularity (EnumGranularity granularity) {
this.setParam("granularity", granularity);
return this;
}
public APIRequestGetConversationAnalytics setGranularity (String granularity) {
this.setParam("granularity", granularity);
return this;
}
public APIRequestGetConversationAnalytics setMetricTypes (List metricTypes) {
this.setParam("metric_types", metricTypes);
return this;
}
public APIRequestGetConversationAnalytics setMetricTypes (String metricTypes) {
this.setParam("metric_types", metricTypes);
return this;
}
public APIRequestGetConversationAnalytics setPhoneNumbers (List phoneNumbers) {
this.setParam("phone_numbers", phoneNumbers);
return this;
}
public APIRequestGetConversationAnalytics setPhoneNumbers (String phoneNumbers) {
this.setParam("phone_numbers", phoneNumbers);
return this;
}
public APIRequestGetConversationAnalytics setStart (Long start) {
this.setParam("start", start);
return this;
}
public APIRequestGetConversationAnalytics setStart (String start) {
this.setParam("start", start);
return this;
}
public APIRequestGetConversationAnalytics requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestGetConversationAnalytics requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetConversationAnalytics requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestGetConversationAnalytics requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetConversationAnalytics requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestGetConversationAnalytics requestField (String field, boolean value) {
this.requestFieldInternal(field, 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 APIRequestGetDccConfig 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 APIRequestGetDccConfig.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
public APIRequestGetDccConfig(String nodeId, APIContext context) {
super(context, nodeId, "/dcc_config", "GET", Arrays.asList(PARAMS));
}
@Override
public APIRequestGetDccConfig setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestGetDccConfig setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestGetDccConfig requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestGetDccConfig requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetDccConfig requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestGetDccConfig requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetDccConfig requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestGetDccConfig requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
}
public static class APIRequestGetFlows 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 APIRequestGetFlows.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
public APIRequestGetFlows(String nodeId, APIContext context) {
super(context, nodeId, "/flows", "GET", Arrays.asList(PARAMS));
}
@Override
public APIRequestGetFlows setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestGetFlows setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestGetFlows requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestGetFlows requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetFlows requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestGetFlows requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetFlows requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestGetFlows requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
}
public static class APIRequestCreateFlow extends APIRequest {
APINode lastResponse = null;
@Override
public APINode getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"categories",
"clone_flow_id",
"endpoint_uri",
"name",
};
public static final String[] FIELDS = {
};
@Override
public APINode parseResponse(String response, String header) throws APIException {
return APINode.parseResponse(response, getContext(), this, header).head();
}
@Override
public APINode execute() throws APIException {
return execute(new HashMap());
}
@Override
public APINode 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 APINode apply(ResponseWrapper result) {
try {
return APIRequestCreateFlow.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
public APIRequestCreateFlow(String nodeId, APIContext context) {
super(context, nodeId, "/flows", "POST", Arrays.asList(PARAMS));
}
@Override
public APIRequestCreateFlow setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestCreateFlow setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestCreateFlow setCategories (List categories) {
this.setParam("categories", categories);
return this;
}
public APIRequestCreateFlow setCategories (String categories) {
this.setParam("categories", categories);
return this;
}
public APIRequestCreateFlow setCloneFlowId (String cloneFlowId) {
this.setParam("clone_flow_id", cloneFlowId);
return this;
}
public APIRequestCreateFlow setEndpointUri (String endpointUri) {
this.setParam("endpoint_uri", endpointUri);
return this;
}
public APIRequestCreateFlow setName (String name) {
this.setParam("name", name);
return this;
}
public APIRequestCreateFlow requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestCreateFlow requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestCreateFlow requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestCreateFlow requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestCreateFlow requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestCreateFlow requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
}
public static class APIRequestCreateGeneratePaymentConfigurationOauthLink extends APIRequest {
WhatsAppBusinessAccount lastResponse = null;
@Override
public WhatsAppBusinessAccount getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"configuration_name",
"redirect_url",
};
public static final String[] FIELDS = {
};
@Override
public WhatsAppBusinessAccount parseResponse(String response, String header) throws APIException {
return WhatsAppBusinessAccount.parseResponse(response, getContext(), this, header).head();
}
@Override
public WhatsAppBusinessAccount execute() throws APIException {
return execute(new HashMap());
}
@Override
public WhatsAppBusinessAccount 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 WhatsAppBusinessAccount apply(ResponseWrapper result) {
try {
return APIRequestCreateGeneratePaymentConfigurationOauthLink.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
public APIRequestCreateGeneratePaymentConfigurationOauthLink(String nodeId, APIContext context) {
super(context, nodeId, "/generate_payment_configuration_oauth_link", "POST", Arrays.asList(PARAMS));
}
@Override
public APIRequestCreateGeneratePaymentConfigurationOauthLink setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestCreateGeneratePaymentConfigurationOauthLink setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestCreateGeneratePaymentConfigurationOauthLink setConfigurationName (String configurationName) {
this.setParam("configuration_name", configurationName);
return this;
}
public APIRequestCreateGeneratePaymentConfigurationOauthLink setRedirectUrl (String redirectUrl) {
this.setParam("redirect_url", redirectUrl);
return this;
}
public APIRequestCreateGeneratePaymentConfigurationOauthLink requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestCreateGeneratePaymentConfigurationOauthLink requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestCreateGeneratePaymentConfigurationOauthLink requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestCreateGeneratePaymentConfigurationOauthLink requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestCreateGeneratePaymentConfigurationOauthLink requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestCreateGeneratePaymentConfigurationOauthLink requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
}
public static class APIRequestGetMessageCampaigns 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 APIRequestGetMessageCampaigns.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
public APIRequestGetMessageCampaigns(String nodeId, APIContext context) {
super(context, nodeId, "/message_campaigns", "GET", Arrays.asList(PARAMS));
}
@Override
public APIRequestGetMessageCampaigns setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestGetMessageCampaigns setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestGetMessageCampaigns requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestGetMessageCampaigns requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetMessageCampaigns requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestGetMessageCampaigns requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetMessageCampaigns requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestGetMessageCampaigns requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
}
public static class APIRequestGetMessageTemplatePreviews extends APIRequest {
APINodeList lastResponse = null;
@Override
public APINodeList getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"add_security_recommendation",
"button_types",
"category",
"code_expiration_minutes",
"languages",
};
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 APIRequestGetMessageTemplatePreviews.this.parseResponse(result.getBody(), result.getHeader());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
},
MoreExecutors.directExecutor()
);
};
public APIRequestGetMessageTemplatePreviews(String nodeId, APIContext context) {
super(context, nodeId, "/message_template_previews", "GET", Arrays.asList(PARAMS));
}
@Override
public APIRequestGetMessageTemplatePreviews setParam(String param, Object value) {
setParamInternal(param, value);
return this;
}
@Override
public APIRequestGetMessageTemplatePreviews setParams(Map params) {
setParamsInternal(params);
return this;
}
public APIRequestGetMessageTemplatePreviews setAddSecurityRecommendation (Boolean addSecurityRecommendation) {
this.setParam("add_security_recommendation", addSecurityRecommendation);
return this;
}
public APIRequestGetMessageTemplatePreviews setAddSecurityRecommendation (String addSecurityRecommendation) {
this.setParam("add_security_recommendation", addSecurityRecommendation);
return this;
}
public APIRequestGetMessageTemplatePreviews setButtonTypes (List buttonTypes) {
this.setParam("button_types", buttonTypes);
return this;
}
public APIRequestGetMessageTemplatePreviews setButtonTypes (String buttonTypes) {
this.setParam("button_types", buttonTypes);
return this;
}
public APIRequestGetMessageTemplatePreviews setCategory (EnumCategory category) {
this.setParam("category", category);
return this;
}
public APIRequestGetMessageTemplatePreviews setCategory (String category) {
this.setParam("category", category);
return this;
}
public APIRequestGetMessageTemplatePreviews setCodeExpirationMinutes (Long codeExpirationMinutes) {
this.setParam("code_expiration_minutes", codeExpirationMinutes);
return this;
}
public APIRequestGetMessageTemplatePreviews setCodeExpirationMinutes (String codeExpirationMinutes) {
this.setParam("code_expiration_minutes", codeExpirationMinutes);
return this;
}
public APIRequestGetMessageTemplatePreviews setLanguages (List languages) {
this.setParam("languages", languages);
return this;
}
public APIRequestGetMessageTemplatePreviews setLanguages (String languages) {
this.setParam("languages", languages);
return this;
}
public APIRequestGetMessageTemplatePreviews requestAllFields () {
return this.requestAllFields(true);
}
public APIRequestGetMessageTemplatePreviews requestAllFields (boolean value) {
for (String field : FIELDS) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetMessageTemplatePreviews requestFields (List fields) {
return this.requestFields(fields, true);
}
@Override
public APIRequestGetMessageTemplatePreviews requestFields (List fields, boolean value) {
for (String field : fields) {
this.requestField(field, value);
}
return this;
}
@Override
public APIRequestGetMessageTemplatePreviews requestField (String field) {
this.requestField(field, true);
return this;
}
@Override
public APIRequestGetMessageTemplatePreviews requestField (String field, boolean value) {
this.requestFieldInternal(field, value);
return this;
}
}
public static class APIRequestDeleteMessageTemplates extends APIRequest {
APINodeList lastResponse = null;
@Override
public APINodeList getLastResponse() {
return lastResponse;
}
public static final String[] PARAMS = {
"hsm_id",
"name",
};
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