/*
 * 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.ModelApiException;
import org.openapitools.client.model.OrderItem;
import org.openapitools.client.model.OrderItems;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class OrderItemsApi {
    private ApiClient localVarApiClient;

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

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

    public ApiClient getApiClient() {
        return localVarApiClient;
    }

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

    /**
     * Build call for createOrderItem
     * @param orderItem order-item object to be created (required)
     * @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> 201 </td><td> the created order-item </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Invalid inputs supplied </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call createOrderItemCall(OrderItem orderItem, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = orderItem;

        // create path and map variables
        String localVarPath = "/ordering/order-items";

        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 createOrderItemValidateBeforeCall(OrderItem orderItem, final ApiCallback _callback) throws ApiException {
        
        // verify the required parameter 'orderItem' is set
        if (orderItem == null) {
            throw new ApiException("Missing the required parameter 'orderItem' when calling createOrderItem(Async)");
        }
        

        okhttp3.Call localVarCall = createOrderItemCall(orderItem, _callback);
        return localVarCall;

    }

    /**
     * Returns the created order-item
     * Returns the created order-item
     * @param orderItem order-item object to be created (required)
     * @return OrderItem
     * @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> 201 </td><td> the created order-item </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Invalid inputs supplied </td><td>  -  </td></tr>
     </table>
     */
    public OrderItem createOrderItem(OrderItem orderItem) throws ApiException {
        ApiResponse<OrderItem> localVarResp = createOrderItemWithHttpInfo(orderItem);
        return localVarResp.getData();
    }

    /**
     * Returns the created order-item
     * Returns the created order-item
     * @param orderItem order-item object to be created (required)
     * @return ApiResponse&lt;OrderItem&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> 201 </td><td> the created order-item </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Invalid inputs supplied </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<OrderItem> createOrderItemWithHttpInfo(OrderItem orderItem) throws ApiException {
        okhttp3.Call localVarCall = createOrderItemValidateBeforeCall(orderItem, null);
        Type localVarReturnType = new TypeToken<OrderItem>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Returns the created order-item (asynchronously)
     * Returns the created order-item
     * @param orderItem order-item object to be created (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
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 201 </td><td> the created order-item </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Invalid inputs supplied </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call createOrderItemAsync(OrderItem orderItem, final ApiCallback<OrderItem> _callback) throws ApiException {

        okhttp3.Call localVarCall = createOrderItemValidateBeforeCall(orderItem, _callback);
        Type localVarReturnType = new TypeToken<OrderItem>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for deleteOrderItem
     * @param id id of the order-item to delete (required)
     * @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> the deleted order-item </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> order-item not found </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call deleteOrderItemCall(Long id, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/ordering/order-items/{id}"
            .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 = {
            
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

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

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

        okhttp3.Call localVarCall = deleteOrderItemCall(id, _callback);
        return localVarCall;

    }

    /**
     * delete an existing order-item
     * delete an existing order-item, and returns the deleted order-item
     * @param id id of the order-item to delete (required)
     * @return OrderItem
     * @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> the deleted order-item </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> order-item not found </td><td>  -  </td></tr>
     </table>
     */
    public OrderItem deleteOrderItem(Long id) throws ApiException {
        ApiResponse<OrderItem> localVarResp = deleteOrderItemWithHttpInfo(id);
        return localVarResp.getData();
    }

    /**
     * delete an existing order-item
     * delete an existing order-item, and returns the deleted order-item
     * @param id id of the order-item to delete (required)
     * @return ApiResponse&lt;OrderItem&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> the deleted order-item </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> order-item not found </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<OrderItem> deleteOrderItemWithHttpInfo(Long id) throws ApiException {
        okhttp3.Call localVarCall = deleteOrderItemValidateBeforeCall(id, null);
        Type localVarReturnType = new TypeToken<OrderItem>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * delete an existing order-item (asynchronously)
     * delete an existing order-item, and returns the deleted order-item
     * @param id id of the order-item to delete (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
     * @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> the deleted order-item </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> order-item not found </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call deleteOrderItemAsync(Long id, final ApiCallback<OrderItem> _callback) throws ApiException {

        okhttp3.Call localVarCall = deleteOrderItemValidateBeforeCall(id, _callback);
        Type localVarReturnType = new TypeToken<OrderItem>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for deleteOrderItem1
     * @param id ids of order-items to delete (required)
     * @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> 200 </td><td> the order-items deletion went ok  </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> order-item not found </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call deleteOrderItem1Call(List<Long> id, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/ordering/order-items";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        if (id != null) {
            localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "id", id));
        }

        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 = {
            
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

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

    @SuppressWarnings("rawtypes")
    private okhttp3.Call deleteOrderItem1ValidateBeforeCall(List<Long> id, final ApiCallback _callback) throws ApiException {
        
        // verify the required parameter 'id' is set
        if (id == null) {
            throw new ApiException("Missing the required parameter 'id' when calling deleteOrderItem1(Async)");
        }
        

        okhttp3.Call localVarCall = deleteOrderItem1Call(id, _callback);
        return localVarCall;

    }

    /**
     * delete more than one order-item
     * delete more than one order-item
     * @param id ids of order-items to delete (required)
     * @return String
     * @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> the order-items deletion went ok  </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> order-item not found </td><td>  -  </td></tr>
     </table>
     */
    public String deleteOrderItem1(List<Long> id) throws ApiException {
        ApiResponse<String> localVarResp = deleteOrderItem1WithHttpInfo(id);
        return localVarResp.getData();
    }

    /**
     * delete more than one order-item
     * delete more than one order-item
     * @param id ids of order-items to delete (required)
     * @return ApiResponse&lt;String&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> the order-items deletion went ok  </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> order-item not found </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<String> deleteOrderItem1WithHttpInfo(List<Long> id) throws ApiException {
        okhttp3.Call localVarCall = deleteOrderItem1ValidateBeforeCall(id, null);
        Type localVarReturnType = new TypeToken<String>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * delete more than one order-item (asynchronously)
     * delete more than one order-item
     * @param id ids of order-items to delete (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
     * @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> the order-items deletion went ok  </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> order-item not found </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call deleteOrderItem1Async(List<Long> id, final ApiCallback<String> _callback) throws ApiException {

        okhttp3.Call localVarCall = deleteOrderItem1ValidateBeforeCall(id, _callback);
        Type localVarReturnType = new TypeToken<String>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for getOrderItem
     * @param id id of the order-Item (required)
     * @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> the searched order-Item </td><td>  * ETag - a pseudo-unique identifier that represents the version of the data sent back <br>  </td></tr>
        <tr><td> 304 </td><td> Not Modified, Returned to the client when the cached copy of a particular resource is up to date with the server </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> order-Item not found </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getOrderItemCall(Long id, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/ordering/order-items/{id}"
            .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 = {
            
        };
        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 getOrderItemValidateBeforeCall(Long id, final ApiCallback _callback) throws ApiException {
        
        // verify the required parameter 'id' is set
        if (id == null) {
            throw new ApiException("Missing the required parameter 'id' when calling getOrderItem(Async)");
        }
        

        okhttp3.Call localVarCall = getOrderItemCall(id, _callback);
        return localVarCall;

    }

    /**
     * Return an order-Item
     * Returns a single order-Item
     * @param id id of the order-Item (required)
     * @return OrderItem
     * @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> the searched order-Item </td><td>  * ETag - a pseudo-unique identifier that represents the version of the data sent back <br>  </td></tr>
        <tr><td> 304 </td><td> Not Modified, Returned to the client when the cached copy of a particular resource is up to date with the server </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> order-Item not found </td><td>  -  </td></tr>
     </table>
     */
    public OrderItem getOrderItem(Long id) throws ApiException {
        ApiResponse<OrderItem> localVarResp = getOrderItemWithHttpInfo(id);
        return localVarResp.getData();
    }

    /**
     * Return an order-Item
     * Returns a single order-Item
     * @param id id of the order-Item (required)
     * @return ApiResponse&lt;OrderItem&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> the searched order-Item </td><td>  * ETag - a pseudo-unique identifier that represents the version of the data sent back <br>  </td></tr>
        <tr><td> 304 </td><td> Not Modified, Returned to the client when the cached copy of a particular resource is up to date with the server </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> order-Item not found </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<OrderItem> getOrderItemWithHttpInfo(Long id) throws ApiException {
        okhttp3.Call localVarCall = getOrderItemValidateBeforeCall(id, null);
        Type localVarReturnType = new TypeToken<OrderItem>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Return an order-Item (asynchronously)
     * Returns a single order-Item
     * @param id id of the order-Item (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
     * @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> the searched order-Item </td><td>  * ETag - a pseudo-unique identifier that represents the version of the data sent back <br>  </td></tr>
        <tr><td> 304 </td><td> Not Modified, Returned to the client when the cached copy of a particular resource is up to date with the server </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> order-Item not found </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getOrderItemAsync(Long id, final ApiCallback<OrderItem> _callback) throws ApiException {

        okhttp3.Call localVarCall = getOrderItemValidateBeforeCall(id, _callback);
        Type localVarReturnType = new TypeToken<OrderItem>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for getOrderItems
     * @param offset  (optional, default to 0l)
     * @param limit  (optional, default to 50l)
     * @param sort  (optional)
     * @param orderBy  (optional)
     * @param filter  (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> list of order-items </td><td>  * ETag - a pseudo-unique identifier that represents the version of the data sent back. <br>  </td></tr>
        <tr><td> 304 </td><td> Not Modified, Returned to the client when the cached copy of a particular file is up to date with the server </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Invalid parameters supplied </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getOrderItemsCall(Long offset, Long limit, String sort, String orderBy, String filter, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/ordering/order-items";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        if (offset != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset));
        }

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

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

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

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

        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 = {
            
        };
        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 getOrderItemsValidateBeforeCall(Long offset, Long limit, String sort, String orderBy, String filter, final ApiCallback _callback) throws ApiException {
        

        okhttp3.Call localVarCall = getOrderItemsCall(offset, limit, sort, orderBy, filter, _callback);
        return localVarCall;

    }

    /**
     * Return a list of order-items
     * Returns a list of order-items with pagination feature or non integers will simulate API error conditions
     * @param offset  (optional, default to 0l)
     * @param limit  (optional, default to 50l)
     * @param sort  (optional)
     * @param orderBy  (optional)
     * @param filter  (optional)
     * @return OrderItems
     * @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> list of order-items </td><td>  * ETag - a pseudo-unique identifier that represents the version of the data sent back. <br>  </td></tr>
        <tr><td> 304 </td><td> Not Modified, Returned to the client when the cached copy of a particular file is up to date with the server </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Invalid parameters supplied </td><td>  -  </td></tr>
     </table>
     */
    public OrderItems getOrderItems(Long offset, Long limit, String sort, String orderBy, String filter) throws ApiException {
        ApiResponse<OrderItems> localVarResp = getOrderItemsWithHttpInfo(offset, limit, sort, orderBy, filter);
        return localVarResp.getData();
    }

    /**
     * Return a list of order-items
     * Returns a list of order-items with pagination feature or non integers will simulate API error conditions
     * @param offset  (optional, default to 0l)
     * @param limit  (optional, default to 50l)
     * @param sort  (optional)
     * @param orderBy  (optional)
     * @param filter  (optional)
     * @return ApiResponse&lt;OrderItems&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> list of order-items </td><td>  * ETag - a pseudo-unique identifier that represents the version of the data sent back. <br>  </td></tr>
        <tr><td> 304 </td><td> Not Modified, Returned to the client when the cached copy of a particular file is up to date with the server </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Invalid parameters supplied </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<OrderItems> getOrderItemsWithHttpInfo(Long offset, Long limit, String sort, String orderBy, String filter) throws ApiException {
        okhttp3.Call localVarCall = getOrderItemsValidateBeforeCall(offset, limit, sort, orderBy, filter, null);
        Type localVarReturnType = new TypeToken<OrderItems>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Return a list of order-items (asynchronously)
     * Returns a list of order-items with pagination feature or non integers will simulate API error conditions
     * @param offset  (optional, default to 0l)
     * @param limit  (optional, default to 50l)
     * @param sort  (optional)
     * @param orderBy  (optional)
     * @param filter  (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> list of order-items </td><td>  * ETag - a pseudo-unique identifier that represents the version of the data sent back. <br>  </td></tr>
        <tr><td> 304 </td><td> Not Modified, Returned to the client when the cached copy of a particular file is up to date with the server </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Invalid parameters supplied </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getOrderItemsAsync(Long offset, Long limit, String sort, String orderBy, String filter, final ApiCallback<OrderItems> _callback) throws ApiException {

        okhttp3.Call localVarCall = getOrderItemsValidateBeforeCall(offset, limit, sort, orderBy, filter, _callback);
        Type localVarReturnType = new TypeToken<OrderItems>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for patchOrderItem
     * @param id id of the order-item to update (required)
     * @param orderItem order-item object to be update (required)
     * @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> the updated order-item </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Invalid inputs supplied </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> order-item not found </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call patchOrderItemCall(Long id, OrderItem orderItem, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = orderItem;

        // create path and map variables
        String localVarPath = "/ordering/order-items/{id}"
            .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, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
    }

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

        okhttp3.Call localVarCall = patchOrderItemCall(id, orderItem, _callback);
        return localVarCall;

    }

    /**
     * partially update an existing order-item
     * update an existing order-item with a set of changes to apply to the order-item, and returns the updated order-item
     * @param id id of the order-item to update (required)
     * @param orderItem order-item object to be update (required)
     * @return OrderItem
     * @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> the updated order-item </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Invalid inputs supplied </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> order-item not found </td><td>  -  </td></tr>
     </table>
     */
    public OrderItem patchOrderItem(Long id, OrderItem orderItem) throws ApiException {
        ApiResponse<OrderItem> localVarResp = patchOrderItemWithHttpInfo(id, orderItem);
        return localVarResp.getData();
    }

    /**
     * partially update an existing order-item
     * update an existing order-item with a set of changes to apply to the order-item, and returns the updated order-item
     * @param id id of the order-item to update (required)
     * @param orderItem order-item object to be update (required)
     * @return ApiResponse&lt;OrderItem&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> the updated order-item </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Invalid inputs supplied </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> order-item not found </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<OrderItem> patchOrderItemWithHttpInfo(Long id, OrderItem orderItem) throws ApiException {
        okhttp3.Call localVarCall = patchOrderItemValidateBeforeCall(id, orderItem, null);
        Type localVarReturnType = new TypeToken<OrderItem>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * partially update an existing order-item (asynchronously)
     * update an existing order-item with a set of changes to apply to the order-item, and returns the updated order-item
     * @param id id of the order-item to update (required)
     * @param orderItem order-item object to be update (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
     * @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> the updated order-item </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Invalid inputs supplied </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> order-item not found </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call patchOrderItemAsync(Long id, OrderItem orderItem, final ApiCallback<OrderItem> _callback) throws ApiException {

        okhttp3.Call localVarCall = patchOrderItemValidateBeforeCall(id, orderItem, _callback);
        Type localVarReturnType = new TypeToken<OrderItem>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for updateOrderItem
     * @param id id of the order-item to update (required)
     * @param orderItem order-item object to be update (required)
     * @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> the updated order-item </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Invalid inputs supplied </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> order-item not found </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call updateOrderItemCall(Long id, OrderItem orderItem, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = orderItem;

        // create path and map variables
        String localVarPath = "/ordering/order-items/{id}"
            .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, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
    }

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

        okhttp3.Call localVarCall = updateOrderItemCall(id, orderItem, _callback);
        return localVarCall;

    }

    /**
     * update an existing order-item
     * update an existing order-item, and returns the updated order-item
     * @param id id of the order-item to update (required)
     * @param orderItem order-item object to be update (required)
     * @return OrderItem
     * @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> the updated order-item </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Invalid inputs supplied </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> order-item not found </td><td>  -  </td></tr>
     </table>
     */
    public OrderItem updateOrderItem(Long id, OrderItem orderItem) throws ApiException {
        ApiResponse<OrderItem> localVarResp = updateOrderItemWithHttpInfo(id, orderItem);
        return localVarResp.getData();
    }

    /**
     * update an existing order-item
     * update an existing order-item, and returns the updated order-item
     * @param id id of the order-item to update (required)
     * @param orderItem order-item object to be update (required)
     * @return ApiResponse&lt;OrderItem&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> the updated order-item </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Invalid inputs supplied </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> order-item not found </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<OrderItem> updateOrderItemWithHttpInfo(Long id, OrderItem orderItem) throws ApiException {
        okhttp3.Call localVarCall = updateOrderItemValidateBeforeCall(id, orderItem, null);
        Type localVarReturnType = new TypeToken<OrderItem>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * update an existing order-item (asynchronously)
     * update an existing order-item, and returns the updated order-item
     * @param id id of the order-item to update (required)
     * @param orderItem order-item object to be update (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
     * @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> the updated order-item </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Invalid inputs supplied </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> order-item not found </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call updateOrderItemAsync(Long id, OrderItem orderItem, final ApiCallback<OrderItem> _callback) throws ApiException {

        okhttp3.Call localVarCall = updateOrderItemValidateBeforeCall(id, orderItem, _callback);
        Type localVarReturnType = new TypeToken<OrderItem>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
}
