/*
 * Swagger of Opencellsoft Api
 * @#Introduction
 *
 * The version of the OpenAPI document: 7.3.1-SNAPSHOT
 * Contact: contact@opencellsoft.fr
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package org.openapitools.client.api;

import org.openapitools.client.ApiCallback;
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.ApiResponse;
import org.openapitools.client.Configuration;
import org.openapitools.client.Pair;
import org.openapitools.client.ProgressRequestBody;
import org.openapitools.client.ProgressResponseBody;

import com.google.gson.reflect.TypeToken;

import java.io.IOException;


import org.openapitools.client.model.GenericPagingAndFiltering;
import org.openapitools.client.model.GenericRequestDto;

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 localVarApiClient;

    public DefaultApi() {
        this(Configuration.getDefaultApiClient());
    }

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

    public ApiClient getApiClient() {
        return localVarApiClient;
    }

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

    /**
     * Build call for get1
     * @param entityName  (required)
     * @param id  (required)
     * @param genericRequestDto  (optional)
     * @param _callback Callback for upload/download progress
     * @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> 0 </td><td> default response </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call get1Call(String entityName, Long id, GenericRequestDto genericRequestDto, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = genericRequestDto;

        // create path and map variables
        String localVarPath = "/generic/{entityName}/{id}"
            .replaceAll("\\{" + "entityName" + "\\}", localVarApiClient.escapeString(entityName.toString()))
            .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

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

    @SuppressWarnings("rawtypes")
    private okhttp3.Call get1ValidateBeforeCall(String entityName, Long id, GenericRequestDto genericRequestDto, final ApiCallback _callback) throws ApiException {
        
        // verify the required parameter 'entityName' is set
        if (entityName == null) {
            throw new ApiException("Missing the required parameter 'entityName' when calling get1(Async)");
        }
        
        // verify the required parameter 'id' is set
        if (id == null) {
            throw new ApiException("Missing the required parameter 'id' when calling get1(Async)");
        }
        

        okhttp3.Call localVarCall = get1Call(entityName, id, genericRequestDto, _callback);
        return localVarCall;

    }

    /**
     * 
     * 
     * @param entityName  (required)
     * @param id  (required)
     * @param genericRequestDto  (optional)
     * @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> 0 </td><td> default response </td><td>  -  </td></tr>
     </table>
     */
    public void get1(String entityName, Long id, GenericRequestDto genericRequestDto) throws ApiException {
        get1WithHttpInfo(entityName, id, genericRequestDto);
    }

    /**
     * 
     * 
     * @param entityName  (required)
     * @param id  (required)
     * @param genericRequestDto  (optional)
     * @return ApiResponse&lt;Void&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> 0 </td><td> default response </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<Void> get1WithHttpInfo(String entityName, Long id, GenericRequestDto genericRequestDto) throws ApiException {
        okhttp3.Call localVarCall = get1ValidateBeforeCall(entityName, id, genericRequestDto, null);
        return localVarApiClient.execute(localVarCall);
    }

    /**
     *  (asynchronously)
     * 
     * @param entityName  (required)
     * @param id  (required)
     * @param genericRequestDto  (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
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 0 </td><td> default response </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call get1Async(String entityName, Long id, GenericRequestDto genericRequestDto, final ApiCallback<Void> _callback) throws ApiException {

        okhttp3.Call localVarCall = get1ValidateBeforeCall(entityName, id, genericRequestDto, _callback);
        localVarApiClient.executeAsync(localVarCall, _callback);
        return localVarCall;
    }
    /**
     * Build call for getAll1
     * @param entityName  (required)
     * @param genericPagingAndFiltering  (optional)
     * @param _callback Callback for upload/download progress
     * @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> 0 </td><td> default response </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getAll1Call(String entityName, GenericPagingAndFiltering genericPagingAndFiltering, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = genericPagingAndFiltering;

        // create path and map variables
        String localVarPath = "/generic/all/{entityName}"
            .replaceAll("\\{" + "entityName" + "\\}", localVarApiClient.escapeString(entityName.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

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

    @SuppressWarnings("rawtypes")
    private okhttp3.Call getAll1ValidateBeforeCall(String entityName, GenericPagingAndFiltering genericPagingAndFiltering, final ApiCallback _callback) throws ApiException {
        
        // verify the required parameter 'entityName' is set
        if (entityName == null) {
            throw new ApiException("Missing the required parameter 'entityName' when calling getAll1(Async)");
        }
        

        okhttp3.Call localVarCall = getAll1Call(entityName, genericPagingAndFiltering, _callback);
        return localVarCall;

    }

    /**
     * 
     * 
     * @param entityName  (required)
     * @param genericPagingAndFiltering  (optional)
     * @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> 0 </td><td> default response </td><td>  -  </td></tr>
     </table>
     */
    public void getAll1(String entityName, GenericPagingAndFiltering genericPagingAndFiltering) throws ApiException {
        getAll1WithHttpInfo(entityName, genericPagingAndFiltering);
    }

    /**
     * 
     * 
     * @param entityName  (required)
     * @param genericPagingAndFiltering  (optional)
     * @return ApiResponse&lt;Void&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> 0 </td><td> default response </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<Void> getAll1WithHttpInfo(String entityName, GenericPagingAndFiltering genericPagingAndFiltering) throws ApiException {
        okhttp3.Call localVarCall = getAll1ValidateBeforeCall(entityName, genericPagingAndFiltering, null);
        return localVarApiClient.execute(localVarCall);
    }

    /**
     *  (asynchronously)
     * 
     * @param entityName  (required)
     * @param genericPagingAndFiltering  (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
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 0 </td><td> default response </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getAll1Async(String entityName, GenericPagingAndFiltering genericPagingAndFiltering, final ApiCallback<Void> _callback) throws ApiException {

        okhttp3.Call localVarCall = getAll1ValidateBeforeCall(entityName, genericPagingAndFiltering, _callback);
        localVarApiClient.executeAsync(localVarCall, _callback);
        return localVarCall;
    }
    /**
     * Build call for update1
     * @param entityName  (required)
     * @param id  (required)
     * @param body  (optional)
     * @param _callback Callback for upload/download progress
     * @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> 0 </td><td> default response </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call update1Call(String entityName, Long id, String body, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/generic/{entityName}/{id}"
            .replaceAll("\\{" + "entityName" + "\\}", localVarApiClient.escapeString(entityName.toString()))
            .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        String[] localVarAuthNames = new String[] { "auth" };
        return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call update1ValidateBeforeCall(String entityName, Long id, String body, final ApiCallback _callback) throws ApiException {
        
        // verify the required parameter 'entityName' is set
        if (entityName == null) {
            throw new ApiException("Missing the required parameter 'entityName' when calling update1(Async)");
        }
        
        // verify the required parameter 'id' is set
        if (id == null) {
            throw new ApiException("Missing the required parameter 'id' when calling update1(Async)");
        }
        

        okhttp3.Call localVarCall = update1Call(entityName, id, body, _callback);
        return localVarCall;

    }

    /**
     * 
     * 
     * @param entityName  (required)
     * @param id  (required)
     * @param body  (optional)
     * @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> 0 </td><td> default response </td><td>  -  </td></tr>
     </table>
     */
    public void update1(String entityName, Long id, String body) throws ApiException {
        update1WithHttpInfo(entityName, id, body);
    }

    /**
     * 
     * 
     * @param entityName  (required)
     * @param id  (required)
     * @param body  (optional)
     * @return ApiResponse&lt;Void&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> 0 </td><td> default response </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<Void> update1WithHttpInfo(String entityName, Long id, String body) throws ApiException {
        okhttp3.Call localVarCall = update1ValidateBeforeCall(entityName, id, body, null);
        return localVarApiClient.execute(localVarCall);
    }

    /**
     *  (asynchronously)
     * 
     * @param entityName  (required)
     * @param id  (required)
     * @param body  (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
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 0 </td><td> default response </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call update1Async(String entityName, Long id, String body, final ApiCallback<Void> _callback) throws ApiException {

        okhttp3.Call localVarCall = update1ValidateBeforeCall(entityName, id, body, _callback);
        localVarApiClient.executeAsync(localVarCall, _callback);
        return localVarCall;
    }
}
