clients/java/src/main/java/io/swagger/client/api/PostApi.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.PostCreate;
import io.swagger.client.model.PostLanguageCreate;
import io.swagger.client.model.PostLanguageRead;
import io.swagger.client.model.PostLanguageUpdate;
import io.swagger.client.model.PostRead;
import io.swagger.client.model.PostUpdate;
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 PostApi {
    private ApiClient apiClient;

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

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

    public ApiClient getApiClient() {
        return apiClient;
    }

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

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

        
        
        
        
    }

    /**
     * Create Post Language
     * Create a PostLanguage.
     * @param body  (required)
     * @return PostLanguageRead
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public PostLanguageRead createPostLanguagePostLanguagesPost(PostLanguageCreate body) throws ApiException {
        ApiResponse<PostLanguageRead> resp = createPostLanguagePostLanguagesPostWithHttpInfo(body);
        return resp.getData();
    }

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

    /**
     * Create Post Language (asynchronously)
     * Create a PostLanguage.
     * @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 createPostLanguagePostLanguagesPostAsync(PostLanguageCreate body, final ApiCallback<PostLanguageRead> 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 = createPostLanguagePostLanguagesPostValidateBeforeCall(body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<PostLanguageRead>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for createPostPostsPost
     * @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 createPostPostsPostCall(PostCreate body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;
        
        // create path and map variables
        String localVarPath = "/posts";

        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 createPostPostsPostValidateBeforeCall(PostCreate 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 createPostPostsPost(Async)");
        }
        
        com.squareup.okhttp.Call call = createPostPostsPostCall(body, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Create Post
     * Create a Post.
     * @param body  (required)
     * @return PostRead
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public PostRead createPostPostsPost(PostCreate body) throws ApiException {
        ApiResponse<PostRead> resp = createPostPostsPostWithHttpInfo(body);
        return resp.getData();
    }

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

    /**
     * Create Post (asynchronously)
     * Create a Post.
     * @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 createPostPostsPostAsync(PostCreate body, final ApiCallback<PostRead> 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 = createPostPostsPostValidateBeforeCall(body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<PostRead>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for deletePostLanguagePostLanguagesPostLanguageIdDelete
     * @param postLanguageId  (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 deletePostLanguagePostLanguagesPostLanguageIdDeleteCall(Integer postLanguageId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/post_languages/{post_language_id}"
            .replaceAll("\\{" + "post_language_id" + "\\}", apiClient.escapeString(postLanguageId.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 deletePostLanguagePostLanguagesPostLanguageIdDeleteValidateBeforeCall(Integer postLanguageId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'postLanguageId' is set
        if (postLanguageId == null) {
            throw new ApiException("Missing the required parameter 'postLanguageId' when calling deletePostLanguagePostLanguagesPostLanguageIdDelete(Async)");
        }
        
        com.squareup.okhttp.Call call = deletePostLanguagePostLanguagesPostLanguageIdDeleteCall(postLanguageId, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

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

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

    /**
     * Delete Post Language (asynchronously)
     * 
     * @param postLanguageId  (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 deletePostLanguagePostLanguagesPostLanguageIdDeleteAsync(Integer postLanguageId, 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 = deletePostLanguagePostLanguagesPostLanguageIdDeleteValidateBeforeCall(postLanguageId, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<SuccessResponseModel>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for deletePostPostsPostIdDelete
     * @param postId  (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 deletePostPostsPostIdDeleteCall(Integer postId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/posts/{post_id}"
            .replaceAll("\\{" + "post_id" + "\\}", apiClient.escapeString(postId.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 deletePostPostsPostIdDeleteValidateBeforeCall(Integer postId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'postId' is set
        if (postId == null) {
            throw new ApiException("Missing the required parameter 'postId' when calling deletePostPostsPostIdDelete(Async)");
        }
        
        com.squareup.okhttp.Call call = deletePostPostsPostIdDeleteCall(postId, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

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

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

    /**
     * Delete Post (asynchronously)
     * 
     * @param postId  (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 deletePostPostsPostIdDeleteAsync(Integer postId, 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 = deletePostPostsPostIdDeleteValidateBeforeCall(postId, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<SuccessResponseModel>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for readPostLanguagePostLanguagesPostLanguageIdGet
     * @param postLanguageId  (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 readPostLanguagePostLanguagesPostLanguageIdGetCall(Integer postLanguageId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/post_languages/{post_language_id}"
            .replaceAll("\\{" + "post_language_id" + "\\}", apiClient.escapeString(postLanguageId.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 readPostLanguagePostLanguagesPostLanguageIdGetValidateBeforeCall(Integer postLanguageId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'postLanguageId' is set
        if (postLanguageId == null) {
            throw new ApiException("Missing the required parameter 'postLanguageId' when calling readPostLanguagePostLanguagesPostLanguageIdGet(Async)");
        }
        
        com.squareup.okhttp.Call call = readPostLanguagePostLanguagesPostLanguageIdGetCall(postLanguageId, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

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

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

    /**
     * Read Post Language (asynchronously)
     * 
     * @param postLanguageId  (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 readPostLanguagePostLanguagesPostLanguageIdGetAsync(Integer postLanguageId, final ApiCallback<PostLanguageRead> 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 = readPostLanguagePostLanguagesPostLanguageIdGetValidateBeforeCall(postLanguageId, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<PostLanguageRead>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for readPostLanguagesPostLanguagesGet
     * @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 readPostLanguagesPostLanguagesGetCall(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 = "/post_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 readPostLanguagesPostLanguagesGetValidateBeforeCall(String q, Integer offset, Integer limit, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        com.squareup.okhttp.Call call = readPostLanguagesPostLanguagesGetCall(q, offset, limit, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

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

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

    /**
     * Read Post Languages (asynchronously)
     * Get all PostLanguage.
     * @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 readPostLanguagesPostLanguagesGetAsync(String q, Integer offset, Integer limit, final ApiCallback<List<PostLanguageRead>> 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 = readPostLanguagesPostLanguagesGetValidateBeforeCall(q, offset, limit, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<List<PostLanguageRead>>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for readPostPostsPostIdGet
     * @param postId  (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 readPostPostsPostIdGetCall(Integer postId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/posts/{post_id}"
            .replaceAll("\\{" + "post_id" + "\\}", apiClient.escapeString(postId.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 readPostPostsPostIdGetValidateBeforeCall(Integer postId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'postId' is set
        if (postId == null) {
            throw new ApiException("Missing the required parameter 'postId' when calling readPostPostsPostIdGet(Async)");
        }
        
        com.squareup.okhttp.Call call = readPostPostsPostIdGetCall(postId, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Read Post
     * 
     * @param postId  (required)
     * @return PostRead
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public PostRead readPostPostsPostIdGet(Integer postId) throws ApiException {
        ApiResponse<PostRead> resp = readPostPostsPostIdGetWithHttpInfo(postId);
        return resp.getData();
    }

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

    /**
     * Read Post (asynchronously)
     * 
     * @param postId  (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 readPostPostsPostIdGetAsync(Integer postId, final ApiCallback<PostRead> 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 = readPostPostsPostIdGetValidateBeforeCall(postId, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<PostRead>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for readPostsPostsGet
     * @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 readPostsPostsGetCall(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 = "/posts";

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

        
        
        
        
    }

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

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

    /**
     * Read Posts (asynchronously)
     * Get all Post.
     * @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 readPostsPostsGetAsync(String q, Integer offset, Integer limit, final ApiCallback<List<PostRead>> 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 = readPostsPostsGetValidateBeforeCall(q, offset, limit, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<List<PostRead>>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for updatePostLanguagePostLanguagesPostLanguageIdPatch
     * @param body  (required)
     * @param postLanguageId  (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 updatePostLanguagePostLanguagesPostLanguageIdPatchCall(PostLanguageUpdate body, Integer postLanguageId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;
        
        // create path and map variables
        String localVarPath = "/post_languages/{post_language_id}"
            .replaceAll("\\{" + "post_language_id" + "\\}", apiClient.escapeString(postLanguageId.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 updatePostLanguagePostLanguagesPostLanguageIdPatchValidateBeforeCall(PostLanguageUpdate body, Integer postLanguageId, 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 updatePostLanguagePostLanguagesPostLanguageIdPatch(Async)");
        }
        // verify the required parameter 'postLanguageId' is set
        if (postLanguageId == null) {
            throw new ApiException("Missing the required parameter 'postLanguageId' when calling updatePostLanguagePostLanguagesPostLanguageIdPatch(Async)");
        }
        
        com.squareup.okhttp.Call call = updatePostLanguagePostLanguagesPostLanguageIdPatchCall(body, postLanguageId, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Update Post Language
     * 
     * @param body  (required)
     * @param postLanguageId  (required)
     * @return PostLanguageRead
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public PostLanguageRead updatePostLanguagePostLanguagesPostLanguageIdPatch(PostLanguageUpdate body, Integer postLanguageId) throws ApiException {
        ApiResponse<PostLanguageRead> resp = updatePostLanguagePostLanguagesPostLanguageIdPatchWithHttpInfo(body, postLanguageId);
        return resp.getData();
    }

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

    /**
     * Update Post Language (asynchronously)
     * 
     * @param body  (required)
     * @param postLanguageId  (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 updatePostLanguagePostLanguagesPostLanguageIdPatchAsync(PostLanguageUpdate body, Integer postLanguageId, final ApiCallback<PostLanguageRead> 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 = updatePostLanguagePostLanguagesPostLanguageIdPatchValidateBeforeCall(body, postLanguageId, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<PostLanguageRead>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for updatePostPostsPostIdPatch
     * @param body  (required)
     * @param postId  (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 updatePostPostsPostIdPatchCall(PostUpdate body, Integer postId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;
        
        // create path and map variables
        String localVarPath = "/posts/{post_id}"
            .replaceAll("\\{" + "post_id" + "\\}", apiClient.escapeString(postId.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 updatePostPostsPostIdPatchValidateBeforeCall(PostUpdate body, Integer postId, 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 updatePostPostsPostIdPatch(Async)");
        }
        // verify the required parameter 'postId' is set
        if (postId == null) {
            throw new ApiException("Missing the required parameter 'postId' when calling updatePostPostsPostIdPatch(Async)");
        }
        
        com.squareup.okhttp.Call call = updatePostPostsPostIdPatchCall(body, postId, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Update Post
     * 
     * @param body  (required)
     * @param postId  (required)
     * @return PostRead
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public PostRead updatePostPostsPostIdPatch(PostUpdate body, Integer postId) throws ApiException {
        ApiResponse<PostRead> resp = updatePostPostsPostIdPatchWithHttpInfo(body, postId);
        return resp.getData();
    }

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

    /**
     * Update Post (asynchronously)
     * 
     * @param body  (required)
     * @param postId  (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 updatePostPostsPostIdPatchAsync(PostUpdate body, Integer postId, final ApiCallback<PostRead> 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 = updatePostPostsPostIdPatchValidateBeforeCall(body, postId, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<PostRead>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
}
