Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Marketing API v.1.0
* IMPORTANT: This swagger links to Criteo production environment. Any test applied here will thus impact real campaigns.
*
* The version of the OpenAPI document: 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.AudienceCreateRequest;
import com.criteo.marketing.model.AudienceCreateResponse;
import com.criteo.marketing.model.AudiencePatchRequest;
import com.criteo.marketing.model.AudiencePatchResponse;
import com.criteo.marketing.model.AudiencePutRequest;
import com.criteo.marketing.model.AudiencesGetResponse;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class AudiencesApi {
private ApiClient localVarApiClient;
public AudiencesApi() {
this(Configuration.getDefaultApiClient());
}
public AudiencesApi(ApiClient apiClient) {
this.localVarApiClient = apiClient;
}
public ApiClient getApiClient() {
return localVarApiClient;
}
public void setApiClient(ApiClient apiClient) {
this.localVarApiClient = apiClient;
}
/**
* Build call for addRemoveUsersToAudience
* @param audienceId Mandatory. The id of the audience to add or remove users to. (required)
* @param authorization JWT Bearer Token (required)
* @param request Mandatory. The request to create the Audience. (required)
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
* @http.response.details
Status Code
Description
Response Headers
200
Users were Added/Removed successfully.
-
400
Invalid Operation, Schema, no valid identifiers given, too many identifiers given in a single request or invalid use of Gum caller id field.
-
401
Authentication failed.
-
403
The Advertiser this Audience belongs to is not in current user's portfolio.
-
404
Audience not found.
-
429
Throttling failure. Maximum sending rate exceeded.
-
500
Unknown error.
-
*/
public okhttp3.Call addRemoveUsersToAudienceCall(Integer audienceId, String authorization, AudiencePatchRequest request, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = request;
// create path and map variables
String localVarPath = "/v1/audiences/userlist/{audienceId}"
.replaceAll("\\{" + "audienceId" + "\\}", localVarApiClient.escapeString(audienceId.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
if (authorization != null) {
localVarHeaderParams.put("Authorization", localVarApiClient.parameterToString(authorization));
}
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json", "text/json", "application/xml", "text/xml", "text/html"
};
final String localVarAccept = localVarApiClient.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 = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
String[] localVarAuthNames = new String[] { "Authorization" };
return localVarApiClient.buildCall(localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call addRemoveUsersToAudienceValidateBeforeCall(Integer audienceId, String authorization, AudiencePatchRequest request, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'audienceId' is set
if (audienceId == null) {
throw new ApiException("Missing the required parameter 'audienceId' when calling addRemoveUsersToAudience(Async)");
}
// verify the required parameter 'authorization' is set
if (authorization == null) {
throw new ApiException("Missing the required parameter 'authorization' when calling addRemoveUsersToAudience(Async)");
}
// verify the required parameter 'request' is set
if (request == null) {
throw new ApiException("Missing the required parameter 'request' when calling addRemoveUsersToAudience(Async)");
}
okhttp3.Call localVarCall = addRemoveUsersToAudienceCall(audienceId, authorization, request, _callback);
return localVarCall;
}
/**
* Add/Remove users to an Audience.
* Add/Remove users to an Audience.
* @param audienceId Mandatory. The id of the audience to add or remove users to. (required)
* @param authorization JWT Bearer Token (required)
* @param request Mandatory. The request to create the Audience. (required)
* @return AudiencePatchResponse
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code
Description
Response Headers
200
Users were Added/Removed successfully.
-
400
Invalid Operation, Schema, no valid identifiers given, too many identifiers given in a single request or invalid use of Gum caller id field.
-
401
Authentication failed.
-
403
The Advertiser this Audience belongs to is not in current user's portfolio.
-
404
Audience not found.
-
429
Throttling failure. Maximum sending rate exceeded.
-
500
Unknown error.
-
*/
public AudiencePatchResponse addRemoveUsersToAudience(Integer audienceId, String authorization, AudiencePatchRequest request) throws ApiException {
ApiResponse localVarResp = addRemoveUsersToAudienceWithHttpInfo(audienceId, authorization, request);
return localVarResp.getData();
}
/**
* Add/Remove users to an Audience.
* Add/Remove users to an Audience.
* @param audienceId Mandatory. The id of the audience to add or remove users to. (required)
* @param authorization JWT Bearer Token (required)
* @param request Mandatory. The request to create the Audience. (required)
* @return ApiResponse<AudiencePatchResponse>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code
Description
Response Headers
200
Users were Added/Removed successfully.
-
400
Invalid Operation, Schema, no valid identifiers given, too many identifiers given in a single request or invalid use of Gum caller id field.
-
401
Authentication failed.
-
403
The Advertiser this Audience belongs to is not in current user's portfolio.
-
404
Audience not found.
-
429
Throttling failure. Maximum sending rate exceeded.
-
500
Unknown error.
-
*/
public ApiResponse addRemoveUsersToAudienceWithHttpInfo(Integer audienceId, String authorization, AudiencePatchRequest request) throws ApiException {
okhttp3.Call localVarCall = addRemoveUsersToAudienceValidateBeforeCall(audienceId, authorization, request, null);
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
/**
* Add/Remove users to an Audience. (asynchronously)
* Add/Remove users to an Audience.
* @param audienceId Mandatory. The id of the audience to add or remove users to. (required)
* @param authorization JWT Bearer Token (required)
* @param request Mandatory. The request to create the Audience. (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
* @http.response.details
Status Code
Description
Response Headers
200
Users were Added/Removed successfully.
-
400
Invalid Operation, Schema, no valid identifiers given, too many identifiers given in a single request or invalid use of Gum caller id field.
-
401
Authentication failed.
-
403
The Advertiser this Audience belongs to is not in current user's portfolio.
-
404
Audience not found.
-
429
Throttling failure. Maximum sending rate exceeded.
-
500
Unknown error.
-
*/
public okhttp3.Call addRemoveUsersToAudienceAsync(Integer audienceId, String authorization, AudiencePatchRequest request, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = addRemoveUsersToAudienceValidateBeforeCall(audienceId, authorization, request, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for createAudience
* @param authorization JWT Bearer Token (required)
* @param createRequest (required)
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
* @http.response.details
Status Code
Description
Response Headers
200
Newly created Audience.
-
400
The Audience name is incorrect. Must not be empty.
-
401
Authentication failed.
-
403
The requested advertiser is missing from current user's portfolio.
-
409
The Audience name is already used for this Advertiser.
-
429
Throttling failure. Maximum sending rate exceeded.
-
500
Unknown error.
-
*/
public okhttp3.Call createAudienceCall(String authorization, AudienceCreateRequest createRequest, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = createRequest;
// create path and map variables
String localVarPath = "/v1/audiences/userlist";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
if (authorization != null) {
localVarHeaderParams.put("Authorization", localVarApiClient.parameterToString(authorization));
}
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json", "text/json", "application/xml", "text/xml", "text/html"
};
final String localVarAccept = localVarApiClient.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 = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
String[] localVarAuthNames = new String[] { "Authorization" };
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call createAudienceValidateBeforeCall(String authorization, AudienceCreateRequest createRequest, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'authorization' is set
if (authorization == null) {
throw new ApiException("Missing the required parameter 'authorization' when calling createAudience(Async)");
}
// verify the required parameter 'createRequest' is set
if (createRequest == null) {
throw new ApiException("Missing the required parameter 'createRequest' when calling createAudience(Async)");
}
okhttp3.Call localVarCall = createAudienceCall(authorization, createRequest, _callback);
return localVarCall;
}
/**
* Create a new Audience.
* Create a new Audience for the given Advertiser.
* @param authorization JWT Bearer Token (required)
* @param createRequest (required)
* @return AudienceCreateResponse
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code
Description
Response Headers
200
Newly created Audience.
-
400
The Audience name is incorrect. Must not be empty.
-
401
Authentication failed.
-
403
The requested advertiser is missing from current user's portfolio.
-
409
The Audience name is already used for this Advertiser.
-
429
Throttling failure. Maximum sending rate exceeded.
-
500
Unknown error.
-
*/
public AudienceCreateResponse createAudience(String authorization, AudienceCreateRequest createRequest) throws ApiException {
ApiResponse localVarResp = createAudienceWithHttpInfo(authorization, createRequest);
return localVarResp.getData();
}
/**
* Create a new Audience.
* Create a new Audience for the given Advertiser.
* @param authorization JWT Bearer Token (required)
* @param createRequest (required)
* @return ApiResponse<AudienceCreateResponse>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code
Description
Response Headers
200
Newly created Audience.
-
400
The Audience name is incorrect. Must not be empty.
-
401
Authentication failed.
-
403
The requested advertiser is missing from current user's portfolio.
-
409
The Audience name is already used for this Advertiser.
-
429
Throttling failure. Maximum sending rate exceeded.
-
500
Unknown error.
-
*/
public ApiResponse createAudienceWithHttpInfo(String authorization, AudienceCreateRequest createRequest) throws ApiException {
okhttp3.Call localVarCall = createAudienceValidateBeforeCall(authorization, createRequest, null);
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
/**
* Create a new Audience. (asynchronously)
* Create a new Audience for the given Advertiser.
* @param authorization JWT Bearer Token (required)
* @param createRequest (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
* @http.response.details
Status Code
Description
Response Headers
200
Newly created Audience.
-
400
The Audience name is incorrect. Must not be empty.
-
401
Authentication failed.
-
403
The requested advertiser is missing from current user's portfolio.
-
409
The Audience name is already used for this Advertiser.
-
429
Throttling failure. Maximum sending rate exceeded.
-
500
Unknown error.
-
*/
public okhttp3.Call createAudienceAsync(String authorization, AudienceCreateRequest createRequest, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = createAudienceValidateBeforeCall(authorization, createRequest, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for deleteAudience
* @param audienceId Mandatory. The id of the audience to delete. (required)
* @param authorization JWT Bearer Token (required)
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
* @http.response.details
Status Code
Description
Response Headers
200
OK
-
204
Audience was deleted.
-
401
Authentication failed.
-
403
The Advertiser this Audience belongs to is not in current user's portfolio.
-
404
Audience not found.
-
429
Throttling failure. Maximum sending rate exceeded.
-
500
Unknown error.
-
*/
public okhttp3.Call deleteAudienceCall(Integer audienceId, String authorization, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/audiences/{audienceId}"
.replaceAll("\\{" + "audienceId" + "\\}", localVarApiClient.escapeString(audienceId.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
if (authorization != null) {
localVarHeaderParams.put("Authorization", localVarApiClient.parameterToString(authorization));
}
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json", "text/json", "application/xml", "text/xml", "text/html"
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
};
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
String[] localVarAuthNames = new String[] { "Authorization" };
return localVarApiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call deleteAudienceValidateBeforeCall(Integer audienceId, String authorization, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'audienceId' is set
if (audienceId == null) {
throw new ApiException("Missing the required parameter 'audienceId' when calling deleteAudience(Async)");
}
// verify the required parameter 'authorization' is set
if (authorization == null) {
throw new ApiException("Missing the required parameter 'authorization' when calling deleteAudience(Async)");
}
okhttp3.Call localVarCall = deleteAudienceCall(audienceId, authorization, _callback);
return localVarCall;
}
/**
* Delete an Audience.
* Delete an Audience.
* @param audienceId Mandatory. The id of the audience to delete. (required)
* @param authorization JWT Bearer Token (required)
* @return Object
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code
Description
Response Headers
200
OK
-
204
Audience was deleted.
-
401
Authentication failed.
-
403
The Advertiser this Audience belongs to is not in current user's portfolio.
-
404
Audience not found.
-
429
Throttling failure. Maximum sending rate exceeded.