com.criteo.marketing.api.CampaignsApi 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.CampaignBidChangeRequest;
import com.criteo.marketing.model.CampaignBidMessage;
import com.criteo.marketing.model.CampaignMessage;
import com.criteo.marketing.model.CategoryMessage;
import com.criteo.marketing.model.MessageWithDetailsCampaignBidChangeResponse;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CampaignsApi {
private ApiClient apiClient;
public CampaignsApi() {
this(Configuration.getDefaultApiClient());
}
public CampaignsApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Build call for getBids
* @param authorization JWT Bearer Token (required)
* @param campaignIds Optional. The ids of the campaigns we want to get the bids on. If not specified, advertiserIds will be used. (optional)
* @param advertiserIds Optional. The ids of the advertisers' campaigns we want to get the bids on. If campaignIds not specified, and neither is advertiserIds, all the advertisers in the user's portfolio are used. (optional)
* @param categoryHashCodes Optional. Filters only specified categories. By default no filtering is applied. (optional)
* @param bidType Optional. Filters by bid type. By default no filtering is applied. (optional)
* @param campaignStatus Optional. Filters by campaign status. By default no filtering is applied. (optional)
* @param pendingChanges Optional. Filters only pending changes or settled ones. By default no filtering is applied. (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 getBidsCall(String authorization, String campaignIds, String advertiserIds, String categoryHashCodes, String bidType, String campaignStatus, Boolean pendingChanges, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
String localVarPath = "/v1/campaigns/bids";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
if (campaignIds != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("campaignIds", campaignIds));
}
if (advertiserIds != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("advertiserIds", advertiserIds));
}
if (categoryHashCodes != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("categoryHashCodes", categoryHashCodes));
}
if (bidType != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("bidType", bidType));
}
if (campaignStatus != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("campaignStatus", campaignStatus));
}
if (pendingChanges != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("pendingChanges", pendingChanges));
}
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 getBidsValidateBeforeCall(String authorization, String campaignIds, String advertiserIds, String categoryHashCodes, String bidType, String campaignStatus, Boolean pendingChanges, 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 getBids(Async)");
}
okhttp3.Call call = getBidsCall(authorization, campaignIds, advertiserIds, categoryHashCodes, bidType, campaignStatus, pendingChanges, progressListener, progressRequestListener);
return call;
}
/**
* Gets a the bids for campaigns and their categories
* Get the campaigns' bids, as well as the bids of their categories
* @param authorization JWT Bearer Token (required)
* @param campaignIds Optional. The ids of the campaigns we want to get the bids on. If not specified, advertiserIds will be used. (optional)
* @param advertiserIds Optional. The ids of the advertisers' campaigns we want to get the bids on. If campaignIds not specified, and neither is advertiserIds, all the advertisers in the user's portfolio are used. (optional)
* @param categoryHashCodes Optional. Filters only specified categories. By default no filtering is applied. (optional)
* @param bidType Optional. Filters by bid type. By default no filtering is applied. (optional)
* @param campaignStatus Optional. Filters by campaign status. By default no filtering is applied. (optional)
* @param pendingChanges Optional. Filters only pending changes or settled ones. By default no filtering is applied. (optional)
* @return List<CampaignBidMessage>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public List getBids(String authorization, String campaignIds, String advertiserIds, String categoryHashCodes, String bidType, String campaignStatus, Boolean pendingChanges) throws ApiException {
ApiResponse> resp = getBidsWithHttpInfo(authorization, campaignIds, advertiserIds, categoryHashCodes, bidType, campaignStatus, pendingChanges);
return resp.getData();
}
/**
* Gets a the bids for campaigns and their categories
* Get the campaigns' bids, as well as the bids of their categories
* @param authorization JWT Bearer Token (required)
* @param campaignIds Optional. The ids of the campaigns we want to get the bids on. If not specified, advertiserIds will be used. (optional)
* @param advertiserIds Optional. The ids of the advertisers' campaigns we want to get the bids on. If campaignIds not specified, and neither is advertiserIds, all the advertisers in the user's portfolio are used. (optional)
* @param categoryHashCodes Optional. Filters only specified categories. By default no filtering is applied. (optional)
* @param bidType Optional. Filters by bid type. By default no filtering is applied. (optional)
* @param campaignStatus Optional. Filters by campaign status. By default no filtering is applied. (optional)
* @param pendingChanges Optional. Filters only pending changes or settled ones. By default no filtering is applied. (optional)
* @return ApiResponse<List<CampaignBidMessage>>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse> getBidsWithHttpInfo(String authorization, String campaignIds, String advertiserIds, String categoryHashCodes, String bidType, String campaignStatus, Boolean pendingChanges) throws ApiException {
okhttp3.Call call = getBidsValidateBeforeCall(authorization, campaignIds, advertiserIds, categoryHashCodes, bidType, campaignStatus, pendingChanges, null, null);
Type localVarReturnType = new TypeToken>(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Gets a the bids for campaigns and their categories (asynchronously)
* Get the campaigns' bids, as well as the bids of their categories
* @param authorization JWT Bearer Token (required)
* @param campaignIds Optional. The ids of the campaigns we want to get the bids on. If not specified, advertiserIds will be used. (optional)
* @param advertiserIds Optional. The ids of the advertisers' campaigns we want to get the bids on. If campaignIds not specified, and neither is advertiserIds, all the advertisers in the user's portfolio are used. (optional)
* @param categoryHashCodes Optional. Filters only specified categories. By default no filtering is applied. (optional)
* @param bidType Optional. Filters by bid type. By default no filtering is applied. (optional)
* @param campaignStatus Optional. Filters by campaign status. By default no filtering is applied. (optional)
* @param pendingChanges Optional. Filters only pending changes or settled ones. By default no filtering is applied. (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 getBidsAsync(String authorization, String campaignIds, String advertiserIds, String categoryHashCodes, String bidType, String campaignStatus, Boolean pendingChanges, 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 = getBidsValidateBeforeCall(authorization, campaignIds, advertiserIds, categoryHashCodes, bidType, campaignStatus, pendingChanges, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getCampaign
* @param campaignId Mandatory. The id of the campaign to return. (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 getCampaignCall(Integer campaignId, String authorization, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
String localVarPath = "/v1/campaigns/{campaignId}"
.replaceAll("\\{" + "campaignId" + "\\}", apiClient.escapeString(campaignId.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 getCampaignValidateBeforeCall(Integer campaignId, String authorization, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'campaignId' is set
if (campaignId == null) {
throw new ApiException("Missing the required parameter 'campaignId' when calling getCampaign(Async)");
}
// verify the required parameter 'authorization' is set
if (authorization == null) {
throw new ApiException("Missing the required parameter 'authorization' when calling getCampaign(Async)");
}
okhttp3.Call call = getCampaignCall(campaignId, authorization, progressListener, progressRequestListener);
return call;
}
/**
* Gets a specific campaign
* Get a specific campaign
* @param campaignId Mandatory. The id of the campaign to return. (required)
* @param authorization JWT Bearer Token (required)
* @return CampaignMessage
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public CampaignMessage getCampaign(Integer campaignId, String authorization) throws ApiException {
ApiResponse resp = getCampaignWithHttpInfo(campaignId, authorization);
return resp.getData();
}
/**
* Gets a specific campaign
* Get a specific campaign
* @param campaignId Mandatory. The id of the campaign to return. (required)
* @param authorization JWT Bearer Token (required)
* @return ApiResponse<CampaignMessage>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getCampaignWithHttpInfo(Integer campaignId, String authorization) throws ApiException {
okhttp3.Call call = getCampaignValidateBeforeCall(campaignId, authorization, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Gets a specific campaign (asynchronously)
* Get a specific campaign
* @param campaignId Mandatory. The id of the campaign to return. (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 getCampaignAsync(Integer campaignId, 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 = getCampaignValidateBeforeCall(campaignId, authorization, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getCampaigns
* @param authorization JWT Bearer Token (required)
* @param campaignIds Optional. One or more campaign ids, E.g., 78, 12932, 45236. If the campaign ids requested are not linked to advertisers in the user's portfolio, they will be skipped. (optional)
* @param advertiserIds Optional. One or more advertiser ids, E.g., 78, 12932, 45236. If the advertiser ids requested are not part of the user's portfolio, they will be skipped. (optional)
* @param campaignStatus Optional. Filters by campaign status. By default no filtering is applied. (optional)
* @param bidType Optional. Filters by campaign bid type. By default, no filtering is applied. (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 getCampaignsCall(String authorization, String campaignIds, String advertiserIds, String campaignStatus, String bidType, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
String localVarPath = "/v1/campaigns";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
if (campaignIds != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("campaignIds", campaignIds));
}
if (advertiserIds != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("advertiserIds", advertiserIds));
}
if (campaignStatus != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("campaignStatus", campaignStatus));
}
if (bidType != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("bidType", bidType));
}
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 getCampaignsValidateBeforeCall(String authorization, String campaignIds, String advertiserIds, String campaignStatus, String bidType, 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 getCampaigns(Async)");
}
okhttp3.Call call = getCampaignsCall(authorization, campaignIds, advertiserIds, campaignStatus, bidType, progressListener, progressRequestListener);
return call;
}
/**
* Gets campaigns
* Get the list of campaigns with the specified filters. If a campaign is requested but is missing from current user's portfolio, it will not be included in the list. If neither campaign ids nor advertisers ids are provided, then the user's portfolio will be used.
* @param authorization JWT Bearer Token (required)
* @param campaignIds Optional. One or more campaign ids, E.g., 78, 12932, 45236. If the campaign ids requested are not linked to advertisers in the user's portfolio, they will be skipped. (optional)
* @param advertiserIds Optional. One or more advertiser ids, E.g., 78, 12932, 45236. If the advertiser ids requested are not part of the user's portfolio, they will be skipped. (optional)
* @param campaignStatus Optional. Filters by campaign status. By default no filtering is applied. (optional)
* @param bidType Optional. Filters by campaign bid type. By default, no filtering is applied. (optional)
* @return List<CampaignMessage>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public List getCampaigns(String authorization, String campaignIds, String advertiserIds, String campaignStatus, String bidType) throws ApiException {
ApiResponse> resp = getCampaignsWithHttpInfo(authorization, campaignIds, advertiserIds, campaignStatus, bidType);
return resp.getData();
}
/**
* Gets campaigns
* Get the list of campaigns with the specified filters. If a campaign is requested but is missing from current user's portfolio, it will not be included in the list. If neither campaign ids nor advertisers ids are provided, then the user's portfolio will be used.
* @param authorization JWT Bearer Token (required)
* @param campaignIds Optional. One or more campaign ids, E.g., 78, 12932, 45236. If the campaign ids requested are not linked to advertisers in the user's portfolio, they will be skipped. (optional)
* @param advertiserIds Optional. One or more advertiser ids, E.g., 78, 12932, 45236. If the advertiser ids requested are not part of the user's portfolio, they will be skipped. (optional)
* @param campaignStatus Optional. Filters by campaign status. By default no filtering is applied. (optional)
* @param bidType Optional. Filters by campaign bid type. By default, no filtering is applied. (optional)
* @return ApiResponse<List<CampaignMessage>>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse> getCampaignsWithHttpInfo(String authorization, String campaignIds, String advertiserIds, String campaignStatus, String bidType) throws ApiException {
okhttp3.Call call = getCampaignsValidateBeforeCall(authorization, campaignIds, advertiserIds, campaignStatus, bidType, null, null);
Type localVarReturnType = new TypeToken>(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Gets campaigns (asynchronously)
* Get the list of campaigns with the specified filters. If a campaign is requested but is missing from current user's portfolio, it will not be included in the list. If neither campaign ids nor advertisers ids are provided, then the user's portfolio will be used.
* @param authorization JWT Bearer Token (required)
* @param campaignIds Optional. One or more campaign ids, E.g., 78, 12932, 45236. If the campaign ids requested are not linked to advertisers in the user's portfolio, they will be skipped. (optional)
* @param advertiserIds Optional. One or more advertiser ids, E.g., 78, 12932, 45236. If the advertiser ids requested are not part of the user's portfolio, they will be skipped. (optional)
* @param campaignStatus Optional. Filters by campaign status. By default no filtering is applied. (optional)
* @param bidType Optional. Filters by campaign bid type. By default, no filtering is applied. (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 getCampaignsAsync(String authorization, String campaignIds, String advertiserIds, String campaignStatus, String bidType, 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 = getCampaignsValidateBeforeCall(authorization, campaignIds, advertiserIds, campaignStatus, bidType, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getCategories
* @param campaignId Mandatory. The id of the campaign the categories are linked to. (required)
* @param authorization JWT Bearer Token (required)
* @param enabledOnly Optional. Returns only categories you can bid on. Defaults to false. (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 getCategoriesCall(Integer campaignId, String authorization, Boolean enabledOnly, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
String localVarPath = "/v1/campaigns/{campaignId}/categories"
.replaceAll("\\{" + "campaignId" + "\\}", apiClient.escapeString(campaignId.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
if (enabledOnly != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("enabledOnly", enabledOnly));
}
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 getCategoriesValidateBeforeCall(Integer campaignId, String authorization, Boolean enabledOnly, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'campaignId' is set
if (campaignId == null) {
throw new ApiException("Missing the required parameter 'campaignId' when calling getCategories(Async)");
}
// verify the required parameter 'authorization' is set
if (authorization == null) {
throw new ApiException("Missing the required parameter 'authorization' when calling getCategories(Async)");
}
okhttp3.Call call = getCategoriesCall(campaignId, authorization, enabledOnly, progressListener, progressRequestListener);
return call;
}
/**
* Gets categories
* Get the list of categories linked to the requested campaign.
* @param campaignId Mandatory. The id of the campaign the categories are linked to. (required)
* @param authorization JWT Bearer Token (required)
* @param enabledOnly Optional. Returns only categories you can bid on. Defaults to false. (optional)
* @return CategoryMessage
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public CategoryMessage getCategories(Integer campaignId, String authorization, Boolean enabledOnly) throws ApiException {
ApiResponse resp = getCategoriesWithHttpInfo(campaignId, authorization, enabledOnly);
return resp.getData();
}
/**
* Gets categories
* Get the list of categories linked to the requested campaign.
* @param campaignId Mandatory. The id of the campaign the categories are linked to. (required)
* @param authorization JWT Bearer Token (required)
* @param enabledOnly Optional. Returns only categories you can bid on. Defaults to false. (optional)
* @return ApiResponse<CategoryMessage>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getCategoriesWithHttpInfo(Integer campaignId, String authorization, Boolean enabledOnly) throws ApiException {
okhttp3.Call call = getCategoriesValidateBeforeCall(campaignId, authorization, enabledOnly, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Gets categories (asynchronously)
* Get the list of categories linked to the requested campaign.
* @param campaignId Mandatory. The id of the campaign the categories are linked to. (required)
* @param authorization JWT Bearer Token (required)
* @param enabledOnly Optional. Returns only categories you can bid on. Defaults to false. (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 getCategoriesAsync(Integer campaignId, String authorization, Boolean enabledOnly, 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 = getCategoriesValidateBeforeCall(campaignId, authorization, enabledOnly, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getCategory
* @param campaignId Mandatory. The id of the campaign the categories are linked to. (required)
* @param categoryHashCode Mandatory. The id of the category to return. (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 getCategoryCall(Integer campaignId, Integer categoryHashCode, String authorization, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
String localVarPath = "/v1/campaigns/{campaignId}/categories/{categoryHashCode}"
.replaceAll("\\{" + "campaignId" + "\\}", apiClient.escapeString(campaignId.toString()))
.replaceAll("\\{" + "categoryHashCode" + "\\}", apiClient.escapeString(categoryHashCode.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 getCategoryValidateBeforeCall(Integer campaignId, Integer categoryHashCode, String authorization, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'campaignId' is set
if (campaignId == null) {
throw new ApiException("Missing the required parameter 'campaignId' when calling getCategory(Async)");
}
// verify the required parameter 'categoryHashCode' is set
if (categoryHashCode == null) {
throw new ApiException("Missing the required parameter 'categoryHashCode' when calling getCategory(Async)");
}
// verify the required parameter 'authorization' is set
if (authorization == null) {
throw new ApiException("Missing the required parameter 'authorization' when calling getCategory(Async)");
}
okhttp3.Call call = getCategoryCall(campaignId, categoryHashCode, authorization, progressListener, progressRequestListener);
return call;
}
/**
* Gets a specific category
* Get a specific category linked to the requested campaign.
* @param campaignId Mandatory. The id of the campaign the categories are linked to. (required)
* @param categoryHashCode Mandatory. The id of the category to return. (required)
* @param authorization JWT Bearer Token (required)
* @return CategoryMessage
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public CategoryMessage getCategory(Integer campaignId, Integer categoryHashCode, String authorization) throws ApiException {
ApiResponse resp = getCategoryWithHttpInfo(campaignId, categoryHashCode, authorization);
return resp.getData();
}
/**
* Gets a specific category
* Get a specific category linked to the requested campaign.
* @param campaignId Mandatory. The id of the campaign the categories are linked to. (required)
* @param categoryHashCode Mandatory. The id of the category to return. (required)
* @param authorization JWT Bearer Token (required)
* @return ApiResponse<CategoryMessage>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getCategoryWithHttpInfo(Integer campaignId, Integer categoryHashCode, String authorization) throws ApiException {
okhttp3.Call call = getCategoryValidateBeforeCall(campaignId, categoryHashCode, authorization, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Gets a specific category (asynchronously)
* Get a specific category linked to the requested campaign.
* @param campaignId Mandatory. The id of the campaign the categories are linked to. (required)
* @param categoryHashCode Mandatory. The id of the category to return. (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 getCategoryAsync(Integer campaignId, Integer categoryHashCode, 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 = getCategoryValidateBeforeCall(campaignId, categoryHashCode, authorization, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for updateBids
* @param authorization JWT Bearer Token (required)
* @param bidChanges Specifies the list of bid changes to be applied. (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 updateBidsCall(String authorization, List bidChanges, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = bidChanges;
// create path and map variables
String localVarPath = "/v1/campaigns/bids";
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, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call updateBidsValidateBeforeCall(String authorization, List bidChanges, 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 updateBids(Async)");
}
// verify the required parameter 'bidChanges' is set
if (bidChanges == null) {
throw new ApiException("Missing the required parameter 'bidChanges' when calling updateBids(Async)");
}
okhttp3.Call call = updateBidsCall(authorization, bidChanges, progressListener, progressRequestListener);
return call;
}
/**
* Update bids for campaigns and their categories
* If a campaign bid is updated, all (if any) category bids for this campaign will be updated with the new value if they are initially equal to the campaign bid. If the category bid is not wanted to be cascaded to the categories with the same bid value, new change bids must be added in the request for the categories where the value should be kept (with the initial value).
* @param authorization JWT Bearer Token (required)
* @param bidChanges Specifies the list of bid changes to be applied. (required)
* @return List<CampaignMessage>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public List updateBids(String authorization, List bidChanges) throws ApiException {
ApiResponse> resp = updateBidsWithHttpInfo(authorization, bidChanges);
return resp.getData();
}
/**
* Update bids for campaigns and their categories
* If a campaign bid is updated, all (if any) category bids for this campaign will be updated with the new value if they are initially equal to the campaign bid. If the category bid is not wanted to be cascaded to the categories with the same bid value, new change bids must be added in the request for the categories where the value should be kept (with the initial value).
* @param authorization JWT Bearer Token (required)
* @param bidChanges Specifies the list of bid changes to be applied. (required)
* @return ApiResponse<List<CampaignMessage>>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse> updateBidsWithHttpInfo(String authorization, List bidChanges) throws ApiException {
okhttp3.Call call = updateBidsValidateBeforeCall(authorization, bidChanges, null, null);
Type localVarReturnType = new TypeToken>(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Update bids for campaigns and their categories (asynchronously)
* If a campaign bid is updated, all (if any) category bids for this campaign will be updated with the new value if they are initially equal to the campaign bid. If the category bid is not wanted to be cascaded to the categories with the same bid value, new change bids must be added in the request for the categories where the value should be kept (with the initial value).
* @param authorization JWT Bearer Token (required)
* @param bidChanges Specifies the list of bid changes to be applied. (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 updateBidsAsync(String authorization, List bidChanges, 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 = updateBidsValidateBeforeCall(authorization, bidChanges, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy