Java tutorial
/** * Onfido API * The Onfido API is used to submit check requests. * * OpenAPI spec version: 2.0.0 * * * 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. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.onfido.api; import com.onfido.ApiCallback; import com.onfido.ApiClient; import com.onfido.ApiException; import com.onfido.ApiResponse; import com.onfido.Configuration; import com.onfido.Pair; import com.onfido.ProgressRequestBody; import com.onfido.ProgressResponseBody; import com.google.gson.reflect.TypeToken; import java.io.IOException; import com.onfido.models.Error; import com.onfido.models.Applicant; import com.onfido.models.Check; import com.onfido.models.CheckCreationRequest; import com.onfido.models.Webhook; import java.io.File; import com.onfido.models.GenericAddressesList; import com.onfido.models.Document; import com.onfido.models.LivePhoto; import com.onfido.models.Report; import com.onfido.models.ReportTypeGroup; import com.onfido.models.ApplicantsList; import com.onfido.models.ChecksList; import com.onfido.models.DocumentsList; import com.onfido.models.LivePhotosList; import com.onfido.models.ReportTypeGroupsList; import com.onfido.models.ReportsList; import com.onfido.models.WebhooksList; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class DefaultApi { private ApiClient apiClient; public DefaultApi() { this(Configuration.getDefaultApiClient()); } public DefaultApi(ApiClient apiClient) { this.apiClient = apiClient; } public ApiClient getApiClient() { return apiClient; } public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } /* Build call for cancelReport */ private com.squareup.okhttp.Call cancelReportCall(String checkId, String reportId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'checkId' is set if (checkId == null) { throw new ApiException("Missing the required parameter 'checkId' when calling cancelReport(Async)"); } // verify the required parameter 'reportId' is set if (reportId == null) { throw new ApiException("Missing the required parameter 'reportId' when calling cancelReport(Async)"); } // create path and map variables String localVarPath = "/checks/{check_id}/reports/{report_id}/cancel".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "check_id" + "\\}", apiClient.escapeString(checkId.toString())) .replaceAll("\\{" + "report_id" + "\\}", apiClient.escapeString(reportId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; 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[] { "Token" }; return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * This endpoint is for cancelling individual paused reports. * * @param checkId (required) * @param reportId (required) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public void cancelReport(String checkId, String reportId) throws ApiException { cancelReportWithHttpInfo(checkId, reportId); } /** * This endpoint is for cancelling individual paused reports. * * @param checkId (required) * @param reportId (required) * @return ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<Void> cancelReportWithHttpInfo(String checkId, String reportId) throws ApiException { com.squareup.okhttp.Call call = cancelReportCall(checkId, reportId, null, null); return apiClient.execute(call); } /** * This endpoint is for cancelling individual paused reports. (asynchronously) * * @param checkId (required) * @param reportId (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 cancelReportAsync(String checkId, String reportId, final ApiCallback<Void> 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 = cancelReportCall(checkId, reportId, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } /* Build call for createApplicant */ private com.squareup.okhttp.Call createApplicantCall(Applicant data, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = data; // create path and map variables String localVarPath = "/applicants".replaceAll("\\{format\\}", "json"); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; 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[] { "Token" }; return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * Create Applicant * * @param data (optional) * @return Applicant * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public Applicant createApplicant(Applicant data) throws ApiException { ApiResponse<Applicant> resp = createApplicantWithHttpInfo(data); return resp.getData(); } /** * Create Applicant * * @param data (optional) * @return ApiResponse<Applicant> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<Applicant> createApplicantWithHttpInfo(Applicant data) throws ApiException { com.squareup.okhttp.Call call = createApplicantCall(data, null, null); Type localVarReturnType = new TypeToken<Applicant>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * Create Applicant (asynchronously) * * @param data (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 com.squareup.okhttp.Call createApplicantAsync(Applicant data, final ApiCallback<Applicant> 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 = createApplicantCall(data, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<Applicant>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for createCheck */ private com.squareup.okhttp.Call createCheckCall(String applicantId, CheckCreationRequest data, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = data; // verify the required parameter 'applicantId' is set if (applicantId == null) { throw new ApiException("Missing the required parameter 'applicantId' when calling createCheck(Async)"); } // create path and map variables String localVarPath = "/applicants/{applicant_id}/checks".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "applicant_id" + "\\}", apiClient.escapeString(applicantId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; 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[] { "Token" }; return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * Create a check * * @param applicantId (required) * @param data (optional) * @return Check * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public Check createCheck(String applicantId, CheckCreationRequest data) throws ApiException { ApiResponse<Check> resp = createCheckWithHttpInfo(applicantId, data); return resp.getData(); } /** * Create a check * * @param applicantId (required) * @param data (optional) * @return ApiResponse<Check> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<Check> createCheckWithHttpInfo(String applicantId, CheckCreationRequest data) throws ApiException { com.squareup.okhttp.Call call = createCheckCall(applicantId, data, null, null); Type localVarReturnType = new TypeToken<Check>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * Create a check (asynchronously) * * @param applicantId (required) * @param data (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 com.squareup.okhttp.Call createCheckAsync(String applicantId, CheckCreationRequest data, final ApiCallback<Check> 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 = createCheckCall(applicantId, data, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<Check>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for createWebhook */ private com.squareup.okhttp.Call createWebhookCall(Webhook data, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = data; // create path and map variables String localVarPath = "/webhooks".replaceAll("\\{format\\}", "json"); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; 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[] { "Token" }; return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * Create a webhook * * @param data (optional) * @return Webhook * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public Webhook createWebhook(Webhook data) throws ApiException { ApiResponse<Webhook> resp = createWebhookWithHttpInfo(data); return resp.getData(); } /** * Create a webhook * * @param data (optional) * @return ApiResponse<Webhook> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<Webhook> createWebhookWithHttpInfo(Webhook data) throws ApiException { com.squareup.okhttp.Call call = createWebhookCall(data, null, null); Type localVarReturnType = new TypeToken<Webhook>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * Create a webhook (asynchronously) * * @param data (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 com.squareup.okhttp.Call createWebhookAsync(Webhook data, final ApiCallback<Webhook> 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 = createWebhookCall(data, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<Webhook>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for destroyApplicant */ private com.squareup.okhttp.Call destroyApplicantCall(String applicantId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'applicantId' is set if (applicantId == null) { throw new ApiException( "Missing the required parameter 'applicantId' when calling destroyApplicant(Async)"); } // create path and map variables String localVarPath = "/applicants/{applicant_id}".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "applicant_id" + "\\}", apiClient.escapeString(applicantId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; 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[] { "Token" }; return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * Delete Applicant * * @param applicantId (required) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public void destroyApplicant(String applicantId) throws ApiException { destroyApplicantWithHttpInfo(applicantId); } /** * Delete Applicant * * @param applicantId (required) * @return ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<Void> destroyApplicantWithHttpInfo(String applicantId) throws ApiException { com.squareup.okhttp.Call call = destroyApplicantCall(applicantId, null, null); return apiClient.execute(call); } /** * Delete Applicant (asynchronously) * * @param applicantId (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 destroyApplicantAsync(String applicantId, final ApiCallback<Void> 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 = destroyApplicantCall(applicantId, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } /* Build call for downloadDocument */ private com.squareup.okhttp.Call downloadDocumentCall(String applicantId, String documentId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'applicantId' is set if (applicantId == null) { throw new ApiException( "Missing the required parameter 'applicantId' when calling downloadDocument(Async)"); } // verify the required parameter 'documentId' is set if (documentId == null) { throw new ApiException( "Missing the required parameter 'documentId' when calling downloadDocument(Async)"); } // create path and map variables String localVarPath = "/applicants/{applicant_id}/documents/{document_id}/download" .replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "applicant_id" + "\\}", apiClient.escapeString(applicantId.toString())) .replaceAll("\\{" + "document_id" + "\\}", apiClient.escapeString(documentId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "image/png", "image/jpeg", "applicant/pdf" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; 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[] { "Token" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * Download a documents raw data * * @param applicantId (required) * @param documentId (required) * @return File * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public File downloadDocument(String applicantId, String documentId) throws ApiException { ApiResponse<File> resp = downloadDocumentWithHttpInfo(applicantId, documentId); return resp.getData(); } /** * Download a documents raw data * * @param applicantId (required) * @param documentId (required) * @return ApiResponse<File> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<File> downloadDocumentWithHttpInfo(String applicantId, String documentId) throws ApiException { com.squareup.okhttp.Call call = downloadDocumentCall(applicantId, documentId, null, null); Type localVarReturnType = new TypeToken<File>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * Download a documents raw data (asynchronously) * * @param applicantId (required) * @param documentId (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 downloadDocumentAsync(String applicantId, String documentId, final ApiCallback<File> 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 = downloadDocumentCall(applicantId, documentId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<File>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for downloadLivePhoto */ private com.squareup.okhttp.Call downloadLivePhotoCall(String livePhotoId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'livePhotoId' is set if (livePhotoId == null) { throw new ApiException( "Missing the required parameter 'livePhotoId' when calling downloadLivePhoto(Async)"); } // create path and map variables String localVarPath = "/live_photos/{live_photo_id}/download".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "live_photo_id" + "\\}", apiClient.escapeString(livePhotoId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; 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[] { "Token" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * Download live photo * Live photos are downloaded using this endpoint. * @param livePhotoId The live photos unique identifier. (required) * @return File * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public File downloadLivePhoto(String livePhotoId) throws ApiException { ApiResponse<File> resp = downloadLivePhotoWithHttpInfo(livePhotoId); return resp.getData(); } /** * Download live photo * Live photos are downloaded using this endpoint. * @param livePhotoId The live photos unique identifier. (required) * @return ApiResponse<File> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<File> downloadLivePhotoWithHttpInfo(String livePhotoId) throws ApiException { com.squareup.okhttp.Call call = downloadLivePhotoCall(livePhotoId, null, null); Type localVarReturnType = new TypeToken<File>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * Download live photo (asynchronously) * Live photos are downloaded using this endpoint. * @param livePhotoId The live photos unique identifier. (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 downloadLivePhotoAsync(String livePhotoId, final ApiCallback<File> 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 = downloadLivePhotoCall(livePhotoId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<File>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for findAddresses */ private com.squareup.okhttp.Call findAddressesCall(String postcode, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'postcode' is set if (postcode == null) { throw new ApiException("Missing the required parameter 'postcode' when calling findAddresses(Async)"); } // create path and map variables String localVarPath = "/addresses/pick".replaceAll("\\{format\\}", "json"); List<Pair> localVarQueryParams = new ArrayList<Pair>(); if (postcode != null) localVarQueryParams.addAll(apiClient.parameterToPairs("", "postcode", postcode)); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; 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[] { "Token" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * Search for addresses by postcode * * @param postcode (required) * @return GenericAddressesList * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public GenericAddressesList findAddresses(String postcode) throws ApiException { ApiResponse<GenericAddressesList> resp = findAddressesWithHttpInfo(postcode); return resp.getData(); } /** * Search for addresses by postcode * * @param postcode (required) * @return ApiResponse<GenericAddressesList> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<GenericAddressesList> findAddressesWithHttpInfo(String postcode) throws ApiException { com.squareup.okhttp.Call call = findAddressesCall(postcode, null, null); Type localVarReturnType = new TypeToken<GenericAddressesList>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * Search for addresses by postcode (asynchronously) * * @param postcode (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 findAddressesAsync(String postcode, final ApiCallback<GenericAddressesList> 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 = findAddressesCall(postcode, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<GenericAddressesList>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for findApplicant */ private com.squareup.okhttp.Call findApplicantCall(String applicantId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'applicantId' is set if (applicantId == null) { throw new ApiException( "Missing the required parameter 'applicantId' when calling findApplicant(Async)"); } // create path and map variables String localVarPath = "/applicants/{applicant_id}".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "applicant_id" + "\\}", apiClient.escapeString(applicantId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; 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[] { "Token" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * Retrieve Applicant * * @param applicantId (required) * @return Applicant * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public Applicant findApplicant(String applicantId) throws ApiException { ApiResponse<Applicant> resp = findApplicantWithHttpInfo(applicantId); return resp.getData(); } /** * Retrieve Applicant * * @param applicantId (required) * @return ApiResponse<Applicant> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<Applicant> findApplicantWithHttpInfo(String applicantId) throws ApiException { com.squareup.okhttp.Call call = findApplicantCall(applicantId, null, null); Type localVarReturnType = new TypeToken<Applicant>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * Retrieve Applicant (asynchronously) * * @param applicantId (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 findApplicantAsync(String applicantId, final ApiCallback<Applicant> 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 = findApplicantCall(applicantId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<Applicant>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for findCheck */ private com.squareup.okhttp.Call findCheckCall(String applicantId, String checkId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'applicantId' is set if (applicantId == null) { throw new ApiException("Missing the required parameter 'applicantId' when calling findCheck(Async)"); } // verify the required parameter 'checkId' is set if (checkId == null) { throw new ApiException("Missing the required parameter 'checkId' when calling findCheck(Async)"); } // create path and map variables String localVarPath = "/applicants/{applicant_id}/checks/{check_id}".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "applicant_id" + "\\}", apiClient.escapeString(applicantId.toString())) .replaceAll("\\{" + "check_id" + "\\}", apiClient.escapeString(checkId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; 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[] { "Token" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * Retrieve a Check * * @param applicantId (required) * @param checkId (required) * @return Check * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public Check findCheck(String applicantId, String checkId) throws ApiException { ApiResponse<Check> resp = findCheckWithHttpInfo(applicantId, checkId); return resp.getData(); } /** * Retrieve a Check * * @param applicantId (required) * @param checkId (required) * @return ApiResponse<Check> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<Check> findCheckWithHttpInfo(String applicantId, String checkId) throws ApiException { com.squareup.okhttp.Call call = findCheckCall(applicantId, checkId, null, null); Type localVarReturnType = new TypeToken<Check>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * Retrieve a Check (asynchronously) * * @param applicantId (required) * @param checkId (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 findCheckAsync(String applicantId, String checkId, final ApiCallback<Check> 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 = findCheckCall(applicantId, checkId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<Check>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for findDocument */ private com.squareup.okhttp.Call findDocumentCall(String applicantId, String documentId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'applicantId' is set if (applicantId == null) { throw new ApiException("Missing the required parameter 'applicantId' when calling findDocument(Async)"); } // verify the required parameter 'documentId' is set if (documentId == null) { throw new ApiException("Missing the required parameter 'documentId' when calling findDocument(Async)"); } // create path and map variables String localVarPath = "/applicants/{applicant_id}/documents/{document_id}" .replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "applicant_id" + "\\}", apiClient.escapeString(applicantId.toString())) .replaceAll("\\{" + "document_id" + "\\}", apiClient.escapeString(documentId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; 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[] { "Token" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * A single document can be retrieved by calling this endpoint with the documents unique identifier. * * @param applicantId (required) * @param documentId (required) * @return Document * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public Document findDocument(String applicantId, String documentId) throws ApiException { ApiResponse<Document> resp = findDocumentWithHttpInfo(applicantId, documentId); return resp.getData(); } /** * A single document can be retrieved by calling this endpoint with the documents unique identifier. * * @param applicantId (required) * @param documentId (required) * @return ApiResponse<Document> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<Document> findDocumentWithHttpInfo(String applicantId, String documentId) throws ApiException { com.squareup.okhttp.Call call = findDocumentCall(applicantId, documentId, null, null); Type localVarReturnType = new TypeToken<Document>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * A single document can be retrieved by calling this endpoint with the documents unique identifier. (asynchronously) * * @param applicantId (required) * @param documentId (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 findDocumentAsync(String applicantId, String documentId, final ApiCallback<Document> 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 = findDocumentCall(applicantId, documentId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<Document>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for findLivePhoto */ private com.squareup.okhttp.Call findLivePhotoCall(String livePhotoId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'livePhotoId' is set if (livePhotoId == null) { throw new ApiException( "Missing the required parameter 'livePhotoId' when calling findLivePhoto(Async)"); } // create path and map variables String localVarPath = "/live_photos/{live_photo_id}".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "live_photo_id" + "\\}", apiClient.escapeString(livePhotoId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; 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[] { "Token" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * Retrieve live photo * * @param livePhotoId The live photos unique identifier. (required) * @return LivePhoto * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public LivePhoto findLivePhoto(String livePhotoId) throws ApiException { ApiResponse<LivePhoto> resp = findLivePhotoWithHttpInfo(livePhotoId); return resp.getData(); } /** * Retrieve live photo * * @param livePhotoId The live photos unique identifier. (required) * @return ApiResponse<LivePhoto> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<LivePhoto> findLivePhotoWithHttpInfo(String livePhotoId) throws ApiException { com.squareup.okhttp.Call call = findLivePhotoCall(livePhotoId, null, null); Type localVarReturnType = new TypeToken<LivePhoto>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * Retrieve live photo (asynchronously) * * @param livePhotoId The live photos unique identifier. (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 findLivePhotoAsync(String livePhotoId, final ApiCallback<LivePhoto> 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 = findLivePhotoCall(livePhotoId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<LivePhoto>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for findReport */ private com.squareup.okhttp.Call findReportCall(String checkId, String reportId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'checkId' is set if (checkId == null) { throw new ApiException("Missing the required parameter 'checkId' when calling findReport(Async)"); } // verify the required parameter 'reportId' is set if (reportId == null) { throw new ApiException("Missing the required parameter 'reportId' when calling findReport(Async)"); } // create path and map variables String localVarPath = "/checks/{check_id}/reports/{report_id}".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "check_id" + "\\}", apiClient.escapeString(checkId.toString())) .replaceAll("\\{" + "report_id" + "\\}", apiClient.escapeString(reportId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; 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[] { "Token" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * A single report can be retrieved using this endpoint with the corresponding unique identifier. * * @param checkId (required) * @param reportId (required) * @return Report * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public Report findReport(String checkId, String reportId) throws ApiException { ApiResponse<Report> resp = findReportWithHttpInfo(checkId, reportId); return resp.getData(); } /** * A single report can be retrieved using this endpoint with the corresponding unique identifier. * * @param checkId (required) * @param reportId (required) * @return ApiResponse<Report> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<Report> findReportWithHttpInfo(String checkId, String reportId) throws ApiException { com.squareup.okhttp.Call call = findReportCall(checkId, reportId, null, null); Type localVarReturnType = new TypeToken<Report>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * A single report can be retrieved using this endpoint with the corresponding unique identifier. (asynchronously) * * @param checkId (required) * @param reportId (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 findReportAsync(String checkId, String reportId, final ApiCallback<Report> 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 = findReportCall(checkId, reportId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<Report>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for findReportTypeGroup */ private com.squareup.okhttp.Call findReportTypeGroupCall(String reportTypeGroupId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'reportTypeGroupId' is set if (reportTypeGroupId == null) { throw new ApiException( "Missing the required parameter 'reportTypeGroupId' when calling findReportTypeGroup(Async)"); } // create path and map variables String localVarPath = "/report_type_groups/{report_type_group_id}".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "report_type_group_id" + "\\}", apiClient.escapeString(reportTypeGroupId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; 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[] { "Token" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * Retrieve single report type group object * * @param reportTypeGroupId (required) * @return ReportTypeGroup * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ReportTypeGroup findReportTypeGroup(String reportTypeGroupId) throws ApiException { ApiResponse<ReportTypeGroup> resp = findReportTypeGroupWithHttpInfo(reportTypeGroupId); return resp.getData(); } /** * Retrieve single report type group object * * @param reportTypeGroupId (required) * @return ApiResponse<ReportTypeGroup> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<ReportTypeGroup> findReportTypeGroupWithHttpInfo(String reportTypeGroupId) throws ApiException { com.squareup.okhttp.Call call = findReportTypeGroupCall(reportTypeGroupId, null, null); Type localVarReturnType = new TypeToken<ReportTypeGroup>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * Retrieve single report type group object (asynchronously) * * @param reportTypeGroupId (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 findReportTypeGroupAsync(String reportTypeGroupId, final ApiCallback<ReportTypeGroup> 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 = findReportTypeGroupCall(reportTypeGroupId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<ReportTypeGroup>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for findWebhook */ private com.squareup.okhttp.Call findWebhookCall(String webhookId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'webhookId' is set if (webhookId == null) { throw new ApiException("Missing the required parameter 'webhookId' when calling findWebhook(Async)"); } // create path and map variables String localVarPath = "/webhooks/{webhook_id}".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "webhook_id" + "\\}", apiClient.escapeString(webhookId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; 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[] { "Token" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * Retrieve a Webhook * * @param webhookId (required) * @return Webhook * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public Webhook findWebhook(String webhookId) throws ApiException { ApiResponse<Webhook> resp = findWebhookWithHttpInfo(webhookId); return resp.getData(); } /** * Retrieve a Webhook * * @param webhookId (required) * @return ApiResponse<Webhook> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<Webhook> findWebhookWithHttpInfo(String webhookId) throws ApiException { com.squareup.okhttp.Call call = findWebhookCall(webhookId, null, null); Type localVarReturnType = new TypeToken<Webhook>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * Retrieve a Webhook (asynchronously) * * @param webhookId (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 findWebhookAsync(String webhookId, final ApiCallback<Webhook> 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 = findWebhookCall(webhookId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<Webhook>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for listApplicants */ private com.squareup.okhttp.Call listApplicantsCall(String page, String perPage, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/applicants".replaceAll("\\{format\\}", "json"); List<Pair> localVarQueryParams = new ArrayList<Pair>(); if (page != null) localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); if (perPage != null) localVarQueryParams.addAll(apiClient.parameterToPairs("", "per_page", perPage)); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; 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[] { "Token" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * List Applicants * * @param page The page to return. Defaults to the first page if omitted. The first page is `page=1` (optional) * @param perPage The number of objects per page. Defaults to 20 if omitted. (optional) * @return ApplicantsList * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApplicantsList listApplicants(String page, String perPage) throws ApiException { ApiResponse<ApplicantsList> resp = listApplicantsWithHttpInfo(page, perPage); return resp.getData(); } /** * List Applicants * * @param page The page to return. Defaults to the first page if omitted. The first page is `page=1` (optional) * @param perPage The number of objects per page. Defaults to 20 if omitted. (optional) * @return ApiResponse<ApplicantsList> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<ApplicantsList> listApplicantsWithHttpInfo(String page, String perPage) throws ApiException { com.squareup.okhttp.Call call = listApplicantsCall(page, perPage, null, null); Type localVarReturnType = new TypeToken<ApplicantsList>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * List Applicants (asynchronously) * * @param page The page to return. Defaults to the first page if omitted. The first page is `page=1` (optional) * @param perPage The number of objects per page. Defaults to 20 if omitted. (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 com.squareup.okhttp.Call listApplicantsAsync(String page, String perPage, final ApiCallback<ApplicantsList> 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 = listApplicantsCall(page, perPage, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<ApplicantsList>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for listChecks */ private com.squareup.okhttp.Call listChecksCall(String applicantId, String page, String perPage, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'applicantId' is set if (applicantId == null) { throw new ApiException("Missing the required parameter 'applicantId' when calling listChecks(Async)"); } // create path and map variables String localVarPath = "/applicants/{applicant_id}/checks".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "applicant_id" + "\\}", apiClient.escapeString(applicantId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); if (page != null) localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); if (perPage != null) localVarQueryParams.addAll(apiClient.parameterToPairs("", "per_page", perPage)); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; 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[] { "Token" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * Retrieve Checks * * @param applicantId (required) * @param page The page to return. Defaults to the first page if omitted. The first page is `page=1` (optional) * @param perPage The number of objects per page. Defaults to 20 if omitted. (optional) * @return ChecksList * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ChecksList listChecks(String applicantId, String page, String perPage) throws ApiException { ApiResponse<ChecksList> resp = listChecksWithHttpInfo(applicantId, page, perPage); return resp.getData(); } /** * Retrieve Checks * * @param applicantId (required) * @param page The page to return. Defaults to the first page if omitted. The first page is `page=1` (optional) * @param perPage The number of objects per page. Defaults to 20 if omitted. (optional) * @return ApiResponse<ChecksList> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<ChecksList> listChecksWithHttpInfo(String applicantId, String page, String perPage) throws ApiException { com.squareup.okhttp.Call call = listChecksCall(applicantId, page, perPage, null, null); Type localVarReturnType = new TypeToken<ChecksList>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * Retrieve Checks (asynchronously) * * @param applicantId (required) * @param page The page to return. Defaults to the first page if omitted. The first page is `page=1` (optional) * @param perPage The number of objects per page. Defaults to 20 if omitted. (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 com.squareup.okhttp.Call listChecksAsync(String applicantId, String page, String perPage, final ApiCallback<ChecksList> 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 = listChecksCall(applicantId, page, perPage, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<ChecksList>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for listDocuments */ private com.squareup.okhttp.Call listDocumentsCall(String applicantId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'applicantId' is set if (applicantId == null) { throw new ApiException( "Missing the required parameter 'applicantId' when calling listDocuments(Async)"); } // create path and map variables String localVarPath = "/applicants/{applicant_id}/documents".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "applicant_id" + "\\}", apiClient.escapeString(applicantId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; 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[] { "Token" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * List documents * All documents belonging to an applicant can be listed from this endpoint * @param applicantId (required) * @return DocumentsList * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public DocumentsList listDocuments(String applicantId) throws ApiException { ApiResponse<DocumentsList> resp = listDocumentsWithHttpInfo(applicantId); return resp.getData(); } /** * List documents * All documents belonging to an applicant can be listed from this endpoint * @param applicantId (required) * @return ApiResponse<DocumentsList> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<DocumentsList> listDocumentsWithHttpInfo(String applicantId) throws ApiException { com.squareup.okhttp.Call call = listDocumentsCall(applicantId, null, null); Type localVarReturnType = new TypeToken<DocumentsList>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * List documents (asynchronously) * All documents belonging to an applicant can be listed from this endpoint * @param applicantId (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 listDocumentsAsync(String applicantId, final ApiCallback<DocumentsList> 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 = listDocumentsCall(applicantId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<DocumentsList>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for listLivePhotos */ private com.squareup.okhttp.Call listLivePhotosCall(String applicantId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'applicantId' is set if (applicantId == null) { throw new ApiException( "Missing the required parameter 'applicantId' when calling listLivePhotos(Async)"); } // create path and map variables String localVarPath = "/live_photos".replaceAll("\\{format\\}", "json"); List<Pair> localVarQueryParams = new ArrayList<Pair>(); if (applicantId != null) localVarQueryParams.addAll(apiClient.parameterToPairs("", "applicant_id", applicantId)); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; 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[] { "Token" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * List live photos * * @param applicantId The id of the applicant the live photos belongs to. (required) * @return LivePhotosList * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public LivePhotosList listLivePhotos(String applicantId) throws ApiException { ApiResponse<LivePhotosList> resp = listLivePhotosWithHttpInfo(applicantId); return resp.getData(); } /** * List live photos * * @param applicantId The id of the applicant the live photos belongs to. (required) * @return ApiResponse<LivePhotosList> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<LivePhotosList> listLivePhotosWithHttpInfo(String applicantId) throws ApiException { com.squareup.okhttp.Call call = listLivePhotosCall(applicantId, null, null); Type localVarReturnType = new TypeToken<LivePhotosList>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * List live photos (asynchronously) * * @param applicantId The id of the applicant the live photos belongs to. (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 listLivePhotosAsync(String applicantId, final ApiCallback<LivePhotosList> 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 = listLivePhotosCall(applicantId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<LivePhotosList>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for listReportTypeGroups */ private com.squareup.okhttp.Call listReportTypeGroupsCall( final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/report_type_groups".replaceAll("\\{format\\}", "json"); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; 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[] { "Token" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * Retrieve all report type groups * * @return ReportTypeGroupsList * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ReportTypeGroupsList listReportTypeGroups() throws ApiException { ApiResponse<ReportTypeGroupsList> resp = listReportTypeGroupsWithHttpInfo(); return resp.getData(); } /** * Retrieve all report type groups * * @return ApiResponse<ReportTypeGroupsList> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<ReportTypeGroupsList> listReportTypeGroupsWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = listReportTypeGroupsCall(null, null); Type localVarReturnType = new TypeToken<ReportTypeGroupsList>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * Retrieve all report type groups (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 com.squareup.okhttp.Call listReportTypeGroupsAsync(final ApiCallback<ReportTypeGroupsList> 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 = listReportTypeGroupsCall(progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<ReportTypeGroupsList>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for listReports */ private com.squareup.okhttp.Call listReportsCall(String checkId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'checkId' is set if (checkId == null) { throw new ApiException("Missing the required parameter 'checkId' when calling listReports(Async)"); } // create path and map variables String localVarPath = "/checks/{check_id}/reports".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "check_id" + "\\}", apiClient.escapeString(checkId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; 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[] { "Token" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * All the reports belonging to a particular check can be listed from this endpoint. * * @param checkId (required) * @return ReportsList * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ReportsList listReports(String checkId) throws ApiException { ApiResponse<ReportsList> resp = listReportsWithHttpInfo(checkId); return resp.getData(); } /** * All the reports belonging to a particular check can be listed from this endpoint. * * @param checkId (required) * @return ApiResponse<ReportsList> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<ReportsList> listReportsWithHttpInfo(String checkId) throws ApiException { com.squareup.okhttp.Call call = listReportsCall(checkId, null, null); Type localVarReturnType = new TypeToken<ReportsList>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * All the reports belonging to a particular check can be listed from this endpoint. (asynchronously) * * @param checkId (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 listReportsAsync(String checkId, final ApiCallback<ReportsList> 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 = listReportsCall(checkId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<ReportsList>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for listWebhooks */ private com.squareup.okhttp.Call listWebhooksCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/webhooks".replaceAll("\\{format\\}", "json"); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; 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[] { "Token" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * List webhooks * * @return WebhooksList * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public WebhooksList listWebhooks() throws ApiException { ApiResponse<WebhooksList> resp = listWebhooksWithHttpInfo(); return resp.getData(); } /** * List webhooks * * @return ApiResponse<WebhooksList> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<WebhooksList> listWebhooksWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = listWebhooksCall(null, null); Type localVarReturnType = new TypeToken<WebhooksList>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * List webhooks (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 com.squareup.okhttp.Call listWebhooksAsync(final ApiCallback<WebhooksList> 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 = listWebhooksCall(progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<WebhooksList>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for resumeCheck */ private com.squareup.okhttp.Call resumeCheckCall(String checkId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'checkId' is set if (checkId == null) { throw new ApiException("Missing the required parameter 'checkId' when calling resumeCheck(Async)"); } // create path and map variables String localVarPath = "/checks/{check_id}/resume".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "check_id" + "\\}", apiClient.escapeString(checkId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; 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[] { "Token" }; return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * Resume a Check * * @param checkId (required) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public void resumeCheck(String checkId) throws ApiException { resumeCheckWithHttpInfo(checkId); } /** * Resume a Check * * @param checkId (required) * @return ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<Void> resumeCheckWithHttpInfo(String checkId) throws ApiException { com.squareup.okhttp.Call call = resumeCheckCall(checkId, null, null); return apiClient.execute(call); } /** * Resume a Check (asynchronously) * * @param checkId (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 resumeCheckAsync(String checkId, final ApiCallback<Void> 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 = resumeCheckCall(checkId, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } /* Build call for resumeReport */ private com.squareup.okhttp.Call resumeReportCall(String checkId, String reportId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'checkId' is set if (checkId == null) { throw new ApiException("Missing the required parameter 'checkId' when calling resumeReport(Async)"); } // verify the required parameter 'reportId' is set if (reportId == null) { throw new ApiException("Missing the required parameter 'reportId' when calling resumeReport(Async)"); } // create path and map variables String localVarPath = "/checks/{check_id}/reports/{report_id}/resume".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "check_id" + "\\}", apiClient.escapeString(checkId.toString())) .replaceAll("\\{" + "report_id" + "\\}", apiClient.escapeString(reportId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; 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[] { "Token" }; return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * This endpoint is for resuming individual paused reports. * * @param checkId (required) * @param reportId (required) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public void resumeReport(String checkId, String reportId) throws ApiException { resumeReportWithHttpInfo(checkId, reportId); } /** * This endpoint is for resuming individual paused reports. * * @param checkId (required) * @param reportId (required) * @return ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<Void> resumeReportWithHttpInfo(String checkId, String reportId) throws ApiException { com.squareup.okhttp.Call call = resumeReportCall(checkId, reportId, null, null); return apiClient.execute(call); } /** * This endpoint is for resuming individual paused reports. (asynchronously) * * @param checkId (required) * @param reportId (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 resumeReportAsync(String checkId, String reportId, final ApiCallback<Void> 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 = resumeReportCall(checkId, reportId, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } /* Build call for updateApplicant */ private com.squareup.okhttp.Call updateApplicantCall(String applicantId, Applicant data, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = data; // verify the required parameter 'applicantId' is set if (applicantId == null) { throw new ApiException( "Missing the required parameter 'applicantId' when calling updateApplicant(Async)"); } // create path and map variables String localVarPath = "/applicants/{applicant_id}".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "applicant_id" + "\\}", apiClient.escapeString(applicantId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; 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[] { "Token" }; return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * Update Applicant * * @param applicantId (required) * @param data (optional) * @return Applicant * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public Applicant updateApplicant(String applicantId, Applicant data) throws ApiException { ApiResponse<Applicant> resp = updateApplicantWithHttpInfo(applicantId, data); return resp.getData(); } /** * Update Applicant * * @param applicantId (required) * @param data (optional) * @return ApiResponse<Applicant> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<Applicant> updateApplicantWithHttpInfo(String applicantId, Applicant data) throws ApiException { com.squareup.okhttp.Call call = updateApplicantCall(applicantId, data, null, null); Type localVarReturnType = new TypeToken<Applicant>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * Update Applicant (asynchronously) * * @param applicantId (required) * @param data (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 com.squareup.okhttp.Call updateApplicantAsync(String applicantId, Applicant data, final ApiCallback<Applicant> 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 = updateApplicantCall(applicantId, data, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<Applicant>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for uploadDocument */ private com.squareup.okhttp.Call uploadDocumentCall(String applicantId, String type, String side, File file, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'applicantId' is set if (applicantId == null) { throw new ApiException( "Missing the required parameter 'applicantId' when calling uploadDocument(Async)"); } // verify the required parameter 'type' is set if (type == null) { throw new ApiException("Missing the required parameter 'type' when calling uploadDocument(Async)"); } // create path and map variables String localVarPath = "/applicants/{applicant_id}/documents".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "applicant_id" + "\\}", apiClient.escapeString(applicantId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); if (type != null) localVarFormParams.put("type", type); if (side != null) localVarFormParams.put("side", side); if (file != null) localVarFormParams.put("file", file); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "multipart/form-data" }; 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[] { "Token" }; return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * Upload a document * Documents are uploaded using this endpoint. Along with the file upload the relevant document type must be specified. Documents must be uploaded as a multipart form. The valid file types are: jpg, png and pdf. The file size must be between 2KB and 3MB. * @param applicantId (required) * @param type (required) * @param side (optional) * @param file (optional) * @return Document * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public Document uploadDocument(String applicantId, String type, String side, File file) throws ApiException { ApiResponse<Document> resp = uploadDocumentWithHttpInfo(applicantId, type, side, file); return resp.getData(); } /** * Upload a document * Documents are uploaded using this endpoint. Along with the file upload the relevant document type must be specified. Documents must be uploaded as a multipart form. The valid file types are: jpg, png and pdf. The file size must be between 2KB and 3MB. * @param applicantId (required) * @param type (required) * @param side (optional) * @param file (optional) * @return ApiResponse<Document> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<Document> uploadDocumentWithHttpInfo(String applicantId, String type, String side, File file) throws ApiException { com.squareup.okhttp.Call call = uploadDocumentCall(applicantId, type, side, file, null, null); Type localVarReturnType = new TypeToken<Document>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * Upload a document (asynchronously) * Documents are uploaded using this endpoint. Along with the file upload the relevant document type must be specified. Documents must be uploaded as a multipart form. The valid file types are: jpg, png and pdf. The file size must be between 2KB and 3MB. * @param applicantId (required) * @param type (required) * @param side (optional) * @param file (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 com.squareup.okhttp.Call uploadDocumentAsync(String applicantId, String type, String side, File file, final ApiCallback<Document> 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 = uploadDocumentCall(applicantId, type, side, file, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<Document>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for uploadLivePhoto */ private com.squareup.okhttp.Call uploadLivePhotoCall(String applicantId, File file, Boolean advancedValidation, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'applicantId' is set if (applicantId == null) { throw new ApiException( "Missing the required parameter 'applicantId' when calling uploadLivePhoto(Async)"); } // verify the required parameter 'file' is set if (file == null) { throw new ApiException("Missing the required parameter 'file' when calling uploadLivePhoto(Async)"); } // create path and map variables String localVarPath = "/live_photos".replaceAll("\\{format\\}", "json"); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); if (applicantId != null) localVarFormParams.put("applicant_id", applicantId); if (file != null) localVarFormParams.put("file", file); if (advancedValidation != null) localVarFormParams.put("advanced_validation", advancedValidation); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "multipart/form-data" }; 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[] { "Token" }; return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * Upload live photo * You can upload live photos to this endpoint. Like document upload, files must be uploaded as a multipart form. Valid file types are jpg, png and pdf. The file size must be between 32KB and 10MB. Live photos are validated at the point of upload to check that they contain exactly one face. This validation can be disabled by setting the advanced_validation argument to false. * @param applicantId The applicant_id to associate the live photo to. (required) * @param file The file to be uploaded. (required) * @param advancedValidation Validates that the live photo contains exactly one face. (optional) * @return LivePhoto * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public LivePhoto uploadLivePhoto(String applicantId, File file, Boolean advancedValidation) throws ApiException { ApiResponse<LivePhoto> resp = uploadLivePhotoWithHttpInfo(applicantId, file, advancedValidation); return resp.getData(); } /** * Upload live photo * You can upload live photos to this endpoint. Like document upload, files must be uploaded as a multipart form. Valid file types are jpg, png and pdf. The file size must be between 32KB and 10MB. Live photos are validated at the point of upload to check that they contain exactly one face. This validation can be disabled by setting the advanced_validation argument to false. * @param applicantId The applicant_id to associate the live photo to. (required) * @param file The file to be uploaded. (required) * @param advancedValidation Validates that the live photo contains exactly one face. (optional) * @return ApiResponse<LivePhoto> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<LivePhoto> uploadLivePhotoWithHttpInfo(String applicantId, File file, Boolean advancedValidation) throws ApiException { com.squareup.okhttp.Call call = uploadLivePhotoCall(applicantId, file, advancedValidation, null, null); Type localVarReturnType = new TypeToken<LivePhoto>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * Upload live photo (asynchronously) * You can upload live photos to this endpoint. Like document upload, files must be uploaded as a multipart form. Valid file types are jpg, png and pdf. The file size must be between 32KB and 10MB. Live photos are validated at the point of upload to check that they contain exactly one face. This validation can be disabled by setting the advanced_validation argument to false. * @param applicantId The applicant_id to associate the live photo to. (required) * @param file The file to be uploaded. (required) * @param advancedValidation Validates that the live photo contains exactly one face. (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 com.squareup.okhttp.Call uploadLivePhotoAsync(String applicantId, File file, Boolean advancedValidation, final ApiCallback<LivePhoto> 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 = uploadLivePhotoCall(applicantId, file, advancedValidation, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<LivePhoto>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } }