com.criteo.marketing.api.SellersV2Api Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of marketing.java-client Show documentation
Show all versions of marketing.java-client Show documentation
Criteo Marketing SDK for Java
/*
* Marketing API v.1.0
* IMPORTANT: This swagger links to Criteo production environment. Any test applied here will thus impact real campaigns.
*
* OpenAPI spec version: v.1.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.criteo.marketing.api;
import com.criteo.marketing.ApiCallback;
import com.criteo.marketing.ApiClient;
import com.criteo.marketing.ApiException;
import com.criteo.marketing.ApiResponse;
import com.criteo.marketing.Configuration;
import com.criteo.marketing.Pair;
import com.criteo.marketing.ProgressRequestBody;
import com.criteo.marketing.ProgressResponseBody;
import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import com.criteo.marketing.model.CreateSellerBudgetMapiMessage;
import com.criteo.marketing.model.ErrorSource;
import java.time.OffsetDateTime;
import com.criteo.marketing.model.SellerBase;
import com.criteo.marketing.model.SellerBudgetMessage;
import com.criteo.marketing.model.SellerCampaignMessage;
import com.criteo.marketing.model.SellerCampaignUpdate;
import com.criteo.marketing.model.UpdateSellerBudgetMessage;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class SellersV2Api {
private ApiClient apiClient;
public SellersV2Api() {
this(Configuration.getDefaultApiClient());
}
public SellersV2Api(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Build call for createSellerBudgets
* @param authorization JWT Bearer Token (required)
* @param createSellerBudgets (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call createSellerBudgetsCall(String authorization, List createSellerBudgets, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = createSellerBudgets;
// create path and map variables
String localVarPath = "/v2/crp/budgets";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
if (authorization != null) {
localVarHeaderParams.put("Authorization", apiClient.parameterToString(authorization));
}
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json", "text/json", "application/xml", "text/xml", "text/html"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
"application/json", "text/json", "application/xml", "text/xml", "application/x-www-form-urlencoded", "text/html"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (progressListener != null) {
apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "Authorization" };
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call createSellerBudgetsValidateBeforeCall(String authorization, List createSellerBudgets, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'authorization' is set
if (authorization == null) {
throw new ApiException("Missing the required parameter 'authorization' when calling createSellerBudgets(Async)");
}
// verify the required parameter 'createSellerBudgets' is set
if (createSellerBudgets == null) {
throw new ApiException("Missing the required parameter 'createSellerBudgets' when calling createSellerBudgets(Async)");
}
okhttp3.Call call = createSellerBudgetsCall(authorization, createSellerBudgets, progressListener, progressRequestListener);
return call;
}
/**
* Create a collection of budgets.
* Create one or more new budgets to enable spending with the given limitations. All three types of budgets can be created this way. The following constraints apply when creating a new budget. • <b>sellerId</b>: the seller MUST be supplied<br /> • <b>campaignIds</b>: a non-empty array of campaign ids MUST be supplied<br /> • <b>budgetType</b>: a budget type MUST be supplied<br /> • <b>amount</b>: an amount MAY be supplied only if the type is not Uncapped and if supplied it MUST be non-negative<br /> • <b>startDate</b>: a future start date MUST be supplied<br /> • <b>endDate</b>: an end date MAY be supplied and if supplied MUST be greater than the start date<br /> Other attributes MUST NOT be supplied.
* @param authorization JWT Bearer Token (required)
* @param createSellerBudgets (required)
* @return List<SellerBudgetMessage>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public List createSellerBudgets(String authorization, List createSellerBudgets) throws ApiException {
ApiResponse> resp = createSellerBudgetsWithHttpInfo(authorization, createSellerBudgets);
return resp.getData();
}
/**
* Create a collection of budgets.
* Create one or more new budgets to enable spending with the given limitations. All three types of budgets can be created this way. The following constraints apply when creating a new budget. • <b>sellerId</b>: the seller MUST be supplied<br /> • <b>campaignIds</b>: a non-empty array of campaign ids MUST be supplied<br /> • <b>budgetType</b>: a budget type MUST be supplied<br /> • <b>amount</b>: an amount MAY be supplied only if the type is not Uncapped and if supplied it MUST be non-negative<br /> • <b>startDate</b>: a future start date MUST be supplied<br /> • <b>endDate</b>: an end date MAY be supplied and if supplied MUST be greater than the start date<br /> Other attributes MUST NOT be supplied.
* @param authorization JWT Bearer Token (required)
* @param createSellerBudgets (required)
* @return ApiResponse<List<SellerBudgetMessage>>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse> createSellerBudgetsWithHttpInfo(String authorization, List createSellerBudgets) throws ApiException {
okhttp3.Call call = createSellerBudgetsValidateBeforeCall(authorization, createSellerBudgets, null, null);
Type localVarReturnType = new TypeToken>(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Create a collection of budgets. (asynchronously)
* Create one or more new budgets to enable spending with the given limitations. All three types of budgets can be created this way. The following constraints apply when creating a new budget. • <b>sellerId</b>: the seller MUST be supplied<br /> • <b>campaignIds</b>: a non-empty array of campaign ids MUST be supplied<br /> • <b>budgetType</b>: a budget type MUST be supplied<br /> • <b>amount</b>: an amount MAY be supplied only if the type is not Uncapped and if supplied it MUST be non-negative<br /> • <b>startDate</b>: a future start date MUST be supplied<br /> • <b>endDate</b>: an end date MAY be supplied and if supplied MUST be greater than the start date<br /> Other attributes MUST NOT be supplied.
* @param authorization JWT Bearer Token (required)
* @param createSellerBudgets (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public okhttp3.Call createSellerBudgetsAsync(String authorization, List createSellerBudgets, final ApiCallback> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
okhttp3.Call call = createSellerBudgetsValidateBeforeCall(authorization, createSellerBudgets, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getBudgetsBySeller
* @param sellerId Return only budgets belonging to the given seller. (required)
* @param authorization JWT Bearer Token (required)
* @param status Return only budgets with the given status. (optional)
* @param withBalance Return only budgets with the given status. (optional)
* @param withSpend Return budgets with any positive spend. (optional)
* @param endAfterDate Return budgets that end after the given date. If param is not provided, default behavior is to only return budgets that have not yet ended. (optional)
* @param startBeforeDate Return budgets that start on or before the given date. (optional)
* @param campaignId Return only budgets that pay for a given campaign. (optional)
* @param type Return only budgets with the given budget type. (optional)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call getBudgetsBySellerCall(String sellerId, String authorization, String status, Boolean withBalance, Boolean withSpend, OffsetDateTime endAfterDate, OffsetDateTime startBeforeDate, Integer campaignId, String type, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
String localVarPath = "/v2/crp/sellers/{sellerId}/budgets"
.replaceAll("\\{" + "sellerId" + "\\}", apiClient.escapeString(sellerId.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
if (status != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("status", status));
}
if (withBalance != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("withBalance", withBalance));
}
if (withSpend != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("withSpend", withSpend));
}
if (endAfterDate != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("endAfterDate", endAfterDate));
}
if (startBeforeDate != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("startBeforeDate", startBeforeDate));
}
if (campaignId != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("campaignId", campaignId));
}
if (type != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("type", type));
}
Map localVarHeaderParams = new HashMap();
if (authorization != null) {
localVarHeaderParams.put("Authorization", apiClient.parameterToString(authorization));
}
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json", "text/json", "application/xml", "text/xml", "text/html"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (progressListener != null) {
apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "Authorization" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call getBudgetsBySellerValidateBeforeCall(String sellerId, String authorization, String status, Boolean withBalance, Boolean withSpend, OffsetDateTime endAfterDate, OffsetDateTime startBeforeDate, Integer campaignId, String type, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'sellerId' is set
if (sellerId == null) {
throw new ApiException("Missing the required parameter 'sellerId' when calling getBudgetsBySeller(Async)");
}
// verify the required parameter 'authorization' is set
if (authorization == null) {
throw new ApiException("Missing the required parameter 'authorization' when calling getBudgetsBySeller(Async)");
}
okhttp3.Call call = getBudgetsBySellerCall(sellerId, authorization, status, withBalance, withSpend, endAfterDate, startBeforeDate, campaignId, type, progressListener, progressRequestListener);
return call;
}
/**
* Get a collection of budgets for this seller.
* Return a collection of budgets for this seller filtered by optional filter parameters. If all parameters are omitted the entire collection to which the user has access is returned, except those whose endDate is in the past. Returned budgets must satisfy all supplied filter criteria if multiple parameters are used. See the budgets endpoint for additional details.
* @param sellerId Return only budgets belonging to the given seller. (required)
* @param authorization JWT Bearer Token (required)
* @param status Return only budgets with the given status. (optional)
* @param withBalance Return only budgets with the given status. (optional)
* @param withSpend Return budgets with any positive spend. (optional)
* @param endAfterDate Return budgets that end after the given date. If param is not provided, default behavior is to only return budgets that have not yet ended. (optional)
* @param startBeforeDate Return budgets that start on or before the given date. (optional)
* @param campaignId Return only budgets that pay for a given campaign. (optional)
* @param type Return only budgets with the given budget type. (optional)
* @return List<SellerBudgetMessage>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public List getBudgetsBySeller(String sellerId, String authorization, String status, Boolean withBalance, Boolean withSpend, OffsetDateTime endAfterDate, OffsetDateTime startBeforeDate, Integer campaignId, String type) throws ApiException {
ApiResponse> resp = getBudgetsBySellerWithHttpInfo(sellerId, authorization, status, withBalance, withSpend, endAfterDate, startBeforeDate, campaignId, type);
return resp.getData();
}
/**
* Get a collection of budgets for this seller.
* Return a collection of budgets for this seller filtered by optional filter parameters. If all parameters are omitted the entire collection to which the user has access is returned, except those whose endDate is in the past. Returned budgets must satisfy all supplied filter criteria if multiple parameters are used. See the budgets endpoint for additional details.
* @param sellerId Return only budgets belonging to the given seller. (required)
* @param authorization JWT Bearer Token (required)
* @param status Return only budgets with the given status. (optional)
* @param withBalance Return only budgets with the given status. (optional)
* @param withSpend Return budgets with any positive spend. (optional)
* @param endAfterDate Return budgets that end after the given date. If param is not provided, default behavior is to only return budgets that have not yet ended. (optional)
* @param startBeforeDate Return budgets that start on or before the given date. (optional)
* @param campaignId Return only budgets that pay for a given campaign. (optional)
* @param type Return only budgets with the given budget type. (optional)
* @return ApiResponse<List<SellerBudgetMessage>>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse> getBudgetsBySellerWithHttpInfo(String sellerId, String authorization, String status, Boolean withBalance, Boolean withSpend, OffsetDateTime endAfterDate, OffsetDateTime startBeforeDate, Integer campaignId, String type) throws ApiException {
okhttp3.Call call = getBudgetsBySellerValidateBeforeCall(sellerId, authorization, status, withBalance, withSpend, endAfterDate, startBeforeDate, campaignId, type, null, null);
Type localVarReturnType = new TypeToken>(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Get a collection of budgets for this seller. (asynchronously)
* Return a collection of budgets for this seller filtered by optional filter parameters. If all parameters are omitted the entire collection to which the user has access is returned, except those whose endDate is in the past. Returned budgets must satisfy all supplied filter criteria if multiple parameters are used. See the budgets endpoint for additional details.
* @param sellerId Return only budgets belonging to the given seller. (required)
* @param authorization JWT Bearer Token (required)
* @param status Return only budgets with the given status. (optional)
* @param withBalance Return only budgets with the given status. (optional)
* @param withSpend Return budgets with any positive spend. (optional)
* @param endAfterDate Return budgets that end after the given date. If param is not provided, default behavior is to only return budgets that have not yet ended. (optional)
* @param startBeforeDate Return budgets that start on or before the given date. (optional)
* @param campaignId Return only budgets that pay for a given campaign. (optional)
* @param type Return only budgets with the given budget type. (optional)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public okhttp3.Call getBudgetsBySellerAsync(String sellerId, String authorization, String status, Boolean withBalance, Boolean withSpend, OffsetDateTime endAfterDate, OffsetDateTime startBeforeDate, Integer campaignId, String type, final ApiCallback> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
okhttp3.Call call = getBudgetsBySellerValidateBeforeCall(sellerId, authorization, status, withBalance, withSpend, endAfterDate, startBeforeDate, campaignId, type, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getBudgetsBySellerCampaignId
* @param sellerCampaignId Return only budgets belonging to the given seller campaign. (required)
* @param authorization JWT Bearer Token (required)
* @param status Return only budgets with the given status. (optional)
* @param withBalance Return only budgets with a positive balance. (optional)
* @param withSpend Return budgets with a positive spend. (optional)
* @param endAfterDate Return budgets that end after the given date. If param is not provided, default behavior is to only return budgets that have not yet ended. (optional)
* @param startBeforeDate Return budgets that start on or before the given date. (optional)
* @param type Return only budgets with the given budget type. (optional)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call getBudgetsBySellerCampaignIdCall(String sellerCampaignId, String authorization, String status, Boolean withBalance, Boolean withSpend, OffsetDateTime endAfterDate, OffsetDateTime startBeforeDate, String type, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
String localVarPath = "/v2/crp/seller-campaigns/{sellerCampaignId}/budgets"
.replaceAll("\\{" + "sellerCampaignId" + "\\}", apiClient.escapeString(sellerCampaignId.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
if (status != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("status", status));
}
if (withBalance != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("withBalance", withBalance));
}
if (withSpend != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("withSpend", withSpend));
}
if (endAfterDate != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("endAfterDate", endAfterDate));
}
if (startBeforeDate != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("startBeforeDate", startBeforeDate));
}
if (type != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("type", type));
}
Map localVarHeaderParams = new HashMap();
if (authorization != null) {
localVarHeaderParams.put("Authorization", apiClient.parameterToString(authorization));
}
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json", "text/json", "application/xml", "text/xml", "text/html"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (progressListener != null) {
apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "Authorization" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call getBudgetsBySellerCampaignIdValidateBeforeCall(String sellerCampaignId, String authorization, String status, Boolean withBalance, Boolean withSpend, OffsetDateTime endAfterDate, OffsetDateTime startBeforeDate, String type, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'sellerCampaignId' is set
if (sellerCampaignId == null) {
throw new ApiException("Missing the required parameter 'sellerCampaignId' when calling getBudgetsBySellerCampaignId(Async)");
}
// verify the required parameter 'authorization' is set
if (authorization == null) {
throw new ApiException("Missing the required parameter 'authorization' when calling getBudgetsBySellerCampaignId(Async)");
}
okhttp3.Call call = getBudgetsBySellerCampaignIdCall(sellerCampaignId, authorization, status, withBalance, withSpend, endAfterDate, startBeforeDate, type, progressListener, progressRequestListener);
return call;
}
/**
* Get a collection of budgets for this seller campaign.
* Return a collection of budgets for this seller campaign filtered by optional filter parameters. If all parameters are omitted the entire collection to which the user has access is returned, except those whose endDate is in the past. Returned budgets must satisfy all supplied filter criteria if multiple parameters are used. See the budgets endpoint for additional details.
* @param sellerCampaignId Return only budgets belonging to the given seller campaign. (required)
* @param authorization JWT Bearer Token (required)
* @param status Return only budgets with the given status. (optional)
* @param withBalance Return only budgets with a positive balance. (optional)
* @param withSpend Return budgets with a positive spend. (optional)
* @param endAfterDate Return budgets that end after the given date. If param is not provided, default behavior is to only return budgets that have not yet ended. (optional)
* @param startBeforeDate Return budgets that start on or before the given date. (optional)
* @param type Return only budgets with the given budget type. (optional)
* @return List<SellerBudgetMessage>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public List getBudgetsBySellerCampaignId(String sellerCampaignId, String authorization, String status, Boolean withBalance, Boolean withSpend, OffsetDateTime endAfterDate, OffsetDateTime startBeforeDate, String type) throws ApiException {
ApiResponse> resp = getBudgetsBySellerCampaignIdWithHttpInfo(sellerCampaignId, authorization, status, withBalance, withSpend, endAfterDate, startBeforeDate, type);
return resp.getData();
}
/**
* Get a collection of budgets for this seller campaign.
* Return a collection of budgets for this seller campaign filtered by optional filter parameters. If all parameters are omitted the entire collection to which the user has access is returned, except those whose endDate is in the past. Returned budgets must satisfy all supplied filter criteria if multiple parameters are used. See the budgets endpoint for additional details.
* @param sellerCampaignId Return only budgets belonging to the given seller campaign. (required)
* @param authorization JWT Bearer Token (required)
* @param status Return only budgets with the given status. (optional)
* @param withBalance Return only budgets with a positive balance. (optional)
* @param withSpend Return budgets with a positive spend. (optional)
* @param endAfterDate Return budgets that end after the given date. If param is not provided, default behavior is to only return budgets that have not yet ended. (optional)
* @param startBeforeDate Return budgets that start on or before the given date. (optional)
* @param type Return only budgets with the given budget type. (optional)
* @return ApiResponse<List<SellerBudgetMessage>>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse> getBudgetsBySellerCampaignIdWithHttpInfo(String sellerCampaignId, String authorization, String status, Boolean withBalance, Boolean withSpend, OffsetDateTime endAfterDate, OffsetDateTime startBeforeDate, String type) throws ApiException {
okhttp3.Call call = getBudgetsBySellerCampaignIdValidateBeforeCall(sellerCampaignId, authorization, status, withBalance, withSpend, endAfterDate, startBeforeDate, type, null, null);
Type localVarReturnType = new TypeToken>(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Get a collection of budgets for this seller campaign. (asynchronously)
* Return a collection of budgets for this seller campaign filtered by optional filter parameters. If all parameters are omitted the entire collection to which the user has access is returned, except those whose endDate is in the past. Returned budgets must satisfy all supplied filter criteria if multiple parameters are used. See the budgets endpoint for additional details.
* @param sellerCampaignId Return only budgets belonging to the given seller campaign. (required)
* @param authorization JWT Bearer Token (required)
* @param status Return only budgets with the given status. (optional)
* @param withBalance Return only budgets with a positive balance. (optional)
* @param withSpend Return budgets with a positive spend. (optional)
* @param endAfterDate Return budgets that end after the given date. If param is not provided, default behavior is to only return budgets that have not yet ended. (optional)
* @param startBeforeDate Return budgets that start on or before the given date. (optional)
* @param type Return only budgets with the given budget type. (optional)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public okhttp3.Call getBudgetsBySellerCampaignIdAsync(String sellerCampaignId, String authorization, String status, Boolean withBalance, Boolean withSpend, OffsetDateTime endAfterDate, OffsetDateTime startBeforeDate, String type, final ApiCallback> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
okhttp3.Call call = getBudgetsBySellerCampaignIdValidateBeforeCall(sellerCampaignId, authorization, status, withBalance, withSpend, endAfterDate, startBeforeDate, type, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getSeller
* @param sellerId Id of the seller. (required)
* @param authorization JWT Bearer Token (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call getSellerCall(String sellerId, String authorization, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
String localVarPath = "/v2/crp/sellers/{sellerId}"
.replaceAll("\\{" + "sellerId" + "\\}", apiClient.escapeString(sellerId.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
if (authorization != null) {
localVarHeaderParams.put("Authorization", apiClient.parameterToString(authorization));
}
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json", "text/json", "application/xml", "text/xml", "text/html"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (progressListener != null) {
apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "Authorization" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call getSellerValidateBeforeCall(String sellerId, String authorization, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'sellerId' is set
if (sellerId == null) {
throw new ApiException("Missing the required parameter 'sellerId' when calling getSeller(Async)");
}
// verify the required parameter 'authorization' is set
if (authorization == null) {
throw new ApiException("Missing the required parameter 'authorization' when calling getSeller(Async)");
}
okhttp3.Call call = getSellerCall(sellerId, authorization, progressListener, progressRequestListener);
return call;
}
/**
* Get details for a seller.
* Returns details for the selected seller. For example { \"id\" : \"123456\" \"sellerName\": \"HBogart\", }
* @param sellerId Id of the seller. (required)
* @param authorization JWT Bearer Token (required)
* @return SellerBase
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public SellerBase getSeller(String sellerId, String authorization) throws ApiException {
ApiResponse resp = getSellerWithHttpInfo(sellerId, authorization);
return resp.getData();
}
/**
* Get details for a seller.
* Returns details for the selected seller. For example { \"id\" : \"123456\" \"sellerName\": \"HBogart\", }
* @param sellerId Id of the seller. (required)
* @param authorization JWT Bearer Token (required)
* @return ApiResponse<SellerBase>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getSellerWithHttpInfo(String sellerId, String authorization) throws ApiException {
okhttp3.Call call = getSellerValidateBeforeCall(sellerId, authorization, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Get details for a seller. (asynchronously)
* Returns details for the selected seller. For example { \"id\" : \"123456\" \"sellerName\": \"HBogart\", }
* @param sellerId Id of the seller. (required)
* @param authorization JWT Bearer Token (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public okhttp3.Call getSellerAsync(String sellerId, String authorization, final ApiCallback callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
okhttp3.Call call = getSellerValidateBeforeCall(sellerId, authorization, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getSellerBudget
* @param budgetId (required)
* @param authorization JWT Bearer Token (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call getSellerBudgetCall(Long budgetId, String authorization, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
String localVarPath = "/v2/crp/budgets/{budgetId}"
.replaceAll("\\{" + "budgetId" + "\\}", apiClient.escapeString(budgetId.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
if (authorization != null) {
localVarHeaderParams.put("Authorization", apiClient.parameterToString(authorization));
}
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json", "text/json", "text/html"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (progressListener != null) {
apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "Authorization" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call getSellerBudgetValidateBeforeCall(Long budgetId, String authorization, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'budgetId' is set
if (budgetId == null) {
throw new ApiException("Missing the required parameter 'budgetId' when calling getSellerBudget(Async)");
}
// verify the required parameter 'authorization' is set
if (authorization == null) {
throw new ApiException("Missing the required parameter 'authorization' when calling getSellerBudget(Async)");
}
okhttp3.Call call = getSellerBudgetCall(budgetId, authorization, progressListener, progressRequestListener);
return call;
}
/**
* Get details for a budget.
* Return a budget. For example: { \"id\": \"1759183\", \"sellerId\": \"321392\", \"campaignIds\": [ 143962 ], \"budgetType\": \"Capped\", \"amount\": 1000, \"startDate\": \"2021-01-11\", \"endDate\": \"2021-01-12\", \"spend\": null, \"status\": \"Active\" } A budget limits the spend of a seller for one or more campaigns. There are three types of budget:<br /><b>Uncapped</b> budgets put no limit on the total amount of spend.<br /><b>Capped</b> budgets limit the total spend to a fixed amount.<br /><b>Daily</b> budgets limit daily spend to a fixed amount.<br /> In addition, budgets can limit the spend to a specific range of dates using the start and end date attributes. Finally a budget must be active to be used. <b>Spend</b> approximates the current spend against this budget. There may be a lag between when an ad is clicked and the time it accrues to the spend. Daily budgets show spend against the most recent day only.
* @param budgetId (required)
* @param authorization JWT Bearer Token (required)
* @return SellerBudgetMessage
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public SellerBudgetMessage getSellerBudget(Long budgetId, String authorization) throws ApiException {
ApiResponse resp = getSellerBudgetWithHttpInfo(budgetId, authorization);
return resp.getData();
}
/**
* Get details for a budget.
* Return a budget. For example: { \"id\": \"1759183\", \"sellerId\": \"321392\", \"campaignIds\": [ 143962 ], \"budgetType\": \"Capped\", \"amount\": 1000, \"startDate\": \"2021-01-11\", \"endDate\": \"2021-01-12\", \"spend\": null, \"status\": \"Active\" } A budget limits the spend of a seller for one or more campaigns. There are three types of budget:<br /><b>Uncapped</b> budgets put no limit on the total amount of spend.<br /><b>Capped</b> budgets limit the total spend to a fixed amount.<br /><b>Daily</b> budgets limit daily spend to a fixed amount.<br /> In addition, budgets can limit the spend to a specific range of dates using the start and end date attributes. Finally a budget must be active to be used. <b>Spend</b> approximates the current spend against this budget. There may be a lag between when an ad is clicked and the time it accrues to the spend. Daily budgets show spend against the most recent day only.
* @param budgetId (required)
* @param authorization JWT Bearer Token (required)
* @return ApiResponse<SellerBudgetMessage>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getSellerBudgetWithHttpInfo(Long budgetId, String authorization) throws ApiException {
okhttp3.Call call = getSellerBudgetValidateBeforeCall(budgetId, authorization, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Get details for a budget. (asynchronously)
* Return a budget. For example: { \"id\": \"1759183\", \"sellerId\": \"321392\", \"campaignIds\": [ 143962 ], \"budgetType\": \"Capped\", \"amount\": 1000, \"startDate\": \"2021-01-11\", \"endDate\": \"2021-01-12\", \"spend\": null, \"status\": \"Active\" } A budget limits the spend of a seller for one or more campaigns. There are three types of budget:<br /><b>Uncapped</b> budgets put no limit on the total amount of spend.<br /><b>Capped</b> budgets limit the total spend to a fixed amount.<br /><b>Daily</b> budgets limit daily spend to a fixed amount.<br /> In addition, budgets can limit the spend to a specific range of dates using the start and end date attributes. Finally a budget must be active to be used. <b>Spend</b> approximates the current spend against this budget. There may be a lag between when an ad is clicked and the time it accrues to the spend. Daily budgets show spend against the most recent day only.
* @param budgetId (required)
* @param authorization JWT Bearer Token (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public okhttp3.Call getSellerBudgetAsync(Long budgetId, String authorization, final ApiCallback callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
okhttp3.Call call = getSellerBudgetValidateBeforeCall(budgetId, authorization, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getSellerBudgets
* @param authorization JWT Bearer Token (required)
* @param status Return only budgets with the given status. (optional)
* @param withBalance Return only budgets with the given status. (optional)
* @param withSpend Return budgets with any positive spend. (optional)
* @param endAfterDate Return budgets that end after the given date. If param is not provided, default behavior is to only return budgets that have not yet ended. (optional)
* @param startBeforeDate Return budgets that start on or before the given date. (optional)
* @param campaignId Return only budgets that pay for a given campaign. (optional)
* @param sellerId Return only budgets belonging to the given seller. (optional)
* @param type Return only budgets with the given budget type. (optional)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call getSellerBudgetsCall(String authorization, String status, Boolean withBalance, Boolean withSpend, OffsetDateTime endAfterDate, OffsetDateTime startBeforeDate, Integer campaignId, String sellerId, String type, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
String localVarPath = "/v2/crp/budgets";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
if (status != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("status", status));
}
if (withBalance != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("withBalance", withBalance));
}
if (withSpend != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("withSpend", withSpend));
}
if (endAfterDate != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("endAfterDate", endAfterDate));
}
if (startBeforeDate != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("startBeforeDate", startBeforeDate));
}
if (campaignId != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("campaignId", campaignId));
}
if (sellerId != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("sellerId", sellerId));
}
if (type != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("type", type));
}
Map localVarHeaderParams = new HashMap();
if (authorization != null) {
localVarHeaderParams.put("Authorization", apiClient.parameterToString(authorization));
}
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json", "text/json", "application/xml", "text/xml", "text/html"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (progressListener != null) {
apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "Authorization" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call getSellerBudgetsValidateBeforeCall(String authorization, String status, Boolean withBalance, Boolean withSpend, OffsetDateTime endAfterDate, OffsetDateTime startBeforeDate, Integer campaignId, String sellerId, String type, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'authorization' is set
if (authorization == null) {
throw new ApiException("Missing the required parameter 'authorization' when calling getSellerBudgets(Async)");
}
okhttp3.Call call = getSellerBudgetsCall(authorization, status, withBalance, withSpend, endAfterDate, startBeforeDate, campaignId, sellerId, type, progressListener, progressRequestListener);
return call;
}
/**
* Get a collection of budgets.
* Return a collection of budgets filtered by optional filter parameters. If all parameters are omitted the entire collection to which the user has access is returned, except those whose endDate is in the past. Returned budgets must satisfy all supplied filter criteria if multiple parameters are used. <b>Date filter.</b> Filtering can return only budgets that were active for a date range by specifying the startBeforeDate and endAfterDate. Leaving off the startBeforeDate value makes budgets with any startDate qualify, whereas when leaving off the endAfterDate value will only return budgets whose endDate has not already passed. To get budgets that were active on a specific date, set both values to that day. <b>Spend.</b> If the endAfterDate is supplied, the spend excludes spend that happened after that date. In the case of a daily budget, only the spend for the final day is displayed. See the budgets endpoint for additional details.
* @param authorization JWT Bearer Token (required)
* @param status Return only budgets with the given status. (optional)
* @param withBalance Return only budgets with the given status. (optional)
* @param withSpend Return budgets with any positive spend. (optional)
* @param endAfterDate Return budgets that end after the given date. If param is not provided, default behavior is to only return budgets that have not yet ended. (optional)
* @param startBeforeDate Return budgets that start on or before the given date. (optional)
* @param campaignId Return only budgets that pay for a given campaign. (optional)
* @param sellerId Return only budgets belonging to the given seller. (optional)
* @param type Return only budgets with the given budget type. (optional)
* @return List<SellerBudgetMessage>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public List getSellerBudgets(String authorization, String status, Boolean withBalance, Boolean withSpend, OffsetDateTime endAfterDate, OffsetDateTime startBeforeDate, Integer campaignId, String sellerId, String type) throws ApiException {
ApiResponse> resp = getSellerBudgetsWithHttpInfo(authorization, status, withBalance, withSpend, endAfterDate, startBeforeDate, campaignId, sellerId, type);
return resp.getData();
}
/**
* Get a collection of budgets.
* Return a collection of budgets filtered by optional filter parameters. If all parameters are omitted the entire collection to which the user has access is returned, except those whose endDate is in the past. Returned budgets must satisfy all supplied filter criteria if multiple parameters are used. <b>Date filter.</b> Filtering can return only budgets that were active for a date range by specifying the startBeforeDate and endAfterDate. Leaving off the startBeforeDate value makes budgets with any startDate qualify, whereas when leaving off the endAfterDate value will only return budgets whose endDate has not already passed. To get budgets that were active on a specific date, set both values to that day. <b>Spend.</b> If the endAfterDate is supplied, the spend excludes spend that happened after that date. In the case of a daily budget, only the spend for the final day is displayed. See the budgets endpoint for additional details.
* @param authorization JWT Bearer Token (required)
* @param status Return only budgets with the given status. (optional)
* @param withBalance Return only budgets with the given status. (optional)
* @param withSpend Return budgets with any positive spend. (optional)
* @param endAfterDate Return budgets that end after the given date. If param is not provided, default behavior is to only return budgets that have not yet ended. (optional)
* @param startBeforeDate Return budgets that start on or before the given date. (optional)
* @param campaignId Return only budgets that pay for a given campaign. (optional)
* @param sellerId Return only budgets belonging to the given seller. (optional)
* @param type Return only budgets with the given budget type. (optional)
* @return ApiResponse<List<SellerBudgetMessage>>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse> getSellerBudgetsWithHttpInfo(String authorization, String status, Boolean withBalance, Boolean withSpend, OffsetDateTime endAfterDate, OffsetDateTime startBeforeDate, Integer campaignId, String sellerId, String type) throws ApiException {
okhttp3.Call call = getSellerBudgetsValidateBeforeCall(authorization, status, withBalance, withSpend, endAfterDate, startBeforeDate, campaignId, sellerId, type, null, null);
Type localVarReturnType = new TypeToken>(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Get a collection of budgets. (asynchronously)
* Return a collection of budgets filtered by optional filter parameters. If all parameters are omitted the entire collection to which the user has access is returned, except those whose endDate is in the past. Returned budgets must satisfy all supplied filter criteria if multiple parameters are used. <b>Date filter.</b> Filtering can return only budgets that were active for a date range by specifying the startBeforeDate and endAfterDate. Leaving off the startBeforeDate value makes budgets with any startDate qualify, whereas when leaving off the endAfterDate value will only return budgets whose endDate has not already passed. To get budgets that were active on a specific date, set both values to that day. <b>Spend.</b> If the endAfterDate is supplied, the spend excludes spend that happened after that date. In the case of a daily budget, only the spend for the final day is displayed. See the budgets endpoint for additional details.
* @param authorization JWT Bearer Token (required)
* @param status Return only budgets with the given status. (optional)
* @param withBalance Return only budgets with the given status. (optional)
* @param withSpend Return budgets with any positive spend. (optional)
* @param endAfterDate Return budgets that end after the given date. If param is not provided, default behavior is to only return budgets that have not yet ended. (optional)
* @param startBeforeDate Return budgets that start on or before the given date. (optional)
* @param campaignId Return only budgets that pay for a given campaign. (optional)
* @param sellerId Return only budgets belonging to the given seller. (optional)
* @param type Return only budgets with the given budget type. (optional)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public okhttp3.Call getSellerBudgetsAsync(String authorization, String status, Boolean withBalance, Boolean withSpend, OffsetDateTime endAfterDate, OffsetDateTime startBeforeDate, Integer campaignId, String sellerId, String type, final ApiCallback> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
okhttp3.Call call = getSellerBudgetsValidateBeforeCall(authorization, status, withBalance, withSpend, endAfterDate, startBeforeDate, campaignId, sellerId, type, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getSellerCampaign
* @param sellerCampaignId Id of the seller campaign. (required)
* @param authorization JWT Bearer Token (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call getSellerCampaignCall(String sellerCampaignId, String authorization, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
String localVarPath = "/v2/crp/seller-campaigns/{sellerCampaignId}"
.replaceAll("\\{" + "sellerCampaignId" + "\\}", apiClient.escapeString(sellerCampaignId.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
if (authorization != null) {
localVarHeaderParams.put("Authorization", apiClient.parameterToString(authorization));
}
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json", "text/json", "text/html"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (progressListener != null) {
apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "Authorization" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call getSellerCampaignValidateBeforeCall(String sellerCampaignId, String authorization, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'sellerCampaignId' is set
if (sellerCampaignId == null) {
throw new ApiException("Missing the required parameter 'sellerCampaignId' when calling getSellerCampaign(Async)");
}
// verify the required parameter 'authorization' is set
if (authorization == null) {
throw new ApiException("Missing the required parameter 'authorization' when calling getSellerCampaign(Async)");
}
okhttp3.Call call = getSellerCampaignCall(sellerCampaignId, authorization, progressListener, progressRequestListener);
return call;
}
/**
* Get details for a seller campaign.
* Return details for a seller campaign. For example, { \"id\": \"543210.123456\", \"suspendedSince\": \"2018-07-30\", \"sellerId\": \"543210\", \"campaignId\": 123456, \"bid\": 1.55 } An active seller campaign is one for which the value of <b>suspendedSince</b> is null and the <b>bid</b> is positive. The currency of the bid is the <b>bidCurrency</b> of the associated campaign. Any active seller campaign must also have an active total (capped or uncapped) budget. It may optionally have an active daily budget as well to further limit spending.
* @param sellerCampaignId Id of the seller campaign. (required)
* @param authorization JWT Bearer Token (required)
* @return SellerCampaignMessage
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public SellerCampaignMessage getSellerCampaign(String sellerCampaignId, String authorization) throws ApiException {
ApiResponse resp = getSellerCampaignWithHttpInfo(sellerCampaignId, authorization);
return resp.getData();
}
/**
* Get details for a seller campaign.
* Return details for a seller campaign. For example, { \"id\": \"543210.123456\", \"suspendedSince\": \"2018-07-30\", \"sellerId\": \"543210\", \"campaignId\": 123456, \"bid\": 1.55 } An active seller campaign is one for which the value of <b>suspendedSince</b> is null and the <b>bid</b> is positive. The currency of the bid is the <b>bidCurrency</b> of the associated campaign. Any active seller campaign must also have an active total (capped or uncapped) budget. It may optionally have an active daily budget as well to further limit spending.
* @param sellerCampaignId Id of the seller campaign. (required)
* @param authorization JWT Bearer Token (required)
* @return ApiResponse<SellerCampaignMessage>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getSellerCampaignWithHttpInfo(String sellerCampaignId, String authorization) throws ApiException {
okhttp3.Call call = getSellerCampaignValidateBeforeCall(sellerCampaignId, authorization, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Get details for a seller campaign. (asynchronously)
* Return details for a seller campaign. For example, { \"id\": \"543210.123456\", \"suspendedSince\": \"2018-07-30\", \"sellerId\": \"543210\", \"campaignId\": 123456, \"bid\": 1.55 } An active seller campaign is one for which the value of <b>suspendedSince</b> is null and the <b>bid</b> is positive. The currency of the bid is the <b>bidCurrency</b> of the associated campaign. Any active seller campaign must also have an active total (capped or uncapped) budget. It may optionally have an active daily budget as well to further limit spending.
* @param sellerCampaignId Id of the seller campaign. (required)
* @param authorization JWT Bearer Token (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public okhttp3.Call getSellerCampaignAsync(String sellerCampaignId, String authorization, final ApiCallback callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
okhttp3.Call call = getSellerCampaignValidateBeforeCall(sellerCampaignId, authorization, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getSellerCampaigns
* @param authorization JWT Bearer Token (required)
* @param sellerStatus Return only seller campaigns for sellers with the given status. (optional)
* @param sellerId Return only seller campaigns belonging to the given seller. (optional)
* @param campaignId Return only seller campaigns associated with the given campaign. (optional)
* @param budgetStatus Return only seller campaigns whose budget has the given status. (optional)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call getSellerCampaignsCall(String authorization, String sellerStatus, String sellerId, Integer campaignId, String budgetStatus, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
String localVarPath = "/v2/crp/seller-campaigns";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
if (sellerStatus != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("sellerStatus", sellerStatus));
}
if (sellerId != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("sellerId", sellerId));
}
if (campaignId != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("campaignId", campaignId));
}
if (budgetStatus != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("budgetStatus", budgetStatus));
}
Map localVarHeaderParams = new HashMap();
if (authorization != null) {
localVarHeaderParams.put("Authorization", apiClient.parameterToString(authorization));
}
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json", "text/json", "application/xml", "text/xml", "text/html"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (progressListener != null) {
apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "Authorization" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call getSellerCampaignsValidateBeforeCall(String authorization, String sellerStatus, String sellerId, Integer campaignId, String budgetStatus, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'authorization' is set
if (authorization == null) {
throw new ApiException("Missing the required parameter 'authorization' when calling getSellerCampaigns(Async)");
}
okhttp3.Call call = getSellerCampaignsCall(authorization, sellerStatus, sellerId, campaignId, budgetStatus, progressListener, progressRequestListener);
return call;
}
/**
* Get a collection of seller campaigns.
* Return a collection of seller campaigns filtered by optional filter parameters. If all parameters are omitted the entire collection to which the user has access is returned. Returned sellers must satisfy all supplied filter criteria if multiple parameters are used.
* @param authorization JWT Bearer Token (required)
* @param sellerStatus Return only seller campaigns for sellers with the given status. (optional)
* @param sellerId Return only seller campaigns belonging to the given seller. (optional)
* @param campaignId Return only seller campaigns associated with the given campaign. (optional)
* @param budgetStatus Return only seller campaigns whose budget has the given status. (optional)
* @return List<SellerCampaignMessage>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public List getSellerCampaigns(String authorization, String sellerStatus, String sellerId, Integer campaignId, String budgetStatus) throws ApiException {
ApiResponse> resp = getSellerCampaignsWithHttpInfo(authorization, sellerStatus, sellerId, campaignId, budgetStatus);
return resp.getData();
}
/**
* Get a collection of seller campaigns.
* Return a collection of seller campaigns filtered by optional filter parameters. If all parameters are omitted the entire collection to which the user has access is returned. Returned sellers must satisfy all supplied filter criteria if multiple parameters are used.
* @param authorization JWT Bearer Token (required)
* @param sellerStatus Return only seller campaigns for sellers with the given status. (optional)
* @param sellerId Return only seller campaigns belonging to the given seller. (optional)
* @param campaignId Return only seller campaigns associated with the given campaign. (optional)
* @param budgetStatus Return only seller campaigns whose budget has the given status. (optional)
* @return ApiResponse<List<SellerCampaignMessage>>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse> getSellerCampaignsWithHttpInfo(String authorization, String sellerStatus, String sellerId, Integer campaignId, String budgetStatus) throws ApiException {
okhttp3.Call call = getSellerCampaignsValidateBeforeCall(authorization, sellerStatus, sellerId, campaignId, budgetStatus, null, null);
Type localVarReturnType = new TypeToken>(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Get a collection of seller campaigns. (asynchronously)
* Return a collection of seller campaigns filtered by optional filter parameters. If all parameters are omitted the entire collection to which the user has access is returned. Returned sellers must satisfy all supplied filter criteria if multiple parameters are used.
* @param authorization JWT Bearer Token (required)
* @param sellerStatus Return only seller campaigns for sellers with the given status. (optional)
* @param sellerId Return only seller campaigns belonging to the given seller. (optional)
* @param campaignId Return only seller campaigns associated with the given campaign. (optional)
* @param budgetStatus Return only seller campaigns whose budget has the given status. (optional)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public okhttp3.Call getSellerCampaignsAsync(String authorization, String sellerStatus, String sellerId, Integer campaignId, String budgetStatus, final ApiCallback> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
okhttp3.Call call = getSellerCampaignsValidateBeforeCall(authorization, sellerStatus, sellerId, campaignId, budgetStatus, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getSellerCampaignsBySeller
* @param sellerId Return only seller campaigns belonging to the given seller. (required)
* @param authorization JWT Bearer Token (required)
* @param sellerStatus Return only seller campaigns for sellers with the given status. (optional)
* @param campaignId Return only seller campaigns associated with the given campaign. (optional)
* @param budgetStatus Return only seller campaigns whose budget has the given status. (optional)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call getSellerCampaignsBySellerCall(String sellerId, String authorization, String sellerStatus, Integer campaignId, String budgetStatus, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
String localVarPath = "/v2/crp/sellers/{sellerId}/seller-campaigns"
.replaceAll("\\{" + "sellerId" + "\\}", apiClient.escapeString(sellerId.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
if (sellerStatus != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("sellerStatus", sellerStatus));
}
if (campaignId != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("campaignId", campaignId));
}
if (budgetStatus != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("budgetStatus", budgetStatus));
}
Map localVarHeaderParams = new HashMap();
if (authorization != null) {
localVarHeaderParams.put("Authorization", apiClient.parameterToString(authorization));
}
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json", "text/json", "application/xml", "text/xml", "text/html"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (progressListener != null) {
apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "Authorization" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call getSellerCampaignsBySellerValidateBeforeCall(String sellerId, String authorization, String sellerStatus, Integer campaignId, String budgetStatus, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'sellerId' is set
if (sellerId == null) {
throw new ApiException("Missing the required parameter 'sellerId' when calling getSellerCampaignsBySeller(Async)");
}
// verify the required parameter 'authorization' is set
if (authorization == null) {
throw new ApiException("Missing the required parameter 'authorization' when calling getSellerCampaignsBySeller(Async)");
}
okhttp3.Call call = getSellerCampaignsBySellerCall(sellerId, authorization, sellerStatus, campaignId, budgetStatus, progressListener, progressRequestListener);
return call;
}
/**
* Get a collection of seller campaigns for this seller.
* Return a collection of seller campaigns for this seller filtered by optional filter parameters. If all parameters are omitted the entire collection to which the user has access is returned. Returned sellers must satisfy all supplied filter criteria if multiple parameters are used. See the seller campaigns endpoint for additional details.
* @param sellerId Return only seller campaigns belonging to the given seller. (required)
* @param authorization JWT Bearer Token (required)
* @param sellerStatus Return only seller campaigns for sellers with the given status. (optional)
* @param campaignId Return only seller campaigns associated with the given campaign. (optional)
* @param budgetStatus Return only seller campaigns whose budget has the given status. (optional)
* @return List<SellerCampaignMessage>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public List getSellerCampaignsBySeller(String sellerId, String authorization, String sellerStatus, Integer campaignId, String budgetStatus) throws ApiException {
ApiResponse> resp = getSellerCampaignsBySellerWithHttpInfo(sellerId, authorization, sellerStatus, campaignId, budgetStatus);
return resp.getData();
}
/**
* Get a collection of seller campaigns for this seller.
* Return a collection of seller campaigns for this seller filtered by optional filter parameters. If all parameters are omitted the entire collection to which the user has access is returned. Returned sellers must satisfy all supplied filter criteria if multiple parameters are used. See the seller campaigns endpoint for additional details.
* @param sellerId Return only seller campaigns belonging to the given seller. (required)
* @param authorization JWT Bearer Token (required)
* @param sellerStatus Return only seller campaigns for sellers with the given status. (optional)
* @param campaignId Return only seller campaigns associated with the given campaign. (optional)
* @param budgetStatus Return only seller campaigns whose budget has the given status. (optional)
* @return ApiResponse<List<SellerCampaignMessage>>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse> getSellerCampaignsBySellerWithHttpInfo(String sellerId, String authorization, String sellerStatus, Integer campaignId, String budgetStatus) throws ApiException {
okhttp3.Call call = getSellerCampaignsBySellerValidateBeforeCall(sellerId, authorization, sellerStatus, campaignId, budgetStatus, null, null);
Type localVarReturnType = new TypeToken>(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Get a collection of seller campaigns for this seller. (asynchronously)
* Return a collection of seller campaigns for this seller filtered by optional filter parameters. If all parameters are omitted the entire collection to which the user has access is returned. Returned sellers must satisfy all supplied filter criteria if multiple parameters are used. See the seller campaigns endpoint for additional details.
* @param sellerId Return only seller campaigns belonging to the given seller. (required)
* @param authorization JWT Bearer Token (required)
* @param sellerStatus Return only seller campaigns for sellers with the given status. (optional)
* @param campaignId Return only seller campaigns associated with the given campaign. (optional)
* @param budgetStatus Return only seller campaigns whose budget has the given status. (optional)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public okhttp3.Call getSellerCampaignsBySellerAsync(String sellerId, String authorization, String sellerStatus, Integer campaignId, String budgetStatus, final ApiCallback> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
okhttp3.Call call = getSellerCampaignsBySellerValidateBeforeCall(sellerId, authorization, sellerStatus, campaignId, budgetStatus, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getSellers
* @param authorization JWT Bearer Token (required)
* @param sellerStatus Return only sellers with specific status. (optional)
* @param withProducts Return only sellers with or without products in catalog. (optional)
* @param withBudgetStatus Return only sellers with specific budget status. (optional)
* @param sellerName Return only sellers with the matching name. (optional)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call getSellersCall(String authorization, String sellerStatus, Boolean withProducts, String withBudgetStatus, String sellerName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
String localVarPath = "/v2/crp/sellers";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
if (sellerStatus != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("sellerStatus", sellerStatus));
}
if (withProducts != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("withProducts", withProducts));
}
if (withBudgetStatus != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("withBudgetStatus", withBudgetStatus));
}
if (sellerName != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("sellerName", sellerName));
}
Map localVarHeaderParams = new HashMap();
if (authorization != null) {
localVarHeaderParams.put("Authorization", apiClient.parameterToString(authorization));
}
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json", "text/json", "application/xml", "text/xml", "text/html"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (progressListener != null) {
apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "Authorization" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call getSellersValidateBeforeCall(String authorization, String sellerStatus, Boolean withProducts, String withBudgetStatus, String sellerName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'authorization' is set
if (authorization == null) {
throw new ApiException("Missing the required parameter 'authorization' when calling getSellers(Async)");
}
okhttp3.Call call = getSellersCall(authorization, sellerStatus, withProducts, withBudgetStatus, sellerName, progressListener, progressRequestListener);
return call;
}
/**
* Get a collection of sellers.
* Return a collection of sellers filtered by optional filter parameters. If all parameters are omitted the entire collection to which the user has access is returned. Returned sellers must satisfy all supplied filter criteria if multiple parameters are used.
* @param authorization JWT Bearer Token (required)
* @param sellerStatus Return only sellers with specific status. (optional)
* @param withProducts Return only sellers with or without products in catalog. (optional)
* @param withBudgetStatus Return only sellers with specific budget status. (optional)
* @param sellerName Return only sellers with the matching name. (optional)
* @return List<SellerBase>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public List getSellers(String authorization, String sellerStatus, Boolean withProducts, String withBudgetStatus, String sellerName) throws ApiException {
ApiResponse> resp = getSellersWithHttpInfo(authorization, sellerStatus, withProducts, withBudgetStatus, sellerName);
return resp.getData();
}
/**
* Get a collection of sellers.
* Return a collection of sellers filtered by optional filter parameters. If all parameters are omitted the entire collection to which the user has access is returned. Returned sellers must satisfy all supplied filter criteria if multiple parameters are used.
* @param authorization JWT Bearer Token (required)
* @param sellerStatus Return only sellers with specific status. (optional)
* @param withProducts Return only sellers with or without products in catalog. (optional)
* @param withBudgetStatus Return only sellers with specific budget status. (optional)
* @param sellerName Return only sellers with the matching name. (optional)
* @return ApiResponse<List<SellerBase>>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse> getSellersWithHttpInfo(String authorization, String sellerStatus, Boolean withProducts, String withBudgetStatus, String sellerName) throws ApiException {
okhttp3.Call call = getSellersValidateBeforeCall(authorization, sellerStatus, withProducts, withBudgetStatus, sellerName, null, null);
Type localVarReturnType = new TypeToken>(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Get a collection of sellers. (asynchronously)
* Return a collection of sellers filtered by optional filter parameters. If all parameters are omitted the entire collection to which the user has access is returned. Returned sellers must satisfy all supplied filter criteria if multiple parameters are used.
* @param authorization JWT Bearer Token (required)
* @param sellerStatus Return only sellers with specific status. (optional)
* @param withProducts Return only sellers with or without products in catalog. (optional)
* @param withBudgetStatus Return only sellers with specific budget status. (optional)
* @param sellerName Return only sellers with the matching name. (optional)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public okhttp3.Call getSellersAsync(String authorization, String sellerStatus, Boolean withProducts, String withBudgetStatus, String sellerName, final ApiCallback> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
okhttp3.Call call = getSellersValidateBeforeCall(authorization, sellerStatus, withProducts, withBudgetStatus, sellerName, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for updateSellerBudget
* @param budgetId (required)
* @param authorization JWT Bearer Token (required)
* @param message (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call updateSellerBudgetCall(String budgetId, String authorization, UpdateSellerBudgetMessage message, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = message;
// create path and map variables
String localVarPath = "/v2/crp/budgets/{budgetId}"
.replaceAll("\\{" + "budgetId" + "\\}", apiClient.escapeString(budgetId.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
if (authorization != null) {
localVarHeaderParams.put("Authorization", apiClient.parameterToString(authorization));
}
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json", "text/json", "application/xml", "text/xml", "text/html"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
"application/json", "text/json", "application/x-www-form-urlencoded", "text/html"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (progressListener != null) {
apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "Authorization" };
return apiClient.buildCall(localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call updateSellerBudgetValidateBeforeCall(String budgetId, String authorization, UpdateSellerBudgetMessage message, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'budgetId' is set
if (budgetId == null) {
throw new ApiException("Missing the required parameter 'budgetId' when calling updateSellerBudget(Async)");
}
// verify the required parameter 'authorization' is set
if (authorization == null) {
throw new ApiException("Missing the required parameter 'authorization' when calling updateSellerBudget(Async)");
}
// verify the required parameter 'message' is set
if (message == null) {
throw new ApiException("Missing the required parameter 'message' when calling updateSellerBudget(Async)");
}
okhttp3.Call call = updateSellerBudgetCall(budgetId, authorization, message, progressListener, progressRequestListener);
return call;
}
/**
* Modify a single budget.
* Modify an existing active budget to change its limitations or status. All three types of budgets can be modified. See the additional restrictions listed in the PATCH budgets endpoint.
* @param budgetId (required)
* @param authorization JWT Bearer Token (required)
* @param message (required)
* @return List<SellerBudgetMessage>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public List updateSellerBudget(String budgetId, String authorization, UpdateSellerBudgetMessage message) throws ApiException {
ApiResponse> resp = updateSellerBudgetWithHttpInfo(budgetId, authorization, message);
return resp.getData();
}
/**
* Modify a single budget.
* Modify an existing active budget to change its limitations or status. All three types of budgets can be modified. See the additional restrictions listed in the PATCH budgets endpoint.
* @param budgetId (required)
* @param authorization JWT Bearer Token (required)
* @param message (required)
* @return ApiResponse<List<SellerBudgetMessage>>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse> updateSellerBudgetWithHttpInfo(String budgetId, String authorization, UpdateSellerBudgetMessage message) throws ApiException {
okhttp3.Call call = updateSellerBudgetValidateBeforeCall(budgetId, authorization, message, null, null);
Type localVarReturnType = new TypeToken>(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Modify a single budget. (asynchronously)
* Modify an existing active budget to change its limitations or status. All three types of budgets can be modified. See the additional restrictions listed in the PATCH budgets endpoint.
* @param budgetId (required)
* @param authorization JWT Bearer Token (required)
* @param message (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public okhttp3.Call updateSellerBudgetAsync(String budgetId, String authorization, UpdateSellerBudgetMessage message, final ApiCallback> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
okhttp3.Call call = updateSellerBudgetValidateBeforeCall(budgetId, authorization, message, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for updateSellerBudgets
* @param authorization JWT Bearer Token (required)
* @param updateSellerBudgets (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call updateSellerBudgetsCall(String authorization, List updateSellerBudgets, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = updateSellerBudgets;
// create path and map variables
String localVarPath = "/v2/crp/budgets";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
if (authorization != null) {
localVarHeaderParams.put("Authorization", apiClient.parameterToString(authorization));
}
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json", "text/json", "application/xml", "text/xml", "text/html"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
"application/json", "text/json", "application/xml", "text/xml", "application/x-www-form-urlencoded", "text/html"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (progressListener != null) {
apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "Authorization" };
return apiClient.buildCall(localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call updateSellerBudgetsValidateBeforeCall(String authorization, List updateSellerBudgets, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'authorization' is set
if (authorization == null) {
throw new ApiException("Missing the required parameter 'authorization' when calling updateSellerBudgets(Async)");
}
// verify the required parameter 'updateSellerBudgets' is set
if (updateSellerBudgets == null) {
throw new ApiException("Missing the required parameter 'updateSellerBudgets' when calling updateSellerBudgets(Async)");
}
okhttp3.Call call = updateSellerBudgetsCall(authorization, updateSellerBudgets, progressListener, progressRequestListener);
return call;
}
/**
* Modify a collection of budgets.
* Modify one or more existing active budgets to change their limitations or status. All three types of budgets can be modified. The following constraints apply when modifying an existing budget. • <b>campaignIds</b>: a non-empty subset of the original campaign ids MAY be supplied<br /> • <b>amount</b>: an amount MAY be supplied only if the type is not Uncapped and if supplied it MUST be non-negative<br /> • <b>startDate</b>: a future start date MAY be supplied for budgets that have not yet started<br /> • <b>endDate</b>: an end date MAY be supplied and if supplied MUST be a future date greater than the start date<br /> Other attributes MUST NOT be supplied. Adding new campaigns to a budget is not allowed. In addition, reducing the amount for a Capped budget to a value less than the current spend not allowed.
* @param authorization JWT Bearer Token (required)
* @param updateSellerBudgets (required)
* @return List<SellerBudgetMessage>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public List updateSellerBudgets(String authorization, List updateSellerBudgets) throws ApiException {
ApiResponse> resp = updateSellerBudgetsWithHttpInfo(authorization, updateSellerBudgets);
return resp.getData();
}
/**
* Modify a collection of budgets.
* Modify one or more existing active budgets to change their limitations or status. All three types of budgets can be modified. The following constraints apply when modifying an existing budget. • <b>campaignIds</b>: a non-empty subset of the original campaign ids MAY be supplied<br /> • <b>amount</b>: an amount MAY be supplied only if the type is not Uncapped and if supplied it MUST be non-negative<br /> • <b>startDate</b>: a future start date MAY be supplied for budgets that have not yet started<br /> • <b>endDate</b>: an end date MAY be supplied and if supplied MUST be a future date greater than the start date<br /> Other attributes MUST NOT be supplied. Adding new campaigns to a budget is not allowed. In addition, reducing the amount for a Capped budget to a value less than the current spend not allowed.
* @param authorization JWT Bearer Token (required)
* @param updateSellerBudgets (required)
* @return ApiResponse<List<SellerBudgetMessage>>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse> updateSellerBudgetsWithHttpInfo(String authorization, List updateSellerBudgets) throws ApiException {
okhttp3.Call call = updateSellerBudgetsValidateBeforeCall(authorization, updateSellerBudgets, null, null);
Type localVarReturnType = new TypeToken>(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Modify a collection of budgets. (asynchronously)
* Modify one or more existing active budgets to change their limitations or status. All three types of budgets can be modified. The following constraints apply when modifying an existing budget. • <b>campaignIds</b>: a non-empty subset of the original campaign ids MAY be supplied<br /> • <b>amount</b>: an amount MAY be supplied only if the type is not Uncapped and if supplied it MUST be non-negative<br /> • <b>startDate</b>: a future start date MAY be supplied for budgets that have not yet started<br /> • <b>endDate</b>: an end date MAY be supplied and if supplied MUST be a future date greater than the start date<br /> Other attributes MUST NOT be supplied. Adding new campaigns to a budget is not allowed. In addition, reducing the amount for a Capped budget to a value less than the current spend not allowed.
* @param authorization JWT Bearer Token (required)
* @param updateSellerBudgets (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public okhttp3.Call updateSellerBudgetsAsync(String authorization, List updateSellerBudgets, final ApiCallback> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
okhttp3.Call call = updateSellerBudgetsValidateBeforeCall(authorization, updateSellerBudgets, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for updateSellerCampaign
* @param sellerCampaignId Id of the existing seller campaign to update (required)
* @param bid The new bid for the seller campaign. (required)
* @param authorization JWT Bearer Token (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call updateSellerCampaignCall(String sellerCampaignId, Double bid, String authorization, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
String localVarPath = "/v2/crp/seller-campaigns/{sellerCampaignId}"
.replaceAll("\\{" + "sellerCampaignId" + "\\}", apiClient.escapeString(sellerCampaignId.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
if (bid != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("bid", bid));
}
Map localVarHeaderParams = new HashMap();
if (authorization != null) {
localVarHeaderParams.put("Authorization", apiClient.parameterToString(authorization));
}
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json", "text/json", "text/html"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (progressListener != null) {
apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "Authorization" };
return apiClient.buildCall(localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call updateSellerCampaignValidateBeforeCall(String sellerCampaignId, Double bid, String authorization, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'sellerCampaignId' is set
if (sellerCampaignId == null) {
throw new ApiException("Missing the required parameter 'sellerCampaignId' when calling updateSellerCampaign(Async)");
}
// verify the required parameter 'bid' is set
if (bid == null) {
throw new ApiException("Missing the required parameter 'bid' when calling updateSellerCampaign(Async)");
}
// verify the required parameter 'authorization' is set
if (authorization == null) {
throw new ApiException("Missing the required parameter 'authorization' when calling updateSellerCampaign(Async)");
}
okhttp3.Call call = updateSellerCampaignCall(sellerCampaignId, bid, authorization, progressListener, progressRequestListener);
return call;
}
/**
* Update an existing seller campaign.
* Patching a seller campaign allows the bid to be modified. The bid must be a non-negative value. Setting the bid to zero will make a seller campaign inactive. The currency used for bids will be the default currency of the campaign.
* @param sellerCampaignId Id of the existing seller campaign to update (required)
* @param bid The new bid for the seller campaign. (required)
* @param authorization JWT Bearer Token (required)
* @return SellerCampaignMessage
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public SellerCampaignMessage updateSellerCampaign(String sellerCampaignId, Double bid, String authorization) throws ApiException {
ApiResponse resp = updateSellerCampaignWithHttpInfo(sellerCampaignId, bid, authorization);
return resp.getData();
}
/**
* Update an existing seller campaign.
* Patching a seller campaign allows the bid to be modified. The bid must be a non-negative value. Setting the bid to zero will make a seller campaign inactive. The currency used for bids will be the default currency of the campaign.
* @param sellerCampaignId Id of the existing seller campaign to update (required)
* @param bid The new bid for the seller campaign. (required)
* @param authorization JWT Bearer Token (required)
* @return ApiResponse<SellerCampaignMessage>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse updateSellerCampaignWithHttpInfo(String sellerCampaignId, Double bid, String authorization) throws ApiException {
okhttp3.Call call = updateSellerCampaignValidateBeforeCall(sellerCampaignId, bid, authorization, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Update an existing seller campaign. (asynchronously)
* Patching a seller campaign allows the bid to be modified. The bid must be a non-negative value. Setting the bid to zero will make a seller campaign inactive. The currency used for bids will be the default currency of the campaign.
* @param sellerCampaignId Id of the existing seller campaign to update (required)
* @param bid The new bid for the seller campaign. (required)
* @param authorization JWT Bearer Token (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public okhttp3.Call updateSellerCampaignAsync(String sellerCampaignId, Double bid, String authorization, final ApiCallback callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
okhttp3.Call call = updateSellerCampaignValidateBeforeCall(sellerCampaignId, bid, authorization, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for updateSellerCampaigns
* @param authorization JWT Bearer Token (required)
* @param campaignMessages (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call updateSellerCampaignsCall(String authorization, List campaignMessages, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = campaignMessages;
// create path and map variables
String localVarPath = "/v2/crp/seller-campaigns";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
if (authorization != null) {
localVarHeaderParams.put("Authorization", apiClient.parameterToString(authorization));
}
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json", "text/json", "application/xml", "text/xml", "text/html"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
"application/json", "text/json", "application/xml", "text/xml", "application/x-www-form-urlencoded", "text/html"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (progressListener != null) {
apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "Authorization" };
return apiClient.buildCall(localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call updateSellerCampaignsValidateBeforeCall(String authorization, List campaignMessages, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'authorization' is set
if (authorization == null) {
throw new ApiException("Missing the required parameter 'authorization' when calling updateSellerCampaigns(Async)");
}
// verify the required parameter 'campaignMessages' is set
if (campaignMessages == null) {
throw new ApiException("Missing the required parameter 'campaignMessages' when calling updateSellerCampaigns(Async)");
}
okhttp3.Call call = updateSellerCampaignsCall(authorization, campaignMessages, progressListener, progressRequestListener);
return call;
}
/**
* Update a collection of seller campaigns.
* Patching a collection of seller campaigns allows their bids to be modified. Each bid must be a non-negative value. Setting the bid to zero will make a seller campaign inactive. The currency used for bids will be the default currency of the campaign.
* @param authorization JWT Bearer Token (required)
* @param campaignMessages (required)
* @return List<SellerCampaignMessage>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public List updateSellerCampaigns(String authorization, List campaignMessages) throws ApiException {
ApiResponse> resp = updateSellerCampaignsWithHttpInfo(authorization, campaignMessages);
return resp.getData();
}
/**
* Update a collection of seller campaigns.
* Patching a collection of seller campaigns allows their bids to be modified. Each bid must be a non-negative value. Setting the bid to zero will make a seller campaign inactive. The currency used for bids will be the default currency of the campaign.
* @param authorization JWT Bearer Token (required)
* @param campaignMessages (required)
* @return ApiResponse<List<SellerCampaignMessage>>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse> updateSellerCampaignsWithHttpInfo(String authorization, List campaignMessages) throws ApiException {
okhttp3.Call call = updateSellerCampaignsValidateBeforeCall(authorization, campaignMessages, null, null);
Type localVarReturnType = new TypeToken>(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Update a collection of seller campaigns. (asynchronously)
* Patching a collection of seller campaigns allows their bids to be modified. Each bid must be a non-negative value. Setting the bid to zero will make a seller campaign inactive. The currency used for bids will be the default currency of the campaign.
* @param authorization JWT Bearer Token (required)
* @param campaignMessages (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public okhttp3.Call updateSellerCampaignsAsync(String authorization, List campaignMessages, final ApiCallback> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
okhttp3.Call call = updateSellerCampaignsValidateBeforeCall(authorization, campaignMessages, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
}