All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.criteo.marketing.api.AudiencesApi Maven / Gradle / Ivy

There is a newer version: 1.0.28
Show newest version
/*
 * 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. -
500 Unknown error. -
*/ public Object deleteAudience(Integer audienceId, String authorization) throws ApiException { ApiResponse localVarResp = deleteAudienceWithHttpInfo(audienceId, authorization); return localVarResp.getData(); } /** * Delete an Audience. * Delete an Audience. * @param audienceId Mandatory. The id of the audience to delete. (required) * @param authorization JWT Bearer Token (required) * @return ApiResponse<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. -
500 Unknown error. -
*/ public ApiResponse deleteAudienceWithHttpInfo(Integer audienceId, String authorization) throws ApiException { okhttp3.Call localVarCall = deleteAudienceValidateBeforeCall(audienceId, authorization, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Delete an Audience. (asynchronously) * Delete an Audience. * @param audienceId Mandatory. The id of the audience to delete. (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 * @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 deleteAudienceAsync(Integer audienceId, String authorization, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = deleteAudienceValidateBeforeCall(audienceId, authorization, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getAudiences * @param authorization JWT Bearer Token (required) * @param advertiserId Mandatory. Advertiser to get all Audiences for. (optional) * @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 List of Audiences. -
401 Authentication failed. -
403 The requested advertiser is missing from current user's portfolio. -
429 Throttling failure. Maximum sending rate exceeded. -
500 Unknown error. -
*/ public okhttp3.Call getAudiencesCall(String authorization, Integer advertiserId, final ApiCallback _callback) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/v1/audiences"; List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); if (advertiserId != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("advertiserId", advertiserId)); } 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, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call getAudiencesValidateBeforeCall(String authorization, Integer advertiserId, 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 getAudiences(Async)"); } okhttp3.Call localVarCall = getAudiencesCall(authorization, advertiserId, _callback); return localVarCall; } /** * Get the list of Audiences. * Get the list of Audiences for the given Advertiser. * @param authorization JWT Bearer Token (required) * @param advertiserId Mandatory. Advertiser to get all Audiences for. (optional) * @return AudiencesGetResponse * @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 List of Audiences. -
401 Authentication failed. -
403 The requested advertiser is missing from current user's portfolio. -
429 Throttling failure. Maximum sending rate exceeded. -
500 Unknown error. -
*/ public AudiencesGetResponse getAudiences(String authorization, Integer advertiserId) throws ApiException { ApiResponse localVarResp = getAudiencesWithHttpInfo(authorization, advertiserId); return localVarResp.getData(); } /** * Get the list of Audiences. * Get the list of Audiences for the given Advertiser. * @param authorization JWT Bearer Token (required) * @param advertiserId Mandatory. Advertiser to get all Audiences for. (optional) * @return ApiResponse<AudiencesGetResponse> * @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 List of Audiences. -
401 Authentication failed. -
403 The requested advertiser is missing from current user's portfolio. -
429 Throttling failure. Maximum sending rate exceeded. -
500 Unknown error. -
*/ public ApiResponse getAudiencesWithHttpInfo(String authorization, Integer advertiserId) throws ApiException { okhttp3.Call localVarCall = getAudiencesValidateBeforeCall(authorization, advertiserId, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Get the list of Audiences. (asynchronously) * Get the list of Audiences for the given Advertiser. * @param authorization JWT Bearer Token (required) * @param advertiserId Mandatory. Advertiser to get all Audiences for. (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 * @http.response.details
Status Code Description Response Headers
200 List of Audiences. -
401 Authentication failed. -
403 The requested advertiser is missing from current user's portfolio. -
429 Throttling failure. Maximum sending rate exceeded. -
500 Unknown error. -
*/ public okhttp3.Call getAudiencesAsync(String authorization, Integer advertiserId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getAudiencesValidateBeforeCall(authorization, advertiserId, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for removeUsersFromAudience * @param audienceId Mandatory. The id of the audience to empty. (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 emptied. -
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 removeUsersFromAudienceCall(Integer audienceId, String authorization, final ApiCallback _callback) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/v1/audiences/userlist/{audienceId}/users" .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 removeUsersFromAudienceValidateBeforeCall(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 removeUsersFromAudience(Async)"); } // verify the required parameter 'authorization' is set if (authorization == null) { throw new ApiException("Missing the required parameter 'authorization' when calling removeUsersFromAudience(Async)"); } okhttp3.Call localVarCall = removeUsersFromAudienceCall(audienceId, authorization, _callback); return localVarCall; } /** * Remove all users from an Audience. * Remove all users from an Audience. * @param audienceId Mandatory. The id of the audience to empty. (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 emptied. -
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 Object removeUsersFromAudience(Integer audienceId, String authorization) throws ApiException { ApiResponse localVarResp = removeUsersFromAudienceWithHttpInfo(audienceId, authorization); return localVarResp.getData(); } /** * Remove all users from an Audience. * Remove all users from an Audience. * @param audienceId Mandatory. The id of the audience to empty. (required) * @param authorization JWT Bearer Token (required) * @return ApiResponse<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 emptied. -
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 removeUsersFromAudienceWithHttpInfo(Integer audienceId, String authorization) throws ApiException { okhttp3.Call localVarCall = removeUsersFromAudienceValidateBeforeCall(audienceId, authorization, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Remove all users from an Audience. (asynchronously) * Remove all users from an Audience. * @param audienceId Mandatory. The id of the audience to empty. (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 * @http.response.details
Status Code Description Response Headers
200 OK -
204 Audience was emptied. -
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 removeUsersFromAudienceAsync(Integer audienceId, String authorization, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = removeUsersFromAudienceValidateBeforeCall(audienceId, authorization, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for updateAudienceMetadata * @param audienceId Mandatory. The id of the Audience to update. (required) * @param authorization JWT Bearer Token (required) * @param request Mandatory. The request to update the Audience metadata. (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 metadata was successfully changed. -
400 The Audience name is incorrect. Must not be empty. -
401 Authentication failed. -
403 The Advertiser this Audience belongs to is not in current user's portfolio. -
404 Audience not found. -
409 The Audience name is already used for this Advertiser. -
429 Throttling failure. Maximum sending rate exceeded. -
500 Unknown error. -
*/ public okhttp3.Call updateAudienceMetadataCall(Integer audienceId, String authorization, AudiencePutRequest request, final ApiCallback _callback) throws ApiException { Object localVarPostBody = request; // 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 = { "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, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call updateAudienceMetadataValidateBeforeCall(Integer audienceId, String authorization, AudiencePutRequest 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 updateAudienceMetadata(Async)"); } // verify the required parameter 'authorization' is set if (authorization == null) { throw new ApiException("Missing the required parameter 'authorization' when calling updateAudienceMetadata(Async)"); } // verify the required parameter 'request' is set if (request == null) { throw new ApiException("Missing the required parameter 'request' when calling updateAudienceMetadata(Async)"); } okhttp3.Call localVarCall = updateAudienceMetadataCall(audienceId, authorization, request, _callback); return localVarCall; } /** * Update an Audience metadata. * Update an Audience metadata. * @param audienceId Mandatory. The id of the Audience to update. (required) * @param authorization JWT Bearer Token (required) * @param request Mandatory. The request to update the Audience metadata. (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 metadata was successfully changed. -
400 The Audience name is incorrect. Must not be empty. -
401 Authentication failed. -
403 The Advertiser this Audience belongs to is not in current user's portfolio. -
404 Audience not found. -
409 The Audience name is already used for this Advertiser. -
429 Throttling failure. Maximum sending rate exceeded. -
500 Unknown error. -
*/ public Object updateAudienceMetadata(Integer audienceId, String authorization, AudiencePutRequest request) throws ApiException { ApiResponse localVarResp = updateAudienceMetadataWithHttpInfo(audienceId, authorization, request); return localVarResp.getData(); } /** * Update an Audience metadata. * Update an Audience metadata. * @param audienceId Mandatory. The id of the Audience to update. (required) * @param authorization JWT Bearer Token (required) * @param request Mandatory. The request to update the Audience metadata. (required) * @return ApiResponse<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 metadata was successfully changed. -
400 The Audience name is incorrect. Must not be empty. -
401 Authentication failed. -
403 The Advertiser this Audience belongs to is not in current user's portfolio. -
404 Audience not found. -
409 The Audience name is already used for this Advertiser. -
429 Throttling failure. Maximum sending rate exceeded. -
500 Unknown error. -
*/ public ApiResponse updateAudienceMetadataWithHttpInfo(Integer audienceId, String authorization, AudiencePutRequest request) throws ApiException { okhttp3.Call localVarCall = updateAudienceMetadataValidateBeforeCall(audienceId, authorization, request, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Update an Audience metadata. (asynchronously) * Update an Audience metadata. * @param audienceId Mandatory. The id of the Audience to update. (required) * @param authorization JWT Bearer Token (required) * @param request Mandatory. The request to update the Audience metadata. (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 OK -
204 Audience metadata was successfully changed. -
400 The Audience name is incorrect. Must not be empty. -
401 Authentication failed. -
403 The Advertiser this Audience belongs to is not in current user's portfolio. -
404 Audience not found. -
409 The Audience name is already used for this Advertiser. -
429 Throttling failure. Maximum sending rate exceeded. -
500 Unknown error. -
*/ public okhttp3.Call updateAudienceMetadataAsync(Integer audienceId, String authorization, AudiencePutRequest request, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = updateAudienceMetadataValidateBeforeCall(audienceId, authorization, request, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } }