org.openapitools.client.api.SectorApi 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.Sector;
import org.openapitools.client.model.SectorSpending;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class SectorApi {
private ApiClient localVarApiClient;
public SectorApi() {
this(Configuration.getDefaultApiClient());
}
public SectorApi(ApiClient apiClient) {
this.localVarApiClient = apiClient;
}
public ApiClient getApiClient() {
return localVarApiClient;
}
public void setApiClient(ApiClient apiClient) {
this.localVarApiClient = apiClient;
}
/**
* Build call for getSectors
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call getSectorsCall(final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
String localVarPath = "/sectors";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
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 getSectorsValidateBeforeCall(final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = getSectorsCall(_callback);
return localVarCall;
}
/**
* Returns the valid sectors which can be passed to various other endpoints in the sector field
*
* @return List<Sector>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public List getSectors() throws ApiException {
ApiResponse> localVarResp = getSectorsWithHttpInfo();
return localVarResp.getData();
}
/**
* Returns the valid sectors which can be passed to various other endpoints in the sector field
*
* @return ApiResponse<List<Sector>>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse> getSectorsWithHttpInfo() throws ApiException {
okhttp3.Call localVarCall = getSectorsValidateBeforeCall(null);
Type localVarReturnType = new TypeToken>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
/**
* Returns the valid sectors which can be passed to various other endpoints in the sector field (asynchronously)
*
* @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 getSectorsAsync(final ApiCallback> _callback) throws ApiException {
okhttp3.Call localVarCall = getSectorsValidateBeforeCall(_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;
}
}