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

com.genesys.internal.statistics.api.StatisticsApi Maven / Gradle / Ivy

/*
 * Statistics Service
 * Statistics Service
 *
 * OpenAPI spec version: 9.0.000.00.dev
 * 
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 * Do not edit the class manually.
 */


package com.genesys.internal.statistics.api;

import com.genesys.internal.common.ApiCallback;
import com.genesys.internal.common.ApiClient;
import com.genesys.internal.common.ApiException;
import com.genesys.internal.common.ApiResponse;
import com.genesys.internal.common.Configuration;
import com.genesys.internal.common.Pair;
import com.genesys.internal.common.ProgressRequestBody;
import com.genesys.internal.common.ProgressResponseBody;

import com.google.gson.reflect.TypeToken;

import java.io.IOException;


import com.genesys.internal.statistics.model.ModelApiResponse;
import com.genesys.internal.statistics.model.PeekedStatisticResponse;
import com.genesys.internal.statistics.model.PeekedStatisticsResponse;
import com.genesys.internal.statistics.model.StatisticDataResponse;

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 apiClient;

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

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

    public ApiClient getApiClient() {
        return apiClient;
    }

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

    /**
     * Build call for createSubscriptionUsingPOST
     * @param statistics definitions for statistics which are to be opened with stat server (required)
     * @param verbose Verbose level for response (optional, default to INFO)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public com.squareup.okhttp.Call createSubscriptionUsingPOSTCall(String statistics, String verbose, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = statistics;
        
        // create path and map variables
        String localVarPath = "/subscriptions";

        List localVarQueryParams = new ArrayList();
        if (verbose != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "verbose", verbose));

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
                    com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] {  };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call createSubscriptionUsingPOSTValidateBeforeCall(String statistics, String verbose, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'statistics' is set
        if (statistics == null) {
            throw new ApiException("Missing the required parameter 'statistics' when calling createSubscriptionUsingPOST(Async)");
        }
        
        
        com.squareup.okhttp.Call call = createSubscriptionUsingPOSTCall(statistics, verbose, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Opens the stat server subscription for the specified set of statistics. The statistic updates will be delivered via comet. Alternatively they can be peeked using corresponding API.
     * 
     * @param statistics definitions for statistics which are to be opened with stat server (required)
     * @param verbose Verbose level for response (optional, default to INFO)
     * @return StatisticDataResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public StatisticDataResponse createSubscriptionUsingPOST(String statistics, String verbose) throws ApiException {
        ApiResponse resp = createSubscriptionUsingPOSTWithHttpInfo(statistics, verbose);
        return resp.getData();
    }

    /**
     * Opens the stat server subscription for the specified set of statistics. The statistic updates will be delivered via comet. Alternatively they can be peeked using corresponding API.
     * 
     * @param statistics definitions for statistics which are to be opened with stat server (required)
     * @param verbose Verbose level for response (optional, default to INFO)
     * @return ApiResponse<StatisticDataResponse>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse createSubscriptionUsingPOSTWithHttpInfo(String statistics, String verbose) throws ApiException {
        com.squareup.okhttp.Call call = createSubscriptionUsingPOSTValidateBeforeCall(statistics, verbose, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Opens the stat server subscription for the specified set of statistics. The statistic updates will be delivered via comet. Alternatively they can be peeked using corresponding API. (asynchronously)
     * 
     * @param statistics definitions for statistics which are to be opened with stat server (required)
     * @param verbose Verbose level for response (optional, default to INFO)
     * @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 com.squareup.okhttp.Call createSubscriptionUsingPOSTAsync(String statistics, String verbose, 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);
                }
            };
        }

        com.squareup.okhttp.Call call = createSubscriptionUsingPOSTValidateBeforeCall(statistics, verbose, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for deleteSubscription
     * @param id The id of the subscription to delete (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 com.squareup.okhttp.Call deleteSubscriptionCall(String id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/subscriptions/{id}"
            .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));

        List localVarQueryParams = new ArrayList();

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
                    com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] {  };
        return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call deleteSubscriptionValidateBeforeCall(String id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'id' is set
        if (id == null) {
            throw new ApiException("Missing the required parameter 'id' when calling deleteSubscription(Async)");
        }
        
        
        com.squareup.okhttp.Call call = deleteSubscriptionCall(id, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Deletes the specified stat server subscription
     * 
     * @param id The id of the subscription to delete (required)
     * @return ModelApiResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ModelApiResponse deleteSubscription(String id) throws ApiException {
        ApiResponse resp = deleteSubscriptionWithHttpInfo(id);
        return resp.getData();
    }

    /**
     * Deletes the specified stat server subscription
     * 
     * @param id The id of the subscription to delete (required)
     * @return ApiResponse<ModelApiResponse>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse deleteSubscriptionWithHttpInfo(String id) throws ApiException {
        com.squareup.okhttp.Call call = deleteSubscriptionValidateBeforeCall(id, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Deletes the specified stat server subscription (asynchronously)
     * 
     * @param id The id of the subscription to delete (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 com.squareup.okhttp.Call deleteSubscriptionAsync(String id, 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);
                }
            };
        }

        com.squareup.okhttp.Call call = deleteSubscriptionValidateBeforeCall(id, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for getStatValue
     * @param statisticName name of statistic to be peeked (required)
     * @param objectId id of object for which statistic to be peeked (required)
     * @param objectType type of object for which statistic to be peeked (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 com.squareup.okhttp.Call getStatValueCall(String statisticName, String objectId, String objectType, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/statistic-values/{statisticName}"
            .replaceAll("\\{" + "statisticName" + "\\}", apiClient.escapeString(statisticName.toString()));

        List localVarQueryParams = new ArrayList();
        if (objectId != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "objectId", objectId));
        if (objectType != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "objectType", objectType));

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
                    com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] {  };
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call getStatValueValidateBeforeCall(String statisticName, String objectId, String objectType, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'statisticName' is set
        if (statisticName == null) {
            throw new ApiException("Missing the required parameter 'statisticName' when calling getStatValue(Async)");
        }
        
        // verify the required parameter 'objectId' is set
        if (objectId == null) {
            throw new ApiException("Missing the required parameter 'objectId' when calling getStatValue(Async)");
        }
        
        // verify the required parameter 'objectType' is set
        if (objectType == null) {
            throw new ApiException("Missing the required parameter 'objectType' when calling getStatValue(Async)");
        }
        
        
        com.squareup.okhttp.Call call = getStatValueCall(statisticName, objectId, objectType, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Peeks the value of specified statistic
     * 
     * @param statisticName name of statistic to be peeked (required)
     * @param objectId id of object for which statistic to be peeked (required)
     * @param objectType type of object for which statistic to be peeked (required)
     * @return PeekedStatisticResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public PeekedStatisticResponse getStatValue(String statisticName, String objectId, String objectType) throws ApiException {
        ApiResponse resp = getStatValueWithHttpInfo(statisticName, objectId, objectType);
        return resp.getData();
    }

    /**
     * Peeks the value of specified statistic
     * 
     * @param statisticName name of statistic to be peeked (required)
     * @param objectId id of object for which statistic to be peeked (required)
     * @param objectType type of object for which statistic to be peeked (required)
     * @return ApiResponse<PeekedStatisticResponse>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse getStatValueWithHttpInfo(String statisticName, String objectId, String objectType) throws ApiException {
        com.squareup.okhttp.Call call = getStatValueValidateBeforeCall(statisticName, objectId, objectType, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Peeks the value of specified statistic (asynchronously)
     * 
     * @param statisticName name of statistic to be peeked (required)
     * @param objectId id of object for which statistic to be peeked (required)
     * @param objectType type of object for which statistic to be peeked (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 com.squareup.okhttp.Call getStatValueAsync(String statisticName, String objectId, String objectType, 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);
                }
            };
        }

        com.squareup.okhttp.Call call = getStatValueValidateBeforeCall(statisticName, objectId, objectType, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for getStatValues
     * @param statistics A set of definitions for statistics which are to be peeked from stat server (required)
     * @param verbose verbose (optional, default to INFO)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public com.squareup.okhttp.Call getStatValuesCall(String statistics, String verbose, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = statistics;
        
        // create path and map variables
        String localVarPath = "/operations/get-statistic-ex";

        List localVarQueryParams = new ArrayList();
        if (verbose != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "verbose", verbose));

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
                    com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] {  };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call getStatValuesValidateBeforeCall(String statistics, String verbose, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'statistics' is set
        if (statistics == null) {
            throw new ApiException("Missing the required parameter 'statistics' when calling getStatValues(Async)");
        }
        
        
        com.squareup.okhttp.Call call = getStatValuesCall(statistics, verbose, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Peeks the values of specified statistics
     * 
     * @param statistics A set of definitions for statistics which are to be peeked from stat server (required)
     * @param verbose verbose (optional, default to INFO)
     * @return PeekedStatisticsResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public PeekedStatisticsResponse getStatValues(String statistics, String verbose) throws ApiException {
        ApiResponse resp = getStatValuesWithHttpInfo(statistics, verbose);
        return resp.getData();
    }

    /**
     * Peeks the values of specified statistics
     * 
     * @param statistics A set of definitions for statistics which are to be peeked from stat server (required)
     * @param verbose verbose (optional, default to INFO)
     * @return ApiResponse<PeekedStatisticsResponse>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse getStatValuesWithHttpInfo(String statistics, String verbose) throws ApiException {
        com.squareup.okhttp.Call call = getStatValuesValidateBeforeCall(statistics, verbose, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Peeks the values of specified statistics (asynchronously)
     * 
     * @param statistics A set of definitions for statistics which are to be peeked from stat server (required)
     * @param verbose verbose (optional, default to INFO)
     * @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 com.squareup.okhttp.Call getStatValuesAsync(String statistics, String verbose, 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);
                }
            };
        }

        com.squareup.okhttp.Call call = getStatValuesValidateBeforeCall(statistics, verbose, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for peekSubscriptionStats
     * @param id The id of the subscription to peek (required)
     * @param statisticIds The ids of the statistics to peek (optional)
     * @param verbose Verbose level for response (optional, default to INFO)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public com.squareup.okhttp.Call peekSubscriptionStatsCall(String id, String statisticIds, String verbose, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/subscriptions/{id}/statistic-values"
            .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));

        List localVarQueryParams = new ArrayList();
        if (statisticIds != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "statisticIds", statisticIds));
        if (verbose != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "verbose", verbose));

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
                    com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] {  };
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call peekSubscriptionStatsValidateBeforeCall(String id, String statisticIds, String verbose, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'id' is set
        if (id == null) {
            throw new ApiException("Missing the required parameter 'id' when calling peekSubscriptionStats(Async)");
        }
        
        
        com.squareup.okhttp.Call call = peekSubscriptionStatsCall(id, statisticIds, verbose, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Peeks the values of statistics opened inside the specified subscription
     * 
     * @param id The id of the subscription to peek (required)
     * @param statisticIds The ids of the statistics to peek (optional)
     * @param verbose Verbose level for response (optional, default to INFO)
     * @return StatisticDataResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public StatisticDataResponse peekSubscriptionStats(String id, String statisticIds, String verbose) throws ApiException {
        ApiResponse resp = peekSubscriptionStatsWithHttpInfo(id, statisticIds, verbose);
        return resp.getData();
    }

    /**
     * Peeks the values of statistics opened inside the specified subscription
     * 
     * @param id The id of the subscription to peek (required)
     * @param statisticIds The ids of the statistics to peek (optional)
     * @param verbose Verbose level for response (optional, default to INFO)
     * @return ApiResponse<StatisticDataResponse>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse peekSubscriptionStatsWithHttpInfo(String id, String statisticIds, String verbose) throws ApiException {
        com.squareup.okhttp.Call call = peekSubscriptionStatsValidateBeforeCall(id, statisticIds, verbose, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Peeks the values of statistics opened inside the specified subscription (asynchronously)
     * 
     * @param id The id of the subscription to peek (required)
     * @param statisticIds The ids of the statistics to peek (optional)
     * @param verbose Verbose level for response (optional, default to INFO)
     * @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 com.squareup.okhttp.Call peekSubscriptionStatsAsync(String id, String statisticIds, String verbose, 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);
                }
            };
        }

        com.squareup.okhttp.Call call = peekSubscriptionStatsValidateBeforeCall(id, statisticIds, verbose, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy