clients/java/src/main/java/io/swagger/client/api/SiteApi.java
<filename>clients/java/src/main/java/io/swagger/client/api/SiteApi.java/*
 * JBS Backend Service
 * Journalim Protocol Compatible Backend Service
 *
 * OpenAPI spec version: 0.0.1
 * Contact: efpyi@example.com
 *
 * 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.
 */

package io.swagger.client.api;

import io.swagger.client.ApiCallback;
import io.swagger.client.ApiClient;
import io.swagger.client.ApiException;
import io.swagger.client.ApiResponse;
import io.swagger.client.Configuration;
import io.swagger.client.Pair;
import io.swagger.client.ProgressRequestBody;
import io.swagger.client.ProgressResponseBody;

import com.google.gson.reflect.TypeToken;

import java.io.IOException;


import io.swagger.client.model.ErrorResponseModel;
import io.swagger.client.model.HTTPValidationError;
import io.swagger.client.model.SiteCreate;
import io.swagger.client.model.SiteLanguageCreate;
import io.swagger.client.model.SiteLanguageRead;
import io.swagger.client.model.SiteLanguageUpdate;
import io.swagger.client.model.SiteRead;
import io.swagger.client.model.SiteUpdate;
import io.swagger.client.model.SuccessResponseModel;

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

public class SiteApi {
    private ApiClient apiClient;

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

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

    public ApiClient getApiClient() {
        return apiClient;
    }

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

    /**
     * Build call for createSiteLanguageSiteLanguagesPost
     * @param body  (required)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public com.squareup.okhttp.Call createSiteLanguageSiteLanguagesPostCall(SiteLanguageCreate body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;
        
        // create path and map variables
        String localVarPath = "/site_languages";

        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 = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

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

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

        String[] localVarAuthNames = new String[] { "OAuth2PasswordBearer" };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call createSiteLanguageSiteLanguagesPostValidateBeforeCall(SiteLanguageCreate body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'body' is set
        if (body == null) {
            throw new ApiException("Missing the required parameter 'body' when calling createSiteLanguageSiteLanguagesPost(Async)");
        }
        
        com.squareup.okhttp.Call call = createSiteLanguageSiteLanguagesPostCall(body, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Create Site Language
     * Create a SiteLanguage.
     * @param body  (required)
     * @return SiteLanguageRead
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public SiteLanguageRead createSiteLanguageSiteLanguagesPost(SiteLanguageCreate body) throws ApiException {
        ApiResponse<SiteLanguageRead> resp = createSiteLanguageSiteLanguagesPostWithHttpInfo(body);
        return resp.getData();
    }

    /**
     * Create Site Language
     * Create a SiteLanguage.
     * @param body  (required)
     * @return ApiResponse&lt;SiteLanguageRead&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<SiteLanguageRead> createSiteLanguageSiteLanguagesPostWithHttpInfo(SiteLanguageCreate body) throws ApiException {
        com.squareup.okhttp.Call call = createSiteLanguageSiteLanguagesPostValidateBeforeCall(body, null, null);
        Type localVarReturnType = new TypeToken<SiteLanguageRead>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Create Site Language (asynchronously)
     * Create a SiteLanguage.
     * @param body  (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 createSiteLanguageSiteLanguagesPostAsync(SiteLanguageCreate body, final ApiCallback<SiteLanguageRead> 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 = createSiteLanguageSiteLanguagesPostValidateBeforeCall(body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<SiteLanguageRead>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for createSiteSitesPost
     * @param body  (required)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public com.squareup.okhttp.Call createSiteSitesPostCall(SiteCreate body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;
        
        // create path and map variables
        String localVarPath = "/sites";

        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 = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

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

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

        String[] localVarAuthNames = new String[] { "OAuth2PasswordBearer" };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call createSiteSitesPostValidateBeforeCall(SiteCreate body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'body' is set
        if (body == null) {
            throw new ApiException("Missing the required parameter 'body' when calling createSiteSitesPost(Async)");
        }
        
        com.squareup.okhttp.Call call = createSiteSitesPostCall(body, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Create Site
     * Create a Site.
     * @param body  (required)
     * @return SiteRead
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public SiteRead createSiteSitesPost(SiteCreate body) throws ApiException {
        ApiResponse<SiteRead> resp = createSiteSitesPostWithHttpInfo(body);
        return resp.getData();
    }

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

    /**
     * Create Site (asynchronously)
     * Create a Site.
     * @param body  (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 createSiteSitesPostAsync(SiteCreate body, final ApiCallback<SiteRead> 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 = createSiteSitesPostValidateBeforeCall(body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<SiteRead>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for deleteSiteLanguageSiteLanguagesSiteLanguageIdDelete
     * @param siteLanguageId  (required)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public com.squareup.okhttp.Call deleteSiteLanguageSiteLanguagesSiteLanguageIdDeleteCall(Integer siteLanguageId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/site_languages/{site_language_id}"
            .replaceAll("\\{" + "site_language_id" + "\\}", apiClient.escapeString(siteLanguageId.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 = 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[] { "OAuth2PasswordBearer" };
        return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call deleteSiteLanguageSiteLanguagesSiteLanguageIdDeleteValidateBeforeCall(Integer siteLanguageId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'siteLanguageId' is set
        if (siteLanguageId == null) {
            throw new ApiException("Missing the required parameter 'siteLanguageId' when calling deleteSiteLanguageSiteLanguagesSiteLanguageIdDelete(Async)");
        }
        
        com.squareup.okhttp.Call call = deleteSiteLanguageSiteLanguagesSiteLanguageIdDeleteCall(siteLanguageId, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Delete Site Language
     * 
     * @param siteLanguageId  (required)
     * @return SuccessResponseModel
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public SuccessResponseModel deleteSiteLanguageSiteLanguagesSiteLanguageIdDelete(Integer siteLanguageId) throws ApiException {
        ApiResponse<SuccessResponseModel> resp = deleteSiteLanguageSiteLanguagesSiteLanguageIdDeleteWithHttpInfo(siteLanguageId);
        return resp.getData();
    }

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

    /**
     * Delete Site Language (asynchronously)
     * 
     * @param siteLanguageId  (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 deleteSiteLanguageSiteLanguagesSiteLanguageIdDeleteAsync(Integer siteLanguageId, final ApiCallback<SuccessResponseModel> 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 = deleteSiteLanguageSiteLanguagesSiteLanguageIdDeleteValidateBeforeCall(siteLanguageId, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<SuccessResponseModel>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for deleteSiteSitesSiteIdDelete
     * @param siteId  (required)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public com.squareup.okhttp.Call deleteSiteSitesSiteIdDeleteCall(Integer siteId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/sites/{site_id}"
            .replaceAll("\\{" + "site_id" + "\\}", apiClient.escapeString(siteId.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 = 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[] { "OAuth2PasswordBearer" };
        return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call deleteSiteSitesSiteIdDeleteValidateBeforeCall(Integer siteId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'siteId' is set
        if (siteId == null) {
            throw new ApiException("Missing the required parameter 'siteId' when calling deleteSiteSitesSiteIdDelete(Async)");
        }
        
        com.squareup.okhttp.Call call = deleteSiteSitesSiteIdDeleteCall(siteId, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Delete Site
     * 
     * @param siteId  (required)
     * @return SuccessResponseModel
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public SuccessResponseModel deleteSiteSitesSiteIdDelete(Integer siteId) throws ApiException {
        ApiResponse<SuccessResponseModel> resp = deleteSiteSitesSiteIdDeleteWithHttpInfo(siteId);
        return resp.getData();
    }

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

    /**
     * Delete Site (asynchronously)
     * 
     * @param siteId  (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 deleteSiteSitesSiteIdDeleteAsync(Integer siteId, final ApiCallback<SuccessResponseModel> 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 = deleteSiteSitesSiteIdDeleteValidateBeforeCall(siteId, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<SuccessResponseModel>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for readSiteLanguageSiteLanguagesSiteLanguageIdGet
     * @param siteLanguageId  (required)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public com.squareup.okhttp.Call readSiteLanguageSiteLanguagesSiteLanguageIdGetCall(Integer siteLanguageId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/site_languages/{site_language_id}"
            .replaceAll("\\{" + "site_language_id" + "\\}", apiClient.escapeString(siteLanguageId.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 = 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[] {  };
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call readSiteLanguageSiteLanguagesSiteLanguageIdGetValidateBeforeCall(Integer siteLanguageId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'siteLanguageId' is set
        if (siteLanguageId == null) {
            throw new ApiException("Missing the required parameter 'siteLanguageId' when calling readSiteLanguageSiteLanguagesSiteLanguageIdGet(Async)");
        }
        
        com.squareup.okhttp.Call call = readSiteLanguageSiteLanguagesSiteLanguageIdGetCall(siteLanguageId, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Read Site Language
     * 
     * @param siteLanguageId  (required)
     * @return SiteLanguageRead
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public SiteLanguageRead readSiteLanguageSiteLanguagesSiteLanguageIdGet(Integer siteLanguageId) throws ApiException {
        ApiResponse<SiteLanguageRead> resp = readSiteLanguageSiteLanguagesSiteLanguageIdGetWithHttpInfo(siteLanguageId);
        return resp.getData();
    }

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

    /**
     * Read Site Language (asynchronously)
     * 
     * @param siteLanguageId  (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 readSiteLanguageSiteLanguagesSiteLanguageIdGetAsync(Integer siteLanguageId, final ApiCallback<SiteLanguageRead> 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 = readSiteLanguageSiteLanguagesSiteLanguageIdGetValidateBeforeCall(siteLanguageId, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<SiteLanguageRead>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for readSiteLanguagesSiteLanguagesGet
     * @param q  (optional)
     * @param offset  (optional, default to 0)
     * @param limit  (optional, default to 100)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public com.squareup.okhttp.Call readSiteLanguagesSiteLanguagesGetCall(String q, Integer offset, Integer limit, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/site_languages";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        if (q != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("q", q));
        if (offset != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("offset", offset));
        if (limit != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit));

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

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

        final String[] localVarAccepts = {
            "application/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[] {  };
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call readSiteLanguagesSiteLanguagesGetValidateBeforeCall(String q, Integer offset, Integer limit, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        com.squareup.okhttp.Call call = readSiteLanguagesSiteLanguagesGetCall(q, offset, limit, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Read Site Languages
     * Get all SiteLanguage.
     * @param q  (optional)
     * @param offset  (optional, default to 0)
     * @param limit  (optional, default to 100)
     * @return List&lt;SiteLanguageRead&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public List<SiteLanguageRead> readSiteLanguagesSiteLanguagesGet(String q, Integer offset, Integer limit) throws ApiException {
        ApiResponse<List<SiteLanguageRead>> resp = readSiteLanguagesSiteLanguagesGetWithHttpInfo(q, offset, limit);
        return resp.getData();
    }

    /**
     * Read Site Languages
     * Get all SiteLanguage.
     * @param q  (optional)
     * @param offset  (optional, default to 0)
     * @param limit  (optional, default to 100)
     * @return ApiResponse&lt;List&lt;SiteLanguageRead&gt;&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<List<SiteLanguageRead>> readSiteLanguagesSiteLanguagesGetWithHttpInfo(String q, Integer offset, Integer limit) throws ApiException {
        com.squareup.okhttp.Call call = readSiteLanguagesSiteLanguagesGetValidateBeforeCall(q, offset, limit, null, null);
        Type localVarReturnType = new TypeToken<List<SiteLanguageRead>>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Read Site Languages (asynchronously)
     * Get all SiteLanguage.
     * @param q  (optional)
     * @param offset  (optional, default to 0)
     * @param limit  (optional, default to 100)
     * @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 readSiteLanguagesSiteLanguagesGetAsync(String q, Integer offset, Integer limit, final ApiCallback<List<SiteLanguageRead>> 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 = readSiteLanguagesSiteLanguagesGetValidateBeforeCall(q, offset, limit, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<List<SiteLanguageRead>>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for readSiteSitesSiteIdGet
     * @param siteId  (required)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public com.squareup.okhttp.Call readSiteSitesSiteIdGetCall(Integer siteId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/sites/{site_id}"
            .replaceAll("\\{" + "site_id" + "\\}", apiClient.escapeString(siteId.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 = 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[] {  };
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call readSiteSitesSiteIdGetValidateBeforeCall(Integer siteId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'siteId' is set
        if (siteId == null) {
            throw new ApiException("Missing the required parameter 'siteId' when calling readSiteSitesSiteIdGet(Async)");
        }
        
        com.squareup.okhttp.Call call = readSiteSitesSiteIdGetCall(siteId, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Read Site
     * 
     * @param siteId  (required)
     * @return SiteRead
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public SiteRead readSiteSitesSiteIdGet(Integer siteId) throws ApiException {
        ApiResponse<SiteRead> resp = readSiteSitesSiteIdGetWithHttpInfo(siteId);
        return resp.getData();
    }

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

    /**
     * Read Site (asynchronously)
     * 
     * @param siteId  (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 readSiteSitesSiteIdGetAsync(Integer siteId, final ApiCallback<SiteRead> 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 = readSiteSitesSiteIdGetValidateBeforeCall(siteId, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<SiteRead>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for readSitesSitesGet
     * @param q  (optional)
     * @param offset  (optional, default to 0)
     * @param limit  (optional, default to 100)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public com.squareup.okhttp.Call readSitesSitesGetCall(String q, Integer offset, Integer limit, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/sites";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        if (q != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("q", q));
        if (offset != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("offset", offset));
        if (limit != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit));

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

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

        final String[] localVarAccepts = {
            "application/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[] {  };
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call readSitesSitesGetValidateBeforeCall(String q, Integer offset, Integer limit, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        com.squareup.okhttp.Call call = readSitesSitesGetCall(q, offset, limit, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Read Sites
     * Get all Site.
     * @param q  (optional)
     * @param offset  (optional, default to 0)
     * @param limit  (optional, default to 100)
     * @return List&lt;SiteRead&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public List<SiteRead> readSitesSitesGet(String q, Integer offset, Integer limit) throws ApiException {
        ApiResponse<List<SiteRead>> resp = readSitesSitesGetWithHttpInfo(q, offset, limit);
        return resp.getData();
    }

    /**
     * Read Sites
     * Get all Site.
     * @param q  (optional)
     * @param offset  (optional, default to 0)
     * @param limit  (optional, default to 100)
     * @return ApiResponse&lt;List&lt;SiteRead&gt;&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<List<SiteRead>> readSitesSitesGetWithHttpInfo(String q, Integer offset, Integer limit) throws ApiException {
        com.squareup.okhttp.Call call = readSitesSitesGetValidateBeforeCall(q, offset, limit, null, null);
        Type localVarReturnType = new TypeToken<List<SiteRead>>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Read Sites (asynchronously)
     * Get all Site.
     * @param q  (optional)
     * @param offset  (optional, default to 0)
     * @param limit  (optional, default to 100)
     * @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 readSitesSitesGetAsync(String q, Integer offset, Integer limit, final ApiCallback<List<SiteRead>> 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 = readSitesSitesGetValidateBeforeCall(q, offset, limit, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<List<SiteRead>>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for updateSiteLanguageSiteLanguagesSiteLanguageIdPatch
     * @param body  (required)
     * @param siteLanguageId  (required)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public com.squareup.okhttp.Call updateSiteLanguageSiteLanguagesSiteLanguageIdPatchCall(SiteLanguageUpdate body, Integer siteLanguageId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;
        
        // create path and map variables
        String localVarPath = "/site_languages/{site_language_id}"
            .replaceAll("\\{" + "site_language_id" + "\\}", apiClient.escapeString(siteLanguageId.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 = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

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

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

        String[] localVarAuthNames = new String[] { "OAuth2PasswordBearer" };
        return apiClient.buildCall(localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call updateSiteLanguageSiteLanguagesSiteLanguageIdPatchValidateBeforeCall(SiteLanguageUpdate body, Integer siteLanguageId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'body' is set
        if (body == null) {
            throw new ApiException("Missing the required parameter 'body' when calling updateSiteLanguageSiteLanguagesSiteLanguageIdPatch(Async)");
        }
        // verify the required parameter 'siteLanguageId' is set
        if (siteLanguageId == null) {
            throw new ApiException("Missing the required parameter 'siteLanguageId' when calling updateSiteLanguageSiteLanguagesSiteLanguageIdPatch(Async)");
        }
        
        com.squareup.okhttp.Call call = updateSiteLanguageSiteLanguagesSiteLanguageIdPatchCall(body, siteLanguageId, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Update Site Language
     * 
     * @param body  (required)
     * @param siteLanguageId  (required)
     * @return SiteLanguageRead
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public SiteLanguageRead updateSiteLanguageSiteLanguagesSiteLanguageIdPatch(SiteLanguageUpdate body, Integer siteLanguageId) throws ApiException {
        ApiResponse<SiteLanguageRead> resp = updateSiteLanguageSiteLanguagesSiteLanguageIdPatchWithHttpInfo(body, siteLanguageId);
        return resp.getData();
    }

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

    /**
     * Update Site Language (asynchronously)
     * 
     * @param body  (required)
     * @param siteLanguageId  (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 updateSiteLanguageSiteLanguagesSiteLanguageIdPatchAsync(SiteLanguageUpdate body, Integer siteLanguageId, final ApiCallback<SiteLanguageRead> 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 = updateSiteLanguageSiteLanguagesSiteLanguageIdPatchValidateBeforeCall(body, siteLanguageId, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<SiteLanguageRead>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for updateSiteSitesSiteIdPatch
     * @param body  (required)
     * @param siteId  (required)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public com.squareup.okhttp.Call updateSiteSitesSiteIdPatchCall(SiteUpdate body, Integer siteId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;
        
        // create path and map variables
        String localVarPath = "/sites/{site_id}"
            .replaceAll("\\{" + "site_id" + "\\}", apiClient.escapeString(siteId.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 = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

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

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

        String[] localVarAuthNames = new String[] { "OAuth2PasswordBearer" };
        return apiClient.buildCall(localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call updateSiteSitesSiteIdPatchValidateBeforeCall(SiteUpdate body, Integer siteId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'body' is set
        if (body == null) {
            throw new ApiException("Missing the required parameter 'body' when calling updateSiteSitesSiteIdPatch(Async)");
        }
        // verify the required parameter 'siteId' is set
        if (siteId == null) {
            throw new ApiException("Missing the required parameter 'siteId' when calling updateSiteSitesSiteIdPatch(Async)");
        }
        
        com.squareup.okhttp.Call call = updateSiteSitesSiteIdPatchCall(body, siteId, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Update Site
     * 
     * @param body  (required)
     * @param siteId  (required)
     * @return SiteRead
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public SiteRead updateSiteSitesSiteIdPatch(SiteUpdate body, Integer siteId) throws ApiException {
        ApiResponse<SiteRead> resp = updateSiteSitesSiteIdPatchWithHttpInfo(body, siteId);
        return resp.getData();
    }

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

    /**
     * Update Site (asynchronously)
     * 
     * @param body  (required)
     * @param siteId  (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 updateSiteSitesSiteIdPatchAsync(SiteUpdate body, Integer siteId, final ApiCallback<SiteRead> 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 = updateSiteSitesSiteIdPatchValidateBeforeCall(body, siteId, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<SiteRead>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
}
