clients/java/src/main/java/io/swagger/client/api/PublicationApi.java
/*
 * JBS Backend Service
 * Journalim Protocol Compatible Backend Service
 *
 * OpenAPI spec version: 0.0.1
 * Contact: envkt@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.PublicationCreate;
import io.swagger.client.model.PublicationLanguageCreate;
import io.swagger.client.model.PublicationLanguageRead;
import io.swagger.client.model.PublicationLanguageUpdate;
import io.swagger.client.model.PublicationRead;
import io.swagger.client.model.PublicationUpdate;
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 PublicationApi {
    private ApiClient apiClient;

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

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

    public ApiClient getApiClient() {
        return apiClient;
    }

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

    /**
     * Build call for createPublicationLanguagePublicationLanguagesPost
     * @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 createPublicationLanguagePublicationLanguagesPostCall(PublicationLanguageCreate body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;
        
        // create path and map variables
        String localVarPath = "/publication_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 createPublicationLanguagePublicationLanguagesPostValidateBeforeCall(PublicationLanguageCreate 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 createPublicationLanguagePublicationLanguagesPost(Async)");
        }
        
        com.squareup.okhttp.Call call = createPublicationLanguagePublicationLanguagesPostCall(body, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Create Publication Language
     * Create a PublicationLanguage.
     * @param body  (required)
     * @return PublicationLanguageRead
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public PublicationLanguageRead createPublicationLanguagePublicationLanguagesPost(PublicationLanguageCreate body) throws ApiException {
        ApiResponse<PublicationLanguageRead> resp = createPublicationLanguagePublicationLanguagesPostWithHttpInfo(body);
        return resp.getData();
    }

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

    /**
     * Create Publication Language (asynchronously)
     * Create a PublicationLanguage.
     * @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 createPublicationLanguagePublicationLanguagesPostAsync(PublicationLanguageCreate body, final ApiCallback<PublicationLanguageRead> 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 = createPublicationLanguagePublicationLanguagesPostValidateBeforeCall(body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<PublicationLanguageRead>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for createPublicationPublicationsPost
     * @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 createPublicationPublicationsPostCall(PublicationCreate body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;
        
        // create path and map variables
        String localVarPath = "/publications";

        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 createPublicationPublicationsPostValidateBeforeCall(PublicationCreate 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 createPublicationPublicationsPost(Async)");
        }
        
        com.squareup.okhttp.Call call = createPublicationPublicationsPostCall(body, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Create Publication
     * Create a Publication.
     * @param body  (required)
     * @return PublicationRead
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public PublicationRead createPublicationPublicationsPost(PublicationCreate body) throws ApiException {
        ApiResponse<PublicationRead> resp = createPublicationPublicationsPostWithHttpInfo(body);
        return resp.getData();
    }

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

    /**
     * Create Publication (asynchronously)
     * Create a Publication.
     * @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 createPublicationPublicationsPostAsync(PublicationCreate body, final ApiCallback<PublicationRead> 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 = createPublicationPublicationsPostValidateBeforeCall(body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<PublicationRead>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for deletePublicationLanguagePublicationLanguagesPublicationLanguageIdDelete
     * @param publicationLanguageId  (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 deletePublicationLanguagePublicationLanguagesPublicationLanguageIdDeleteCall(Integer publicationLanguageId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/publication_languages/{publication_language_id}"
            .replaceAll("\\{" + "publication_language_id" + "\\}", apiClient.escapeString(publicationLanguageId.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 deletePublicationLanguagePublicationLanguagesPublicationLanguageIdDeleteValidateBeforeCall(Integer publicationLanguageId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'publicationLanguageId' is set
        if (publicationLanguageId == null) {
            throw new ApiException("Missing the required parameter 'publicationLanguageId' when calling deletePublicationLanguagePublicationLanguagesPublicationLanguageIdDelete(Async)");
        }
        
        com.squareup.okhttp.Call call = deletePublicationLanguagePublicationLanguagesPublicationLanguageIdDeleteCall(publicationLanguageId, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

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

    /**
     * Delete Publication Language
     * 
     * @param publicationLanguageId  (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> deletePublicationLanguagePublicationLanguagesPublicationLanguageIdDeleteWithHttpInfo(Integer publicationLanguageId) throws ApiException {
        com.squareup.okhttp.Call call = deletePublicationLanguagePublicationLanguagesPublicationLanguageIdDeleteValidateBeforeCall(publicationLanguageId, null, null);
        Type localVarReturnType = new TypeToken<SuccessResponseModel>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Delete Publication Language (asynchronously)
     * 
     * @param publicationLanguageId  (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 deletePublicationLanguagePublicationLanguagesPublicationLanguageIdDeleteAsync(Integer publicationLanguageId, 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 = deletePublicationLanguagePublicationLanguagesPublicationLanguageIdDeleteValidateBeforeCall(publicationLanguageId, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<SuccessResponseModel>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for deletePublicationPublicationsPublicationIdDelete
     * @param publicationId  (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 deletePublicationPublicationsPublicationIdDeleteCall(Integer publicationId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/publications/{publication_id}"
            .replaceAll("\\{" + "publication_id" + "\\}", apiClient.escapeString(publicationId.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 deletePublicationPublicationsPublicationIdDeleteValidateBeforeCall(Integer publicationId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'publicationId' is set
        if (publicationId == null) {
            throw new ApiException("Missing the required parameter 'publicationId' when calling deletePublicationPublicationsPublicationIdDelete(Async)");
        }
        
        com.squareup.okhttp.Call call = deletePublicationPublicationsPublicationIdDeleteCall(publicationId, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

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

    /**
     * Delete Publication
     * 
     * @param publicationId  (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> deletePublicationPublicationsPublicationIdDeleteWithHttpInfo(Integer publicationId) throws ApiException {
        com.squareup.okhttp.Call call = deletePublicationPublicationsPublicationIdDeleteValidateBeforeCall(publicationId, null, null);
        Type localVarReturnType = new TypeToken<SuccessResponseModel>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Delete Publication (asynchronously)
     * 
     * @param publicationId  (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 deletePublicationPublicationsPublicationIdDeleteAsync(Integer publicationId, 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 = deletePublicationPublicationsPublicationIdDeleteValidateBeforeCall(publicationId, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<SuccessResponseModel>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for readPublicationLanguagePublicationLanguagesPublicationLanguageIdGet
     * @param publicationLanguageId  (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 readPublicationLanguagePublicationLanguagesPublicationLanguageIdGetCall(Integer publicationLanguageId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/publication_languages/{publication_language_id}"
            .replaceAll("\\{" + "publication_language_id" + "\\}", apiClient.escapeString(publicationLanguageId.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 readPublicationLanguagePublicationLanguagesPublicationLanguageIdGetValidateBeforeCall(Integer publicationLanguageId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'publicationLanguageId' is set
        if (publicationLanguageId == null) {
            throw new ApiException("Missing the required parameter 'publicationLanguageId' when calling readPublicationLanguagePublicationLanguagesPublicationLanguageIdGet(Async)");
        }
        
        com.squareup.okhttp.Call call = readPublicationLanguagePublicationLanguagesPublicationLanguageIdGetCall(publicationLanguageId, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

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

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

    /**
     * Read Publication Language (asynchronously)
     * 
     * @param publicationLanguageId  (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 readPublicationLanguagePublicationLanguagesPublicationLanguageIdGetAsync(Integer publicationLanguageId, final ApiCallback<PublicationLanguageRead> 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 = readPublicationLanguagePublicationLanguagesPublicationLanguageIdGetValidateBeforeCall(publicationLanguageId, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<PublicationLanguageRead>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for readPublicationLanguagesPublicationLanguagesGet
     * @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 readPublicationLanguagesPublicationLanguagesGetCall(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 = "/publication_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 readPublicationLanguagesPublicationLanguagesGetValidateBeforeCall(String q, Integer offset, Integer limit, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        com.squareup.okhttp.Call call = readPublicationLanguagesPublicationLanguagesGetCall(q, offset, limit, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

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

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

    /**
     * Read Publication Languages (asynchronously)
     * Get all PublicationLanguage.
     * @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 readPublicationLanguagesPublicationLanguagesGetAsync(String q, Integer offset, Integer limit, final ApiCallback<List<PublicationLanguageRead>> 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 = readPublicationLanguagesPublicationLanguagesGetValidateBeforeCall(q, offset, limit, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<List<PublicationLanguageRead>>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for readPublicationPublicationsPublicationIdGet
     * @param publicationId  (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 readPublicationPublicationsPublicationIdGetCall(Integer publicationId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/publications/{publication_id}"
            .replaceAll("\\{" + "publication_id" + "\\}", apiClient.escapeString(publicationId.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 readPublicationPublicationsPublicationIdGetValidateBeforeCall(Integer publicationId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'publicationId' is set
        if (publicationId == null) {
            throw new ApiException("Missing the required parameter 'publicationId' when calling readPublicationPublicationsPublicationIdGet(Async)");
        }
        
        com.squareup.okhttp.Call call = readPublicationPublicationsPublicationIdGetCall(publicationId, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Read Publication
     * 
     * @param publicationId  (required)
     * @return PublicationRead
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public PublicationRead readPublicationPublicationsPublicationIdGet(Integer publicationId) throws ApiException {
        ApiResponse<PublicationRead> resp = readPublicationPublicationsPublicationIdGetWithHttpInfo(publicationId);
        return resp.getData();
    }

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

    /**
     * Read Publication (asynchronously)
     * 
     * @param publicationId  (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 readPublicationPublicationsPublicationIdGetAsync(Integer publicationId, final ApiCallback<PublicationRead> 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 = readPublicationPublicationsPublicationIdGetValidateBeforeCall(publicationId, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<PublicationRead>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for readPublicationsPublicationsGet
     * @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 readPublicationsPublicationsGetCall(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 = "/publications";

        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 readPublicationsPublicationsGetValidateBeforeCall(String q, Integer offset, Integer limit, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        com.squareup.okhttp.Call call = readPublicationsPublicationsGetCall(q, offset, limit, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

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

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

    /**
     * Read Publications (asynchronously)
     * Get all Publication.
     * @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 readPublicationsPublicationsGetAsync(String q, Integer offset, Integer limit, final ApiCallback<List<PublicationRead>> 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 = readPublicationsPublicationsGetValidateBeforeCall(q, offset, limit, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<List<PublicationRead>>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for updatePublicationLanguagePublicationLanguagesPublicationLanguageIdPatch
     * @param body  (required)
     * @param publicationLanguageId  (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 updatePublicationLanguagePublicationLanguagesPublicationLanguageIdPatchCall(PublicationLanguageUpdate body, Integer publicationLanguageId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;
        
        // create path and map variables
        String localVarPath = "/publication_languages/{publication_language_id}"
            .replaceAll("\\{" + "publication_language_id" + "\\}", apiClient.escapeString(publicationLanguageId.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 updatePublicationLanguagePublicationLanguagesPublicationLanguageIdPatchValidateBeforeCall(PublicationLanguageUpdate body, Integer publicationLanguageId, 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 updatePublicationLanguagePublicationLanguagesPublicationLanguageIdPatch(Async)");
        }
        // verify the required parameter 'publicationLanguageId' is set
        if (publicationLanguageId == null) {
            throw new ApiException("Missing the required parameter 'publicationLanguageId' when calling updatePublicationLanguagePublicationLanguagesPublicationLanguageIdPatch(Async)");
        }
        
        com.squareup.okhttp.Call call = updatePublicationLanguagePublicationLanguagesPublicationLanguageIdPatchCall(body, publicationLanguageId, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Update Publication Language
     * 
     * @param body  (required)
     * @param publicationLanguageId  (required)
     * @return PublicationLanguageRead
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public PublicationLanguageRead updatePublicationLanguagePublicationLanguagesPublicationLanguageIdPatch(PublicationLanguageUpdate body, Integer publicationLanguageId) throws ApiException {
        ApiResponse<PublicationLanguageRead> resp = updatePublicationLanguagePublicationLanguagesPublicationLanguageIdPatchWithHttpInfo(body, publicationLanguageId);
        return resp.getData();
    }

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

    /**
     * Update Publication Language (asynchronously)
     * 
     * @param body  (required)
     * @param publicationLanguageId  (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 updatePublicationLanguagePublicationLanguagesPublicationLanguageIdPatchAsync(PublicationLanguageUpdate body, Integer publicationLanguageId, final ApiCallback<PublicationLanguageRead> 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 = updatePublicationLanguagePublicationLanguagesPublicationLanguageIdPatchValidateBeforeCall(body, publicationLanguageId, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<PublicationLanguageRead>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for updatePublicationPublicationsPublicationIdPatch
     * @param body  (required)
     * @param publicationId  (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 updatePublicationPublicationsPublicationIdPatchCall(PublicationUpdate body, Integer publicationId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;
        
        // create path and map variables
        String localVarPath = "/publications/{publication_id}"
            .replaceAll("\\{" + "publication_id" + "\\}", apiClient.escapeString(publicationId.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 updatePublicationPublicationsPublicationIdPatchValidateBeforeCall(PublicationUpdate body, Integer publicationId, 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 updatePublicationPublicationsPublicationIdPatch(Async)");
        }
        // verify the required parameter 'publicationId' is set
        if (publicationId == null) {
            throw new ApiException("Missing the required parameter 'publicationId' when calling updatePublicationPublicationsPublicationIdPatch(Async)");
        }
        
        com.squareup.okhttp.Call call = updatePublicationPublicationsPublicationIdPatchCall(body, publicationId, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Update Publication
     * 
     * @param body  (required)
     * @param publicationId  (required)
     * @return PublicationRead
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public PublicationRead updatePublicationPublicationsPublicationIdPatch(PublicationUpdate body, Integer publicationId) throws ApiException {
        ApiResponse<PublicationRead> resp = updatePublicationPublicationsPublicationIdPatchWithHttpInfo(body, publicationId);
        return resp.getData();
    }

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

    /**
     * Update Publication (asynchronously)
     * 
     * @param body  (required)
     * @param publicationId  (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 updatePublicationPublicationsPublicationIdPatchAsync(PublicationUpdate body, Integer publicationId, final ApiCallback<PublicationRead> 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 = updatePublicationPublicationsPublicationIdPatchValidateBeforeCall(body, publicationId, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<PublicationRead>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
}
