Java tutorial
/** * IdCheck.IO API * Check identity documents * * OpenAPI spec version: 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.ariadnext.idcheckio.api; import com.ariadnext.idcheckio.invoker.ApiCallback; import com.ariadnext.idcheckio.invoker.ApiClient; import com.ariadnext.idcheckio.invoker.ApiException; import com.ariadnext.idcheckio.invoker.ApiResponse; import com.ariadnext.idcheckio.invoker.Configuration; import com.ariadnext.idcheckio.invoker.Pair; import com.ariadnext.idcheckio.invoker.ProgressRequestBody; import com.ariadnext.idcheckio.invoker.ProgressResponseBody; import com.google.gson.reflect.TypeToken; import java.io.IOException; import com.ariadnext.idcheckio.model.ErrorResponse; import com.ariadnext.idcheckio.model.ReportResponse; import com.ariadnext.idcheckio.model.ResultResponse; import com.ariadnext.idcheckio.model.TaskResponse; import com.ariadnext.idcheckio.model.ImageRequest; import com.ariadnext.idcheckio.model.MrzRequest; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class AnalysisApi { private ApiClient apiClient; public AnalysisApi() { this(Configuration.getDefaultApiClient()); } public AnalysisApi(ApiClient apiClient) { this.apiClient = apiClient; } public ApiClient getApiClient() { return apiClient; } public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } /* Build call for getReport */ private com.squareup.okhttp.Call getReportCall(String analysisRefUid, String acceptLanguage, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'analysisRefUid' is set if (analysisRefUid == null) { throw new ApiException("Missing the required parameter 'analysisRefUid' when calling getReport(Async)"); } // create path and map variables String localVarPath = "/v0/pdfreport/{analysisRefUid}".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "analysisRefUid" + "\\}", apiClient.escapeString(analysisRefUid.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); if (acceptLanguage != null) localVarHeaderParams.put("Accept-Language", apiClient.parameterToString(acceptLanguage)); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json; charset=utf-8" }; 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[] { "basic" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * HTTP GET report (demo) * Get a pdf report (base64 encoded) (demo) * @param analysisRefUid Report analysisRefUid (required) * @param acceptLanguage Accept language header (optional) * @return ReportResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ReportResponse getReport(String analysisRefUid, String acceptLanguage) throws ApiException { ApiResponse<ReportResponse> resp = getReportWithHttpInfo(analysisRefUid, acceptLanguage); return resp.getData(); } /** * HTTP GET report (demo) * Get a pdf report (base64 encoded) (demo) * @param analysisRefUid Report analysisRefUid (required) * @param acceptLanguage Accept language header (optional) * @return ApiResponse<ReportResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<ReportResponse> getReportWithHttpInfo(String analysisRefUid, String acceptLanguage) throws ApiException { com.squareup.okhttp.Call call = getReportCall(analysisRefUid, acceptLanguage, null, null); Type localVarReturnType = new TypeToken<ReportResponse>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * HTTP GET report (demo) (asynchronously) * Get a pdf report (base64 encoded) (demo) * @param analysisRefUid Report analysisRefUid (required) * @param acceptLanguage Accept language header (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 getReportAsync(String analysisRefUid, String acceptLanguage, final ApiCallback<ReportResponse> 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 = getReportCall(analysisRefUid, acceptLanguage, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<ReportResponse>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for getResult */ private com.squareup.okhttp.Call getResultCall(String analysisRefUid, String acceptLanguage, Boolean rectoImageCropped, Boolean faceImageCropped, Boolean signatureImageCropped, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'analysisRefUid' is set if (analysisRefUid == null) { throw new ApiException("Missing the required parameter 'analysisRefUid' when calling getResult(Async)"); } // create path and map variables String localVarPath = "/v0/result/{analysisRefUid}".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "analysisRefUid" + "\\}", apiClient.escapeString(analysisRefUid.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); if (rectoImageCropped != null) localVarQueryParams.addAll(apiClient.parameterToPairs("", "rectoImageCropped", rectoImageCropped)); if (faceImageCropped != null) localVarQueryParams.addAll(apiClient.parameterToPairs("", "faceImageCropped", faceImageCropped)); if (signatureImageCropped != null) localVarQueryParams .addAll(apiClient.parameterToPairs("", "signatureImageCropped", signatureImageCropped)); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); if (acceptLanguage != null) localVarHeaderParams.put("Accept-Language", apiClient.parameterToString(acceptLanguage)); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json; charset=utf-8" }; 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[] { "basic" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * HTTP GET result * Get result controls * @param analysisRefUid Result analysisRefUid (required) * @param acceptLanguage Accept language header (optional) * @param rectoImageCropped True to obtain recto image cropped if applicable (optional, default to false) * @param faceImageCropped True to obtain face image cropped if applicable (optional, default to false) * @param signatureImageCropped True to obtain signature image cropped if applicable (optional, default to false) * @return ResultResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ResultResponse getResult(String analysisRefUid, String acceptLanguage, Boolean rectoImageCropped, Boolean faceImageCropped, Boolean signatureImageCropped) throws ApiException { ApiResponse<ResultResponse> resp = getResultWithHttpInfo(analysisRefUid, acceptLanguage, rectoImageCropped, faceImageCropped, signatureImageCropped); return resp.getData(); } /** * HTTP GET result * Get result controls * @param analysisRefUid Result analysisRefUid (required) * @param acceptLanguage Accept language header (optional) * @param rectoImageCropped True to obtain recto image cropped if applicable (optional, default to false) * @param faceImageCropped True to obtain face image cropped if applicable (optional, default to false) * @param signatureImageCropped True to obtain signature image cropped if applicable (optional, default to false) * @return ApiResponse<ResultResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<ResultResponse> getResultWithHttpInfo(String analysisRefUid, String acceptLanguage, Boolean rectoImageCropped, Boolean faceImageCropped, Boolean signatureImageCropped) throws ApiException { com.squareup.okhttp.Call call = getResultCall(analysisRefUid, acceptLanguage, rectoImageCropped, faceImageCropped, signatureImageCropped, null, null); Type localVarReturnType = new TypeToken<ResultResponse>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * HTTP GET result (asynchronously) * Get result controls * @param analysisRefUid Result analysisRefUid (required) * @param acceptLanguage Accept language header (optional) * @param rectoImageCropped True to obtain recto image cropped if applicable (optional, default to false) * @param faceImageCropped True to obtain face image cropped if applicable (optional, default to false) * @param signatureImageCropped True to obtain signature image cropped if applicable (optional, default to false) * @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 getResultAsync(String analysisRefUid, String acceptLanguage, Boolean rectoImageCropped, Boolean faceImageCropped, Boolean signatureImageCropped, final ApiCallback<ResultResponse> 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 = getResultCall(analysisRefUid, acceptLanguage, rectoImageCropped, faceImageCropped, signatureImageCropped, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<ResultResponse>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for getTask */ private com.squareup.okhttp.Call getTaskCall(String analysisRefUid, String acceptLanguage, Long wait, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'analysisRefUid' is set if (analysisRefUid == null) { throw new ApiException("Missing the required parameter 'analysisRefUid' when calling getTask(Async)"); } // create path and map variables String localVarPath = "/v0/task/{analysisRefUid}".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "analysisRefUid" + "\\}", apiClient.escapeString(analysisRefUid.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); if (wait != null) localVarQueryParams.addAll(apiClient.parameterToPairs("", "wait", wait)); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); if (acceptLanguage != null) localVarHeaderParams.put("Accept-Language", apiClient.parameterToString(acceptLanguage)); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json; charset=utf-8" }; 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[] { "basic" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * HTTP GET task * Get task status * @param analysisRefUid Task analysisRefUid (required) * @param acceptLanguage Accept language header (optional) * @param wait specify a maximum wait time in milliseconds (optional) * @return TaskResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public TaskResponse getTask(String analysisRefUid, String acceptLanguage, Long wait) throws ApiException { ApiResponse<TaskResponse> resp = getTaskWithHttpInfo(analysisRefUid, acceptLanguage, wait); return resp.getData(); } /** * HTTP GET task * Get task status * @param analysisRefUid Task analysisRefUid (required) * @param acceptLanguage Accept language header (optional) * @param wait specify a maximum wait time in milliseconds (optional) * @return ApiResponse<TaskResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<TaskResponse> getTaskWithHttpInfo(String analysisRefUid, String acceptLanguage, Long wait) throws ApiException { com.squareup.okhttp.Call call = getTaskCall(analysisRefUid, acceptLanguage, wait, null, null); Type localVarReturnType = new TypeToken<TaskResponse>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * HTTP GET task (asynchronously) * Get task status * @param analysisRefUid Task analysisRefUid (required) * @param acceptLanguage Accept language header (optional) * @param wait specify a maximum wait time in milliseconds (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 getTaskAsync(String analysisRefUid, String acceptLanguage, Long wait, final ApiCallback<TaskResponse> 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 = getTaskCall(analysisRefUid, acceptLanguage, wait, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<TaskResponse>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for postImage */ private com.squareup.okhttp.Call postImageCall(ImageRequest body, Boolean asyncMode, String acceptLanguage, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // verify the required parameter 'body' is set if (body == null) { throw new ApiException("Missing the required parameter 'body' when calling postImage(Async)"); } // create path and map variables String localVarPath = "/v0/task/image".replaceAll("\\{format\\}", "json"); List<Pair> localVarQueryParams = new ArrayList<Pair>(); if (asyncMode != null) localVarQueryParams.addAll(apiClient.parameterToPairs("", "asyncMode", asyncMode)); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); if (acceptLanguage != null) localVarHeaderParams.put("Accept-Language", apiClient.parameterToString(acceptLanguage)); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json; charset=utf-8" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)).build(); } }); } String[] localVarAuthNames = new String[] { "basic" }; return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * HTTP POST task image * POST an image check task * @param body Image request (required) * @param asyncMode true to activate asynchrone mode (optional) * @param acceptLanguage Accept language header (optional) * @return ResultResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ResultResponse postImage(ImageRequest body, Boolean asyncMode, String acceptLanguage) throws ApiException { ApiResponse<ResultResponse> resp = postImageWithHttpInfo(body, asyncMode, acceptLanguage); return resp.getData(); } /** * HTTP POST task image * POST an image check task * @param body Image request (required) * @param asyncMode true to activate asynchrone mode (optional) * @param acceptLanguage Accept language header (optional) * @return ApiResponse<ResultResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<ResultResponse> postImageWithHttpInfo(ImageRequest body, Boolean asyncMode, String acceptLanguage) throws ApiException { com.squareup.okhttp.Call call = postImageCall(body, asyncMode, acceptLanguage, null, null); Type localVarReturnType = new TypeToken<ResultResponse>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * HTTP POST task image (asynchronously) * POST an image check task * @param body Image request (required) * @param asyncMode true to activate asynchrone mode (optional) * @param acceptLanguage Accept language header (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 postImageAsync(ImageRequest body, Boolean asyncMode, String acceptLanguage, final ApiCallback<ResultResponse> 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 = postImageCall(body, asyncMode, acceptLanguage, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<ResultResponse>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for postMrz */ private com.squareup.okhttp.Call postMrzCall(MrzRequest body, Boolean asyncMode, String acceptLanguage, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // verify the required parameter 'body' is set if (body == null) { throw new ApiException("Missing the required parameter 'body' when calling postMrz(Async)"); } // create path and map variables String localVarPath = "/v0/task/mrz".replaceAll("\\{format\\}", "json"); List<Pair> localVarQueryParams = new ArrayList<Pair>(); if (asyncMode != null) localVarQueryParams.addAll(apiClient.parameterToPairs("", "asyncMode", asyncMode)); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); if (acceptLanguage != null) localVarHeaderParams.put("Accept-Language", apiClient.parameterToString(acceptLanguage)); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json; charset=utf-8" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)).build(); } }); } String[] localVarAuthNames = new String[] { "basic" }; return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * HTTP POST task mrz * POST a mrz check task * @param body Mrz request (required) * @param asyncMode true to activate asynchrone mode (optional) * @param acceptLanguage Accept language header (optional) * @return ResultResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ResultResponse postMrz(MrzRequest body, Boolean asyncMode, String acceptLanguage) throws ApiException { ApiResponse<ResultResponse> resp = postMrzWithHttpInfo(body, asyncMode, acceptLanguage); return resp.getData(); } /** * HTTP POST task mrz * POST a mrz check task * @param body Mrz request (required) * @param asyncMode true to activate asynchrone mode (optional) * @param acceptLanguage Accept language header (optional) * @return ApiResponse<ResultResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<ResultResponse> postMrzWithHttpInfo(MrzRequest body, Boolean asyncMode, String acceptLanguage) throws ApiException { com.squareup.okhttp.Call call = postMrzCall(body, asyncMode, acceptLanguage, null, null); Type localVarReturnType = new TypeToken<ResultResponse>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * HTTP POST task mrz (asynchronously) * POST a mrz check task * @param body Mrz request (required) * @param asyncMode true to activate asynchrone mode (optional) * @param acceptLanguage Accept language header (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 postMrzAsync(MrzRequest body, Boolean asyncMode, String acceptLanguage, final ApiCallback<ResultResponse> 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 = postMrzCall(body, asyncMode, acceptLanguage, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<ResultResponse>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } }