abtlibrary.utils.as24ApiClient.api.VehiclesApi.java Source code

Java tutorial

Introduction

Here is the source code for abtlibrary.utils.as24ApiClient.api.VehiclesApi.java

Source

/**
 * AS24 API v4.1
 * No descripton provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
 *
 * OpenAPI spec version: v4.1
 * 
 *
 * 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 abtlibrary.utils.as24ApiClient.api;

import abtlibrary.utils.as24ApiClient.ApiCallback;
import abtlibrary.utils.as24ApiClient.ApiClient;
import abtlibrary.utils.as24ApiClient.ApiException;
import abtlibrary.utils.as24ApiClient.ApiResponse;
import abtlibrary.utils.as24ApiClient.Configuration;
import abtlibrary.utils.as24ApiClient.Pair;
import abtlibrary.utils.as24ApiClient.ProgressRequestBody;
import abtlibrary.utils.as24ApiClient.ProgressResponseBody;

import com.google.gson.reflect.TypeToken;

import java.io.IOException;

import abtlibrary.utils.as24ApiClient.model.ResponseMessageCollectionListAd;
import abtlibrary.utils.as24ApiClient.model.ResponseMessageCount;
import abtlibrary.utils.as24ApiClient.model.ResponseMessageAd;
import abtlibrary.utils.as24ApiClient.model.ResponseMessageBoolean;
import abtlibrary.utils.as24ApiClient.model.ResponseMessageLeasing;

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

public class VehiclesApi {
    private ApiClient apiClient;

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

    public VehiclesApi(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return apiClient;
    }

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

    /* Build call for gETpublicV41Vehicles */
    private com.squareup.okhttp.Call gETpublicV41VehiclesCall(Integer skip, Integer take, String filter,
            final ProgressResponseBody.ProgressListener progressListener,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // verify the required parameter 'skip' is set
        if (skip == null) {
            throw new ApiException(
                    "Missing the required parameter 'skip' when calling gETpublicV41Vehicles(Async)");
        }

        // verify the required parameter 'take' is set
        if (take == null) {
            throw new ApiException(
                    "Missing the required parameter 'take' when calling gETpublicV41Vehicles(Async)");
        }

        // create path and map variables
        String localVarPath = "/public/v4.1/vehicles".replaceAll("\\{format\\}", "json");

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        if (skip != null)
            localVarQueryParams.addAll(apiClient.parameterToPairs("", "skip", skip));
        if (take != null)
            localVarQueryParams.addAll(apiClient.parameterToPairs("", "take", take));
        if (filter != null)
            localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter", filter));

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

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

        final String[] localVarContentTypes = {

        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if (progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain)
                        throws IOException {
                    com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                            .body(new ProgressResponseBody(originalResponse.body(), progressListener)).build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "oauth2" };
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams,
                localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    /**
     * 
     * 
     * @param skip  (required)
     * @param take  (required)
     * @param filter  (optional)
     * @return ResponseMessageCollectionListAd
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ResponseMessageCollectionListAd gETpublicV41Vehicles(Integer skip, Integer take, String filter)
            throws ApiException {
        ApiResponse<ResponseMessageCollectionListAd> resp = gETpublicV41VehiclesWithHttpInfo(skip, take, filter);
        return resp.getData();
    }

    /**
     * 
     * 
     * @param skip  (required)
     * @param take  (required)
     * @param filter  (optional)
     * @return ApiResponse&lt;ResponseMessageCollectionListAd&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ResponseMessageCollectionListAd> gETpublicV41VehiclesWithHttpInfo(Integer skip, Integer take,
            String filter) throws ApiException {
        com.squareup.okhttp.Call call = gETpublicV41VehiclesCall(skip, take, filter, null, null);
        Type localVarReturnType = new TypeToken<ResponseMessageCollectionListAd>() {
        }.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     *  (asynchronously)
     * 
     * @param skip  (required)
     * @param take  (required)
     * @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
     */
    public com.squareup.okhttp.Call gETpublicV41VehiclesAsync(Integer skip, Integer take, String filter,
            final ApiCallback<ResponseMessageCollectionListAd> 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 = gETpublicV41VehiclesCall(skip, take, filter, progressListener,
                progressRequestListener);
        Type localVarReturnType = new TypeToken<ResponseMessageCollectionListAd>() {
        }.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }

    /* Build call for gETpublicV41VehiclesCount */
    private com.squareup.okhttp.Call gETpublicV41VehiclesCountCall(String filter,
            final ProgressResponseBody.ProgressListener progressListener,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/public/v4.1/vehicles/count".replaceAll("\\{format\\}", "json");

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        if (filter != null)
            localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter", filter));

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

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

        final String[] localVarContentTypes = {

        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if (progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain)
                        throws IOException {
                    com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                            .body(new ProgressResponseBody(originalResponse.body(), progressListener)).build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "oauth2" };
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams,
                localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    /**
     * 
     * 
     * @param filter  (optional)
     * @return ResponseMessageCount
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ResponseMessageCount gETpublicV41VehiclesCount(String filter) throws ApiException {
        ApiResponse<ResponseMessageCount> resp = gETpublicV41VehiclesCountWithHttpInfo(filter);
        return resp.getData();
    }

    /**
     * 
     * 
     * @param filter  (optional)
     * @return ApiResponse&lt;ResponseMessageCount&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ResponseMessageCount> gETpublicV41VehiclesCountWithHttpInfo(String filter)
            throws ApiException {
        com.squareup.okhttp.Call call = gETpublicV41VehiclesCountCall(filter, null, null);
        Type localVarReturnType = new TypeToken<ResponseMessageCount>() {
        }.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     *  (asynchronously)
     * 
     * @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
     */
    public com.squareup.okhttp.Call gETpublicV41VehiclesCountAsync(String filter,
            final ApiCallback<ResponseMessageCount> 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 = gETpublicV41VehiclesCountCall(filter, progressListener,
                progressRequestListener);
        Type localVarReturnType = new TypeToken<ResponseMessageCount>() {
        }.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }

    /* Build call for gETpublicV41VehiclesId */
    private com.squareup.okhttp.Call gETpublicV41VehiclesIdCall(Integer id,
            final ProgressResponseBody.ProgressListener progressListener,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // verify the required parameter 'id' is set
        if (id == null) {
            throw new ApiException(
                    "Missing the required parameter 'id' when calling gETpublicV41VehiclesId(Async)");
        }

        // create path and map variables
        String localVarPath = "/public/v4.1/vehicles/{id}".replaceAll("\\{format\\}", "json")
                .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

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

        final String[] localVarContentTypes = {

        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if (progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain)
                        throws IOException {
                    com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                            .body(new ProgressResponseBody(originalResponse.body(), progressListener)).build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "oauth2" };
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams,
                localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    /**
     * 
     * 
     * @param id  (required)
     * @return ResponseMessageAd
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ResponseMessageAd gETpublicV41VehiclesId(Integer id) throws ApiException {
        ApiResponse<ResponseMessageAd> resp = gETpublicV41VehiclesIdWithHttpInfo(id);
        return resp.getData();
    }

    /**
     * 
     * 
     * @param id  (required)
     * @return ApiResponse&lt;ResponseMessageAd&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ResponseMessageAd> gETpublicV41VehiclesIdWithHttpInfo(Integer id) throws ApiException {
        com.squareup.okhttp.Call call = gETpublicV41VehiclesIdCall(id, null, null);
        Type localVarReturnType = new TypeToken<ResponseMessageAd>() {
        }.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     *  (asynchronously)
     * 
     * @param id  (required)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public com.squareup.okhttp.Call gETpublicV41VehiclesIdAsync(Integer id,
            final ApiCallback<ResponseMessageAd> 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 = gETpublicV41VehiclesIdCall(id, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ResponseMessageAd>() {
        }.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }

    /* Build call for gETpublicV41VehiclesVehicleidAlternatives */
    private com.squareup.okhttp.Call gETpublicV41VehiclesVehicleidAlternativesCall(Integer vehicleId, String filter,
            final ProgressResponseBody.ProgressListener progressListener,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // verify the required parameter 'vehicleId' is set
        if (vehicleId == null) {
            throw new ApiException(
                    "Missing the required parameter 'vehicleId' when calling gETpublicV41VehiclesVehicleidAlternatives(Async)");
        }

        // create path and map variables
        String localVarPath = "/public/v4.1/vehicles/{vehicleId}/alternatives".replaceAll("\\{format\\}", "json")
                .replaceAll("\\{" + "vehicleId" + "\\}", apiClient.escapeString(vehicleId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        if (filter != null)
            localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter", filter));

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

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

        final String[] localVarContentTypes = {

        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if (progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain)
                        throws IOException {
                    com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                            .body(new ProgressResponseBody(originalResponse.body(), progressListener)).build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "oauth2" };
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams,
                localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    /**
     * 
     * 
     * @param vehicleId  (required)
     * @param filter  (optional)
     * @return ResponseMessageCollectionListAd
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ResponseMessageCollectionListAd gETpublicV41VehiclesVehicleidAlternatives(Integer vehicleId,
            String filter) throws ApiException {
        ApiResponse<ResponseMessageCollectionListAd> resp = gETpublicV41VehiclesVehicleidAlternativesWithHttpInfo(
                vehicleId, filter);
        return resp.getData();
    }

    /**
     * 
     * 
     * @param vehicleId  (required)
     * @param filter  (optional)
     * @return ApiResponse&lt;ResponseMessageCollectionListAd&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ResponseMessageCollectionListAd> gETpublicV41VehiclesVehicleidAlternativesWithHttpInfo(
            Integer vehicleId, String filter) throws ApiException {
        com.squareup.okhttp.Call call = gETpublicV41VehiclesVehicleidAlternativesCall(vehicleId, filter, null,
                null);
        Type localVarReturnType = new TypeToken<ResponseMessageCollectionListAd>() {
        }.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     *  (asynchronously)
     * 
     * @param vehicleId  (required)
     * @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
     */
    public com.squareup.okhttp.Call gETpublicV41VehiclesVehicleidAlternativesAsync(Integer vehicleId, String filter,
            final ApiCallback<ResponseMessageCollectionListAd> 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 = gETpublicV41VehiclesVehicleidAlternativesCall(vehicleId, filter,
                progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ResponseMessageCollectionListAd>() {
        }.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }

    /* Build call for gETpublicV41VehiclesVehicleidIsonline */
    private com.squareup.okhttp.Call gETpublicV41VehiclesVehicleidIsonlineCall(Integer vehicleId,
            final ProgressResponseBody.ProgressListener progressListener,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // verify the required parameter 'vehicleId' is set
        if (vehicleId == null) {
            throw new ApiException(
                    "Missing the required parameter 'vehicleId' when calling gETpublicV41VehiclesVehicleidIsonline(Async)");
        }

        // create path and map variables
        String localVarPath = "/public/v4.1/vehicles/{vehicleId}/isonline".replaceAll("\\{format\\}", "json")
                .replaceAll("\\{" + "vehicleId" + "\\}", apiClient.escapeString(vehicleId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

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

        final String[] localVarContentTypes = {

        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if (progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain)
                        throws IOException {
                    com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                            .body(new ProgressResponseBody(originalResponse.body(), progressListener)).build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "oauth2" };
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams,
                localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    /**
     * 
     * 
     * @param vehicleId  (required)
     * @return ResponseMessageBoolean
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ResponseMessageBoolean gETpublicV41VehiclesVehicleidIsonline(Integer vehicleId) throws ApiException {
        ApiResponse<ResponseMessageBoolean> resp = gETpublicV41VehiclesVehicleidIsonlineWithHttpInfo(vehicleId);
        return resp.getData();
    }

    /**
     * 
     * 
     * @param vehicleId  (required)
     * @return ApiResponse&lt;ResponseMessageBoolean&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ResponseMessageBoolean> gETpublicV41VehiclesVehicleidIsonlineWithHttpInfo(Integer vehicleId)
            throws ApiException {
        com.squareup.okhttp.Call call = gETpublicV41VehiclesVehicleidIsonlineCall(vehicleId, null, null);
        Type localVarReturnType = new TypeToken<ResponseMessageBoolean>() {
        }.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     *  (asynchronously)
     * 
     * @param vehicleId  (required)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public com.squareup.okhttp.Call gETpublicV41VehiclesVehicleidIsonlineAsync(Integer vehicleId,
            final ApiCallback<ResponseMessageBoolean> 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 = gETpublicV41VehiclesVehicleidIsonlineCall(vehicleId, progressListener,
                progressRequestListener);
        Type localVarReturnType = new TypeToken<ResponseMessageBoolean>() {
        }.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }

    /* Build call for gETpublicV41VehiclesVehicleidLeasing */
    private com.squareup.okhttp.Call gETpublicV41VehiclesVehicleidLeasingCall(Integer vehicleId,
            final ProgressResponseBody.ProgressListener progressListener,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // verify the required parameter 'vehicleId' is set
        if (vehicleId == null) {
            throw new ApiException(
                    "Missing the required parameter 'vehicleId' when calling gETpublicV41VehiclesVehicleidLeasing(Async)");
        }

        // create path and map variables
        String localVarPath = "/public/v4.1/vehicles/{vehicleId}/leasing".replaceAll("\\{format\\}", "json")
                .replaceAll("\\{" + "vehicleId" + "\\}", apiClient.escapeString(vehicleId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

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

        final String[] localVarContentTypes = {

        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if (progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain)
                        throws IOException {
                    com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                            .body(new ProgressResponseBody(originalResponse.body(), progressListener)).build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "oauth2" };
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams,
                localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    /**
     * 
     * 
     * @param vehicleId  (required)
     * @return ResponseMessageLeasing
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ResponseMessageLeasing gETpublicV41VehiclesVehicleidLeasing(Integer vehicleId) throws ApiException {
        ApiResponse<ResponseMessageLeasing> resp = gETpublicV41VehiclesVehicleidLeasingWithHttpInfo(vehicleId);
        return resp.getData();
    }

    /**
     * 
     * 
     * @param vehicleId  (required)
     * @return ApiResponse&lt;ResponseMessageLeasing&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ResponseMessageLeasing> gETpublicV41VehiclesVehicleidLeasingWithHttpInfo(Integer vehicleId)
            throws ApiException {
        com.squareup.okhttp.Call call = gETpublicV41VehiclesVehicleidLeasingCall(vehicleId, null, null);
        Type localVarReturnType = new TypeToken<ResponseMessageLeasing>() {
        }.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     *  (asynchronously)
     * 
     * @param vehicleId  (required)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public com.squareup.okhttp.Call gETpublicV41VehiclesVehicleidLeasingAsync(Integer vehicleId,
            final ApiCallback<ResponseMessageLeasing> 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 = gETpublicV41VehiclesVehicleidLeasingCall(vehicleId, progressListener,
                progressRequestListener);
        Type localVarReturnType = new TypeToken<ResponseMessageLeasing>() {
        }.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
}