![JAR search and dependency download from the Maven repository](/logo.png)
Api.SecureFileShareApi Maven / Gradle / Ivy
/*
* CyberSource Merged Spec
* All CyberSource API specs merged together. These are available at https://developer.cybersource.com/api/reference/api-reference.html
*
* OpenAPI spec version: 0.0.1
*
*
* 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 Api;
import Invokers.ApiCallback;
import Invokers.ApiClient;
import Invokers.ApiException;
import Invokers.ApiResponse;
import Invokers.Configuration;
import Invokers.Pair;
import Invokers.ProgressRequestBody;
import Invokers.ProgressResponseBody;
import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import java.io.InputStream;
import Model.InlineResponse4004;
import org.joda.time.LocalDate;
import Model.V1FileDetailsGet200Response;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import utilities.tracking.SdkTracker;
public class SecureFileShareApi {
private static Logger logger = LogManager.getLogger(SecureFileShareApi.class);
private ApiClient apiClient;
public SecureFileShareApi() {
this(Configuration.getDefaultApiClient());
}
public SecureFileShareApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Build call for getFile
* @param fileId Unique identifier for each file (required)
* @param organizationId Valid Cybersource Organization Id (optional)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call getFileCall(String fileId, String organizationId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
SdkTracker sdkTracker = new SdkTracker();
Object localVarPostBody = null;
if ("GET".equalsIgnoreCase("POST")) {
localVarPostBody = "{}";
}
// create path and map variables
String localVarPath = "/sfs/v1/files/{fileId}"
.replaceAll("\\{" + "fileId" + "\\}", apiClient.escapeString(fileId.toString()));
List localVarQueryParams = new ArrayList();
if (organizationId != null)
localVarQueryParams.addAll(apiClient.parameterToPairs("", "organizationId", organizationId));
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/xml", "text/csv", "application/pdf"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"*/*;charset=utf-8"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.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 okhttp3.Call getFileValidateBeforeCall(String fileId, String organizationId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'fileId' is set
if (fileId == null) {
logger.error("Missing the required parameter 'fileId' when calling getFile(Async)");
throw new ApiException("Missing the required parameter 'fileId' when calling getFile(Async)");
}
okhttp3.Call call = getFileCall(fileId, organizationId, progressListener, progressRequestListener);
return call;
}
/**
* Download a File with File Identifier
* Download a file for the given file identifier
* @param fileId Unique identifier for each file (required)
* @param organizationId Valid Cybersource Organization Id (optional)
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void getFile(String fileId, String organizationId) throws ApiException {
logger.info("CALL TO METHOD 'getFile' STARTED");
this.apiClient.setComputationStartTime(System.nanoTime());
getFileWithHttpInfo(fileId, organizationId);
}
/**
* Download a File with File Identifier
* Download a file for the given file identifier
* @param fileId Unique identifier for each file (required)
* @param organizationId Valid Cybersource Organization Id (optional)
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getFileWithHttpInfo(String fileId, String organizationId) throws ApiException {
okhttp3.Call call = getFileValidateBeforeCall(fileId, organizationId, null, null);
return apiClient.execute(call);
}
/**
* Download a File with File Identifier (asynchronously)
* Download a file for the given file identifier
* @param fileId Unique identifier for each file (required)
* @param organizationId Valid Cybersource Organization Id (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 getFileAsync(String fileId, String organizationId, final ApiCallback callback) throws ApiException {
this.apiClient.setComputationStartTime(System.nanoTime());
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);
}
};
}
okhttp3.Call call = getFileValidateBeforeCall(fileId, organizationId, progressListener, progressRequestListener);
apiClient.executeAsync(call, callback);
return call;
}
/**
* Build call for getFileDetail
* @param startDate Valid start date in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd (required)
* @param endDate Valid end date in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd (required)
* @param organizationId Valid Cybersource Organization Id (optional)
* @param name **Tailored to searches for specific files with in given Date range** example : MyTransactionDetailreport.xml (optional)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call getFileDetailCall(LocalDate startDate, LocalDate endDate, String organizationId, String name, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
SdkTracker sdkTracker = new SdkTracker();
Object localVarPostBody = null;
if ("GET".equalsIgnoreCase("POST")) {
localVarPostBody = "{}";
}
// create path and map variables
String localVarPath = "/sfs/v1/file-details";
List localVarQueryParams = new ArrayList();
if (startDate != null)
localVarQueryParams.addAll(apiClient.parameterToPairs("", "startDate", startDate));
if (endDate != null)
localVarQueryParams.addAll(apiClient.parameterToPairs("", "endDate", endDate));
if (organizationId != null)
localVarQueryParams.addAll(apiClient.parameterToPairs("", "organizationId", organizationId));
if (name != null)
localVarQueryParams.addAll(apiClient.parameterToPairs("", "name", name));
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/hal+json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"*/*;charset=utf-8"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.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 okhttp3.Call getFileDetailValidateBeforeCall(LocalDate startDate, LocalDate endDate, String organizationId, String name, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'startDate' is set
if (startDate == null) {
logger.error("Missing the required parameter 'startDate' when calling getFileDetail(Async)");
throw new ApiException("Missing the required parameter 'startDate' when calling getFileDetail(Async)");
}
// verify the required parameter 'endDate' is set
if (endDate == null) {
logger.error("Missing the required parameter 'endDate' when calling getFileDetail(Async)");
throw new ApiException("Missing the required parameter 'endDate' when calling getFileDetail(Async)");
}
okhttp3.Call call = getFileDetailCall(startDate, endDate, organizationId, name, progressListener, progressRequestListener);
return call;
}
/**
* Get List of Files
* Get list of files and it's information of them available inside the report directory
* @param startDate Valid start date in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd (required)
* @param endDate Valid end date in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd (required)
* @param organizationId Valid Cybersource Organization Id (optional)
* @param name **Tailored to searches for specific files with in given Date range** example : MyTransactionDetailreport.xml (optional)
* @return V1FileDetailsGet200Response
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public V1FileDetailsGet200Response getFileDetail(LocalDate startDate, LocalDate endDate, String organizationId, String name) throws ApiException {
logger.info("CALL TO METHOD 'getFileDetail' STARTED");
this.apiClient.setComputationStartTime(System.nanoTime());
ApiResponse resp = getFileDetailWithHttpInfo(startDate, endDate, organizationId, name);
logger.info("CALL TO METHOD 'getFileDetail' ENDED");
return resp.getData();
}
/**
* Get List of Files
* Get list of files and it's information of them available inside the report directory
* @param startDate Valid start date in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd (required)
* @param endDate Valid end date in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd (required)
* @param organizationId Valid Cybersource Organization Id (optional)
* @param name **Tailored to searches for specific files with in given Date range** example : MyTransactionDetailreport.xml (optional)
* @return ApiResponse<V1FileDetailsGet200Response>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getFileDetailWithHttpInfo(LocalDate startDate, LocalDate endDate, String organizationId, String name) throws ApiException {
okhttp3.Call call = getFileDetailValidateBeforeCall(startDate, endDate, organizationId, name, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Get List of Files (asynchronously)
* Get list of files and it's information of them available inside the report directory
* @param startDate Valid start date in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd (required)
* @param endDate Valid end date in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd (required)
* @param organizationId Valid Cybersource Organization Id (optional)
* @param name **Tailored to searches for specific files with in given Date range** example : MyTransactionDetailreport.xml (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 getFileDetailAsync(LocalDate startDate, LocalDate endDate, String organizationId, String name, final ApiCallback callback) throws ApiException {
this.apiClient.setComputationStartTime(System.nanoTime());
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);
}
};
}
okhttp3.Call call = getFileDetailValidateBeforeCall(startDate, endDate, organizationId, name, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy