java/src/main/java/com/konfigthis/dojah/client/api/KeKycApi.java
<reponame>dojah-inc/dojah-sdks/*
 * DOJAH APIs
 * Use Dojah to verify, onboard and manage user identity across Africa!
 *
 * The version of the OpenAPI document: 1.0.0
 * 
 *
 * NOTE: This class is auto generated by Konfig (https://konfigthis.com).
 * Do not edit the class manually.
 */


package com.konfigthis.dojah.client.api;

import com.konfigthis.dojah.client.ApiCallback;
import com.konfigthis.dojah.client.ApiClient;
import com.konfigthis.dojah.client.ApiException;
import com.konfigthis.dojah.client.ApiResponse;
import com.konfigthis.dojah.client.Configuration;
import com.konfigthis.dojah.client.Pair;
import com.konfigthis.dojah.client.ProgressRequestBody;
import com.konfigthis.dojah.client.ProgressResponseBody;

import com.google.gson.reflect.TypeToken;

import java.io.IOException;


import com.konfigthis.dojah.client.model.GetNationalIdResponse;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.ws.rs.core.GenericType;

public class KeKycApi {
    private ApiClient localVarApiClient;
    private int localHostIndex;
    private String localCustomBaseUrl;

    public KeKycApi() throws IllegalArgumentException {
        this(Configuration.getDefaultApiClient());
    }

    public KeKycApi(ApiClient apiClient) throws IllegalArgumentException {
        if (apiClient.getApikeyAuth() == null) {
            throw new IllegalArgumentException("\"Authorization\" is required but no API key was provided. Please set \"Authorization\" with ApiClient#setApikeyAuth(String).");
        }
        this.localVarApiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return localVarApiClient;
    }

    public void setApiClient(ApiClient apiClient) {
        this.localVarApiClient = apiClient;
    }

    public int getHostIndex() {
        return localHostIndex;
    }

    public void setHostIndex(int hostIndex) {
        this.localHostIndex = hostIndex;
    }

    public String getCustomBaseUrl() {
        return localCustomBaseUrl;
    }

    public void setCustomBaseUrl(String customBaseUrl) {
        this.localCustomBaseUrl = customBaseUrl;
    }

    private okhttp3.Call getNationalIdCall(Integer id, String firstName, String lastName, String middleName, String dateOfBirth, String gender, final ApiCallback _callback) throws ApiException {
        String basePath = null;
        // Operation Servers
        String[] localBasePaths = new String[] {  };

        // Determine Base Path to Use
        if (localCustomBaseUrl != null){
            basePath = localCustomBaseUrl;
        } else if ( localBasePaths.length > 0 ) {
            basePath = localBasePaths[localHostIndex];
        } else {
            basePath = null;
        }

        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/api/v1/ke/kyc/id";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        if (id != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("id", id));
        }

        if (firstName != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("first_name", firstName));
        }

        if (lastName != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("last_name", lastName));
        }

        if (middleName != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("middle_name", middleName));
        }

        if (dateOfBirth != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("date_of_birth", dateOfBirth));
        }

        if (gender != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("gender", gender));
        }

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        if (localVarContentType != null) {
            localVarHeaderParams.put("Content-Type", localVarContentType);
        }

        String[] localVarAuthNames = new String[] { "apikeyAuth", "appIdAuth" };
        return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call getNationalIdValidateBeforeCall(Integer id, String firstName, String lastName, String middleName, String dateOfBirth, String gender, final ApiCallback _callback) throws ApiException {
        return getNationalIdCall(id, firstName, lastName, middleName, dateOfBirth, gender, _callback);

    }


    private ApiResponse<GetNationalIdResponse> getNationalIdWithHttpInfo(Integer id, String firstName, String lastName, String middleName, String dateOfBirth, String gender) throws ApiException {
        okhttp3.Call localVarCall = getNationalIdValidateBeforeCall(id, firstName, lastName, middleName, dateOfBirth, gender, null);
        Type localVarReturnType = new TypeToken<GetNationalIdResponse>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    private okhttp3.Call getNationalIdAsync(Integer id, String firstName, String lastName, String middleName, String dateOfBirth, String gender, final ApiCallback<GetNationalIdResponse> _callback) throws ApiException {

        okhttp3.Call localVarCall = getNationalIdValidateBeforeCall(id, firstName, lastName, middleName, dateOfBirth, gender, _callback);
        Type localVarReturnType = new TypeToken<GetNationalIdResponse>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }

    public class GetNationalIdRequestBuilder {
        private Integer id;
        private String firstName;
        private String lastName;
        private String middleName;
        private String dateOfBirth;
        private String gender;

        private GetNationalIdRequestBuilder() {
        }

        /**
         * Set id
         * @param id  (optional)
         * @return GetNationalIdRequestBuilder
         */
        public GetNationalIdRequestBuilder id(Integer id) {
            this.id = id;
            return this;
        }
        
        /**
         * Set firstName
         * @param firstName  (optional)
         * @return GetNationalIdRequestBuilder
         */
        public GetNationalIdRequestBuilder firstName(String firstName) {
            this.firstName = firstName;
            return this;
        }
        
        /**
         * Set lastName
         * @param lastName  (optional)
         * @return GetNationalIdRequestBuilder
         */
        public GetNationalIdRequestBuilder lastName(String lastName) {
            this.lastName = lastName;
            return this;
        }
        
        /**
         * Set middleName
         * @param middleName  (optional)
         * @return GetNationalIdRequestBuilder
         */
        public GetNationalIdRequestBuilder middleName(String middleName) {
            this.middleName = middleName;
            return this;
        }
        
        /**
         * Set dateOfBirth
         * @param dateOfBirth  (optional)
         * @return GetNationalIdRequestBuilder
         */
        public GetNationalIdRequestBuilder dateOfBirth(String dateOfBirth) {
            this.dateOfBirth = dateOfBirth;
            return this;
        }
        
        /**
         * Set gender
         * @param gender  (optional)
         * @return GetNationalIdRequestBuilder
         */
        public GetNationalIdRequestBuilder gender(String gender) {
            this.gender = gender;
            return this;
        }
        
        /**
         * Build call for getNationalId
         * @param _callback ApiCallback API callback
         * @return Call to execute
         * @throws ApiException If fail to serialize the request body object
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Successful response </td><td>  -  </td></tr>
         </table>
         */
        public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException {
            return getNationalIdCall(id, firstName, lastName, middleName, dateOfBirth, gender, _callback);
        }


        /**
         * Execute getNationalId request
         * @return GetNationalIdResponse
         * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Successful response </td><td>  -  </td></tr>
         </table>
         */
        public GetNationalIdResponse execute() throws ApiException {
            ApiResponse<GetNationalIdResponse> localVarResp = getNationalIdWithHttpInfo(id, firstName, lastName, middleName, dateOfBirth, gender);
            return localVarResp.getData();
        }

        /**
         * Execute getNationalId request with HTTP info returned
         * @return ApiResponse&lt;GetNationalIdResponse&gt;
         * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Successful response </td><td>  -  </td></tr>
         </table>
         */
        public ApiResponse<GetNationalIdResponse> executeWithHttpInfo() throws ApiException {
            return getNationalIdWithHttpInfo(id, firstName, lastName, middleName, dateOfBirth, gender);
        }

        /**
         * Execute getNationalId request (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
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            <tr><td> 200 </td><td> Successful response </td><td>  -  </td></tr>
         </table>
         */
        public okhttp3.Call executeAsync(final ApiCallback<GetNationalIdResponse> _callback) throws ApiException {
            return getNationalIdAsync(id, firstName, lastName, middleName, dateOfBirth, gender, _callback);
        }
    }

    /**
     * KYC - National ID
     * 
     * @return GetNationalIdRequestBuilder
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Successful response </td><td>  -  </td></tr>
     </table>
     */
    public GetNationalIdRequestBuilder getNationalId() throws IllegalArgumentException {
        return new GetNationalIdRequestBuilder();
    }
}
