com.criteo.marketing.api.BudgetsApi 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.BudgetMessage;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class BudgetsApi {
private ApiClient apiClient;
public BudgetsApi() {
this(Configuration.getDefaultApiClient());
}
public BudgetsApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Build call for get
* @param authorization JWT Bearer Token (required)
* @param advertiserIds Optional. One or more advertiser ids, E.g. 78, 12932, 45236. If the requested advertiser ids are not part of the user's portfolio, they will be skipped. (optional)
* @param budgetIds Optional. One or more budget ids, E.g. 75, 1931, 532. If the requested budget ids are not part of the user's portfolio, they will be skipped. (optional)
* @param onlyActiveCampaigns Optional. Filters by campaign status, allowing to only display active campaigns or not. Default value is true. (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 getCall(String authorization, String advertiserIds, String budgetIds, Boolean onlyActiveCampaigns, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
String localVarPath = "/v1/budgets";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
if (advertiserIds != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("advertiserIds", advertiserIds));
}
if (budgetIds != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("budgetIds", budgetIds));
}
if (onlyActiveCampaigns != null) {
localVarQueryParams.addAll(apiClient.parameterToPair("onlyActiveCampaigns", onlyActiveCampaigns));
}
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 getValidateBeforeCall(String authorization, String advertiserIds, String budgetIds, Boolean onlyActiveCampaigns, 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 get(Async)");
}
okhttp3.Call call = getCall(authorization, advertiserIds, budgetIds, onlyActiveCampaigns, progressListener, progressRequestListener);
return call;
}
/**
* Gets budgets
* Get the list of budgets with the specified filters. If an advertiser or a budget is requested but is missing from current user's portfolio, it will not be included in the list. If neither budgets ids nor advertisers ids are provided, then the user's portfolio will be used.
* @param authorization JWT Bearer Token (required)
* @param advertiserIds Optional. One or more advertiser ids, E.g. 78, 12932, 45236. If the requested advertiser ids are not part of the user's portfolio, they will be skipped. (optional)
* @param budgetIds Optional. One or more budget ids, E.g. 75, 1931, 532. If the requested budget ids are not part of the user's portfolio, they will be skipped. (optional)
* @param onlyActiveCampaigns Optional. Filters by campaign status, allowing to only display active campaigns or not. Default value is true. (optional)
* @return List<BudgetMessage>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public List get(String authorization, String advertiserIds, String budgetIds, Boolean onlyActiveCampaigns) throws ApiException {
ApiResponse> resp = getWithHttpInfo(authorization, advertiserIds, budgetIds, onlyActiveCampaigns);
return resp.getData();
}
/**
* Gets budgets
* Get the list of budgets with the specified filters. If an advertiser or a budget is requested but is missing from current user's portfolio, it will not be included in the list. If neither budgets ids nor advertisers ids are provided, then the user's portfolio will be used.
* @param authorization JWT Bearer Token (required)
* @param advertiserIds Optional. One or more advertiser ids, E.g. 78, 12932, 45236. If the requested advertiser ids are not part of the user's portfolio, they will be skipped. (optional)
* @param budgetIds Optional. One or more budget ids, E.g. 75, 1931, 532. If the requested budget ids are not part of the user's portfolio, they will be skipped. (optional)
* @param onlyActiveCampaigns Optional. Filters by campaign status, allowing to only display active campaigns or not. Default value is true. (optional)
* @return ApiResponse<List<BudgetMessage>>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse> getWithHttpInfo(String authorization, String advertiserIds, String budgetIds, Boolean onlyActiveCampaigns) throws ApiException {
okhttp3.Call call = getValidateBeforeCall(authorization, advertiserIds, budgetIds, onlyActiveCampaigns, null, null);
Type localVarReturnType = new TypeToken>(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Gets budgets (asynchronously)
* Get the list of budgets with the specified filters. If an advertiser or a budget is requested but is missing from current user's portfolio, it will not be included in the list. If neither budgets ids nor advertisers ids are provided, then the user's portfolio will be used.
* @param authorization JWT Bearer Token (required)
* @param advertiserIds Optional. One or more advertiser ids, E.g. 78, 12932, 45236. If the requested advertiser ids are not part of the user's portfolio, they will be skipped. (optional)
* @param budgetIds Optional. One or more budget ids, E.g. 75, 1931, 532. If the requested budget ids are not part of the user's portfolio, they will be skipped. (optional)
* @param onlyActiveCampaigns Optional. Filters by campaign status, allowing to only display active campaigns or not. Default value is true. (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 getAsync(String authorization, String advertiserIds, String budgetIds, Boolean onlyActiveCampaigns, 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 = getValidateBeforeCall(authorization, advertiserIds, budgetIds, onlyActiveCampaigns, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy