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

com.criteo.marketing.api.StatisticsApi 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.StatsQueryMessageEx;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class StatisticsApi {
    private ApiClient localVarApiClient;

    public StatisticsApi() {
        this(Configuration.getDefaultApiClient());
    }

    public StatisticsApi(ApiClient apiClient) {
        this.localVarApiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return localVarApiClient;
    }

    public void setApiClient(ApiClient apiClient) {
        this.localVarApiClient = apiClient;
    }

    /**
     * Build call for getStats
     * @param authorization JWT Bearer Token (required)
     * @param statsQuery The report query details (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 Statistics report generated OK. -
400 Bad request, invalid syntax or validation error. -
401 Authentication failed. -
403 No campaigns found. -
429 Throttling failure. Maximum sending rate exceeded. -
500 Unknown error. -
*/ public okhttp3.Call getStatsCall(String authorization, StatsQueryMessageEx statsQuery, final ApiCallback _callback) throws ApiException { Object localVarPostBody = statsQuery; // create path and map variables String localVarPath = "/v1/statistics"; 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 getStatsValidateBeforeCall(String authorization, StatsQueryMessageEx statsQuery, 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 getStats(Async)"); } // verify the required parameter 'statsQuery' is set if (statsQuery == null) { throw new ApiException("Missing the required parameter 'statsQuery' when calling getStats(Async)"); } okhttp3.Call localVarCall = getStatsCall(authorization, statsQuery, _callback); return localVarCall; } /** * Generates a statistics report * <b>ReportType</b>: The type of report to generate. Possible values: CampaignPerformance, FacebookDPA, TransactionID. <i>(mandatory)</i><br /><b>AdvertiserIds</b>: The list of advertiser ids, comma-separated. Advertisers not in your portfolio will be skipped. If not present, all the advertisers in the portfolio will be used. <i>(optional)</i><br /><b>StartDate, EndDate</b>: Start date (beginning of day) and end date (end of day) to be used for the report generation. Format to use: yyyy-MM-dd (e.g. 2017-10-30). <i>(mandatory)</i><br /><b>Dimensions</b>: The dimensions to be used in the report. Between one and three. Possible values: CampaignId, AdvertiserId, Category, Hour, Day, Week, Month, Year. <i>(mandatory)</i><br /><b>Metrics</b>: The metrics to be used in the report. For a list of possible values, please see the full documentation. <i>(mandatory)</i><br /><b>Format</b>: The file format of the generated report. Possible values: Csv, Excel, Xml, Json <i>(mandatory)</i><br /><b>Currency</b>: The currency to be used in the report. Three-letter capitals. For a list of possible values, please see the full documentation. If not set, the user's preference setting will be used. <i>(optional)</i><br /><b>Timezone</b>: Timezone to be used in the report. Possible values: GMT, PST, JST. If not set, the user's preference setting will be used. <i>(optional)</i><br /><b>IgnoreXDevice</b>: Ignore cross-device data. Also can explicitly set to null for TransactionID ReportType to get all data. Defaults to false. <i>(optional)</i><br /><h4>Functional cases</h4> Statistic export in a file might be corrupted through Swagger. It's recommended to access this file through a CURL request or other programmatic methods. <h4>Validation rules</h4> StartDate and EndDate are mandatory.<br /> StartDate should come before, or be equal to EndDate.<br /> The requested dimensions must be in a supported combination.<br /> At least one metric must be provided.<br /> All metrics must be supported.<br /> The selected advertisers must have at least one campaign.<br /> Seller dimension is not supported.<br /><h4>Response custom headers</h4> If you are asking for a CampaignPerformance report and sales metrics are late, response will have a custom header <b>latest-available-sales</b>, a datetime with format <b>yyyy-MM-dd HH:mm</b> using the requested timezone. * @param authorization JWT Bearer Token (required) * @param statsQuery The report query details (required) * @return byte[] * @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 Statistics report generated OK. -
400 Bad request, invalid syntax or validation error. -
401 Authentication failed. -
403 No campaigns found. -
429 Throttling failure. Maximum sending rate exceeded. -
500 Unknown error. -
*/ public byte[] getStats(String authorization, StatsQueryMessageEx statsQuery) throws ApiException { ApiResponse localVarResp = getStatsWithHttpInfo(authorization, statsQuery); return localVarResp.getData(); } /** * Generates a statistics report * <b>ReportType</b>: The type of report to generate. Possible values: CampaignPerformance, FacebookDPA, TransactionID. <i>(mandatory)</i><br /><b>AdvertiserIds</b>: The list of advertiser ids, comma-separated. Advertisers not in your portfolio will be skipped. If not present, all the advertisers in the portfolio will be used. <i>(optional)</i><br /><b>StartDate, EndDate</b>: Start date (beginning of day) and end date (end of day) to be used for the report generation. Format to use: yyyy-MM-dd (e.g. 2017-10-30). <i>(mandatory)</i><br /><b>Dimensions</b>: The dimensions to be used in the report. Between one and three. Possible values: CampaignId, AdvertiserId, Category, Hour, Day, Week, Month, Year. <i>(mandatory)</i><br /><b>Metrics</b>: The metrics to be used in the report. For a list of possible values, please see the full documentation. <i>(mandatory)</i><br /><b>Format</b>: The file format of the generated report. Possible values: Csv, Excel, Xml, Json <i>(mandatory)</i><br /><b>Currency</b>: The currency to be used in the report. Three-letter capitals. For a list of possible values, please see the full documentation. If not set, the user's preference setting will be used. <i>(optional)</i><br /><b>Timezone</b>: Timezone to be used in the report. Possible values: GMT, PST, JST. If not set, the user's preference setting will be used. <i>(optional)</i><br /><b>IgnoreXDevice</b>: Ignore cross-device data. Also can explicitly set to null for TransactionID ReportType to get all data. Defaults to false. <i>(optional)</i><br /><h4>Functional cases</h4> Statistic export in a file might be corrupted through Swagger. It's recommended to access this file through a CURL request or other programmatic methods. <h4>Validation rules</h4> StartDate and EndDate are mandatory.<br /> StartDate should come before, or be equal to EndDate.<br /> The requested dimensions must be in a supported combination.<br /> At least one metric must be provided.<br /> All metrics must be supported.<br /> The selected advertisers must have at least one campaign.<br /> Seller dimension is not supported.<br /><h4>Response custom headers</h4> If you are asking for a CampaignPerformance report and sales metrics are late, response will have a custom header <b>latest-available-sales</b>, a datetime with format <b>yyyy-MM-dd HH:mm</b> using the requested timezone. * @param authorization JWT Bearer Token (required) * @param statsQuery The report query details (required) * @return ApiResponse<byte[]> * @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 Statistics report generated OK. -
400 Bad request, invalid syntax or validation error. -
401 Authentication failed. -
403 No campaigns found. -
429 Throttling failure. Maximum sending rate exceeded. -
500 Unknown error. -
*/ public ApiResponse getStatsWithHttpInfo(String authorization, StatsQueryMessageEx statsQuery) throws ApiException { okhttp3.Call localVarCall = getStatsValidateBeforeCall(authorization, statsQuery, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Generates a statistics report (asynchronously) * <b>ReportType</b>: The type of report to generate. Possible values: CampaignPerformance, FacebookDPA, TransactionID. <i>(mandatory)</i><br /><b>AdvertiserIds</b>: The list of advertiser ids, comma-separated. Advertisers not in your portfolio will be skipped. If not present, all the advertisers in the portfolio will be used. <i>(optional)</i><br /><b>StartDate, EndDate</b>: Start date (beginning of day) and end date (end of day) to be used for the report generation. Format to use: yyyy-MM-dd (e.g. 2017-10-30). <i>(mandatory)</i><br /><b>Dimensions</b>: The dimensions to be used in the report. Between one and three. Possible values: CampaignId, AdvertiserId, Category, Hour, Day, Week, Month, Year. <i>(mandatory)</i><br /><b>Metrics</b>: The metrics to be used in the report. For a list of possible values, please see the full documentation. <i>(mandatory)</i><br /><b>Format</b>: The file format of the generated report. Possible values: Csv, Excel, Xml, Json <i>(mandatory)</i><br /><b>Currency</b>: The currency to be used in the report. Three-letter capitals. For a list of possible values, please see the full documentation. If not set, the user's preference setting will be used. <i>(optional)</i><br /><b>Timezone</b>: Timezone to be used in the report. Possible values: GMT, PST, JST. If not set, the user's preference setting will be used. <i>(optional)</i><br /><b>IgnoreXDevice</b>: Ignore cross-device data. Also can explicitly set to null for TransactionID ReportType to get all data. Defaults to false. <i>(optional)</i><br /><h4>Functional cases</h4> Statistic export in a file might be corrupted through Swagger. It's recommended to access this file through a CURL request or other programmatic methods. <h4>Validation rules</h4> StartDate and EndDate are mandatory.<br /> StartDate should come before, or be equal to EndDate.<br /> The requested dimensions must be in a supported combination.<br /> At least one metric must be provided.<br /> All metrics must be supported.<br /> The selected advertisers must have at least one campaign.<br /> Seller dimension is not supported.<br /><h4>Response custom headers</h4> If you are asking for a CampaignPerformance report and sales metrics are late, response will have a custom header <b>latest-available-sales</b>, a datetime with format <b>yyyy-MM-dd HH:mm</b> using the requested timezone. * @param authorization JWT Bearer Token (required) * @param statsQuery The report query details (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 Statistics report generated OK. -
400 Bad request, invalid syntax or validation error. -
401 Authentication failed. -
403 No campaigns found. -
429 Throttling failure. Maximum sending rate exceeded. -
500 Unknown error. -
*/ public okhttp3.Call getStatsAsync(String authorization, StatsQueryMessageEx statsQuery, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getStatsValidateBeforeCall(authorization, statsQuery, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy