All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.genesys.internal.workspace.api.ChatApi Maven / Gradle / Ivy

/*
 * Workspace API
 * Agent API
 *
 * OpenAPI spec version: 1.0.0
 * 
 *
 * 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 com.genesys.internal.workspace.api;

import com.genesys.internal.common.ApiCallback;
import com.genesys.internal.common.ApiClient;
import com.genesys.internal.common.ApiException;
import com.genesys.internal.common.ApiResponse;
import com.genesys.internal.common.Configuration;
import com.genesys.internal.common.Pair;
import com.genesys.internal.common.ProgressRequestBody;
import com.genesys.internal.common.ProgressResponseBody;

import com.google.gson.reflect.TypeToken;

import java.io.IOException;


import com.genesys.internal.workspace.model.AcceptData;
import com.genesys.internal.workspace.model.AcceptData1;
import com.genesys.internal.workspace.model.AcceptData2;
import com.genesys.internal.workspace.model.AcceptData3;
import com.genesys.internal.workspace.model.AcceptData4;
import com.genesys.internal.workspace.model.ApiErrorResponse;
import com.genesys.internal.workspace.model.ApiSuccessResponse;
import com.genesys.internal.workspace.model.ConsultData;
import com.genesys.internal.workspace.model.ConsultData1;
import com.genesys.internal.workspace.model.CustomNotificationData;
import com.genesys.internal.workspace.model.InlineResponse2003;
import com.genesys.internal.workspace.model.InviteData;
import com.genesys.internal.workspace.model.InviteData1;
import com.genesys.internal.workspace.model.LeaveData;
import com.genesys.internal.workspace.model.RemoveFromConferenceData;
import com.genesys.internal.workspace.model.SystemCommandData;
import com.genesys.internal.workspace.model.UpdateNicknameData;

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

public class ChatApi {
    private ApiClient apiClient;

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

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

    public ApiClient getApiClient() {
        return apiClient;
    }

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

    /**
     * Build call for acceptChat
     * @param id The ID of the chat interaction. (required)
     * @param acceptData Request parameters. (optional)
     * @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 acceptChatCall(String id, AcceptData acceptData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = acceptData;

        // create path and map variables
        String localVarPath = "/media/chat/interactions/{id}/accept"
            .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        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[] {  };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call acceptChatValidateBeforeCall(String id, AcceptData acceptData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'id' is set
        if (id == null) {
            throw new ApiException("Missing the required parameter 'id' when calling acceptChat(Async)");
        }
        

        com.squareup.okhttp.Call call = acceptChatCall(id, acceptData, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Accept the specified chat.
     * Accept the specified chat interaction.
     * @param id The ID of the chat interaction. (required)
     * @param acceptData Request parameters. (optional)
     * @return ApiSuccessResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiSuccessResponse acceptChat(String id, AcceptData acceptData) throws ApiException {
        ApiResponse resp = acceptChatWithHttpInfo(id, acceptData);
        return resp.getData();
    }

    /**
     * Accept the specified chat.
     * Accept the specified chat interaction.
     * @param id The ID of the chat interaction. (required)
     * @param acceptData Request parameters. (optional)
     * @return ApiResponse<ApiSuccessResponse>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse acceptChatWithHttpInfo(String id, AcceptData acceptData) throws ApiException {
        com.squareup.okhttp.Call call = acceptChatValidateBeforeCall(id, acceptData, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Accept the specified chat. (asynchronously)
     * Accept the specified chat interaction.
     * @param id The ID of the chat interaction. (required)
     * @param acceptData Request parameters. (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public com.squareup.okhttp.Call acceptChatAsync(String id, AcceptData acceptData, final ApiCallback 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 = acceptChatValidateBeforeCall(id, acceptData, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for cancelConsultationChat
     * @param id The ID of the chat interaction. (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 cancelConsultationChatCall(String id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/media/chat/interactions/{id}/cancel-consult"
            .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        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[] {  };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call cancelConsultationChatValidateBeforeCall(String id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'id' is set
        if (id == null) {
            throw new ApiException("Missing the required parameter 'id' when calling cancelConsultationChat(Async)");
        }
        

        com.squareup.okhttp.Call call = cancelConsultationChatCall(id, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Cancel a chat consultation request.
     * Cancel a chat consultation request that was initialized by calling `/media/chat/interactions/{id}/consult-by-queue`.  If the agent has already accepted the invitation, the Workspace API can't cancel the consultation.
     * @param id The ID of the chat interaction. (required)
     * @return ApiSuccessResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiSuccessResponse cancelConsultationChat(String id) throws ApiException {
        ApiResponse resp = cancelConsultationChatWithHttpInfo(id);
        return resp.getData();
    }

    /**
     * Cancel a chat consultation request.
     * Cancel a chat consultation request that was initialized by calling `/media/chat/interactions/{id}/consult-by-queue`.  If the agent has already accepted the invitation, the Workspace API can't cancel the consultation.
     * @param id The ID of the chat interaction. (required)
     * @return ApiResponse<ApiSuccessResponse>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse cancelConsultationChatWithHttpInfo(String id) throws ApiException {
        com.squareup.okhttp.Call call = cancelConsultationChatValidateBeforeCall(id, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Cancel a chat consultation request. (asynchronously)
     * Cancel a chat consultation request that was initialized by calling `/media/chat/interactions/{id}/consult-by-queue`.  If the agent has already accepted the invitation, the Workspace API can't cancel the consultation.
     * @param id The ID of the chat interaction. (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 cancelConsultationChatAsync(String id, final ApiCallback 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 = cancelConsultationChatValidateBeforeCall(id, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for chatMessages
     * @param id The ID of the chat interaction. (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 chatMessagesCall(String id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/media/chat/interactions/{id}/messages"
            .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        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[] {  };
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call chatMessagesValidateBeforeCall(String id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'id' is set
        if (id == null) {
            throw new ApiException("Missing the required parameter 'id' when calling chatMessages(Async)");
        }
        

        com.squareup.okhttp.Call call = chatMessagesCall(id, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Get chat transcript.
     * Get a transcript for the specified chat interaction.
     * @param id The ID of the chat interaction. (required)
     * @return InlineResponse2003
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public InlineResponse2003 chatMessages(String id) throws ApiException {
        ApiResponse resp = chatMessagesWithHttpInfo(id);
        return resp.getData();
    }

    /**
     * Get chat transcript.
     * Get a transcript for the specified chat interaction.
     * @param id The ID of the chat interaction. (required)
     * @return ApiResponse<InlineResponse2003>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse chatMessagesWithHttpInfo(String id) throws ApiException {
        com.squareup.okhttp.Call call = chatMessagesValidateBeforeCall(id, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Get chat transcript. (asynchronously)
     * Get a transcript for the specified chat interaction.
     * @param id The ID of the chat interaction. (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 chatMessagesAsync(String id, final ApiCallback 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 = chatMessagesValidateBeforeCall(id, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for consult
     * @param id The ID of the chat interaction. (required)
     * @param consultData  (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 consultCall(String id, ConsultData consultData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = consultData;

        // create path and map variables
        String localVarPath = "/media/chat/interactions/{id}/consult"
            .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        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[] {  };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call consultValidateBeforeCall(String id, ConsultData consultData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'id' is set
        if (id == null) {
            throw new ApiException("Missing the required parameter 'id' when calling consult(Async)");
        }
        
        // verify the required parameter 'consultData' is set
        if (consultData == null) {
            throw new ApiException("Missing the required parameter 'consultData' when calling consult(Async)");
        }
        

        com.squareup.okhttp.Call call = consultCall(id, consultData, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Consult with another agent during a chat.
     * A consult occurs in the context of the specified chat, but the customer is not aware of the  consulting agent. Messages and notifications from the consulting agent are only visible  to other agents in the chat, not to the customer. After the consulting agent accepts the  consultation, the originating agent can either transfer the chat to the consulting agent  (`/media/{mediatype}/interactions/{id}/transfer-agent`), add them in a conference  (`/media/chat/interactions/{id}/invite`) or the consulting agent can leave the chat  (`/media/chat/interactions/{id}/leave`).
     * @param id The ID of the chat interaction. (required)
     * @param consultData  (required)
     * @return ApiSuccessResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiSuccessResponse consult(String id, ConsultData consultData) throws ApiException {
        ApiResponse resp = consultWithHttpInfo(id, consultData);
        return resp.getData();
    }

    /**
     * Consult with another agent during a chat.
     * A consult occurs in the context of the specified chat, but the customer is not aware of the  consulting agent. Messages and notifications from the consulting agent are only visible  to other agents in the chat, not to the customer. After the consulting agent accepts the  consultation, the originating agent can either transfer the chat to the consulting agent  (`/media/{mediatype}/interactions/{id}/transfer-agent`), add them in a conference  (`/media/chat/interactions/{id}/invite`) or the consulting agent can leave the chat  (`/media/chat/interactions/{id}/leave`).
     * @param id The ID of the chat interaction. (required)
     * @param consultData  (required)
     * @return ApiResponse<ApiSuccessResponse>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse consultWithHttpInfo(String id, ConsultData consultData) throws ApiException {
        com.squareup.okhttp.Call call = consultValidateBeforeCall(id, consultData, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Consult with another agent during a chat. (asynchronously)
     * A consult occurs in the context of the specified chat, but the customer is not aware of the  consulting agent. Messages and notifications from the consulting agent are only visible  to other agents in the chat, not to the customer. After the consulting agent accepts the  consultation, the originating agent can either transfer the chat to the consulting agent  (`/media/{mediatype}/interactions/{id}/transfer-agent`), add them in a conference  (`/media/chat/interactions/{id}/invite`) or the consulting agent can leave the chat  (`/media/chat/interactions/{id}/leave`).
     * @param id The ID of the chat interaction. (required)
     * @param consultData  (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 consultAsync(String id, ConsultData consultData, final ApiCallback 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 = consultValidateBeforeCall(id, consultData, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for consultByQueue
     * @param id The ID of the chat interaction. (required)
     * @param consultData  (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 consultByQueueCall(String id, ConsultData1 consultData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = consultData;

        // create path and map variables
        String localVarPath = "/media/chat/interactions/{id}/consult-by-queue"
            .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        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[] {  };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call consultByQueueValidateBeforeCall(String id, ConsultData1 consultData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'id' is set
        if (id == null) {
            throw new ApiException("Missing the required parameter 'id' when calling consultByQueue(Async)");
        }
        
        // verify the required parameter 'consultData' is set
        if (consultData == null) {
            throw new ApiException("Missing the required parameter 'consultData' when calling consultByQueue(Async)");
        }
        

        com.squareup.okhttp.Call call = consultByQueueCall(id, consultData, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Consult with another agent via a queue.
     * Consult with another agent during a chat by sending an consult invitation to the specified queue.  A consult occurs in the context of the specified chat, but the customer is not aware of the consulting agent.  Messages and notifications from the consulting agent are only visible to other agents in the  chat, not to the customer. After the consulting agent accepts the consultation, the originating  agent can either transfer the chat to the consulting agent (`/media/{mediatype}/interactions/{id}/transfer-agent`),  add them in a conference (`/media/chat/interactions/{id}/invite`) or the consulting agent can leave  the chat (`/media/chat/interactions/{id}/leave`).
     * @param id The ID of the chat interaction. (required)
     * @param consultData  (required)
     * @return ApiSuccessResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiSuccessResponse consultByQueue(String id, ConsultData1 consultData) throws ApiException {
        ApiResponse resp = consultByQueueWithHttpInfo(id, consultData);
        return resp.getData();
    }

    /**
     * Consult with another agent via a queue.
     * Consult with another agent during a chat by sending an consult invitation to the specified queue.  A consult occurs in the context of the specified chat, but the customer is not aware of the consulting agent.  Messages and notifications from the consulting agent are only visible to other agents in the  chat, not to the customer. After the consulting agent accepts the consultation, the originating  agent can either transfer the chat to the consulting agent (`/media/{mediatype}/interactions/{id}/transfer-agent`),  add them in a conference (`/media/chat/interactions/{id}/invite`) or the consulting agent can leave  the chat (`/media/chat/interactions/{id}/leave`).
     * @param id The ID of the chat interaction. (required)
     * @param consultData  (required)
     * @return ApiResponse<ApiSuccessResponse>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse consultByQueueWithHttpInfo(String id, ConsultData1 consultData) throws ApiException {
        com.squareup.okhttp.Call call = consultByQueueValidateBeforeCall(id, consultData, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Consult with another agent via a queue. (asynchronously)
     * Consult with another agent during a chat by sending an consult invitation to the specified queue.  A consult occurs in the context of the specified chat, but the customer is not aware of the consulting agent.  Messages and notifications from the consulting agent are only visible to other agents in the  chat, not to the customer. After the consulting agent accepts the consultation, the originating  agent can either transfer the chat to the consulting agent (`/media/{mediatype}/interactions/{id}/transfer-agent`),  add them in a conference (`/media/chat/interactions/{id}/invite`) or the consulting agent can leave  the chat (`/media/chat/interactions/{id}/leave`).
     * @param id The ID of the chat interaction. (required)
     * @param consultData  (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 consultByQueueAsync(String id, ConsultData1 consultData, final ApiCallback 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 = consultByQueueValidateBeforeCall(id, consultData, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for invite
     * @param id The ID of the chat interaction. (required)
     * @param inviteData  (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 inviteCall(String id, InviteData inviteData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = inviteData;

        // create path and map variables
        String localVarPath = "/media/chat/interactions/{id}/invite"
            .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        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[] {  };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call inviteValidateBeforeCall(String id, InviteData inviteData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'id' is set
        if (id == null) {
            throw new ApiException("Missing the required parameter 'id' when calling invite(Async)");
        }
        
        // verify the required parameter 'inviteData' is set
        if (inviteData == null) {
            throw new ApiException("Missing the required parameter 'inviteData' when calling invite(Async)");
        }
        

        com.squareup.okhttp.Call call = inviteCall(id, inviteData, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Invite another agent to the chat conference.
     * Invite another agent to join the specified chat conference. The customer is notified when the  invited agent joins the chat. The agents can communicate with the customer or they  can communicate with each other without the customer seeing their messages, depending on the value you set for the `visibility` parameter when you  call `/media/chat/interactions/{id}/send-message`.
     * @param id The ID of the chat interaction. (required)
     * @param inviteData  (required)
     * @return ApiSuccessResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiSuccessResponse invite(String id, InviteData inviteData) throws ApiException {
        ApiResponse resp = inviteWithHttpInfo(id, inviteData);
        return resp.getData();
    }

    /**
     * Invite another agent to the chat conference.
     * Invite another agent to join the specified chat conference. The customer is notified when the  invited agent joins the chat. The agents can communicate with the customer or they  can communicate with each other without the customer seeing their messages, depending on the value you set for the `visibility` parameter when you  call `/media/chat/interactions/{id}/send-message`.
     * @param id The ID of the chat interaction. (required)
     * @param inviteData  (required)
     * @return ApiResponse<ApiSuccessResponse>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse inviteWithHttpInfo(String id, InviteData inviteData) throws ApiException {
        com.squareup.okhttp.Call call = inviteValidateBeforeCall(id, inviteData, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Invite another agent to the chat conference. (asynchronously)
     * Invite another agent to join the specified chat conference. The customer is notified when the  invited agent joins the chat. The agents can communicate with the customer or they  can communicate with each other without the customer seeing their messages, depending on the value you set for the `visibility` parameter when you  call `/media/chat/interactions/{id}/send-message`.
     * @param id The ID of the chat interaction. (required)
     * @param inviteData  (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 inviteAsync(String id, InviteData inviteData, final ApiCallback 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 = inviteValidateBeforeCall(id, inviteData, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for inviteByQueue
     * @param id The ID of the chat interaction. (required)
     * @param inviteData  (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 inviteByQueueCall(String id, InviteData1 inviteData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = inviteData;

        // create path and map variables
        String localVarPath = "/media/chat/interactions/{id}/invite-by-queue"
            .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        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[] {  };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call inviteByQueueValidateBeforeCall(String id, InviteData1 inviteData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'id' is set
        if (id == null) {
            throw new ApiException("Missing the required parameter 'id' when calling inviteByQueue(Async)");
        }
        
        // verify the required parameter 'inviteData' is set
        if (inviteData == null) {
            throw new ApiException("Missing the required parameter 'inviteData' when calling inviteByQueue(Async)");
        }
        

        com.squareup.okhttp.Call call = inviteByQueueCall(id, inviteData, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Invite another agent to the chat conference via a queue.
     * Invite another agent to the chat conference by sending an invitation to the specified queue. The next  available agent in the queue is then sent an invite to join the chat. The customer is notified when the  invited agent joins the chat. The agents can communicate with the customer or they  can communicate with each other without the customer seeing their messages, depending on the value you set for the `visibility` parameter when you  call `/media/chat/interactions/{id}/send-message`.
     * @param id The ID of the chat interaction. (required)
     * @param inviteData  (required)
     * @return ApiSuccessResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiSuccessResponse inviteByQueue(String id, InviteData1 inviteData) throws ApiException {
        ApiResponse resp = inviteByQueueWithHttpInfo(id, inviteData);
        return resp.getData();
    }

    /**
     * Invite another agent to the chat conference via a queue.
     * Invite another agent to the chat conference by sending an invitation to the specified queue. The next  available agent in the queue is then sent an invite to join the chat. The customer is notified when the  invited agent joins the chat. The agents can communicate with the customer or they  can communicate with each other without the customer seeing their messages, depending on the value you set for the `visibility` parameter when you  call `/media/chat/interactions/{id}/send-message`.
     * @param id The ID of the chat interaction. (required)
     * @param inviteData  (required)
     * @return ApiResponse<ApiSuccessResponse>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse inviteByQueueWithHttpInfo(String id, InviteData1 inviteData) throws ApiException {
        com.squareup.okhttp.Call call = inviteByQueueValidateBeforeCall(id, inviteData, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Invite another agent to the chat conference via a queue. (asynchronously)
     * Invite another agent to the chat conference by sending an invitation to the specified queue. The next  available agent in the queue is then sent an invite to join the chat. The customer is notified when the  invited agent joins the chat. The agents can communicate with the customer or they  can communicate with each other without the customer seeing their messages, depending on the value you set for the `visibility` parameter when you  call `/media/chat/interactions/{id}/send-message`.
     * @param id The ID of the chat interaction. (required)
     * @param inviteData  (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 inviteByQueueAsync(String id, InviteData1 inviteData, final ApiCallback 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 = inviteByQueueValidateBeforeCall(id, inviteData, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for leaveChat
     * @param id The ID of the chat interaction. (required)
     * @param leaveData Request parameters. (optional)
     * @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 leaveChatCall(String id, LeaveData leaveData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = leaveData;

        // create path and map variables
        String localVarPath = "/media/chat/interactions/{id}/leave"
            .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        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[] {  };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call leaveChatValidateBeforeCall(String id, LeaveData leaveData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'id' is set
        if (id == null) {
            throw new ApiException("Missing the required parameter 'id' when calling leaveChat(Async)");
        }
        

        com.squareup.okhttp.Call call = leaveChatCall(id, leaveData, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Leave a chat.
     * Leave the specified chat or conference. If the agent is in a conference, the chat  session stays open for the customer. If the agent is not in a conference, the chat   ends for the customer but the agent can still update user data and set disposition.
     * @param id The ID of the chat interaction. (required)
     * @param leaveData Request parameters. (optional)
     * @return ApiSuccessResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiSuccessResponse leaveChat(String id, LeaveData leaveData) throws ApiException {
        ApiResponse resp = leaveChatWithHttpInfo(id, leaveData);
        return resp.getData();
    }

    /**
     * Leave a chat.
     * Leave the specified chat or conference. If the agent is in a conference, the chat  session stays open for the customer. If the agent is not in a conference, the chat   ends for the customer but the agent can still update user data and set disposition.
     * @param id The ID of the chat interaction. (required)
     * @param leaveData Request parameters. (optional)
     * @return ApiResponse<ApiSuccessResponse>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse leaveChatWithHttpInfo(String id, LeaveData leaveData) throws ApiException {
        com.squareup.okhttp.Call call = leaveChatValidateBeforeCall(id, leaveData, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Leave a chat. (asynchronously)
     * Leave the specified chat or conference. If the agent is in a conference, the chat  session stays open for the customer. If the agent is not in a conference, the chat   ends for the customer but the agent can still update user data and set disposition.
     * @param id The ID of the chat interaction. (required)
     * @param leaveData Request parameters. (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public com.squareup.okhttp.Call leaveChatAsync(String id, LeaveData leaveData, final ApiCallback 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 = leaveChatValidateBeforeCall(id, leaveData, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for removeFromConference
     * @param id The ID of the chat interaction. (required)
     * @param removeFromConferenceData  (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 removeFromConferenceCall(String id, RemoveFromConferenceData removeFromConferenceData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = removeFromConferenceData;

        // create path and map variables
        String localVarPath = "/media/chat/interactions/{id}/remove-from-conference"
            .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        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[] {  };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call removeFromConferenceValidateBeforeCall(String id, RemoveFromConferenceData removeFromConferenceData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'id' is set
        if (id == null) {
            throw new ApiException("Missing the required parameter 'id' when calling removeFromConference(Async)");
        }
        
        // verify the required parameter 'removeFromConferenceData' is set
        if (removeFromConferenceData == null) {
            throw new ApiException("Missing the required parameter 'removeFromConferenceData' when calling removeFromConference(Async)");
        }
        

        com.squareup.okhttp.Call call = removeFromConferenceCall(id, removeFromConferenceData, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Remove an agent from a chat conference.
     * Remove the specified agent from the chat conference.
     * @param id The ID of the chat interaction. (required)
     * @param removeFromConferenceData  (required)
     * @return ApiSuccessResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiSuccessResponse removeFromConference(String id, RemoveFromConferenceData removeFromConferenceData) throws ApiException {
        ApiResponse resp = removeFromConferenceWithHttpInfo(id, removeFromConferenceData);
        return resp.getData();
    }

    /**
     * Remove an agent from a chat conference.
     * Remove the specified agent from the chat conference.
     * @param id The ID of the chat interaction. (required)
     * @param removeFromConferenceData  (required)
     * @return ApiResponse<ApiSuccessResponse>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse removeFromConferenceWithHttpInfo(String id, RemoveFromConferenceData removeFromConferenceData) throws ApiException {
        com.squareup.okhttp.Call call = removeFromConferenceValidateBeforeCall(id, removeFromConferenceData, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Remove an agent from a chat conference. (asynchronously)
     * Remove the specified agent from the chat conference.
     * @param id The ID of the chat interaction. (required)
     * @param removeFromConferenceData  (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 removeFromConferenceAsync(String id, RemoveFromConferenceData removeFromConferenceData, final ApiCallback 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 = removeFromConferenceValidateBeforeCall(id, removeFromConferenceData, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for sendCustomNotification
     * @param id The ID of the chat interaction. (required)
     * @param customNotificationData Request parameters. (optional)
     * @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 sendCustomNotificationCall(String id, CustomNotificationData customNotificationData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = customNotificationData;

        // create path and map variables
        String localVarPath = "/media/chat/interactions/{id}/send-custom-notification"
            .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        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[] {  };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call sendCustomNotificationValidateBeforeCall(String id, CustomNotificationData customNotificationData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'id' is set
        if (id == null) {
            throw new ApiException("Missing the required parameter 'id' when calling sendCustomNotification(Async)");
        }
        

        com.squareup.okhttp.Call call = sendCustomNotificationCall(id, customNotificationData, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Send a custom notification.
     * Send a custom notification to the specified chat.
     * @param id The ID of the chat interaction. (required)
     * @param customNotificationData Request parameters. (optional)
     * @return ApiSuccessResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiSuccessResponse sendCustomNotification(String id, CustomNotificationData customNotificationData) throws ApiException {
        ApiResponse resp = sendCustomNotificationWithHttpInfo(id, customNotificationData);
        return resp.getData();
    }

    /**
     * Send a custom notification.
     * Send a custom notification to the specified chat.
     * @param id The ID of the chat interaction. (required)
     * @param customNotificationData Request parameters. (optional)
     * @return ApiResponse<ApiSuccessResponse>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse sendCustomNotificationWithHttpInfo(String id, CustomNotificationData customNotificationData) throws ApiException {
        com.squareup.okhttp.Call call = sendCustomNotificationValidateBeforeCall(id, customNotificationData, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Send a custom notification. (asynchronously)
     * Send a custom notification to the specified chat.
     * @param id The ID of the chat interaction. (required)
     * @param customNotificationData Request parameters. (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public com.squareup.okhttp.Call sendCustomNotificationAsync(String id, CustomNotificationData customNotificationData, final ApiCallback 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 = sendCustomNotificationValidateBeforeCall(id, customNotificationData, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for sendMessage
     * @param id The ID of the chat interaction. (required)
     * @param acceptData Request parameters. (optional)
     * @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 sendMessageCall(String id, AcceptData1 acceptData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = acceptData;

        // create path and map variables
        String localVarPath = "/media/chat/interactions/{id}/send-message"
            .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        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[] {  };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call sendMessageValidateBeforeCall(String id, AcceptData1 acceptData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'id' is set
        if (id == null) {
            throw new ApiException("Missing the required parameter 'id' when calling sendMessage(Async)");
        }
        

        com.squareup.okhttp.Call call = sendMessageCall(id, acceptData, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Send a message.
     * Send a message to participants in the specified chat.
     * @param id The ID of the chat interaction. (required)
     * @param acceptData Request parameters. (optional)
     * @return ApiSuccessResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiSuccessResponse sendMessage(String id, AcceptData1 acceptData) throws ApiException {
        ApiResponse resp = sendMessageWithHttpInfo(id, acceptData);
        return resp.getData();
    }

    /**
     * Send a message.
     * Send a message to participants in the specified chat.
     * @param id The ID of the chat interaction. (required)
     * @param acceptData Request parameters. (optional)
     * @return ApiResponse<ApiSuccessResponse>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse sendMessageWithHttpInfo(String id, AcceptData1 acceptData) throws ApiException {
        com.squareup.okhttp.Call call = sendMessageValidateBeforeCall(id, acceptData, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Send a message. (asynchronously)
     * Send a message to participants in the specified chat.
     * @param id The ID of the chat interaction. (required)
     * @param acceptData Request parameters. (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public com.squareup.okhttp.Call sendMessageAsync(String id, AcceptData1 acceptData, final ApiCallback 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 = sendMessageValidateBeforeCall(id, acceptData, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for sendSystemCommand
     * @param id The ID of the chat interaction. (required)
     * @param systemCommandData Request parameters. (optional)
     * @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 sendSystemCommandCall(String id, SystemCommandData systemCommandData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = systemCommandData;

        // create path and map variables
        String localVarPath = "/media/chat/interactions/{id}/send-system-command"
            .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        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[] {  };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call sendSystemCommandValidateBeforeCall(String id, SystemCommandData systemCommandData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'id' is set
        if (id == null) {
            throw new ApiException("Missing the required parameter 'id' when calling sendSystemCommand(Async)");
        }
        

        com.squareup.okhttp.Call call = sendSystemCommandCall(id, systemCommandData, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Send a system command
     * Send a system command to the specified chat.
     * @param id The ID of the chat interaction. (required)
     * @param systemCommandData Request parameters. (optional)
     * @return ApiSuccessResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiSuccessResponse sendSystemCommand(String id, SystemCommandData systemCommandData) throws ApiException {
        ApiResponse resp = sendSystemCommandWithHttpInfo(id, systemCommandData);
        return resp.getData();
    }

    /**
     * Send a system command
     * Send a system command to the specified chat.
     * @param id The ID of the chat interaction. (required)
     * @param systemCommandData Request parameters. (optional)
     * @return ApiResponse<ApiSuccessResponse>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse sendSystemCommandWithHttpInfo(String id, SystemCommandData systemCommandData) throws ApiException {
        com.squareup.okhttp.Call call = sendSystemCommandValidateBeforeCall(id, systemCommandData, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Send a system command (asynchronously)
     * Send a system command to the specified chat.
     * @param id The ID of the chat interaction. (required)
     * @param systemCommandData Request parameters. (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public com.squareup.okhttp.Call sendSystemCommandAsync(String id, SystemCommandData systemCommandData, final ApiCallback 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 = sendSystemCommandValidateBeforeCall(id, systemCommandData, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for sendTypingStarted
     * @param id The ID of the chat interaction. (required)
     * @param acceptData Request parameters. (optional)
     * @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 sendTypingStartedCall(String id, AcceptData3 acceptData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = acceptData;

        // create path and map variables
        String localVarPath = "/media/chat/interactions/{id}/send-typing-started"
            .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        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[] {  };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call sendTypingStartedValidateBeforeCall(String id, AcceptData3 acceptData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'id' is set
        if (id == null) {
            throw new ApiException("Missing the required parameter 'id' when calling sendTypingStarted(Async)");
        }
        

        com.squareup.okhttp.Call call = sendTypingStartedCall(id, acceptData, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Send notification that the agent is typing.
     * Send notification that the agent is typing to the other participants in the specified chat.
     * @param id The ID of the chat interaction. (required)
     * @param acceptData Request parameters. (optional)
     * @return ApiSuccessResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiSuccessResponse sendTypingStarted(String id, AcceptData3 acceptData) throws ApiException {
        ApiResponse resp = sendTypingStartedWithHttpInfo(id, acceptData);
        return resp.getData();
    }

    /**
     * Send notification that the agent is typing.
     * Send notification that the agent is typing to the other participants in the specified chat.
     * @param id The ID of the chat interaction. (required)
     * @param acceptData Request parameters. (optional)
     * @return ApiResponse<ApiSuccessResponse>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse sendTypingStartedWithHttpInfo(String id, AcceptData3 acceptData) throws ApiException {
        com.squareup.okhttp.Call call = sendTypingStartedValidateBeforeCall(id, acceptData, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Send notification that the agent is typing. (asynchronously)
     * Send notification that the agent is typing to the other participants in the specified chat.
     * @param id The ID of the chat interaction. (required)
     * @param acceptData Request parameters. (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public com.squareup.okhttp.Call sendTypingStartedAsync(String id, AcceptData3 acceptData, final ApiCallback 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 = sendTypingStartedValidateBeforeCall(id, acceptData, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for sendTypingStopped
     * @param id The ID of the chat interaction. (required)
     * @param acceptData Request parameters. (optional)
     * @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 sendTypingStoppedCall(String id, AcceptData4 acceptData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = acceptData;

        // create path and map variables
        String localVarPath = "/media/chat/interactions/{id}/send-typing-stopped"
            .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        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[] {  };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call sendTypingStoppedValidateBeforeCall(String id, AcceptData4 acceptData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'id' is set
        if (id == null) {
            throw new ApiException("Missing the required parameter 'id' when calling sendTypingStopped(Async)");
        }
        

        com.squareup.okhttp.Call call = sendTypingStoppedCall(id, acceptData, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Send notification that the agent stopped typing.
     * Send notification that the agent stopped typing to the other participants in the specified chat.
     * @param id The ID of the chat interaction. (required)
     * @param acceptData Request parameters. (optional)
     * @return ApiSuccessResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiSuccessResponse sendTypingStopped(String id, AcceptData4 acceptData) throws ApiException {
        ApiResponse resp = sendTypingStoppedWithHttpInfo(id, acceptData);
        return resp.getData();
    }

    /**
     * Send notification that the agent stopped typing.
     * Send notification that the agent stopped typing to the other participants in the specified chat.
     * @param id The ID of the chat interaction. (required)
     * @param acceptData Request parameters. (optional)
     * @return ApiResponse<ApiSuccessResponse>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse sendTypingStoppedWithHttpInfo(String id, AcceptData4 acceptData) throws ApiException {
        com.squareup.okhttp.Call call = sendTypingStoppedValidateBeforeCall(id, acceptData, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Send notification that the agent stopped typing. (asynchronously)
     * Send notification that the agent stopped typing to the other participants in the specified chat.
     * @param id The ID of the chat interaction. (required)
     * @param acceptData Request parameters. (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public com.squareup.okhttp.Call sendTypingStoppedAsync(String id, AcceptData4 acceptData, final ApiCallback 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 = sendTypingStoppedValidateBeforeCall(id, acceptData, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for sendUrlData
     * @param id The ID of the chat interaction. (required)
     * @param acceptData Request parameters. (optional)
     * @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 sendUrlDataCall(String id, AcceptData2 acceptData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = acceptData;

        // create path and map variables
        String localVarPath = "/media/chat/interactions/{id}/send-url"
            .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        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[] {  };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call sendUrlDataValidateBeforeCall(String id, AcceptData2 acceptData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'id' is set
        if (id == null) {
            throw new ApiException("Missing the required parameter 'id' when calling sendUrlData(Async)");
        }
        

        com.squareup.okhttp.Call call = sendUrlDataCall(id, acceptData, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Send a URL.
     * Send a URL to participants in the specified chat.
     * @param id The ID of the chat interaction. (required)
     * @param acceptData Request parameters. (optional)
     * @return ApiSuccessResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiSuccessResponse sendUrlData(String id, AcceptData2 acceptData) throws ApiException {
        ApiResponse resp = sendUrlDataWithHttpInfo(id, acceptData);
        return resp.getData();
    }

    /**
     * Send a URL.
     * Send a URL to participants in the specified chat.
     * @param id The ID of the chat interaction. (required)
     * @param acceptData Request parameters. (optional)
     * @return ApiResponse<ApiSuccessResponse>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse sendUrlDataWithHttpInfo(String id, AcceptData2 acceptData) throws ApiException {
        com.squareup.okhttp.Call call = sendUrlDataValidateBeforeCall(id, acceptData, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Send a URL. (asynchronously)
     * Send a URL to participants in the specified chat.
     * @param id The ID of the chat interaction. (required)
     * @param acceptData Request parameters. (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public com.squareup.okhttp.Call sendUrlDataAsync(String id, AcceptData2 acceptData, final ApiCallback 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 = sendUrlDataValidateBeforeCall(id, acceptData, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for updateNickname
     * @param id The ID of the chat interaction. (required)
     * @param updateNicknameData Request parameters. (optional)
     * @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 updateNicknameCall(String id, UpdateNicknameData updateNicknameData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = updateNicknameData;

        // create path and map variables
        String localVarPath = "/media/chat/interactions/{id}/update-nickname"
            .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        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[] {  };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call updateNicknameValidateBeforeCall(String id, UpdateNicknameData updateNicknameData, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'id' is set
        if (id == null) {
            throw new ApiException("Missing the required parameter 'id' when calling updateNickname(Async)");
        }
        

        com.squareup.okhttp.Call call = updateNicknameCall(id, updateNicknameData, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Send a notice to modify the nickname
     * Send a notice to modify my nickname to the specified chat.
     * @param id The ID of the chat interaction. (required)
     * @param updateNicknameData Request parameters. (optional)
     * @return ApiSuccessResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiSuccessResponse updateNickname(String id, UpdateNicknameData updateNicknameData) throws ApiException {
        ApiResponse resp = updateNicknameWithHttpInfo(id, updateNicknameData);
        return resp.getData();
    }

    /**
     * Send a notice to modify the nickname
     * Send a notice to modify my nickname to the specified chat.
     * @param id The ID of the chat interaction. (required)
     * @param updateNicknameData Request parameters. (optional)
     * @return ApiResponse<ApiSuccessResponse>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse updateNicknameWithHttpInfo(String id, UpdateNicknameData updateNicknameData) throws ApiException {
        com.squareup.okhttp.Call call = updateNicknameValidateBeforeCall(id, updateNicknameData, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Send a notice to modify the nickname (asynchronously)
     * Send a notice to modify my nickname to the specified chat.
     * @param id The ID of the chat interaction. (required)
     * @param updateNicknameData Request parameters. (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public com.squareup.okhttp.Call updateNicknameAsync(String id, UpdateNicknameData updateNicknameData, final ApiCallback 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 = updateNicknameValidateBeforeCall(id, updateNicknameData, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy