org.openapitools.client.api.ReportsApi Maven / Gradle / Ivy
The newest version!
/*
* Golden Service API
* An API that conforms to the standards and best practices that should be adhered to in all Mastercard owned APIs. Can be used to create subscriptions to reports that are generated twice daily (6am & 6pm) that deliver e-commerce spending across multiple sectors and locations.
--- * **All requests must be signed using oauth 1.0a. Please refer to: https://developer.mastercard.com/platform/documentation/using-oauth-1a-to-access-mastercard-apis/_** --- * **The user must provide their card details when creating a subscription. These details must be encrypted before entering transit. Please refer to [Mastercard security](https://stage.developer.mastercard.com/platform/documentation/securing-sensitive-data-using-payload-encryption/)** ---
*
* The version of the OpenAPI document: 1.1.0
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.api;
import org.openapitools.client.ApiCallback;
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.ApiResponse;
import org.openapitools.client.Configuration;
import org.openapitools.client.Pair;
import org.openapitools.client.ProgressRequestBody;
import org.openapitools.client.ProgressResponseBody;
import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import org.openapitools.client.model.Error;
import org.threeten.bp.LocalDate;
import org.openapitools.client.model.SectorSpending;
import org.openapitools.client.model.SpendingReport;
import org.openapitools.client.model.TopLocationsReport;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ReportsApi {
private ApiClient localVarApiClient;
public ReportsApi() {
this(Configuration.getDefaultApiClient());
}
public ReportsApi(ApiClient apiClient) {
this.localVarApiClient = apiClient;
}
public ApiClient getApiClient() {
return localVarApiClient;
}
public void setApiClient(ApiClient apiClient) {
this.localVarApiClient = apiClient;
}
/**
* Build call for getSpending
* @param date The date for the requested data (required)
* @param location The location for which you wish to receive the top-sectors report. (required)
* @param spendingType Used to distinguish between gross spending (GS) & average transaction value (ATV) (required)
* @param sector The sector for which you wish to receive reports. Sector ids can be retrieved from sectors call (optional)
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call getSpendingCall(LocalDate date, String location, String spendingType, Integer sector, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
String localVarPath = "/spending-reports";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
if (date != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("date", date));
}
if (sector != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("sector", sector));
}
if (location != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("location", location));
}
if (spendingType != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("spending_type", spendingType));
}
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
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[] { };
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call getSpendingValidateBeforeCall(LocalDate date, String location, String spendingType, Integer sector, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'date' is set
if (date == null) {
throw new ApiException("Missing the required parameter 'date' when calling getSpending(Async)");
}
// verify the required parameter 'location' is set
if (location == null) {
throw new ApiException("Missing the required parameter 'location' when calling getSpending(Async)");
}
// verify the required parameter 'spendingType' is set
if (spendingType == null) {
throw new ApiException("Missing the required parameter 'spendingType' when calling getSpending(Async)");
}
okhttp3.Call localVarCall = getSpendingCall(date, location, spendingType, sector, _callback);
return localVarCall;
}
/**
* Retrieves e-commerce spending for a particular location, sector and date range or single date
*
* @param date The date for the requested data (required)
* @param location The location for which you wish to receive the top-sectors report. (required)
* @param spendingType Used to distinguish between gross spending (GS) & average transaction value (ATV) (required)
* @param sector The sector for which you wish to receive reports. Sector ids can be retrieved from sectors call (optional)
* @return SpendingReport
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public SpendingReport getSpending(LocalDate date, String location, String spendingType, Integer sector) throws ApiException {
ApiResponse localVarResp = getSpendingWithHttpInfo(date, location, spendingType, sector);
return localVarResp.getData();
}
/**
* Retrieves e-commerce spending for a particular location, sector and date range or single date
*
* @param date The date for the requested data (required)
* @param location The location for which you wish to receive the top-sectors report. (required)
* @param spendingType Used to distinguish between gross spending (GS) & average transaction value (ATV) (required)
* @param sector The sector for which you wish to receive reports. Sector ids can be retrieved from sectors call (optional)
* @return ApiResponse<SpendingReport>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getSpendingWithHttpInfo(LocalDate date, String location, String spendingType, Integer sector) throws ApiException {
okhttp3.Call localVarCall = getSpendingValidateBeforeCall(date, location, spendingType, sector, null);
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
/**
* Retrieves e-commerce spending for a particular location, sector and date range or single date (asynchronously)
*
* @param date The date for the requested data (required)
* @param location The location for which you wish to receive the top-sectors report. (required)
* @param spendingType Used to distinguish between gross spending (GS) & average transaction value (ATV) (required)
* @param sector The sector for which you wish to receive reports. Sector ids can be retrieved from sectors call (optional)
* @param _callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public okhttp3.Call getSpendingAsync(LocalDate date, String location, String spendingType, Integer sector, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = getSpendingValidateBeforeCall(date, location, spendingType, sector, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for getTopLocations
* @param date The date for the requested data (required)
* @param spendingType Used to distinguish between gross spending (GS) & average transaction value (ATV) (required)
* @param sector The sector for which you wish to receive reports. Sector ids can be retrieved from sectors call (optional)
* @param limit Can be used to limit the amount of results returned from a query (Pagination) (optional)
* @param offset The number of items to offset the start of the list from (Pagination) (optional)
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call getTopLocationsCall(LocalDate date, String spendingType, Integer sector, Integer limit, Integer offset, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
String localVarPath = "/top-locations";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
if (date != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("date", date));
}
if (sector != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("sector", sector));
}
if (spendingType != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("spending_type", spendingType));
}
if (limit != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit));
}
if (offset != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset));
}
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
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[] { };
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call getTopLocationsValidateBeforeCall(LocalDate date, String spendingType, Integer sector, Integer limit, Integer offset, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'date' is set
if (date == null) {
throw new ApiException("Missing the required parameter 'date' when calling getTopLocations(Async)");
}
// verify the required parameter 'spendingType' is set
if (spendingType == null) {
throw new ApiException("Missing the required parameter 'spendingType' when calling getTopLocations(Async)");
}
okhttp3.Call localVarCall = getTopLocationsCall(date, spendingType, sector, limit, offset, _callback);
return localVarCall;
}
/**
* Retrieves the top grossing locations for the specified date/sector/spending type
*
* @param date The date for the requested data (required)
* @param spendingType Used to distinguish between gross spending (GS) & average transaction value (ATV) (required)
* @param sector The sector for which you wish to receive reports. Sector ids can be retrieved from sectors call (optional)
* @param limit Can be used to limit the amount of results returned from a query (Pagination) (optional)
* @param offset The number of items to offset the start of the list from (Pagination) (optional)
* @return TopLocationsReport
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public TopLocationsReport getTopLocations(LocalDate date, String spendingType, Integer sector, Integer limit, Integer offset) throws ApiException {
ApiResponse localVarResp = getTopLocationsWithHttpInfo(date, spendingType, sector, limit, offset);
return localVarResp.getData();
}
/**
* Retrieves the top grossing locations for the specified date/sector/spending type
*
* @param date The date for the requested data (required)
* @param spendingType Used to distinguish between gross spending (GS) & average transaction value (ATV) (required)
* @param sector The sector for which you wish to receive reports. Sector ids can be retrieved from sectors call (optional)
* @param limit Can be used to limit the amount of results returned from a query (Pagination) (optional)
* @param offset The number of items to offset the start of the list from (Pagination) (optional)
* @return ApiResponse<TopLocationsReport>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getTopLocationsWithHttpInfo(LocalDate date, String spendingType, Integer sector, Integer limit, Integer offset) throws ApiException {
okhttp3.Call localVarCall = getTopLocationsValidateBeforeCall(date, spendingType, sector, limit, offset, null);
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
/**
* Retrieves the top grossing locations for the specified date/sector/spending type (asynchronously)
*
* @param date The date for the requested data (required)
* @param spendingType Used to distinguish between gross spending (GS) & average transaction value (ATV) (required)
* @param sector The sector for which you wish to receive reports. Sector ids can be retrieved from sectors call (optional)
* @param limit Can be used to limit the amount of results returned from a query (Pagination) (optional)
* @param offset The number of items to offset the start of the list from (Pagination) (optional)
* @param _callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public okhttp3.Call getTopLocationsAsync(LocalDate date, String spendingType, Integer sector, Integer limit, Integer offset, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = getTopLocationsValidateBeforeCall(date, spendingType, sector, limit, offset, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for getTopSectors
* @param date The date for the requested data (required)
* @param location The location for which you wish to receive the top-sectors report. (required)
* @param spendingType Used to distinguish between gross spending (GS) & average transaction value (ATV) (required)
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call getTopSectorsCall(LocalDate date, String location, String spendingType, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
String localVarPath = "/top-sectors";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
if (date != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("date", date));
}
if (location != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("location", location));
}
if (spendingType != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("spending_type", spendingType));
}
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
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[] { };
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call getTopSectorsValidateBeforeCall(LocalDate date, String location, String spendingType, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'date' is set
if (date == null) {
throw new ApiException("Missing the required parameter 'date' when calling getTopSectors(Async)");
}
// verify the required parameter 'location' is set
if (location == null) {
throw new ApiException("Missing the required parameter 'location' when calling getTopSectors(Async)");
}
// verify the required parameter 'spendingType' is set
if (spendingType == null) {
throw new ApiException("Missing the required parameter 'spendingType' when calling getTopSectors(Async)");
}
okhttp3.Call localVarCall = getTopSectorsCall(date, location, spendingType, _callback);
return localVarCall;
}
/**
* Retrieves the top grossing sectors for the specified date & location
*
* @param date The date for the requested data (required)
* @param location The location for which you wish to receive the top-sectors report. (required)
* @param spendingType Used to distinguish between gross spending (GS) & average transaction value (ATV) (required)
* @return List<List>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public List getTopSectors(LocalDate date, String location, String spendingType) throws ApiException {
ApiResponse> localVarResp = getTopSectorsWithHttpInfo(date, location, spendingType);
return localVarResp.getData();
}
/**
* Retrieves the top grossing sectors for the specified date & location
*
* @param date The date for the requested data (required)
* @param location The location for which you wish to receive the top-sectors report. (required)
* @param spendingType Used to distinguish between gross spending (GS) & average transaction value (ATV) (required)
* @return ApiResponse<List<List>>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse> getTopSectorsWithHttpInfo(LocalDate date, String location, String spendingType) throws ApiException {
okhttp3.Call localVarCall = getTopSectorsValidateBeforeCall(date, location, spendingType, null);
Type localVarReturnType = new TypeToken>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
/**
* Retrieves the top grossing sectors for the specified date & location (asynchronously)
*
* @param date The date for the requested data (required)
* @param location The location for which you wish to receive the top-sectors report. (required)
* @param spendingType Used to distinguish between gross spending (GS) & average transaction value (ATV) (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 okhttp3.Call getTopSectorsAsync(LocalDate date, String location, String spendingType, final ApiCallback> _callback) throws ApiException {
okhttp3.Call localVarCall = getTopSectorsValidateBeforeCall(date, location, spendingType, _callback);
Type localVarReturnType = new TypeToken>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
}